DLT645-2007协议格式如下:
/* 根据协议格式的状态定义 /
#define FRAME_STATES_DLT645_NULL 0 / no synchronisation /
#define FRAME_STATES_DLT645_68 1 / have the first Flag Byte received /
#define FRAME_STATES_DLT645_ADDR 2 / have the length byte /
#define FRAME_STATES_DLT645_68_2 3 / have the length byte /
#define FRAME_STATES_DLT645_C 4 / have the control byte /
#define FRAME_STATES_DLT645_L 5 / have the confirm length byte /
#define FRAME_STATES_DLT645_DATA 6 / have the confirm length byte /
#define FRAME_STATES_DLT645_CS 7 / wait for the CS /
#define FRAME_STATES_DLT645_END 8 / wait for the 16H /
#define FRAME_STATES_DLT645_COMPLETE 9 / complete frame */
/* 数据结构体定义 /
typedef struct _CHKFRAME {
int eFrameState; / 报文状态 /
uint8 nControlWord; / 普通报文中的控制字 /
time_t iUpdate_Time; / 更新时间 /
time_t iOvertime; / 报文等待超时时间*/
uint8 nChannelType; /* 报文信道来源类型 /
uint8 aBuffer[MAX_FRAME_LEN]; / buffer, that hold the received bytes /
uint16 nFrameLen; / actual length of the buffer */
uint8 pBufferPtr; / pointer to buffe