Serial Communications Functions

Functions and structures used for serial communications are defined in the Winbase.h header file. Reading to and writing from a serial communications port on a Windows CE–based device is done by calling file input and output functions. The following table describes functions and structures defined in the Winbase.h header file.

Function
Description
CreateFile Opens a serial port.
GetCommState Fills in a device-control block—DCB structure—with the current control settings for a specified communication device.
SetCommState Configures a communication device according to the specifications in a DCB structure. The function reinitializes all hardware and control settings, but does not empty I/O queues.
GetCommTimeouts Retrieves the time-out parameters for all read/write operations on a specified communication device.
SetCommTimeouts Sets the time-out parameters for all read/write operations on a specified communication device.
WriteFile Writes data to a serial port, which transfers data to the device at the other end of a serial connection.
ReadFile Reads data from a serial port, which receives data from a device at the other end of a serial connection.
SetCommMask Specifies a set of events to monitor for a communication device.
GetCommMask Retrieves the value of the event mask for a specified communication device.
WaitCommEvent Waits for an event to occur for a specified communication device. The set of events monitored by WaitCommEvent is contained in the event mask associated with the device handle.
EscapeCommFunction Directs a specified communication device to perform an extended function. Often used to set a serial port to IR mode.
ClearCommBreak Restores character transmission for a specified communication device and places the transmission line in a non-break state.
ClearCommError Retrieves communication error data and reports the current status of a specified communication device.