Skip to content
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

Merged
merged 2 commits into from
Oct 24, 2024
Merged

Conversation

m-gorecki
Copy link
Contributor

No description provided.

@@ -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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

put_le16

@@ -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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!!(cmd->enable & 0x02)

@@ -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);
Copy link
Contributor

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

@@ -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)
Copy link
Contributor

@andrzej-kaczmarek andrzej-kaczmarek Sep 5, 2024

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)

@github-actions github-actions bot added the size/M Medium PR label Sep 10, 2024
@m-gorecki m-gorecki force-pushed the periodic-adi branch 2 times, most recently from ccdebea to 5e00565 Compare September 10, 2024 14:08
@m-gorecki m-gorecki removed the size/S Small PR label Sep 10, 2024
@m-gorecki m-gorecki marked this pull request as ready for review September 10, 2024 14:52
@m-gorecki m-gorecki changed the title [wip] periodic adv adi support nimble/ll: Add PA ADI support Sep 10, 2024
@@ -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);
Copy link
Contributor

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

} while (old_adi == advsm->adi);
new_adi = (old_adi & 0xf000) | (ble_ll_rand() & 0x0fff);
} while (old_adi == new_adi);
return new_adi;
Copy link
Contributor

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.
@m-gorecki m-gorecki merged commit dae0e40 into apache:master Oct 24, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants