Demo Glucose Service

Dependencies:   BLE_API mbed nRF51822

Fork of BLE_HeartRate by Bluetooth Low Energy

BLE_Glucose_demo implements the Glucose Service which enables a collector device to connect and interact with.

There is a brief sample code edited with Android Studio for demo this BLE_Glucose_demo example, and it is public on github, everyone can clone it by this URL: https://github.com/Marcomissyou/BluetoothLeGlucose.git. It is convenient for you to development your BLE idea.

There is also provided apk file so you can download and install it directly then demo this code, but make sure your Android phone supports Bluetooth 4.0. /media/uploads/Marcomissyou/bleglucoseservice.apk

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));
     }
 }