HeartRateMonitor class searches for peripherals with the heart rate service (0x180D).
Once a peripheral device is found and connected then a notification is set for the heart rate measurement characteristic (0x2A37).
The DataAvailable event is raised whenever the heart rate changes. The heart rate is parsed from the raw data and printed to the logs.
Note that this class is also compatible with B4i.
It starts searching for devices when the HeartRateMonitor class is initialized.
B4A libraries: BLE2 and ByteConverter
B4i libraries: iBLE and iRandomAccessFile
Once a peripheral device is found and connected then a notification is set for the heart rate measurement characteristic (0x2A37).
The DataAvailable event is raised whenever the heart rate changes. The heart rate is parsed from the raw data and printed to the logs.
Note that this class is also compatible with B4i.
It starts searching for devices when the HeartRateMonitor class is initialized.
B4A libraries: BLE2 and ByteConverter
B4i libraries: iBLE and iRandomAccessFile