You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by an...@apache.org on 2024/10/21 15:00:02 UTC
(mynewt-nimble) branch master updated (d3bf5ec7c -> a5fa9d1e8)
This is an automated email from the ASF dual-hosted git repository.
andk pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git
from d3bf5ec7c nimble/host: Add offset in GATT server long read context
new caad03766 nimble/ll: Allow anonymous adv on non-scan/conn/legacy only
new a5fa9d1e8 nimble/ll: Add option to select location of AdvA in ext adv
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
nimble/controller/src/ble_ll_adv.c | 59 +++++++++++++++++++++++++++++++++++---
nimble/controller/syscfg.yml | 5 ++++
2 files changed, 60 insertions(+), 4 deletions(-)
(mynewt-nimble) 02/02: nimble/ll: Add option to select location of AdvA in ext adv
Posted by an...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
andk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git
commit a5fa9d1e841ed4f160502cff43a4f57d1a0fe2f5
Author: Andrzej Kaczmarek <an...@codecoup.pl>
AuthorDate: Sun Oct 6 21:43:38 2024 +0200
nimble/ll: Add option to select location of AdvA in ext adv
This adds syscfg to select location of AdvA in extended advertising
PDUs. If enabled, AdvA is put in AUX_ADV_IND instead of ADV_EXT_IND.
This is enabled by default to retain current behavior.
---
nimble/controller/src/ble_ll_adv.c | 33 +++++++++++++++++++++++++++++----
nimble/controller/syscfg.yml | 5 +++++
2 files changed, 34 insertions(+), 4 deletions(-)
diff --git a/nimble/controller/src/ble_ll_adv.c b/nimble/controller/src/ble_ll_adv.c
index 64884376a..98ddfbfcc 100644
--- a/nimble/controller/src/ble_ll_adv.c
+++ b/nimble/controller/src/ble_ll_adv.c
@@ -570,6 +570,7 @@ ble_ll_adv_pdu_make(uint8_t *dptr, void *pducb_arg, uint8_t *hdr_byte)
uint8_t ext_hdr_len;
uint8_t ext_hdr_flags;
uint32_t offset;
+ bool has_adva;
advsm = pducb_arg;
@@ -581,8 +582,6 @@ ble_ll_adv_pdu_make(uint8_t *dptr, void *pducb_arg, uint8_t *hdr_byte)
/* only ADV_EXT_IND goes on primary advertising channels */
pdu_type = BLE_ADV_PDU_TYPE_ADV_EXT_IND;
- *hdr_byte = pdu_type;
-
adv_mode = 0;
if (advsm->props & BLE_HCI_LE_SET_EXT_ADV_PROP_CONNECTABLE) {
adv_mode |= BLE_LL_EXT_ADV_MODE_CONN;
@@ -591,11 +590,19 @@ ble_ll_adv_pdu_make(uint8_t *dptr, void *pducb_arg, uint8_t *hdr_byte)
adv_mode |= BLE_LL_EXT_ADV_MODE_SCAN;
}
+ has_adva = !MYNEWT_VAL(BLE_LL_EXT_ADV_ADVA_IN_AUX) &&
+ !(advsm->props & BLE_HCI_LE_SET_EXT_ADV_PROP_ANON_ADV);
+
ext_hdr_len = BLE_LL_EXT_ADV_FLAGS_SIZE + BLE_LL_EXT_ADV_DATA_INFO_SIZE +
BLE_LL_EXT_ADV_AUX_PTR_SIZE;
ext_hdr_flags = (1 << BLE_LL_EXT_ADV_DATA_INFO_BIT) |
(1 << BLE_LL_EXT_ADV_AUX_PTR_BIT);
+ if (has_adva) {
+ ext_hdr_len += BLE_LL_EXT_ADV_ADVA_SIZE;
+ ext_hdr_flags |= (1 << BLE_LL_EXT_ADV_ADVA_BIT);
+ }
+
/* ext hdr len and adv mode */
dptr[0] = ext_hdr_len | (adv_mode << 6);
dptr += 1;
@@ -604,6 +611,15 @@ ble_ll_adv_pdu_make(uint8_t *dptr, void *pducb_arg, uint8_t *hdr_byte)
dptr[0] = ext_hdr_flags;
dptr += 1;
+ if (has_adva) {
+ /* AdvA */
+ if (advsm->flags & BLE_LL_ADV_SM_FLAG_TX_ADD) {
+ pdu_type |= BLE_ADV_PDU_HDR_TXADD_RAND;
+ }
+ memcpy(dptr, advsm->adva, BLE_LL_EXT_ADV_ADVA_SIZE);
+ dptr += BLE_LL_EXT_ADV_ADVA_SIZE;
+ }
+
/* ADI */
dptr[0] = advsm->adi & 0x00ff;
dptr[1] = advsm->adi >> 8;
@@ -619,6 +635,8 @@ ble_ll_adv_pdu_make(uint8_t *dptr, void *pducb_arg, uint8_t *hdr_byte)
ble_ll_adv_put_aux_ptr(AUX_CURRENT(advsm)->chan, advsm->sec_phy,
offset, dptr);
+ *hdr_byte = pdu_type;
+
return BLE_LL_EXT_ADV_HDR_LEN + ext_hdr_len;
}
@@ -1407,9 +1425,16 @@ ble_ll_adv_aux_calculate_payload(struct ble_ll_adv_sm *advsm, uint16_t props,
ext_hdr_len += BLE_LL_EXT_ADV_DATA_INFO_SIZE;
}
- /* AdvA in 1st PDU, except for anonymous */
+ /* AdvA if:
+ * - 1st PDU
+ * - not anonymous
+ * - scannable/connectable or ADVA_IN_AUX selected
+ */
if (first_pdu &&
- !(props & BLE_HCI_LE_SET_EXT_ADV_PROP_ANON_ADV)) {
+ !(props & BLE_HCI_LE_SET_EXT_ADV_PROP_ANON_ADV) &&
+ ((props & (BLE_HCI_LE_SET_EXT_ADV_PROP_CONNECTABLE |
+ BLE_HCI_LE_SET_EXT_ADV_PROP_SCANNABLE)) ||
+ MYNEWT_VAL(BLE_LL_EXT_ADV_ADVA_IN_AUX))) {
ext_hdr_flags |= (1 << BLE_LL_EXT_ADV_ADVA_BIT);
ext_hdr_len += BLE_LL_EXT_ADV_ADVA_SIZE;
}
diff --git a/nimble/controller/syscfg.yml b/nimble/controller/syscfg.yml
index e77a1de44..fc9a93293 100644
--- a/nimble/controller/syscfg.yml
+++ b/nimble/controller/syscfg.yml
@@ -618,6 +618,11 @@ syscfg.defs:
like build optimisation, cache, clock speed etc.
value: 0
+ BLE_LL_EXT_ADV_ADVA_IN_AUX:
+ description: >
+ Put AdvA in AUX_ADV_IND instead of ADV_EXT_IND.
+ value: 1
+
BLE_LL_STACK_SIZE:
description: >
This is the stack size for LL task.
(mynewt-nimble) 01/02: nimble/ll: Allow anonymous adv on non-scan/conn/legacy only
Posted by an...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
andk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git
commit caad037667b1ff00421bb8211efddb94f9f0d82d
Author: Andrzej Kaczmarek <an...@codecoup.pl>
AuthorDate: Fri Oct 18 17:17:27 2024 +0200
nimble/ll: Allow anonymous adv on non-scan/conn/legacy only
---
nimble/controller/src/ble_ll_adv.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/nimble/controller/src/ble_ll_adv.c b/nimble/controller/src/ble_ll_adv.c
index fb7aee633..64884376a 100644
--- a/nimble/controller/src/ble_ll_adv.c
+++ b/nimble/controller/src/ble_ll_adv.c
@@ -3427,6 +3427,32 @@ ble_ll_adv_ext_set_param(const uint8_t *cmdbuf, uint8_t len,
goto done;
}
+ /* Anonymous advertising only makes sense for non-connectable, non-scannable
+ * and non-legacy. This is not explicitly stated anywhere in HCI/LL part of
+ * the spec, but Vol 3, Part C, 9.1.1.2 (GAP) states:
+ * "A device in the Broadcast mode may send non-connectable and non-
+ * scannable undirected or non-connectable and non-scannable directed
+ * advertising events anonymously by excluding the Broadcaster's address."
+ * And Vol 4, Part E, 7.8.53 (HCI) states:
+ * "If the Advertising_Event_Properties parameter does not describe an
+ * event type supported by the Controller, contains an invalid bit
+ * combination, or specifies a type that does not support advertising
+ * data when the advertising set already contains some, the Controller
+ * shall return the error code Invalid HCI Command Parameters (0x12)."
+ *
+ * So let's just assume anonymous on connectable/scannable/legacy is an
+ * invalid bit combination.
+ */
+ if (props & BLE_HCI_LE_SET_EXT_ADV_PROP_ANON_ADV) {
+ if (props & (BLE_HCI_LE_SET_EXT_ADV_PROP_CONNECTABLE |
+ BLE_HCI_LE_SET_EXT_ADV_PROP_SCANNABLE |
+ BLE_HCI_LE_SET_EXT_ADV_PROP_HD_DIRECTED |
+ BLE_HCI_LE_SET_EXT_ADV_PROP_LEGACY)) {
+ rc = BLE_ERR_INV_HCI_CMD_PARMS;
+ goto done;
+ }
+ }
+
if (props & BLE_HCI_LE_SET_EXT_ADV_PROP_LEGACY) {
if (ADV_DATA_LEN(advsm) > BLE_ADV_LEGACY_DATA_MAX_LEN ||
SCAN_RSP_DATA_LEN(advsm) > BLE_SCAN_RSP_LEGACY_DATA_MAX_LEN) {