INtime SDK Help
WaitCommEvent (Serial Communications)
INtime SDK v7 > About INtime > Networking and I/O > Serial Communications (COMM) > WaitCommEvent (Serial Communications)

Waits for an event to occur for a specified communications device. The set of events that this function monitors is contained in the event mask associated with the device handle.

BOOLEAN WaitCommEvent(
  COMMHANDLE hComm,           // handle to comm device
  LPDWORD lpEvtMask,          // event type
  DWORD dwMilliseconds        // timeout in milliseconds
);

Parameters

hComm
[in] Handle to the communications device. The OpenComm function returns this handle.
lpEvtMask
[out] Pointer to a variable that receives a mask indicating the type of event that occurred. If an error occurs, the value is zero; otherwise, it is one of the following values:
Value Description
EV_BREAK A break was detected on input.
EV_CTS The CTS (clear-to-send) signal changed state.
EV_DSR The DSR (data-set-ready) signal changed state.
EV_ERR A line-status error occurred. Line-status errors are CE_FRAME, CE_OVERRUN, and CE_RXPARITY.
EV_RING A ring indicator was detected.
EV_RLSD The RLSD (receive-line-signal-detect) signal changed state.
EV_RXCHAR A character was received and placed in the input buffer.
EV_RXFLAG The event character was received and placed in the input buffer. The event character is specified in the device's DCB structure, which is applied to a serial port by using SetCommState.
EV_TXEMPTY The last character in the output buffer was sent.
dwMilliseconds
[in] The number of milliseconds the calling thread waits:
NO_WAIT The thread does not wait.
WAIT_FOREVER The thread waits for its request to be fully satisfied.
1-655349 Calling thread goes to sleep for this many milliseconds, after which it awakes.

Note: The kernel converts milliseconds to high-level ticks

Return Values

Non-zero
Success.
0 (zero)
Failure. To determine the status, call GetLastRtError.

Status

E_DISCONNECTED
COMM channel is closed.
E_PARAM
Invalid parameter.
E_TIME
The call timed out.

Remarks

This function monitors a set of events for a specified communications resource. To set and query the current event mask of a communications resource, use SetCommMask and GetCommMask.

Requirements

Versions Defined in Include Link to
INtime 3.1 intime/rt/include/comm.h comm.h comm.lib
See Also