I don't know why this is happening.

Fork of BLE_API by Bluetooth Low Energy

Revision:
282:2c490f373b9b
Parent:
281:e459c5be1a10
Child:
283:bef53917ea82
--- a/services/URIBeaconConfigService.h	Fri Feb 13 13:00:41 2015 +0000
+++ b/services/URIBeaconConfigService.h	Fri Feb 13 13:00:41 2015 +0000
@@ -17,10 +17,6 @@
 #ifndef SERVICES_URIBEACONCONFIGSERVICE_H_
 #define SERVICES_URIBEACONCONFIGSERVICE_H_
 
-#include "BLEDevice.h"
-#include "GattCharacteristic.h"
-#include "mbed.h"
-
 #define UUID_URI_BEACON(FIRST, SECOND) { \
         0xee, 0x0c, FIRST, SECOND, 0x87, 0x86, 0x40, 0xba,       \
         0xab, 0x96, 0x99, 0xb9, 0x1a, 0xc9, 0x81, 0xd8,          \
@@ -157,6 +153,7 @@
 
 
   private:
+    // True if the lock bits are non-zero
     bool isLocked() {
         Lock_t testLock;
         memset(testLock, 0, sizeof(Lock_t));
@@ -174,7 +171,8 @@
         if (handle == lockChar.getValueHandle()) {
             // Validated earlier
             memcpy(params.lock, writeParams->data, sizeof(Lock_t));
-            lockedState = true;
+            // use isLocked() in case bits are being set to all 0's
+            lockedState = isLocked();
         } else if (handle == unlockChar.getValueHandle()) {
             // Validated earlier
             memset(params.lock, 0, sizeof(Lock_t));