mynewt-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ccoll...@apache.org
Subject incubator-mynewt-core git commit: MYNEWT-642 Eddystone UID format is incorrect
Date Tue, 28 Feb 2017 04:26:28 GMT
Repository: incubator-mynewt-core
Updated Branches:
  refs/heads/develop e76365601 -> e6594232f


MYNEWT-642 Eddystone UID format is incorrect

The tx power and reserved bytes were missing.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/e6594232
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/e6594232
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/e6594232

Branch: refs/heads/develop
Commit: e6594232f39f717eb5cdeb954a1dc69542b9212e
Parents: e763656
Author: Christopher Collins <ccollins@apache.org>
Authored: Mon Feb 27 20:25:53 2017 -0800
Committer: Christopher Collins <ccollins@apache.org>
Committed: Mon Feb 27 20:25:53 2017 -0800

----------------------------------------------------------------------
 net/nimble/host/src/ble_eddystone.c | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/e6594232/net/nimble/host/src/ble_eddystone.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_eddystone.c b/net/nimble/host/src/ble_eddystone.c
index e6e15c3..6132b78 100644
--- a/net/nimble/host/src/ble_eddystone.c
+++ b/net/nimble/host/src/ble_eddystone.c
@@ -127,12 +127,28 @@ ble_eddystone_set_adv_data_uid(struct ble_hs_adv_fields *adv_fields,
void *uid)
     return BLE_HS_ENOTSUP;
 #endif
 
-    void *svc_data;
+    uint8_t *svc_data;
+    int8_t tx_pwr;
     int rc;
 
+    /* Eddystone UUID and frame type (0). */
     svc_data = ble_eddystone_set_svc_data_base(BLE_EDDYSTONE_FRAME_TYPE_UID);
-    memcpy(svc_data, uid, 16);
-    rc = ble_eddystone_set_adv_data_gen(adv_fields, 16);
+
+    /* Ranging data (Calibrated tx power at 0 meters). */
+    rc = ble_hs_hci_util_read_adv_tx_pwr(&tx_pwr);
+    if (rc != 0) {
+        return rc;
+    }
+    svc_data[0] = tx_pwr;
+
+    /* UID. */
+    memcpy(svc_data + 1, uid, 16);
+
+    /* Reserved. */
+    svc_data[17] = 0x00;
+    svc_data[18] = 0x00;
+
+    rc = ble_eddystone_set_adv_data_gen(adv_fields, 19);
     if (rc != 0) {
         return rc;
     }


Mime
View raw message