XDK Live
Mita provides the possibility to create a BLE resource. If the configuration and implementation provided by the Mita implementation are insufficient for a certain purpose, it is recommended to make adapting changes in the generated C code.
This section will demonstrate the Mita BLE API. In Mita, BLE is defined as a named singleton resource. That means, there can only be one instance of the BLE resource set up, and the name can be specified by the developer. All possible configuration items for the BLE resource are listed below.
Setting up BLE Resource
A BLE resource is generally setup with the required configuration-item macAddress. This configuration-item is a string, which represents the resulting Mac Address. Every Mac Address must match the pattern FC:D6:BD:xx:xx:xx.
Setting up variable topic-signals
In the above example, light is a variable of type uint32_characteristic. This variable is a so-called signal, a BLE instance can have multiple signals, each representing a characteristic. For example, if it is desired to have one characteristic for temperature and one for light, the following code would initialize a BLE resource with characteristics for light and temperature:
Every read/write operation on one of the signals will send or read messages on the on the associated characteristics. The UUID of the characteristics ends with 0001 and 0002 (in hexadecimal) respectively.
Writing on a Characteristic
Assuming that the following BLE resource has been previously set up:
Then the following code will write the light and temperature values on the respective characteristics every 1 second.
Last updated
Was this helpful?