Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: BLE_API BLE_BlueNRG mbed
Fork of BLE_HeartRate by
Diff: HeartRateService.h
- Revision:
- 41:9cef0129da5f
- Parent:
- 39:6390604f904c
--- a/HeartRateService.h Fri Aug 22 15:04:49 2014 +0000
+++ b/HeartRateService.h Tue Sep 02 16:17:18 2014 +0000
@@ -25,13 +25,15 @@
/* Location: https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.body_sensor_location.xml */
class HeartRateService {
public:
- static const unsigned BLE_HRS_BODY_SENSOR_LOCATION_OTHER = 0;
- static const unsigned BLE_HRS_BODY_SENSOR_LOCATION_CHEST = 1;
- static const unsigned BLE_HRS_BODY_SENSOR_LOCATION_WRIST = 2;
- static const unsigned BLE_HRS_BODY_SENSOR_LOCATION_FINGER = 3;
- static const unsigned BLE_HRS_BODY_SENSOR_LOCATION_HAND = 4;
- static const unsigned BLE_HRS_BODY_SENSOR_LOCATION_EAR_LOBE = 5;
- static const unsigned BLE_HRS_BODY_SENSOR_LOCATION_FOOT = 6;
+ enum {
+ LOCATION_OTHER = 0,
+ LOCATION_CHEST,
+ LOCATION_WRIST,
+ LOCATION_FINGER,
+ LOCATION_HAND,
+ LOCATION_EAR_LOBE,
+ LOCATION_FOOT,
+ };
public:
HeartRateService(BLEDevice &_ble, uint8_t _hrmCounter, uint8_t _location) :
@@ -57,7 +59,7 @@
void updateHeartRate(uint8_t hrmCounter) {
if (ble.getGapState().connected) {
bpm.updateHeartRate(hrmCounter);
- ble.updateCharacteristicValue(hrmRate.getHandle(), bpm.getPointer(), HeartRateValueBytes::SIZEOF_ARRAY);
+ ble.updateCharacteristicValue(hrmRate.getValueAttribute().getHandle(), bpm.getPointer(), HeartRateValueBytes::SIZEOF_ARRAY);
}
}
@@ -82,6 +84,7 @@
return beatsPerMinute;
}
+ private:
/* First byte = 8-bit values, no extra info, Second byte = uint8_t HRM value */
/* See --> https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.heart_rate_measurement.xml */
uint8_t beatsPerMinute[SIZEOF_ARRAY];
