emsApplication/applications/ems_datahubs/mqtt_msg.h

55 lines
1.1 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#pragma once
#pragma pack(1)
typedef enum tagTopic : char
{
GateWayPublicTopic_Server = 0,
ServerPublicTopic_GateWay = 1,
}FrameType, MQTT_Topic;
typedef enum tagDataType : char
{
DT_GATEWAY_DATA = 0,
DT_GATEWAY_ALARMDATA = 1,
DT_GATEWAY_READDATA = 2,
DT_GATEWAY_WRITEDATA = 3,
DT_GATEWAY_CTRLDATA = 4,
DT_WEB_CTRL = 5,
DT_WEB_WRITE = 6,
DT_GATEWAY_WRITE = 7,
FRAME_REQUEST = 8,
FRAME_RESPONSE = 9,
}FrameDataType,MQTT_DataType;
/*
{
"FsuCode": "31012010005",
"type": "gateway-data",
"IdCodeContent": [
{
"OID": ".1.3.6.1.4.1.41475.4.98.1.1.1",
"Value": "31012010005",
"Factor": ""
},
{
"OID": ".1.3.6.1.4.1.41475.4.98.1.2.1",
"Value": "10005",
"Factor": ""
}
],
"TimeStamp": "2024-04-17 13:11:37"
}
*/
typedef struct tagMsgData
{
MQTT_Topic mqtt_topic; // MQTT里的Topic
MQTT_DataType mqtt_data_type; // MQTT里的type使用MQTT_DataType枚举类型
unsigned short device_id; //OID里的98
unsigned int content_len; //整个MQTT包字符串的字节长度,4个字节
char content_data[1]; //MQTT包字符串的内容
}MessageData;
#pragma pack()