|HeartRateService (BLE &_ble, uint16_t hrmCounter, BodySensorLocation location)|
|Construct and initialize a heart rate service. More...|
|void||updateHeartRate (uint16_t hrmCounter)|
|Update the heart rate that the service exposes. More...|
|Construct and add to the GattServer the heart rate service. More...|
BLE Heart Rate Service.
Fitness applications use the heart rate service to expose the heart beat per minute measured by a heart rate sensor.
Clients can read the intended location of the sensor and the last heart rate value measured. Additionally, clients can subscribe to server initiated updates of the heart rate value measured by the sensor. The service delivers these updates to the subscribed client in a notification packet.
The subscription mechanism is useful to save power; it avoids unecessary data traffic between the client and the server, which may be induced by polling the value of the heart rate measurement characteristic.
When this class is instantiated, it adds a heart rate service in the GattServer. The service contains the location of the sensor and the initial value measured by the sensor.
Application code can invoke updateHeartRate() when a new heart rate measurement is acquired; this function updates the value of the heart rate measurement characteristic and notifies the new value to subscribed clients.
Construct and initialize a heart rate service.
The construction process adds a GATT heart rate service in
_ble GattServer, sets the value of the heart rate measurement characteristic to
hrmCounter and the value of the body sensor location characteristic to
|[in]||_ble||BLE device that hosts the heart rate service.|
|[in]||hrmCounter||Heart beats per minute measured by the heart rate sensor.|
|[in]||location||Intended location of the heart rate sensor.|
Update the heart rate that the service exposes.
The server sends a notification of the new value to clients that have subscribed to updates of the heart rate measurement characteristic; clients reading the heart rate measurement characteristic after the update obtain the updated value.
|[in]||hrmCounter||Heart rate measured in BPM.|