BLE Feedbakc Service

Dependencies:   BLE_API mbed nRF51822

Fork of BLE_HeartRate by Bluetooth Low Energy

Revision:
64:4ced7a1586b0
Parent:
63:3c5ca3832415
Child:
65:5a78321ef3d3
--- a/ble_feedback.cpp	Fri Jun 12 08:23:05 2015 +0000
+++ b/ble_feedback.cpp	Fri Jun 12 08:30:07 2015 +0000
@@ -1,12 +1,19 @@
 #include "ble_feedback.h"
 
-FeedbackService::FeedbackService(BLEDevice &_ble):
+BLEDevice  _ble;
+
+void disconnectionCallback(Gap::Handle_t handle, Gap::DisconnectionReason_t reason)
+{
+    _ble.startAdvertising(); // restart advertising
+}
+
+FeedbackService::FeedbackService():
         ble(_ble),
         bValueBytes(100),
         FServiceUUID(0x9100),
         writeUUID(0x9101),
         test(0),
-        newValueFlag(false);
+        newValueFlag(false),
         batteryChar(GattCharacteristic::UUID_BATTERY_LEVEL_CHAR, bValueBytes.getPointer(),
                  bValueBytes.getNumValueBytes(), BatteryValueBytes::MAX_VALUE_BYTES,
                  GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY),
@@ -38,7 +45,7 @@
     
 void FeedbackService::init(){
     ble.init();
-    //ble.onDisconnection(disconnectionCallback);
+    ble.onDisconnection(disconnectionCallback);
     }    
     
 void FeedbackService::setupAdvertising(){