重新定义帧结构
parent
30a0a72804
commit
33bb0bdf59
|
@ -89,7 +89,9 @@
|
|||
<ClCompile Include="opmysql.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="frame_define.h" />
|
||||
<ClInclude Include="iconv-utils.h" />
|
||||
<ClInclude Include="kdefine.h" />
|
||||
<ClInclude Include="mqtt_msg.h" />
|
||||
<ClInclude Include="openjson.h" />
|
||||
<ClInclude Include="opmysql.h" />
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
#pragma once
|
||||
#pragma pack(1)
|
||||
|
||||
#include "kdefine.h"
|
||||
|
||||
NAMESPACE_BEGIN(HJ)
|
||||
|
||||
typedef enum tagFrameType : char
|
||||
{
|
||||
Frame_Request = 0, //请求帧
|
||||
Frame_Response = 1, //返回帧
|
||||
}FrameType;
|
||||
|
||||
typedef struct tagFrame
|
||||
{
|
||||
FrameType frame_type; //帧类型
|
||||
unsigned int frame_len; //帧数据长度
|
||||
char frame_content[1]; //帧的内容,实际应为json字符串,由json内容自解释
|
||||
}MessageFrame;
|
||||
|
||||
NAMESPACE_END(HJ)
|
||||
|
||||
#pragma pack()
|
|
@ -0,0 +1,41 @@
|
|||
#ifndef __KDEFINE_INCLUDE__
|
||||
#define __KDEFINE_INCLUDE__
|
||||
|
||||
#define K22_STR_EXP(__A) #__A
|
||||
#define K22_STR(__A) K22_STR_EXP(__A)
|
||||
#define K22_STRW_EXP(__A) L ## #__A
|
||||
#define K22_STRW(__A) K22_STRW_EXP(__A)
|
||||
|
||||
#define K22_CMS_VERSION_MAJOR 1
|
||||
#define K22_CMS_VERSION_MINOR 215
|
||||
#define K22_CMS_VERSION_REVISION 0
|
||||
#define K22_VERSION K22_STR(K22_CMS_VERSION_MAJOR) "." K22_STR(K22_CMS_VERSION_MINOR) "." K22_STR(K22_CMS_VERSION_REVISION) ""
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
# ifndef EXTERN_C
|
||||
# define EXTERN_C extern "C"
|
||||
# endif
|
||||
|
||||
# ifndef BEGIN_EXTERN_C
|
||||
# define BEGIN_EXTERN_C extern "C" {
|
||||
# endif
|
||||
|
||||
# ifndef END_EXTERN_C
|
||||
# define END_EXTERN_C } // extern "C"
|
||||
# endif
|
||||
|
||||
#else
|
||||
|
||||
# define EXTERN_C extern
|
||||
# define BEGIN_EXTERN_C
|
||||
# define END_EXTERN_C
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#define NAMESPACE_BEGIN(X) namespace X {
|
||||
#define NAMESPACE_END(X) }
|
||||
#define USING_NAMESPACE(X) using namespace X
|
||||
|
||||
|
||||
#endif
|
|
@ -15,6 +15,8 @@
|
|||
#include <hv/hssl.h>
|
||||
#include <zlib/zlib.h>
|
||||
|
||||
#include "kdefine.h"
|
||||
|
||||
#include "mqtt_msg.h"
|
||||
#include "openjson.h"
|
||||
#include "opmysql.h"
|
||||
|
@ -23,12 +25,6 @@
|
|||
|
||||
#define TEST_UNPACK 1
|
||||
|
||||
#define K22_STR_EXP(__A) #__A
|
||||
#define K22_STR(__A) K22_STR_EXP(__A)
|
||||
#define K22_CMS_VERSION_MAJOR 1
|
||||
#define K22_CMS_VERSION_MINOR 215
|
||||
#define K22_CMS_VERSION_REVISION 0
|
||||
#define K22_VERSION K22_STR(K22_CMS_VERSION_MAJOR) "." K22_STR(K22_CMS_VERSION_MINOR) "." K22_STR(K22_CMS_VERSION_REVISION) ""
|
||||
|
||||
#define CHUNK 16384
|
||||
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
#pragma once
|
||||
|
||||
#pragma pack(1)
|
||||
typedef enum tagTopic : char
|
||||
{
|
||||
GateWayPublicTopic_Server = 0,
|
||||
ServerPublicTopic_GateWay = 1,
|
||||
}MQTT_Topic;
|
||||
}FrameType, MQTT_Topic;
|
||||
|
||||
typedef enum tagDataType : char
|
||||
{
|
||||
|
@ -15,8 +16,10 @@ typedef enum tagDataType : char
|
|||
DT_GATEWAY_CTRLDATA = 4,
|
||||
DT_WEB_CTRL = 5,
|
||||
DT_WEB_WRITE = 6,
|
||||
DT_GATEWAY_WRITE = 7
|
||||
}MQTT_DataType;
|
||||
DT_GATEWAY_WRITE = 7,
|
||||
FRAME_REQUEST = 8,
|
||||
FRAME_RESPONSE = 9,
|
||||
}FrameDataType,MQTT_DataType;
|
||||
|
||||
/*
|
||||
{
|
||||
|
@ -47,4 +50,6 @@ typedef struct tagMsgData
|
|||
char content_data[1]; //MQTT包字符串的内容
|
||||
}MessageData;
|
||||
|
||||
|
||||
|
||||
#pragma pack()
|
Loading…
Reference in New Issue