93 lines
1.8 KiB
C
93 lines
1.8 KiB
C
#ifndef PROTOCOL_H
|
|
#define PROTOCOL_H
|
|
|
|
#define CLOUND_API_CMD_RSP_BASE (10000)
|
|
|
|
typedef enum
|
|
{
|
|
GET_DEV_ID = 1,
|
|
CONFIG_AP = 2,
|
|
MSG_BYPASS = 1000,
|
|
} CLOUND_API_CMD;
|
|
|
|
typedef enum
|
|
{
|
|
CRYPTO_NONE = 0,
|
|
CRYPTO_MD5 = 1,
|
|
CRYPTO_AES = 2,
|
|
} CRYPTO_TYPE;
|
|
|
|
typedef enum
|
|
{
|
|
CRYPTO_ENCODE = 0,
|
|
CRYPTO_DECODE = 1
|
|
} CRYPTO_OPT;
|
|
|
|
typedef struct
|
|
{
|
|
char* cpuId;
|
|
} RSP_GET_DEVID_PRO, *PRSP_GET_DEVID_PRO;
|
|
|
|
typedef struct
|
|
{
|
|
char* mcuCmd;
|
|
} BYPASS_INFO, *PBYPASS_INFO;
|
|
|
|
typedef struct
|
|
{
|
|
char* ssid;
|
|
char* passwd;
|
|
} CFG_AP_INFO, *PCFG_AP_INFO;
|
|
|
|
typedef struct
|
|
{
|
|
int cmdId;
|
|
int cryptoType;
|
|
int timeStamp;
|
|
char* msgContent;
|
|
} CLOUND_API, *PCLOUND_API;
|
|
|
|
typedef struct
|
|
{
|
|
int errNo;
|
|
char* errMsg;
|
|
} CLOUND_API_RSP_ERR, *PCLOUND_API_RSP_ERR;
|
|
|
|
#if 0
|
|
typedef struct
|
|
{
|
|
unsigned char msgTag;
|
|
unsigned char msgLen;
|
|
unsigned char msgDev;
|
|
unsigned char msgSync;
|
|
unsigned char msgResrved[2];
|
|
unsigned char msgSeq;
|
|
unsigned char msgVer;
|
|
unsigned char proVer;
|
|
unsigned char msgId;
|
|
unsigned char* pData;
|
|
} MCU_MSG, *PMCU_MSG;
|
|
#endif
|
|
|
|
typedef struct MCU_MSG_INFO
|
|
{
|
|
char* pMessage;
|
|
struct MCU_MSG_INFO *next, *prev;
|
|
} *PMCU_MSG_INFO;
|
|
|
|
typedef struct
|
|
{
|
|
unsigned char* pMessage;
|
|
int msgSize;
|
|
} MQTT_MSG, *PMQTT_MSG;
|
|
|
|
int ProtocolInitEnv(void);
|
|
int ProtocolProcess(char* pStrJson);
|
|
|
|
|
|
int ProCacheMCUMsg(unsigned char* pData, int msgSize);
|
|
char* ProGetMCUMsg(void);
|
|
|
|
int ProCacheMQTTMsg(char* pData);
|
|
#endif
|