Heart Rate Monitor example for the BLE API using nRF51822 native mode drivers

Dependencies:   BLE_API mbed nRF51822 X_NUCLEO_IDB0XA1

Fork of BLE_HeartRate by Bluetooth Low Energy

Revision:
5:b0baff4a124f
Parent:
4:12890f3c62eb
Child:
7:daab8ba5139e
--- a/main.cpp	Wed May 21 17:56:42 2014 +0100
+++ b/main.cpp	Thu May 29 09:58:58 2014 +0100
@@ -111,14 +111,14 @@
 
     virtual void onUpdatesEnabled(uint16_t charHandle)
     {
-        if (charHandle == hrmRate.handle) {
+        if (charHandle == hrmRate.getHandle()) {
             pc.printf("Heart rate notify enabled\n\r");
         }
     }
 
     virtual void onUpdatesDisabled(uint16_t charHandle)
     {
-        if (charHandle == hrmRate.handle) {
+        if (charHandle == hrmRate.getHandle()) {
             pc.printf("Heart rate notify disabled\n\r");
         }
     }
@@ -181,9 +181,9 @@
 
     /* Now that we're live, update the battery level characteristic, and */
     /* change the device manufacturer characteristic to 'mbed' */
-    nrf.getGattServer().updateValue(battLevel.handle, (uint8_t *)&batt,
+    nrf.getGattServer().updateValue(battLevel.getHandle(), (uint8_t *)&batt,
                                     sizeof(batt));
-    nrf.getGattServer().updateValue(deviceManufacturer.handle,
+    nrf.getGattServer().updateValue(deviceManufacturer.getHandle(),
                                     deviceName,
                                     sizeof(deviceName));
 
@@ -191,7 +191,7 @@
     /* See --> https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.body_sensor_location.xml */
     uint8_t location = 0x03; /* Finger */
     uint8_t hrmCounter = 100;
-    nrf.getGattServer().updateValue(hrmLocation.handle,
+    nrf.getGattServer().updateValue(hrmLocation.getHandle(),
                                     (uint8_t *)&location,
                                     sizeof(location));
 
@@ -205,7 +205,7 @@
         if (batt > 100) {
             batt = 72;
         }
-        nrf.getGattServer().updateValue(battLevel.handle,
+        nrf.getGattServer().updateValue(battLevel.getHandle(),
                                         (uint8_t *)&batt,
                                         sizeof(batt));
 
@@ -217,7 +217,7 @@
             hrmCounter = 100;
         }
         uint8_t bpm[2] = {0x00, hrmCounter};
-        nrf.getGattServer().updateValue(hrmRate.handle, bpm, sizeof(bpm));
+        nrf.getGattServer().updateValue(hrmRate.getHandle(), bpm, sizeof(bpm));
     }
 }