69 lines
1.5 KiB
C
69 lines
1.5 KiB
C
#ifndef _PROTO_SL651_H
|
||
#define _PROTO_SL651_H
|
||
#include <stdint.h>
|
||
|
||
|
||
// 上行统一使用M1模式,无确认
|
||
// 下行统一使用M2模式一次确认
|
||
|
||
#define _651_STX 2
|
||
#define _651_ETX 3
|
||
#define _651_ETB 23
|
||
|
||
|
||
#define STATION_TYPE 0x5A // 遥测站分类码
|
||
|
||
|
||
#define U_LINKCHECK_MSG 0x2F // 链路维持报
|
||
#define U_USER_TEST_MSG 0x30 // 测试报
|
||
#define U_UNIF_TIME_MSG 0x31 // 均匀时段报
|
||
#define U_TIMINGTT_MSG 0x32 // 定时报
|
||
#define U_MANUAL_MSG 0x33 // 加报报,由时间和事件触发的上报
|
||
#define U_TIME_HOUR_MSG 0X34 // 小时报
|
||
|
||
#define D_MD_BASEPARA_MSG 0X40
|
||
#define D_MD_BASEPARA_MSG 0X40
|
||
|
||
|
||
#pragma pack (1)
|
||
typedef struct _651_U_Header_t
|
||
{
|
||
uint16_t Head;
|
||
uint8_t CentAddr;
|
||
uint8_t DeviAddr[5];
|
||
uint16_t Pass;
|
||
uint8_t FuncCode;
|
||
uint16_t TypeLength;
|
||
uint8_t Stx;
|
||
} _651_U_Header_t;
|
||
|
||
typedef struct _651_D_Header_t
|
||
{
|
||
uint16_t Head;
|
||
uint8_t DeviAddr[5];
|
||
uint8_t CentAddr;
|
||
uint16_t Pass;
|
||
uint8_t FuncCode;
|
||
uint16_t Type: 4;
|
||
uint16_t Length: 12;
|
||
uint8_t Stx;
|
||
} _651_D_Header_t;
|
||
#pragma pack ()
|
||
|
||
|
||
|
||
|
||
|
||
int PP_AddHeader (uint8_t func, char * data, int length, char * txbuff);
|
||
int PP_PacketUnifData (char * tx_data);
|
||
// 闸门状态自报
|
||
int _651PacketDataSluiceUp (char * tx_data);
|
||
int _651PacketDataSluiceAck (char * tx_data);
|
||
int Json651PacketBaseInfo (char * outBuffer, int length);
|
||
int Json651PacketInterfaceInfo (char * outBuffer, int length);
|
||
int Json651PacketSluiceInfo (char * outBuffer, int length);
|
||
|
||
//int Json651UnpackInfo (char *input, int length, SysInfoConfig_t *info);
|
||
int Json651PacketWaterInfo (char *outBuffer, int length);
|
||
#endif
|