Jacob McEntire / BLE_API_mod2

Fork of BLE_API by Bluetooth Low Energy

Revision:
669:7179b4a5aa7d
Parent:
667:875aecb84719
Child:
671:33ec93d25695
--- a/services/BatteryService.h	Fri Jun 19 15:53:01 2015 +0100
+++ b/services/BatteryService.h	Fri Jun 19 15:53:01 2015 +0100
@@ -38,16 +38,10 @@
         batteryLevel(level),
         batteryLevelCharacteristic(GattCharacteristic::UUID_BATTERY_LEVEL_CHAR, &batteryLevel, GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY) {
 
-        static bool serviceAdded = false; /* We should only ever need to add the heart rate service once. */
-        if (serviceAdded) {
-            return;
-        }
-
         GattCharacteristic *charTable[] = {&batteryLevelCharacteristic};
         GattService         batteryService(GattService::UUID_BATTERY_SERVICE, charTable, sizeof(charTable) / sizeof(GattCharacteristic *));
 
         ble.addService(batteryService);
-        serviceAdded = true;
     }
 
     /**
@@ -62,7 +56,7 @@
         ble.updateCharacteristicValue(batteryLevelCharacteristic.getValueAttribute().getHandle(), &batteryLevel, 1);
     }
 
-private:
+protected:
     BLEDevice &ble;
 
     uint8_t    batteryLevel;