Button initiated config service

Dependencies:   BLE_API_EddystoneConfigService_2 mbed nRF51822

Fork of BLE_EddystoneBeaconConfigService_3 by URIBeacon

Revision:
43:e4a4f9a8766f
Parent:
40:6f39aee31205
Child:
44:0e27ee7800b8
diff -r 6d53d41cd03d -r e4a4f9a8766f EddystoneConfigService.h
--- a/EddystoneConfigService.h	Thu Sep 10 22:11:08 2015 +0000
+++ b/EddystoneConfigService.h	Thu Sep 10 23:25:45 2015 +0000
@@ -259,41 +259,21 @@
     */
     void setupEddystoneAdvertisements() {
         DBG("Switching Config -> adv");
-        //uint8_t serviceData[SERVICE_DATA_MAX];
-        //unsigned serviceDataLen = 0;
-        //unsigned beaconPeriod = params.beaconPeriod;
-        
-        //setUIDFrameData(params.txPowerMode,defaultUidNamespaceID, defaultUidInstanceID);
-        //setURLFrameData(params.txPowerMode,(char *)params.uriData);
-
-        // Initialize Frame transition
-        //frameIndex = 0;
-        //uidRFU = 0;
-        //switchFlag = true;
-
-
-        /* Reinitialize the BLE stack. This will clear away the existing services and advertising state. */
-//        ble.shutdown();
-//        ble.init();
-//        ble.setTxPower(params.txPowerMode);
-//        ble.setAdvertisingType(GapAdvertisingParams::ADV_NON_CONNECTABLE_UNDIRECTED);
-//        ble.setAdvertisingInterval(beaconPeriod);
         extern void saveURIBeaconConfigParams(const Params_t *paramsP); /* forward declaration; necessary to avoid a circular dependency. */
         saveURIBeaconConfigParams(&params);
-
-        static EddystoneService eddyServ(ble,params.beaconPeriod,params.txPowerMode, (uint8_t *) params.uidNamespaceID, (uint8_t *) params.uidInstanceID, (const char *) params.uriData, params.uriDataLength, params.tlmVersion, params.tlmEnabled );
-//        updateTlmPduCount(0);
-//        updateTlmTimeSinceBoot(0);
-
-        // Construct TLM Frame in initial advertising.
-//        serviceData[serviceDataLen++] = BEACON_EDDYSTONE[0];
-//        serviceData[serviceDataLen++] = BEACON_EDDYSTONE[1];
-//        serviceDataLen += constructTLMFrame(serviceData+serviceDataLen,SERVICE_DATA_MAX);
-
-//        updateAdvPacket(serviceData, serviceDataLen);
-//        ble.gap().startAdvertising();
-//        ble.gap().onRadioNotification(this,&EddystoneConfigService::radioNotificationCallback);
-//        timeSinceBootTick.attach(this,&EddystoneConfigService::tsbCallback,0.1); // incriment the TimeSinceBoot ticker every 0.1s
+        static EddystoneService eddyServ(ble,params.beaconPeriod,params.txPowerMode);
+        // Set configured frames
+        if(params.tlmEnabled){
+            eddyServ.setTLMFrameData(params.tlmVersion,params.tlmBeaconPeriod);
+        }
+        if(params.uriEnabled){
+            eddyServ.setURLFrameData(params.txPowerMode, (const char *) params.uriData, params.uriBeaconPeriod);
+        }
+        if(params.uidEnabled){
+            eddyServ.setUIDFrameData(params.txPowerMode, (uint8_t *) params.uidNamespaceID, (uint8_t *) params.uidInstanceID, params.uidBeaconPeriod);
+        }        
+        // Start Advertising the eddystone service. 
+        eddyServ.start(); 
     }
 
 private: