ARCHITECTURE
Get_port_status()
22 E355/E265 USER AND BEST PRACTICES GUIDE
Get_port_status()
Parameters
Return Values Returns 0 if no output is pending, 1 if output is pending, or -1 if an error occurred
and errno is set to an error code.
For a communication port, the four status bytes copied into the given buffer are as
follows:
• Byte 1: The number of input messages pending.
• Byte 2: Event Cause Bits described below.
• Byte 3: The number of output messages pending.
• Byte 4: The status byte described below.
The event cause bits are set when an event is sent to the application. The
application can read the bits to determine the cause of the event. The event cause
bits are cleared when they are read. The definitions are as follows:
handle The handle returned for the device by the open() call.
buffer The 4-byte buffer in which to copy the status information.
Table 8 Event Cause Bits
Bit Event Definition
Bit 0 Connect Event Set when a communication port is opened.
Bit 1 Disconnect Event Set when a communication port is closed or Bluetooth
connection is lost.
Bit 2 RX Ready Set when new received data is ready to be read.