External Interfaces/API    

Event Types and Action Properties

The serial port event types and associated action properties are described below.

Table 8-9: Event Types and Action Properties  
Event Type
Associated Properties
Break interrupt
BreakInterruptAction
Bytes available
BytesAvailableAction
BytesAvailableActionCount
BytesAvailableActionMode
Error
ErrorAction
Output empty
OutputEmptyAction
Pin status
PinStatusAction
Timer
TimerAction
TimerPeriod

Break-Interrupt Event.   A break-interrupt event is generated immediately after a break interrupt is generated by the serial port. The serial port generates a break interrupt when the received data has been in an inactive state longer than the transmission time for one character.

This event executes the action function specified for the BreakInterruptAction property. It can be generated for both synchronous and asynchronous read and write operations.

Bytes-Available Event.   A bytes-available event is generated immediately after a predetermined number of bytes are available in the input buffer or a terminator is read, as determined by the BytesAvailableActionMode property.

If BytesAvailableActionMode is byte, the bytes-available event executes the action function specified for the BytesAvailableAction property every time the number of bytes specified by BytesAvailableActionCount is stored in the input buffer. If BytesAvailableActionMode is terminator, then the action function executes every time the character specified by the Terminator property is read.

This event can be generated only during an asynchronous read operation.

Error Event.   An error event is generated immediately after an error occurs.

This event executes the action function specified for the ErrorAction property. It can be generated only during an asynchronous read or write operation.

An error event is generated when a timeout occurs. A timeout occurs if a read or write operation does not successfully complete within the time specified by the Timeout property. An error event is not generated for configuration errors such as setting an invalid property value.

Output-Empty Event.   An output-empty event is generated immediately after the output buffer is empty.

This event executes the action function specified for the OutputEmptyAction property. It can be generated only during an asynchronous write operation.

Pin Status Event.   A pin status event is generated immediately after the state (pin value) changes for the CD, CTS, DSR, or RI pins. Refer to Serial Port Signals and Pin Assignments for a description of these pins.

This event executes the action function specified for the PinStatusAction property. It can be generated for both synchronous and asynchronous read and write operations.

Timer Event.   A timer event is generated when the time specified by the TimerPeriod property passes. Time is measured relative to when the serial port object is connected to the device.

This event executes the action function specified for the TimerAction property.


 Using Events and Actions Storing Event Information