Bluetooth: controller: Use set handle for LE Scan Request Received

Set handle is passed in node_rx header.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
This commit is contained in:
Andrzej Kaczmarek 2020-08-11 00:09:21 +02:00 committed by Carles Cufí
commit bca3560100
3 changed files with 8 additions and 7 deletions

View file

@ -3747,7 +3747,6 @@ static void le_scan_req_received(struct pdu_data *pdu_data,
struct pdu_adv *adv = (void *)pdu_data;
struct bt_hci_evt_le_scan_req_received *sep;
/* TODO: fill handle when Adv Ext. feature is implemented. */
if (!(event_mask & BT_EVT_MASK_LE_META_EVENT) ||
!(le_event_mask & BT_EVT_MASK_LE_SCAN_REQ_RECEIVED)) {
@ -3755,7 +3754,7 @@ static void le_scan_req_received(struct pdu_data *pdu_data,
uint8_t handle;
int8_t rssi;
handle = 0U;
handle = node_rx->hdr.handle & 0xff;
addr.type = adv->tx_addr;
memcpy(&addr.a.val[0], &adv->scan_req.scan_addr[0],
sizeof(bt_addr_t));
@ -3770,7 +3769,7 @@ static void le_scan_req_received(struct pdu_data *pdu_data,
}
sep = meta_evt(buf, BT_HCI_EVT_LE_SCAN_REQ_RECEIVED, sizeof(*sep));
sep->handle = 0U;
sep->handle = node_rx->hdr.handle & 0xff;
sep->addr.type = adv->tx_addr;
memcpy(&sep->addr.a.val[0], &adv->scan_req.scan_addr[0],
sizeof(bt_addr_t));

View file

@ -127,7 +127,8 @@ bool lll_adv_scan_req_check(struct lll_adv *lll, struct pdu_adv *sr,
}
#if defined(CONFIG_BT_CTLR_SCAN_REQ_NOTIFY)
int lll_adv_scan_req_report(struct pdu_adv *pdu_adv_rx, uint8_t rssi_ready)
int lll_adv_scan_req_report(struct lll_adv *lll, struct pdu_adv *pdu_adv_rx,
uint8_t rssi_ready)
{
struct node_rx_pdu *node_rx;
struct pdu_adv *pdu_adv;
@ -141,7 +142,7 @@ int lll_adv_scan_req_report(struct pdu_adv *pdu_adv_rx, uint8_t rssi_ready)
/* Prepare the report (scan req) */
node_rx->hdr.type = NODE_RX_TYPE_SCAN_REQ;
node_rx->hdr.handle = 0xffff;
node_rx->hdr.handle = ull_adv_lll_handle_get(lll);
/* Make a copy of PDU into Rx node (as the received PDU is in the
* scratch buffer), and save the RSSI value.
@ -715,7 +716,7 @@ static inline int isr_rx_pdu(struct lll_adv *lll,
uint32_t err;
/* Generate the scan request event */
err = lll_adv_scan_req_report(pdu_rx, rssi_ready);
err = lll_adv_scan_req_report(lll, pdu_rx, rssi_ready);
if (err) {
/* Scan Response will not be transmitted */
return err;

View file

@ -76,5 +76,6 @@ bool lll_adv_scan_req_check(struct lll_adv *lll, struct pdu_adv *sr,
uint8_t devmatch_ok, uint8_t *rl_idx);
#if defined(CONFIG_BT_CTLR_SCAN_REQ_NOTIFY)
int lll_adv_scan_req_report(struct pdu_adv *pdu_adv_rx, uint8_t rssi_ready);
int lll_adv_scan_req_report(struct lll_adv *lll, struct pdu_adv *pdu_adv_rx,
uint8_t rssi_ready);
#endif