emsApplication/applications/ems_datahubs/mqtt_msg.h

61 lines
1.1 KiB
C
Raw Normal View History

2024-05-24 12:19:45 +08:00
#pragma once
2024-09-10 16:12:38 +08:00
#include "kdefine.h"
2024-09-03 16:27:43 +08:00
2024-05-24 12:19:45 +08:00
#pragma pack(1)
2024-09-10 16:12:38 +08:00
__NAMESPACE_BEGIN__(HJ)
#define MSG_HEADER_LENGTH (8)
2024-05-24 12:19:45 +08:00
typedef enum tagTopic : char
{
GateWayPublicTopic_Server = 0,
ServerPublicTopic_GateWay = 1,
2024-09-10 16:12:38 +08:00
} MQTT_Topic;
2024-05-24 12:19:45 +08:00
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,
2024-09-03 16:27:43 +08:00
DT_GATEWAY_WRITE = 7,
FRAME_REQUEST = 8,
FRAME_RESPONSE = 9,
2024-09-10 16:12:38 +08:00
}MQTT_DataType;
2024-05-24 12:19:45 +08:00
/*
{
"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<54><54><EFBFBD><EFBFBD>Topic
MQTT_DataType mqtt_data_type; // MQTT<54><54><EFBFBD><EFBFBD>type<70><65>ʹ<EFBFBD><CAB9>MQTT_DataTypeö<65><C3B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
unsigned short device_id; //OID<49><44><EFBFBD><EFBFBD>98
unsigned int content_len; //<2F><><EFBFBD><EFBFBD>MQTT<54><54><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֽڳ<D6BD><DAB3><EFBFBD>,4<><34><EFBFBD>ֽ<EFBFBD>
char content_data[1]; //MQTT<54><54><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
}MessageData;
2024-09-10 16:12:38 +08:00
__NAMESPACE_END__(HJ)
2024-09-03 16:27:43 +08:00
2024-05-24 12:19:45 +08:00
#pragma pack()