|
我用DEBUG打错蓝牙关闭时好像是串口被断开了:
for ( ; ; ) {
DWORD dwEvent = 0;
if (! WaitCommEvent (hFile, &dwEvent, NULL)) {
if (hFile != INVALID_HANDLE_VALUE) {
g_fSerialError = TRUE;
IFDBG(DebugOut (DEBUG_ERROR, L"[BCSP] Error waiting on COM port: GetLastError = 0x%08x (%d)\n", GetLastError (), GetLastError ()));
}
SetEvent (g_hPacketReady);
return FALSE;
}
我用DEBUG去打印:[ERR] [BCSP] Error waiting on COM port: GetLastError = 0x00000006 (6)
等待串口出错了,难道是串口没设好?
这个是CE自带的rfcomm\portemu.cxx里的串口设置。
PORTEMU_CONTEXT (void) {
memset (this, 0, sizeof(*this));
fLocal = TRUE;
local_dcb = TRUE;
dcb.DCBlength = sizeof(DCB);
dcb.BaudRate = CBR_115200;
dcb.fBinary = TRUE;
dcb.fParity = FALSE;
dcb.fOutxCtsFlow = FALSE;
dcb.fOutxDsrFlow = FALSE;
dcb.fDtrControl = DTR_CONTROL_DISABLE;
dcb.fDsrSensitivity = FALSE;
dcb.fTXContinueOnXoff = TRUE;
dcb.fOutX = FALSE;
dcb.fInX = FALSE;
dcb.fErrorChar = FALSE;
dcb.fNull = FALSE;
dcb.fRtsControl = RTS_CONTROL_DISABLE;
dcb.fAbortOnError = TRUE;
dcb.XonLim = PORTEMU_XONLIM;
dcb.XoffLim = PORTEMU_XOFFLIM;
dcb.ByteSize = 8;
dcb.Parity = NOPARITY;
dcb.StopBits = ONESTOPBIT;
ct.ReadIntervalTimeout = -1;
ct.ReadTotalTimeoutConstant = PORTEMU_RTO;
ct.ReadTotalTimeoutMultiplier = 0;
ct.WriteTotalTimeoutConstant = PORTEMU_WTO;
ct.WriteTotalTimeoutMultiplier = 10;
}
期待高手的出现!!! |
|