| | |
| | | class HvSerialPort
|
| | | {
|
| | | public:
|
| | | double GetTimeMs()
|
| | | double GetTimemS()
|
| | | {
|
| | | LARGE_INTEGER perfreq;
|
| | | LARGE_INTEGER percounter1;
|
| | |
| | | volatile bool MyThreadProc1Running;
|
| | |
|
| | | volatile int RecvBufDataLen = 0;
|
| | | unsigned char * RecvBuf[2048];
|
| | | unsigned char * RecvBuf[4096];
|
| | | volatile int RecvBufPos = 0;
|
| | |
|
| | | unsigned char * RecvBuf2[4096];
|
| | | DWORD m_dwError;
|
| | | CString m_strResult;
|
| | | int m_nCountToTry = 5;
|
| | | int m_nCountToWait = 0;
|
| | | int m_nCountToWait = 1;
|
| | |
|
| | | volatile DWORD TotalSendBytes, TotalRecvBytes;
|
| | | volatile DWORD SendBytes, RecvBytes;
|
| | |
| | | };
|
| | | ~HvSerialPort()
|
| | | {
|
| | | MyThreadProc1ToRun = 0;
|
| | | if (this->m_bOpened) { this->Close(); }
|
| | | this->hCom1 = INVALID_HANDLE_VALUE;
|
| | |
|
| | |
| | |
|
| | | public:
|
| | | int SetParams(int nPortNum, int BaudRate, CString Settings);
|
| | | int PurgeComBuf()
|
| | | {
|
| | | return PurgeComm(hCom1, PURGE_TXABORT | PURGE_RXABORT | PURGE_TXCLEAR | PURGE_TXCLEAR);
|
| | | }
|
| | |
|
| | | int Open();
|
| | | int ClearStatData();
|
| | |
| | | int Close();
|
| | | int SetRecvDoneCallBack(pRecvDone);
|
| | |
|
| | | int ClearBuf();
|
| | |
|
| | | int Send(void * pBuf, int len1);
|
| | | int Recv(void * pBuf, int len1);
|
| | | int RecvFromCom(void * pBuf, int len1);
|
| | | int RecvFromBuf(void * pBuf, int len1);
|
| | |
|
| | | protected:
|
| | | int PurgeComBuf()
|
| | | {
|
| | | return PurgeComm(hCom1, PURGE_TXABORT | PURGE_RXABORT | PURGE_TXCLEAR | PURGE_TXCLEAR);
|
| | | }
|
| | |
|
| | |
|
| | | static UINT MyJumper1(LPVOID pParam);
|
| | | DWORD WINAPI MyThreadProc1(LPVOID pParam);
|