Using Events and Callbacks with Bluetooth

You can enhance the power and flexibility of your instrument control application by using events. An event occurs after a condition is met, and might result in one or more callbacks.

While the instrument object is connected to the instrument, you can use events to display a message, display data, analyze data, and so on. Callbacks are controlled through callback properties and callback functions. All event types have an associated callback property. Callback functions are MATLAB® functions that you construct to suit your specific application needs.

You execute a callback when a particular event occurs by specifying the name of the callback function as the value for the associated callback property.

The Bluetooth® event types and associated callback properties are described below.

Event Type

Associated Property Name

Bytes-available

BytesAvailableFcn

BytesAvailableFcnCount

BytesAvailableFcnMode

Error

ErrorFcn

Output-empty

OutputEmptyFcn

Timer

TimerFcn

TimerPeriod

These are the same callbacks that are commonly used by other interfaces in the Instrument Control Toolbox™.

Was this topic helpful?