jgh

Dependents:   Migration

Fork of BLE_API by Bluetooth Low Energy

Revision:
884:37599305e7b6
Parent:
880:af79236bf22c
Child:
885:1164aa1735ca
--- a/ble/services/EddystoneService.h	Tue Nov 03 13:21:03 2015 +0000
+++ b/ble/services/EddystoneService.h	Thu Nov 26 12:51:59 2015 +0000
@@ -101,9 +101,9 @@
     void setUIDFrameData(int8_t           power,
                          UIDNamespaceID_t namespaceID,
                          UIDInstanceID_t  instanceID,
-                         float            uidAdvPeriodIn,
+                         uint32_t         uidAdvPeriodIn,
                          uint16_t         RFU = 0x0000) {
-        if (0.0f == uidAdvPeriodIn) {
+        if (0 == uidAdvPeriodIn) {
             uidIsSet = false;
             return;
         }
@@ -170,8 +170,8 @@
      *  @param[in] urlAdvPeriodIn How long to advertise the URL frame (measured in # of adv periods)
      *  @return false on success, true on failure.
      */
-    bool setURLFrameData(int8_t power, const char *urlIn, float urlAdvPeriodIn) {
-        if (0.0f == urlAdvPeriodIn) {
+    bool setURLFrameData(int8_t power, const char *urlIn, uint32_t urlAdvPeriodIn) {
+        if (0 == urlAdvPeriodIn) {
             urlIsSet = false;
             return false;
         }
@@ -193,8 +193,8 @@
      *  @param[in] urlAdvPeriodIn     How long to advertise the URL frame (measured in # of adv periods)
      *  @return false on success, true on failure.
      */
-    bool setURLFrameEncodedData(int8_t power, const char *encodedUrlIn, uint8_t encodedUrlInLength, float urlAdvPeriodIn) {
-        if (0.0f == urlAdvPeriodIn) {
+    bool setURLFrameEncodedData(int8_t power, const char *encodedUrlIn, uint8_t encodedUrlInLength, uint32_t urlAdvPeriodIn) {
+        if (0 == urlAdvPeriodIn) {
             urlIsSet = false;
             return false;
         }
@@ -235,12 +235,12 @@
     *
     */
     void setTLMFrameData(uint8_t  version        = 0,
-                         float    advPeriod      = 60.0f,
+                         uint32_t advPeriod      = 60,
                          uint16_t batteryVoltage = 0,
-                         uint16_t beaconTemp     = 0x8000,
+                         uint16_t beaconTemp     = 0,
                          uint32_t pduCount       = 0,
                          uint32_t timeSinceBoot  = 0) {
-        if (0.0f == advPeriod) {
+        if (0 == advPeriod) {
             tlmIsSet = false;
             return;
         }
@@ -507,7 +507,7 @@
         // Initialize Frame transition, start with URL to pass eddystone validator app on first try
         if (urlIsSet) {
             frameIndex = url;
-            urlTicker.attach(this, &EddystoneService::urlCallback, (float) advPeriodus / 1000.0f);
+            urlTicker.attach(this, &EddystoneService::urlCallback, urlAdvPeriod);
             DBG("attached urlCallback every %d seconds", urlAdvPeriod);
         }
         if (uidIsSet) {
@@ -552,7 +552,7 @@
     UriData_t           defaultUriData;
     int8_t              defaultUrlPower;
     bool                urlIsSet;       // flag that enables / disable URI Frames
-    float               urlAdvPeriod;   // how long the url frame will be advertised for
+    uint32_t            urlAdvPeriod;   // how long the url frame will be advertised for
     Ticker              urlTicker;
 
     // UID Frame Variables
@@ -561,7 +561,7 @@
     int8_t              defaultUidPower;
     uint16_t            uidRFU;
     bool                uidIsSet;       // flag that enables / disable UID Frames
-    float               uidAdvPeriod;   // how long the uid frame will be advertised for
+    uint32_t            uidAdvPeriod;   // how long the uid frame will be advertised for
     Ticker              uidTicker;
 
     // TLM Frame Variables
@@ -571,7 +571,7 @@
     volatile uint32_t   TlmPduCount;
     volatile uint32_t   TlmTimeSinceBoot;
     bool                tlmIsSet;          // flag that enables / disables TLM frames
-    float               TlmAdvPeriod;      // number of minutes between adv frames
+    uint32_t            TlmAdvPeriod;      // number of minutes between adv frames
     Ticker              tlmTicker;
 
 public: