You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ry...@apache.org on 2018/12/21 14:00:16 UTC
[mynewt-nimble] 01/02: nimble/ll: Fix directed extended advertising
This is an automated email from the ASF dual-hosted git repository.
rymek pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git
commit 1a535e8a56b87cb20e9558e7aac9fd661bb0a722
Author: Ćukasz Rymanowski <lu...@codecoup.pl>
AuthorDate: Fri Dec 21 14:14:19 2018 +0100
nimble/ll: Fix directed extended advertising
This patch makes sure TargetA is added only to scannable AUX_ADV_IND
and not later to AUX_SCAN_RSP and chains.
---
nimble/controller/src/ble_ll_adv.c | 28 ++++++++++++++++++++++++----
1 file changed, 24 insertions(+), 4 deletions(-)
diff --git a/nimble/controller/src/ble_ll_adv.c b/nimble/controller/src/ble_ll_adv.c
index 928e88a..54563ba 100644
--- a/nimble/controller/src/ble_ll_adv.c
+++ b/nimble/controller/src/ble_ll_adv.c
@@ -1130,9 +1130,20 @@ ble_ll_adv_aux_calculate(struct ble_ll_adv_sm *advsm,
hdr_len += BLE_LL_EXT_ADV_ADVA_SIZE;
}
- /* TargetA for directed connectable */
- if ((advsm->props & BLE_HCI_LE_SET_EXT_ADV_PROP_DIRECTED) &&
- (advsm->props & BLE_HCI_LE_SET_EXT_ADV_PROP_CONNECTABLE)) {
+ /* Note: this function does not calculate AUX_ADV_IND when advertising is
+ * scannable. Instead it is calculated in ble_ll_adv_aux_schedule_first().
+ *
+ * However this function calculates length of AUX_SCAN_RSP and according
+ * to BT 5.0 Vol 6 Part B, 2.3.2.3, TargetA shall not be include there.
+ *
+ * This is why TargetA is added to all directed advertising here unless it
+ * is scannable one.
+ *
+ * Note. TargetA shall not be also in AUX_CHAIN_IND
+ */
+ if (aux_data_offset == 0 &&
+ (advsm->props & BLE_HCI_LE_SET_EXT_ADV_PROP_DIRECTED) &&
+ !(advsm->props & BLE_HCI_LE_SET_EXT_ADV_PROP_SCANNABLE)) {
aux->ext_hdr |= (1 << BLE_LL_EXT_ADV_TARGETA_BIT);
hdr_len += BLE_LL_EXT_ADV_TARGETA_SIZE;
}
@@ -1265,7 +1276,16 @@ ble_ll_adv_aux_schedule_first(struct ble_ll_adv_sm *advsm)
/* AUX_CONN_RSP */
ble_ll_pdu_tx_time_get(14, advsm->sec_phy);
} else if (advsm->props & BLE_HCI_LE_SET_EXT_ADV_PROP_SCANNABLE) {
- /* Scheduled aux is calculated for AUX_SCAN_RSP, 1st aux is created separately */
+ /* For scannable advertising we need to calculate how much time we
+ * need for AUX_ADV_IND along with AUX_SCAN_REQ, AUX_SCAN_RSP and
+ * IFS in between.
+ *
+ * Note:
+ * 1. aux->payload_len, which calculated by above ble_ll_adv_aux_calulcate(),
+ * contains AUX_SCAN_RSP length.
+ * 2. length of AUX_ADV_IND is calculated by special function:
+ * ble_ll_adv_aux_scannable_pdu_payload_len()
+ */
max_usecs = ble_ll_pdu_tx_time_get(ble_ll_adv_aux_scannable_pdu_payload_len(advsm),
advsm->sec_phy) +
BLE_LL_IFS +