| | |
| | | enum {KLSignStart='%', //0x25 |
| | | KLSignReply='U', //0x55 |
| | | KLSignEnd=0x0D, |
| | | KLMaxPacketLength=64, |
| | | KLMaxPacketLength=256, |
| | | }; |
| | | enum enKLCMDs |
| | | { |
| | |
| | | KLCmdChkPass, |
| | | KLCmdSetPass, |
| | | KLCmdEraseAll, |
| | | KLCmdReadProgram, |
| | | KLCmdStartProgram, |
| | | KLCmdWriteProgram, |
| | | KLCmdFinishProgram, |
| | | |
| | | KLCmdReadPLCProgram, |
| | | KLCmdStartPLCProgram, |
| | | KLCmdWritePLCProgram, |
| | | KLCmdFinishPLCProgram, |
| | | KLCmdReadPLCAnno, |
| | | KLCmdStartPLCAnno, |
| | | KLCmdWritePLCAnno, |
| | | KLCmdFinishPLCAnno, |
| | | |
| | | KLCmdRead1Bit = 0x21, //ReadSingleBit |
| | | KLCmdWrite1Bit = 0x22, //WriteSingleBit |
| | | KLCmdReadBits = 0x23, //ReadBits n = 1 - 8 |
| | |
| | | KLCmdMD, |
| | | KLCmdMG, |
| | | |
| | | KLCmdWriteFirmware, |
| | | KLCmdWriteFirmInfo, |
| | | KLCmdGetPortInfo, |
| | | KLCmdGetPortChnInfo, |
| | | KLCmdGetPortChildInfo, |
| | | KLCmdPortRemoteReq, |
| | | |
| | | KLCmdErrRply=0xEE, //ERRORReply |
| | | }; |
| | |
| | | KLInfoTypeEventLogCount = 3, |
| | | }; |
| | | |
| | | extern unsigned char KLPacketBuf1[256]; |
| | | //extern unsigned char KLPacketBuf1[256]; |
| | | extern unsigned char KLPacketBuf2[256]; |
| | | |
| | | extern unsigned char KLBufferIn[16]; |
| | |
| | | extern int KLThisuS; |
| | | extern int KLRecvTimeuS; |
| | | |
| | | //PendReq 状态 |
| | | //0, 没有 |
| | | //1, 执行中 |
| | | //2, 成功完成 |
| | | //3, 失败 |
| | | #pragma anon_unions |
| | | typedef union tagKLStatDef |
| | | { |
| | |
| | | UCHAR nSEQ : 4; |
| | | UCHAR HasExt : 1; |
| | | UCHAR HasErr : 1; |
| | | UCHAR PendReqStat : 2; |
| | | }; |
| | | }unKLStat, *pKLStat; |
| | | /* |
| | |
| | | }stKLPacket,* pKLPacket; |
| | | */ |
| | | |
| | | int KLinkInit(int ); |
| | | |
| | | unsigned char KLBCC(const void * pData, int nSize); |
| | | // |
| | | |
| | |
| | | /* */ |
| | | int KLParsePacket(int nChn, void * pBuf1, int Len1); |
| | | |
| | | typedef void *(*KLinkEvCBDef) (int nChn, int nEvent, void *, int); //Event callback func ,prama s is void *,void *,int; return void *; |
| | | typedef int (*KLinkSvCBDef) (int nChn, int nSvType, int ,void *, int); //Service Req callback func ,param is int ,int, int, void *,int; return int; |
| | | |
| | | //int ReadData(void); |
| | | |
| | | //int WriteData(void); |