Hi. I'm trying to setup the IOCTL_SERIAL_WAIT_ON_MASK and IOCTL_SERIAL_SET_WAIT_MASK function on Wince 5.0.
I am issuing a deviceiocontrol call and would like have it wait until a certain character ('k') comes over the comm port.
However, this function never returns. Below is a code snippet. Can anyone help me with this? Or does anyone know of any sample code using these functions on Wince? thanks in advance.
<code>
BOOL bRet;
DWORD dwWaitMask;
DeviceIoControl (portHandle, IOCTL_SERIAL_GET_DCB, NULL, 0, &config, sizeof(DCB), &length, NULL);
config.BaudRate = 9600;
config.StopBits = 1;
config.Parity = 0;
config.ByteSize = 8;
config.EvtChar = _T('k');
DeviceIoControl (portHandle, IOCTL_SERIAL_SET_DCB, &config, sizeof(DCB), NULL, 0, &length, NULL);
dwWaitMask = EV_RXFLAG;
bRet = DeviceIoControl (portHandle, IOCTL_SERIAL_SET_WAIT_MASK, &dwWaitMask, sizeof(DWORD), NULL, 0, &length, NULL);
DWORD EventMask = EV_RXFLAG, Events, junk;
DeviceIoControl (hDrvCom2, IOCTL_SERIAL_WAIT_ON_MASK, &EventMask, sizeof(EventMask), &Events, sizeof(Events), &junk, NULL); // this function call never returns.
Thanks.
I am issuing a deviceiocontrol call and would like have it wait until a certain character ('k') comes over the comm port.
However, this function never returns. Below is a code snippet. Can anyone help me with this? Or does anyone know of any sample code using these functions on Wince? thanks in advance.
<code>
BOOL bRet;
DWORD dwWaitMask;
DeviceIoControl (portHandle, IOCTL_SERIAL_GET_DCB, NULL, 0, &config, sizeof(DCB), &length, NULL);
config.BaudRate = 9600;
config.StopBits = 1;
config.Parity = 0;
config.ByteSize = 8;
config.EvtChar = _T('k');
DeviceIoControl (portHandle, IOCTL_SERIAL_SET_DCB, &config, sizeof(DCB), NULL, 0, &length, NULL);
dwWaitMask = EV_RXFLAG;
bRet = DeviceIoControl (portHandle, IOCTL_SERIAL_SET_WAIT_MASK, &dwWaitMask, sizeof(DWORD), NULL, 0, &length, NULL);
DWORD EventMask = EV_RXFLAG, Events, junk;
DeviceIoControl (hDrvCom2, IOCTL_SERIAL_WAIT_ON_MASK, &EventMask, sizeof(EventMask), &Events, sizeof(Events), &junk, NULL); // this function call never returns.
Thanks.