Bluetooth: controller: Add ll_adv_scan_state_cb callback
Added a callback function ll_adv_scan_state_cb from the Controller that gets called on either an advertiser or a scanner getting started as the Controller's first enabled state. The callback is also called on the Controller's last disabled advertising or scanning state. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This commit is contained in:
parent
ffc74034fb
commit
66d9e11f93
2 changed files with 30 additions and 0 deletions
|
@ -8253,6 +8253,10 @@ u32_t radio_adv_enable(u16_t interval, u8_t chl_map, u8_t filter_policy)
|
|||
if (ret_cb == TICKER_STATUS_SUCCESS) {
|
||||
_radio.advertiser.is_enabled = 1;
|
||||
|
||||
if (!_radio.scanner.is_enabled) {
|
||||
ll_adv_scan_state_cb(BIT(0));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -8278,6 +8282,10 @@ u32_t radio_adv_disable(void)
|
|||
|
||||
_radio.advertiser.is_enabled = 0;
|
||||
|
||||
if (!_radio.scanner.is_enabled) {
|
||||
ll_adv_scan_state_cb(0);
|
||||
}
|
||||
|
||||
conn = _radio.advertiser.conn;
|
||||
if (conn) {
|
||||
_radio.advertiser.conn = NULL;
|
||||
|
@ -8397,6 +8405,10 @@ u32_t radio_scan_enable(u8_t type, u8_t init_addr_type, u8_t *init_addr,
|
|||
|
||||
_radio.scanner.is_enabled = 1;
|
||||
|
||||
if (!_radio.advertiser.is_enabled) {
|
||||
ll_adv_scan_state_cb(BIT(1));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -8411,6 +8423,10 @@ u32_t radio_scan_disable(void)
|
|||
|
||||
_radio.scanner.is_enabled = 0;
|
||||
|
||||
if (!_radio.advertiser.is_enabled) {
|
||||
ll_adv_scan_state_cb(0);
|
||||
}
|
||||
|
||||
conn = _radio.scanner.conn;
|
||||
if (conn) {
|
||||
_radio.scanner.conn = NULL;
|
||||
|
@ -9107,6 +9123,15 @@ void radio_rx_dequeue(void)
|
|||
LL_ASSERT(0);
|
||||
break;
|
||||
}
|
||||
|
||||
if (radio_pdu_node_rx->hdr.type == NODE_RX_TYPE_CONNECTION) {
|
||||
u8_t bm = ((u8_t)_radio.scanner.is_enabled << 1) |
|
||||
_radio.advertiser.is_enabled;
|
||||
|
||||
if (!bm) {
|
||||
ll_adv_scan_state_cb(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void radio_rx_mem_release(struct radio_pdu_node_rx **radio_pdu_node_rx)
|
||||
|
@ -9331,3 +9356,7 @@ u32_t radio_tx_mem_enqueue(u16_t handle, struct radio_pdu_node_tx *node_tx)
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void __weak ll_adv_scan_state_cb(u8_t bm)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -356,5 +356,6 @@ u32_t radio_tx_mem_enqueue(u16_t handle,
|
|||
/* Callbacks */
|
||||
extern void radio_active_callback(u8_t active);
|
||||
extern void radio_event_callback(void);
|
||||
extern void ll_adv_scan_state_cb(u8_t bm);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue