123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- // CommAsyn.h: interface for the CCommAsyn class.
- //
- //////////////////////////////////////////////////////////////////////
- #if !defined(AFX_COMMASYN_H__8351010D_0DD3_4F8C_8F3B_959BA59019E7__INCLUDED_)
- #define AFX_COMMASYN_H__8351010D_0DD3_4F8C_8F3B_959BA59019E7__INCLUDED_
- #if _MSC_VER > 1000
- #pragma once
- #endif // _MSC_VER > 1000
- #define STATUS_NORMAL 0
- #define STATUS_FAULT 1
- #define STATUS_NOUSE 2
- #define STATUS_TYPEERROR 3
- #define COMM_CORRECT 0
- #define COMM_ERROR 1
- #define MAX_DATA_NUM128 128
- #define MAX_YXNO 2048
- #define MAX_YCNO 2048
- class CProtocol;
- class CCommAsyn
- {
- public:
- CProtocol* m_pProtocol;
- virtual int Write(BYTE * pBuf, int len) =0;
- virtual int Read(BYTE * pBuf, int len) =0;
- virtual int WriteCommand(char DataBuffer[80], int nDataLen);
- virtual int WorkMain(
- int nAddr, //设备地址
- BYTE Start, //起始位
- BYTE StartAddr[2], //起始地址
- int nRegNum, //读取的寄存器个数
- BYTE FuncCode[2],
- int nDataLen,
- BYTE byWithAddrFlag,
- char chMsg[80]);
- virtual BOOL InitParam(PPORTPARAM pPortParam);
- virtual BOOL CloseComm();
- CCommAsyn();
- virtual ~CCommAsyn();
- };
- #endif // !defined(AFX_COMMASYN_H__8351010D_0DD3_4F8C_8F3B_959BA59019E7__INCLUDED_)
|