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:
20:58bff62d0f7a
Parent:
19:1713b11694ea
Child:
22:299658c5fa3c
--- a/main.cpp	Wed Jun 11 14:45:05 2014 +0100
+++ b/main.cpp	Wed Jun 11 14:52:56 2014 +0100
@@ -47,7 +47,8 @@
 /* Location: https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.body_sensor_location.xml */
 static uint8_t hrmCounter = 100;
 static uint8_t bpm[2] = {0x00, hrmCounter};
-GattCharacteristic hrmRate(GattCharacteristic::UUID_HEART_RATE_MEASUREMENT_CHAR, bpm, sizeof(bpm), sizeof(bpm), GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY);
+GattCharacteristic hrmRate(GattCharacteristic::UUID_HEART_RATE_MEASUREMENT_CHAR, bpm, sizeof(bpm), sizeof(bpm),
+                           GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY);
 static const uint8_t location = 0x03; /* Finger */
 GattCharacteristic hrmLocation(GattCharacteristic::UUID_BODY_SENSOR_LOCATION_CHAR,
                                (uint8_t *)&location, sizeof(location), sizeof(location),
@@ -74,18 +75,6 @@
     GattService::UUID_HEART_RATE_SERVICE
 };
 
-void timeoutCallback(void)
-{
-    DEBUG("Advertising Timeout!\n\r");
-    // Restart the advertising process with a much slower interval,
-    // only start advertising again after a button press, etc.
-}
-
-void connectionCallback(void)
-{
-    DEBUG("Connected!\n\r");
-}
-
 void disconnectionCallback(void)
 {
     DEBUG("Disconnected!\n\r");
@@ -93,20 +82,6 @@
     ble.startAdvertising();
 }
 
-void updatesEnabledCallback(uint16_t charHandle)
-{
-    if (charHandle == hrmRate.getHandle()) {
-        DEBUG("Heart rate notify enabled\n\r");
-    }
-}
-
-void updatesDisabledCallback(uint16_t charHandle)
-{
-    if (charHandle == hrmRate.getHandle()) {
-        DEBUG("Heart rate notify disabled\n\r");
-    }
-}
-
 /**
  * Runs once a second in interrupt context triggered by the 'ticker'; updates
  * battery level and hrmCounter if there is a connection.
@@ -145,11 +120,7 @@
     ble.init();
 
     /* Setup the local GAP/GATT event handlers */
-    ble.onTimeout(timeoutCallback);
-    ble.onConnection(connectionCallback);
     ble.onDisconnection(disconnectionCallback);
-    ble.onUpdatesEnabled(updatesEnabledCallback);
-    ble.onUpdatesDisabled(updatesDisabledCallback);
 
     /* setup advertising */
     ble.accumulateAdvertisingPayload(GapAdvertisingData::BREDR_NOT_SUPPORTED);