WLG/localserver/cmt_protocol.h
2025-01-09 20:00:34 +08:00

77 lines
1.5 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef CMT_PROTOCOL_HPP_
#define CMT_PROTOCOL_HPP_
#include <iostream>
//1 tcp server可以参考本安有线中的代码侦听端口10000
//2 定义无线网关与传感器用到的结构
//3 包头为
struct PackgeHead{
uint8_t head[3]; // 固定值0xAA55AA
uint8_t cmd;
uint16_t total_pkg_count;
uint16_t current_pkg_id;
uint16_t len;
char data[0];
};
#pragma pack(1)
//网关版本和状态信息cmd 80
struct GatewayVersion{
char web_ver[12];
char system_ver[12];
char gateway_ver[12];
char localIP[16];
char gateway_type[12];
char geteway_hw_ver[12];
char comm_mode[12];
int cpu_use;
int memory_use;
int harddisk_remain;
int temperature;
char mac[20];
};
//传感器信息cmd 81
struct SensorInfo{
char mac[20];
char short_addr[8];
char hw_ver[12];
char soft_ver[12];
char gateway_rssi[16];
char sensor_rssi[16];
char battry[12];
int loose_status;
int temperature_bot;
int temperature_top;
char product_no[4];
int status;
int eigenvalue_reportingrate;
int waveX_reportingrate;
int waveY_reportingrate;
int waveZ_reportingrate;
char integratRMS[10];
int upgrade_status;
char upgrade_date[20];
};
//波形cmd 82
struct WaveReq{
char mac[20];
char channel[2];
};
struct WaveRes{
int sampling_rate;
int sampling_time;
char wave[0];
};
// 搜索应答 cmd 1
struct Search {
char mac[20];
int gw_type; // GatewayType
};
#endif