The bluetooth class represents the Bluetooth sub-system integrated into the imp004m module. Attempting to access bluetooth instances and methods on any other imp module will throw an error.
Unlike other imp API entities, bluetooth is a class rather than an automatically instantiated object, so you will work with instances returned by the open() method. The class is accessed as a property of the hardware object.
The imp004m’s Bluetooth sub-system supports Bluetooth 4.1. The standard’s Core Specifications can be downloaded from the Bluetooth SIG here.
When a device’s Squirrel VM is suspended, no new callbacks (for Bluetooth or for any other reason) can be executed until the VM is resumed. When this happens, the whole Bluetooth stack is paused so that it does not cause new events requiring Squirrel execution. This can mean that any in-progress operations will be paused, and may cause large latency spikes in Bluetooth operations — even ones which don’t require Squirrel execution.
In addition, GATT read and write callbacks are called in a context where suspending is not possible. Therefore, if any operation that suspends the VM occurs within these callbacks, a Squirrel error will be raised.
With these two factors in mind, it is strongly recommended that the RETURN_ON_ERROR send timeout policy is selected as the first line in Squirrel that uses Bluetooth features.
For information on setting up the imp004m Breakout Board for Bluetooth LE operation, please see this developer guide.
The required Bluetooth LE firmware is available as a Squirrel file stub here.
The bluetooth object has the following member methods: