nimble/controller: Fix mixed AdvAdd and InitA in the advertising report
With this patch InitA is put into 'Direct address' field and AdvAdd is
put into 'Address' field of LE Direct Advertising Report event
Also RSSI has been added in the end of this report:
> HCI Event: LE Meta Event (0x3e) plen 18
LE Direct Advertising Report (0x0b)
Num reports: 1
Event type: Connectable directed - ADV_DIRECT_IND (0x01)
Address type: Random (0x01)
Address: 7F:1B:6A:0E:32:CF (Resolvable)
Direct address type: Random (0x01)
Direct address: 5E:10:15:22:54:00 (Resolvable)
RSSI: -22 dBm (0xea)
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/ce3e0378
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/ce3e0378
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/ce3e0378
Branch: refs/heads/master
Commit: ce3e0378d3f6c8bba4158aa8f6ba7cc839dadef8
Parents: 94cfca3
Author: Åukasz Rymanowski <[email protected]>
Authored: Mon Apr 3 16:01:43 2017 +0200
Committer: Åukasz Rymanowski <[email protected]>
Committed: Mon Apr 3 16:20:14 2017 +0200
----------------------------------------------------------------------
net/nimble/controller/src/ble_ll_scan.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/ce3e0378/net/nimble/controller/src/ble_ll_scan.c
----------------------------------------------------------------------
diff --git a/net/nimble/controller/src/ble_ll_scan.c
b/net/nimble/controller/src/ble_ll_scan.c
index 90869ff..7f0c40b 100644
--- a/net/nimble/controller/src/ble_ll_scan.c
+++ b/net/nimble/controller/src/ble_ll_scan.c
@@ -465,19 +465,23 @@ ble_ll_hci_send_adv_report(uint8_t pdu_type, uint8_t
txadd, uint8_t *rxbuf,
orig_evbuf = evbuf;
evbuf += 5;
+
+ /* The advertisers address type and address are always in event */
+ evbuf[0] = addr_type;
+ memcpy(evbuf + 1, adv_addr, BLE_DEV_ADDR_LEN);
+ evbuf += BLE_DEV_ADDR_LEN + 1;
+
if (inita) {
evbuf[0] = BLE_HCI_ADV_OWN_ADDR_RANDOM;
memcpy(evbuf + 1, inita, BLE_DEV_ADDR_LEN);
evbuf += BLE_DEV_ADDR_LEN + 1;
} else {
- evbuf[7] = adv_data_len;
- memcpy(evbuf + 8, rxbuf + BLE_DEV_ADDR_LEN, adv_data_len);
- evbuf[8 + adv_data_len] = hdr->rxinfo.rssi;
+ evbuf[0] = adv_data_len;
+ memcpy(evbuf + 1, rxbuf + BLE_DEV_ADDR_LEN, adv_data_len);
+ evbuf += adv_data_len + 1;
}
- /* The advertisers address type and address are always in event */
- evbuf[0] = addr_type;
- memcpy(evbuf + 1, adv_addr, BLE_DEV_ADDR_LEN);
+ evbuf[0] = hdr->rxinfo.rssi;
rc = ble_ll_hci_event_send(orig_evbuf);
if (!rc) {