1234567891011121314151617181920212223242526272829303132333435363738394041 |
- // ProtocolPMC916.h: interface for the CProtocolModbus class.
- //
- //////////////////////////////////////////////////////////////////////
- #if !defined(AFX_PROTOCOLPMC916_H_INCLUDED_)
- #define AFX_PROTOCOLPMC916_H_INCLUDED_
- #if _MSC_VER > 1000
- #pragma once
- #endif // _MSC_VER > 1000
- #define DEBUG_PROTOCOL 1
- #include "Protocol.h"
- class CProtocolModbus : public CProtocol
- {
- public:
- UINT GetCRC(BYTE *pBuf, int len);
- virtual BOOL InitParam(PPORTPARAM pPortParam, CCommAsyn *pComm);
- virtual int WorkMain(SETBASEPARAM SetBasePara, int nDataLen, char chMsg[80]);
- virtual int WriteCommand(SETBASEPARAM SetBasePara, double dbData, int nDataLen);
- CProtocolModbus();
- virtual ~CProtocolModbus();
- protected:
- HANDLE m_hSemComm;
- CRITICAL_SECTION m_csReadFinished;
- CRITICAL_SECTION m_csWrFinished;
- protected:
- virtual int RequestStatus( SETBASEPARAM SetBasePara);
- virtual int ResponseStatus( int nAddr, int nRegNum, int nDataLen, char chMsg[80]);
- virtual int RequestWrStatus( SETBASEPARAM SetBasePara, double dbData, int nDataLen);
- virtual int ResponseWrStatus(int nAddr, int nRegNum, int nDataLen);
- };
- char ByteToAscii(BYTE btSrc);
- WORD AsciiToBYTE(BYTE btSrc);
- static unsigned char LRC(unsigned char *auchMsg, unsigned short usDataLen);
- #endif // !defined(AFX_PROTOCOLPMC916_H_INCLUDED_)
|