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

Retrieves information about a communications error and reports the current status of a communications device. The function is called when a communications error occurs, and it clears the device's error flag to enable additional input and output (I/O) operations.

BOOLEAN ClearCommError(
  COMMHANDLE hComm, // handle to communications device
  LPDWORD lpErrors, // error codes
  LPCOMSTAT lpStat  // communications status
);

Parameters

hComm
[in] Handle to the communications device. OpenComm returns this handle.
lpErrors
[out] Pointer to a variable to fill with a mask that indicates the error type. This parameter can be one or more of the following values:
Value Description
CE_BREAK The hardware detected a break condition
CE_FRAME The hardware detected a framing error.
CE_IOE An I/O error occurred during communications with the device.
CE_MODE The requested mode is not supported, or the hComm parameter is invalid. If this value is specified, it is the only valid error.
CE_OVERRUN A character-buffer overrun occurred. The next character is lost.
CE_RXOVER An input buffer overflow occurred. There is either no room in the input buffer, or a character was received after the end-of-file (EOF) character.
CE_RXPARITY The hardware detected a parity error.
CE_TXFULL The application tried to transmit a character, but the output buffer was full.
lpStat
[out] Pointer to a COMSTAT structure in which the device's status information is returned. If lpStat is NULL, no status information returns.

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

Remarks

If a communications port has been set up with a TRUE value for the fAbortOnError member of the setup DCB structure, the communications software will terminate all read and write operations on the communications port when a communications error occurs. No new read or write operations will be accepted until the application acknowledges the communications error by calling ClearCommError.

ClearCommError fills the status buffer pointed to by the lpStat parameter with the current status of the communications device specified by the hComm parameter.

Requirements

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