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:
Mon Sep 21 16:40:02 2015 +0000
Parent:
62:93742d3fd673
Child:
64:6484b9e3aac0
Commit message:
updated adv and radio power levels per googles instructions

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
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/BLE_API.lib	Fri Sep 18 04:55:58 2015 +0000
+++ b/BLE_API.lib	Mon Sep 21 16:40:02 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/#5ee540bd2bac
--- a/EddystoneConfigService.h	Fri Sep 18 04:55:58 2015 +0000
+++ b/EddystoneConfigService.h	Mon Sep 21 16:40:02 2015 +0000
@@ -99,17 +99,17 @@
         // TLM Frame Data
         uint8_t       tlmVersion;     // version of TLM packet
         bool          tlmEnabled;
-        uint8_t       tlmBeaconPeriod; // how often to broadcat TLM frame, in minutes.  
+        float       tlmBeaconPeriod; // how often to broadcat TLM frame, in S
         // URI Frame Data
         uint8_t       uriDataLength;
         UriData_t     uriData;
         bool          uriEnabled;
-        uint8_t       uriBeaconPeriod; // how often to broadcast URIFrame, in # of adv frames
+        float       uriBeaconPeriod; // how often to broadcast URIFrame, in S
         // UID Frame Data
         UIDNamespaceID_t uidNamespaceID; // UUID type, Namespace ID, 10B
         UIDInstanceID_t  uidInstanceID;  // UUID type, Instance ID,  6B
         bool          uidEnabled;
-        uint8_t       uidBeaconPeriod;   // how often to broadcast UID Frame, in # of adv frames
+        float       uidBeaconPeriod;   // how often to broadcast UID Frame, in S
     };
 
     /**
@@ -214,14 +214,14 @@
     * @param[in] advPeriodInMin how long between TLM frames being advertised, this is measured in minutes.
     *
     */
-    void setDefaultTLMFrameData(uint8_t tlmVersionIn = 0, uint32_t advPeriodInMin = 1){
-        DBG("Setting Default TLM Data, version = %d, advPeriodInMind= %d",tlmVersionIn,advPeriodInMin);
+    void setDefaultTLMFrameData(uint8_t tlmVersionIn = 0, float advPeriodInSec = 60){
+        DBG("Setting Default TLM Data, version = %d, advPeriodInMind= %f",tlmVersionIn,advPeriodInSec);
         defaultTlmVersion = tlmVersionIn;
         TlmBatteryVoltage = 0;
         TlmBeaconTemp = 0;
         TlmPduCount = 0;
         TlmTimeSinceBoot = 0;
-        defaultTlmAdvPeriod = advPeriodInMin;
+        defaultTlmAdvPeriod = advPeriodInSec;
         tlmIsSet = true; // flag to add this to eddystone service when config is done
     
     }
@@ -233,7 +233,7 @@
     * @param[in] advPeriod  how long to advertise the url for, measured in number of ADV frames.
     *
     */
-    void setDefaultURIFrameData(const char * uriIn,uint32_t  advPeriod = 1000){
+    void setDefaultURIFrameData(const char * uriIn, float  advPeriod = 1){
         DBG("Setting Default URI Data");
 //        // Set URL Frame
 //          EddystoneService::encodeURL(uriIn, defaultUriData, defaultUriDataLength); // encode URL to URL Formatting
@@ -257,7 +257,7 @@
     * @param[in] advPeriod   how long to advertise the URL for, measured in the number of adv frames.
     *
     */
-    void setDefaultUIDFrameData(UIDNamespaceID_t *namespaceID, UIDInstanceID_t *instanceID, uint32_t advPeriod = 10){
+    void setDefaultUIDFrameData(UIDNamespaceID_t *namespaceID, UIDInstanceID_t *instanceID, float advPeriod = 10){
         //Set UID frame
         DBG("Setting default UID Data");
         memcpy(defaultUidNamespaceID, namespaceID, UID_NAMESPACEID_SIZE);
@@ -511,7 +511,7 @@
 //UID Default value that is restored on reset
     UIDNamespaceID_t    defaultUidNamespaceID;
     UIDInstanceID_t     defaultUidInstanceID;
-    uint32_t            defaultUidAdvPeriod;
+    float            defaultUidAdvPeriod;
     int8_t              defaultUidPower;
     uint16_t            uidRFU;
     bool                uidIsSet;
@@ -520,12 +520,12 @@
     uint8_t             defaultUriDataLength;
     UriData_t           defaultUriData;
     int8_t              defaultUrlPower;
-    uint32_t            defaultUriAdvPeriod;
+    float            defaultUriAdvPeriod;
     bool                urlIsSet;
 
 //TLM  Default value that is restored on reset
     uint8_t             defaultTlmVersion;
-    uint32_t            defaultTlmAdvPeriod;
+    float            defaultTlmAdvPeriod;
     volatile uint16_t   TlmBatteryVoltage;
     volatile uint16_t   TlmBeaconTemp;
     volatile uint32_t   TlmPduCount;
--- a/main.cpp	Fri Sep 18 04:55:58 2015 +0000
+++ b/main.cpp	Mon Sep 21 16:40:02 2015 +0000
@@ -85,12 +85,12 @@
     uint8_t tlmVersion = 0x00;
     
     /* Initialize a EddystoneBeaconConfig service providing config params, default URI, and power levels. */
-    static EddystoneConfigService::PowerLevels_t defaultAdvPowerLevels = {-30, -16, -4, 4}; // Values for ADV packets related to firmware levels, calibrated based on measured values at 1m
-    static EddystoneConfigService::PowerLevels_t radioPowerLevels =      {-30, -16, -4, 4}; // Values for radio power levels, provided by manufacturer.
+    static EddystoneConfigService::PowerLevels_t defaultAdvPowerLevels = {-47, -33, -21, -13}; // Values for ADV packets related to firmware levels, calibrated based on measured values at 1m
+    static EddystoneConfigService::PowerLevels_t radioPowerLevels =      {-30, -16, -4, 4};    // Values for radio power levels, provided by manufacturer.
     EddystoneBeaconConfig = new EddystoneConfigService(ble, params, defaultAdvPowerLevels, radioPowerLevels);
-    EddystoneBeaconConfig->setDefaultURIFrameData("http://mbed.org",1000);
-    EddystoneBeaconConfig->setDefaultUIDFrameData(&uidNamespaceID, &uidInstanceID,10);
-    EddystoneBeaconConfig->setDefaultTLMFrameData(tlmVersion,1);
+    EddystoneBeaconConfig->setDefaultURIFrameData("http://mbed.org",2);
+    EddystoneBeaconConfig->setDefaultUIDFrameData(&uidNamespaceID, &uidInstanceID,5);
+    EddystoneBeaconConfig->setDefaultTLMFrameData(tlmVersion,10);
     EddystoneBeaconConfig->start(!fetchedFromPersistentStorage);
     
     if (!EddystoneBeaconConfig->initSuccessfully()) {