ble nano hid over gatt
Dependencies: BLE_API mbed-dev nRF51822
Diff: BatteryService.h
- Revision:
- 54:899fc2b0a76b
- Parent:
- 48:d6938de02f62
- Child:
- 58:64df960619ce
--- a/BatteryService.h Mon Aug 29 16:41:36 2016 +0000 +++ b/BatteryService.h Tue Aug 30 13:18:00 2016 +0000 @@ -56,8 +56,10 @@ * Update to battery level. */ void updateBatteryLevel(const uint8_t newLevel) { - batteryLevel = newLevel; - ble.gattServer().write(batteryLevelCharacteristic.getValueHandle(), &batteryLevel, 1); + if (batteryLevel != newLevel) { + batteryLevel = newLevel; + ble.gattServer().write(batteryLevelCharacteristic.getValueHandle(), &batteryLevel, 1); + } } protected: