-
Notifications
You must be signed in to change notification settings - Fork 397
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nimble/ll: Add PA ADI support #1857
Conversation
nimble/controller/src/ble_ll_adv.c
Outdated
@@ -2152,6 +2154,11 @@ ble_ll_adv_sync_pdu_make(uint8_t *dptr, void *pducb_arg, uint8_t *hdr_byte) | |||
dptr += 1; | |||
} | |||
#endif | |||
if (sync->ext_hdr_flags & (1 << BLE_LL_EXT_ADV_DATA_INFO_BIT)) { | |||
dptr[0] = advsm->periodic_adv_adi & 0x00ff; | |||
dptr[1] = advsm->periodic_adv_adi >> 8; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
put_le16
nimble/controller/src/ble_ll_adv.c
Outdated
@@ -4154,6 +4185,8 @@ ble_ll_adv_periodic_enable(const uint8_t *cmdbuf, uint8_t len) | |||
return BLE_ERR_PACKET_TOO_LONG; | |||
} | |||
|
|||
advsm->periodic_include_adi = ((cmd->enable >> 1) & 0x1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
!!(cmd->enable & 0x02)
nimble/controller/src/ble_ll_adv.c
Outdated
@@ -2646,6 +2677,7 @@ ble_ll_adv_sm_start_periodic(struct ble_ll_adv_sm *advsm) | |||
* train is enabled. | |||
*/ | |||
ble_ll_adv_update_did(advsm); | |||
ble_ll_adv_update_did_periodic(advsm); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's no need to update DID for periodic advertising because periodic advertising data doesn't change here
nimble/controller/src/ble_ll_adv.c
Outdated
@@ -2564,6 +2576,24 @@ ble_ll_adv_reschedule_periodic_event(struct ble_ll_adv_sm *advsm) | |||
ble_ll_adv_sync_schedule(advsm, false); | |||
} | |||
|
|||
static void | |||
ble_ll_adv_update_did_periodic(struct ble_ll_adv_sm *advsm) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of duplicating code refactor old code to simply return new value instead of updating struct, i.e.
static uint16_t ble_ll_adv_adi_change_did(uint16_t adi) {}
...
advsm->adv_adi = ble_ll_adv_adi_change_did(advsm->adv_adi)
6631330
to
c260176
Compare
ccdebea
to
5e00565
Compare
5e00565
to
bde7402
Compare
@@ -1959,7 +1964,7 @@ ble_ll_adv_update_adv_scan_rsp_data(struct ble_ll_adv_sm *advsm) | |||
|
|||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV) | |||
/* DID shall be updated when host provides new advertising data */ | |||
ble_ll_adv_update_did(advsm); | |||
advsm->adi = ble_ll_adv_update_did(advsm->adi); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
put changes related to ble_ll_adv_update_did in separate commit
bde7402
to
6d1407f
Compare
} while (old_adi == advsm->adi); | ||
new_adi = (old_adi & 0xf000) | (ble_ll_rand() & 0x0fff); | ||
} while (old_adi == new_adi); | ||
return new_adi; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add empty line before return
Now we can universally update DID with the same function, also for periodic advertising.
This adds ADI support for Periodic Advertising in controller.
6d1407f
to
8d18d6e
Compare
No description provided.