Button initiated config service

Dependencies:   BLE_API_EddystoneConfigService_2 mbed nRF51822

Fork of BLE_EddystoneBeaconConfigService_3 by URIBeacon

Files at this revision

API Documentation at this revision

Comitter:
mbedAustin
Date:
Fri Sep 18 03:57:09 2015 +0000
Parent:
57:3853d5428560
Child:
59:a89c00180058
Commit message:
fixed defaultURIDataLength field not getting set. Still not broadcasting correct URI during config though....

Changed in this revision

BLE_API.lib Show annotated file Show diff for this revision Revisions of this file
EddystoneConfigService.h Show annotated file Show diff for this revision Revisions of this file
--- a/BLE_API.lib	Thu Sep 17 20:50:07 2015 +0000
+++ b/BLE_API.lib	Fri Sep 18 03:57:09 2015 +0000
@@ -1,1 +1,1 @@
-https://developer.mbed.org/teams/URIBeacon/code/BLE_API_EddystoneConfigService_2/#f06e4d6bbcdc
+https://developer.mbed.org/teams/URIBeacon/code/BLE_API_EddystoneConfigService_2/#a098a3069b3a
--- a/EddystoneConfigService.h	Thu Sep 17 20:50:07 2015 +0000
+++ b/EddystoneConfigService.h	Fri Sep 18 03:57:09 2015 +0000
@@ -127,7 +127,7 @@
                            PowerLevels_t &radioPowerLevelsIn) :
         ble(bleIn),
         params(paramsIn),       // Initialize URL Data
-        defaultUriDataLength(0),
+        defaultUriDataLength(),
         defaultUriData(),
         defaultUidNamespaceID(), // Initialize UID Data
         defaultUidInstanceID(),
@@ -172,9 +172,10 @@
         }
         if (resetToDefaultsFlag) {
             resetToDefaults();
+        } else {
+            updateCharacteristicValues();
         }
-        updateCharacteristicValues();
-        
+
         lockChar.setWriteAuthorizationCallback(this, &EddystoneConfigService::lockAuthorizationCallback);
         unlockChar.setWriteAuthorizationCallback(this, &EddystoneConfigService::unlockAuthorizationCallback);
         uriDataChar.setWriteAuthorizationCallback(this, &EddystoneConfigService::uriDataWriteAuthorizationCallback);
@@ -239,7 +240,10 @@
 //        if (defaultUriDataLength > URI_DATA_MAX) {
 //            return;
 //        }
-                memcpy(defaultUriData,uriIn,URI_DATA_MAX);
+        defaultUriDataLength = strlen(uriIn);
+        memcpy(defaultUriData,uriIn,URI_DATA_MAX);
+        //defaultUriDataLength = strlen(uriIn);
+        INFO("\t default URI = %s : %d", uriIn, defaultUriDataLength);
 //              defaultUriData = (UriData_t *)uriIn;
         defaultUriAdvPeriod = advPeriod;
         urlIsSet = true; // flag to add this to eddystone service when config is done
@@ -339,7 +343,7 @@
             INFO("Device Unlocked");
         } else if (handle == uriDataChar.getValueHandle()) {
             params.uriDataLength = writeParams->len;
-                      memset(params.uriData,0x00,URI_DATA_MAX); // clear URI string
+            memset(params.uriData,0x00,URI_DATA_MAX); // clear URI string
             memcpy(params.uriData, writeParams->data, params.uriDataLength); // set URI string
             params.uriEnabled = true;
             INFO("URI = %s, URILen = %d", writeParams->data, writeParams->len);
@@ -418,6 +422,7 @@
     void updateCharacteristicValues(void) {
         ble.updateCharacteristicValue(lockedStateChar.getValueHandle(), &params.lockedState, 1);
         ble.updateCharacteristicValue(uriDataChar.getValueHandle(), params.uriData, params.uriDataLength);
+        INFO("updating URI, %s : %d",params.uriData, params.uriDataLength);
         ble.updateCharacteristicValue(flagsChar.getValueHandle(), &params.flags, 1);
         ble.updateCharacteristicValue(beaconPeriodChar.getValueHandle(),
                                       reinterpret_cast<uint8_t *>(&params.beaconPeriod), sizeof(uint16_t));