1234567891011121314151617181920212223242526272829303132333435363738394041 |
- // Protocol.h: interface for the CProtocol class.
- //
- //////////////////////////////////////////////////////////////////////
- #if !defined(AFX_PROTOCOL_H__B54C8930_9411_4B11_B750_261140346F76__INCLUDED_)
- #define AFX_PROTOCOL_H__B54C8930_9411_4B11_B750_261140346F76__INCLUDED_
- #if _MSC_VER > 1000
- #pragma once
- #endif // _MSC_VER > 1000
- class CCommAsyn;
- class CProtocol
- {
- public:
- virtual BOOL InitParam(PPORTPARAM pPortParam,CCommAsyn*pComm);
- virtual int WorkMain(
- int nAddr, //设备地址
- BYTE Start, //起始位
- BYTE StartAddr[2], //起始地址
- int nRegNum, //读取的寄存器个数
- BYTE FuncCode[2],
- int nDataLen,
- BYTE byWithAddrFlag,
- char chMsg[80]) =0;
- virtual int WriteCommand(char DataBuffer[80], int nDataLen) = 0;
- CProtocol();
- virtual ~CProtocol();
- protected:
- CCommAsyn* m_pComm;
- int WriteMessage(BYTE* pBuf, int len);
- int ReadMessage(BYTE *pBuf, int len);
- public:
- RESPONSE_STRUCT m_structResponse;
- };
- #endif // !defined(AFX_PROTOCOL_H__B54C8930_9411_4B11_B750_261140346F76__INCLUDED_)
|