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
Add BIGInfo reports to controller and host #1507
Conversation
sm->flags |= BLE_LE_SYNC_SM_FLAG_BIGINFO; | ||
} else { | ||
return false; | ||
} |
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.
you can just pass pointer and length to function, no need to check for encryption here
if ((sm->flags & BLE_LE_SYNC_SM_FLAG_BIGINFO) && | ||
!(sm->flags & BLE_LL_SYNC_SM_FLAG_HCI_NO_DATA_SENT)) { | ||
ble_ll_sync_send_biginfo_adv_rpt(sm); | ||
} |
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.
you just send biginfo report if it's present in current PDU, no need to use additional flags
nimble/controller/src/ble_ll_sync.c
Outdated
|
||
hci_ev = ble_transport_alloc_evt(1); | ||
if (!hci_ev) { | ||
assert(0); |
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.
no need to assert here, we'll just skip that event
nimble/controller/src/ble_ll_sync.c
Outdated
|
||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_BIGINFO_REPORTS) | ||
struct ble_ll_acad_biginfo biginfo; | ||
#endif |
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 keep this huge structure in sm all the time. all you need is likely to check if biginfo is present in acad, store the offset and then parse it directly to hci event.
for now I think it will be enough to return that offset from ble_ll_sync_check_acad
and use it in ble_ll_sync_rx_pkt_in
to check whether to send biginfo report
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.
no need to keep offset in sm, ble_ll_sync_check_acad
is called from ble_ll_sync_rx_pkt_in
so it can just return pointer to biginfo and biginfo length
uint16_t max_sdu; | ||
|
||
/** Advertising PHY */ | ||
uint8_t phy; |
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.
this is big phy, not advertising phy
nimble/host/include/host/ble_gap.h
Outdated
uint16_t max_pdu; | ||
|
||
/** Service Data Unit Interval */ | ||
uint8_t sdu_interval[3]; |
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.
uint32_t
will be easier to handle by app
also move below max_sdu
so we don't waste space on alignment unnecessarily
nimble/host/include/host/ble_gap.h
Outdated
uint8_t framing; | ||
|
||
/** Encryption */ | ||
uint8_t encryption; |
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.
use bitfield for both
nimble/host/src/ble_hs_startup.c
Outdated
if (version >= BLE_HCI_VER_BCS_5_2) { | ||
/** | ||
* Enable the following LE events: | ||
* 0x0000000200000000 LE Periodic Advertising Sync Transfer Received event |
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.
this is not the proper event (at least according to description)
nimble/host/src/ble_hs_hci_evt.c
Outdated
@@ -128,6 +131,9 @@ static ble_hs_hci_evt_le_fn * const ble_hs_hci_evt_le_dispatch[] = { | |||
[BLE_HCI_LE_SUBEV_ADV_SET_TERMINATED] = ble_hs_hci_evt_le_adv_set_terminated, | |||
[BLE_HCI_LE_SUBEV_SCAN_REQ_RCVD] = ble_hs_hci_evt_le_scan_req_rcvd, | |||
[BLE_HCI_LE_SUBEV_PERIODIC_ADV_SYNC_TRANSFER] = ble_hs_hci_evt_le_periodic_adv_sync_transfer, | |||
#if MYNEWT_VAL(BLE_BIGINFO_REPORTS) | |||
[BLE_HCI_LE_SUBEV_BIGINFO_ADV_REPORT] = ble_hs_hci_evt_le_biginfo_adv_rpt, |
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.
...adv_report
nimble/host/src/ble_gap.c
Outdated
} | ||
ble_hs_unlock(); | ||
|
||
if (!psync || !cb) { |
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.
it does not make sense to return if !cb
since the same condition is checked below
nimble/controller/src/ble_ll_sync.c
Outdated
#define BLE_LL_SYNC_SM_FLAG_NEW_CHANMAP 0x0200 | ||
#define BLE_LL_SYNC_SM_FLAG_CHAIN 0x0400 | ||
|
||
#define BLE_LL_SYNC_ITVL_USECS 1250 |
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.
do not reformat code unnecesarilly
nimble/controller/src/ble_ll_sync.c
Outdated
@@ -661,6 +669,72 @@ ble_ll_sync_send_truncated_per_adv_rpt(struct ble_ll_sync_sm *sm, uint8_t *evbuf | |||
ble_ll_hci_event_send(hci_ev); | |||
} | |||
|
|||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_BIGINFO_REPORTS) | |||
static void | |||
ble_ll_sync_parse_biginfo_adv_data_to_ev(struct ble_hci_ev_le_subev_biginfo_adv_report *ev, const uint8_t *acad, uint8_t biginfo_acad_offset) |
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.
ble_ll_sync_parse_biginfo_to_ev
also parameters should be biginfo pointer and length, it does not make sense to pass acad and offset and calculate biginfo pointer over and over again
nimble/host/src/ble_gap.c
Outdated
event.biginfo_report.pto = ev->pto; | ||
event.biginfo_report.irc = ev->irc; | ||
event.biginfo_report.max_pdu = ev->max_pdu; | ||
event.biginfo_report.sdu_interval = get_le32(&ev->sdu_interval[0]) & 0x00FFFFFF; |
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.
get_le24
uint8_t framing; | ||
uint8_t giv[8]; | ||
uint8_t gskd[16]; | ||
}; |
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.
this is not used anywhere
nimble/controller/src/ble_ll_sync.c
Outdated
|
||
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_BIGINFO_REPORTS) | ||
struct ble_ll_acad_biginfo biginfo; | ||
#endif |
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.
no need to keep offset in sm, ble_ll_sync_check_acad
is called from ble_ll_sync_rx_pkt_in
so it can just return pointer to biginfo and biginfo length
nimble/controller/src/ble_ll_sync.c
Outdated
} | ||
|
||
static void | ||
ble_ll_sync_send_biginfo_adv_rpt(struct ble_ll_sync_sm *sm, const uint8_t *acad) |
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.
biginfo
and biginfo_len
instead of acad
nimble/controller/syscfg.yml
Outdated
@@ -323,6 +323,12 @@ syscfg.defs: | |||
Advertising Sync Transfer Feature. | |||
value: MYNEWT_VAL(BLE_PERIODIC_ADV_SYNC_TRANSFER) | |||
|
|||
BLE_LL_CFG_FEAT_LL_BIGINFO_REPORTS: |
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.
BLE_LL_PERIODIC_ADV_SYNC_BIGINFO_REPORTS
ac0cecd
to
ae70df0
Compare
This allows to receive BIGInfo reports in periodic advertisement sync callback function
No description provided.