| | |
| | | m_bOpened = true;
|
| | |
|
| | | //Start Read Thread
|
| | | if (m_bUseWorkThread) {
|
| | | MyThreadProc1ToRun = 1;
|
| | | AfxBeginThread(MyJumper1, (LPVOID)this);
|
| | | }
|
| | |
|
| | | // MyThreadProc1ToRun = 1;
|
| | | // AfxBeginThread(MyJumper1, (LPVOID)this);
|
| | |
|
| | | return R_OK;
|
| | | }
|
| | |
| | |
|
| | | // }
|
| | | // if (dwEvtMask & EV_RXCHAR)
|
| | | if (1) { Sleep(1); } else
|
| | | //if (1) { Sleep(1); } else
|
| | | {
|
| | | ClearCommError(hCom1, &m_dwError, &cs);
|
| | | int bytes = cs.cbInQue;
|
| | |
| | | if (bytes > 0)
|
| | | {
|
| | | int j = ReadFile(hCom1, RecvBuf2, bytes, &dwReaded, NULL);
|
| | | if (j > 0)
|
| | | if (j > 0 && dwReaded>0)
|
| | | {
|
| | | //m_CS1.Lock();
|
| | | EnterCriticalSection(&g_cs);
|
| | |
| | | }
|
| | | int HvSerialPort1::Recv(void * pBuf, int len1)
|
| | | {
|
| | | return RecvFromCom(pBuf, len1);
|
| | | if (m_bUseWorkThread) {
|
| | | return RecvFromBuf(pBuf, len1);
|
| | | }
|
| | | else {
|
| | | return RecvFromCom(pBuf, len1);
|
| | | }
|
| | | |
| | | }
|
| | |
|
| | | int HvSerialPort1::RecvFromBuf(void * pBuf, int len1)
|