Button initiated config service

Dependencies:   BLE_API_EddystoneConfigService_2 mbed nRF51822

Fork of BLE_EddystoneBeaconConfigService_3 by URIBeacon

Revision:
19:f7c33fa88ca5
Parent:
18:91c36071aafb
Child:
20:3b133cfafc39
--- a/ZipBeaconConfigService.h	Thu Jul 23 06:02:45 2015 +0000
+++ b/ZipBeaconConfigService.h	Thu Jul 23 06:30:35 2015 +0000
@@ -228,6 +228,8 @@
     *
     */
     void setUIDFrameData(int8_t power, UIDNamespaceID_t namespaceID, UIDInstanceID_t instanceID, uint16_t RFU = 0x0000) {
+        if(power > 20){power = 20;}
+        if(power < -100){power = -100;}
         defaultUidPower = power;
         memcpy(defaultUidNamespaceID, namespaceID, UID_NAMESPACEID_SIZE);
         memcpy(defaultUidInstanceID,  instanceID,  UID_INSTANCEID_SIZE);
@@ -245,6 +247,8 @@
 
         int index = 0;
         Data[index++] = FRAME_TYPE_UID;                     // 1B  Type
+        if(defaultUidPower > 20){defaultUidPower = 20;}     // enforce range of vaild values.
+        if(defaultUidPower < -100){defaultUidPower = -100;}
         Data[index++] = defaultUidPower;                    // 1B  Power @ 0meter
         for(int x = 0; x < UID_NAMESPACEID_SIZE; x++) {     // 10B Namespce ID
             Data[index++] = defaultUidNamespaceID[x];
@@ -252,7 +256,7 @@
         for(int x = 0; x< UID_INSTANCEID_SIZE; x++) {       // 6B  Instance ID
             Data[index++] = defaultUidInstanceID[x];
         }
-        if(0x00 != uidRFU) {                                // 2B RFU, include if non-zero, otherwise ignore
+        if(0 != uidRFU) {                                // 2B RFU, include if non-zero, otherwise ignore
             Data[index++] = (uint8_t)(uidRFU >> 8);
             Data[index++] = (uint8_t)uidRFU;
         }
@@ -476,7 +480,6 @@
 
         ZipBeaconConfigService::UriData_t &uriData            = params.uriData;
         ZipBeaconConfigService::PowerLevels_t &advPowerLevels = params.advPowerLevels;
-        uint8_t flags                                         = params.flags;
 
         // Initialize Frame transition
         frameIndex = 2;
@@ -494,8 +497,8 @@
         saveURIBeaconConfigParams(&params);
 
         setTLMFrameData(0x00,0x2222,0x3333,0x01,0x02); // Initialize TLM Data, for testing, remove for release
-        updateTlmPduCount(0x11);
-        updateTlmTimeSinceBoot(0x22);
+        updateTlmPduCount(0);
+        updateTlmTimeSinceBoot(0);
 
         // Construct TLM Frame in initial advertising.
         serviceData[serviceDataLen++] = BEACON_EDDYSTONE[0];