This is an old revision of the document!
Bluetooth Low Energy for STM32 - peripheral read
In the previous example, a simple peripheral device program has been shown. The program allowed the central device to write data to the chosen characteristic and control the LEDs. In this part, we will read the characteristic data. The example available for STM32WB55 in Arduino in addition to controlling LED, allows also to read the state of the button.
The simplest method to get the information from a connected peripheral device is to read the characteristic. BLE specification defines also the notification and indication mechanisms to enable automatic updating of the information in which the central device is interested. Both methods of data transmission work similarly to interrupt in microprocessors. The client subscribes to the data by enabling notification or indication. Data is sent only if the peripheral decides to do it, periodically or on update. This saves the network use and energy. The Notification is not acknowledged, the indication must be acknowledged by the central device. Both mechanisms are controlled with the characteristic descriptor with UUID 0x2902.
- Notification is controlled with bit 0 (0-disable, 1-enable).
- Indication is controlled with bit 1 (0-disable, 1-enable).
