| | |
| | |
|
| | | } ;
|
| | |
|
| | | enum {KLSignStart='%',
|
| | | KLSignReply='U',
|
| | | enum {KLSignStart='%', //0x25
|
| | | KLSignReply='U', //0x55
|
| | | KLSignEnd=0x0D,
|
| | | KLMaxPacketLength=64,
|
| | | };
|
| | |
| | | KLCmdReadData = 0x35,
|
| | | KLCmdWriteData = 0x36 ,
|
| | |
|
| | | KLCmdStopBlinkLED = 0x4F,
|
| | | KLCmdBlinkLED = 0x50,
|
| | |
|
| | | KLCmdReadProg = 0x51,
|
| | | KLCmdWriteProg,
|
| | |
| | | KLCmdSaveSysCfg,
|
| | | KLCmdSaveRunStat,
|
| | | KLCmdReadRunStat,
|
| | | KLCmdClearRunStat,
|
| | |
|
| | | KLCmdEraseFlashPage = 0x61,
|
| | | KLCmdWriteToFlash = 0x62,
|
| | |
| | | extern unsigned char KLBufferIn[16];
|
| | | extern unsigned char KLBufferOut[16];
|
| | |
|
| | | extern unsigned char nKLAddr;
|
| | | extern unsigned char nKLStationId;
|
| | | extern unsigned char nKLSeq;
|
| | |
|
| | | extern int KLThisuS;
|
| | |
| | | /*
|
| | | typedef struct tagKLPktHdr
|
| | | {
|
| | | unsigned char StSign; //起始标记
|
| | | unsigned char SrcAddr; //源地址
|
| | | unsigned char DstHost; //目标地址
|
| | | unsigned char nCMD; //命令
|
| | | unsigned char StSign; //起始标记
|
| | | unsigned char SrcAddr; //源地址
|
| | | unsigned char DstHost; //目标地址
|
| | | unsigned char nCMD; //命令
|
| | |
|
| | | }stKLPtHdr, * pKLPktHdr;
|
| | | */
|
| | | /*
|
| | | typedef struct tagKLRdPkt
|
| | | {
|
| | | unsigned char StSign; //起始标记 |
| | | unsigned char SrcAddr; //源地址
|
| | | unsigned char DstHost; //目标地址
|
| | | unsigned char nCMD; //命令
|
| | | unsigned char StSign; //起始标记 |
| | | unsigned char SrcAddr; //源地址
|
| | | unsigned char DstHost; //目标地址
|
| | | unsigned char nCMD; //命令
|
| | | unsigned char nType;
|
| | | unsigned char nAddr; //
|
| | | }stKLRdPkt,* pKLRdKpt;
|
| | |
| | | /*
|
| | | typedef struct tagKLPacket
|
| | | {
|
| | | unsigned char StSign; //起始标记 |
| | | unsigned char SrcAddr; //源地址
|
| | | unsigned char DstHost; //目标地址
|
| | | unsigned char nCMD; //命令
|
| | | unsigned char nSEQ; //序列号
|
| | | unsigned char LoadLen; //数据载荷长度 不包括头部5个字节,不包括尾部BCC。
|
| | | unsigned char data[1]; //数据载荷,最末尾是BCC,数据长度为0时,实际也有一个数据。
|
| | | unsigned char StSign; //起始标记 |
| | | unsigned char SrcAddr; //源地址
|
| | | unsigned char DstHost; //目标地址
|
| | | unsigned char nCMD; //命令
|
| | | unsigned char nSEQ; //序列号
|
| | | unsigned char LoadLen; //数据载荷长度 不包括头部5个字节,不包括尾部BCC。
|
| | | unsigned char data[1]; //数据载荷,最末尾是BCC,数据长度为0时,实际也有一个数据。
|
| | | }stKLPacket,* pKLPacket;
|
| | | */
|
| | |
|
| | |
| | | //
|
| | |
|
| | | /* Make a Packet and return Packet Length */
|
| | | int KLMakeReqPacket(void * pBuf1,uchar Src, uchar Dst, uchar nType, uchar nSEQ, uchar DataLen, void *pData );
|
| | | int KLMakeReqPacket(void * pBuf1, uchar Src, uchar Dst, uchar nType, uchar nSEQ, uchar DataLen, void *pData );
|
| | | int KLMakeRplyPacket(void * pBuf1, uchar Dst, uchar Status, uchar nCmd, uchar DataLen, const void *pData );
|
| | |
|
| | | /* */
|
| | | int KLCheckPacket(void * pBuf1,int len1);
|
| | | int KLCheckPacket(int nChn, void * pBuf1, int len1);
|
| | |
|
| | | /* */
|
| | | int KLParsePacket(void * pBuf1, int Len1);
|
| | | int KLParsePacket(int nChn, void * pBuf1, int Len1);
|
| | |
|
| | | //int ReadData(void);
|
| | |
|