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/0c354af2 Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/0c354af2 Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/0c354af2 Branch: refs/heads/1_0_0_dev Commit: 0c354af2d39efa652e8c4211e65968d15b35ac9d Parents: 4f154cd Author: Christopher Collins <[email protected]> Authored: Mon Feb 27 20:25:53 2017 -0800 Committer: Marko Kiiskila <[email protected]> Committed: Mon Mar 6 15:48:13 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/0c354af2/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; }
