Bluetooth: controller: Fix enable and disable of scan state
Updated controller implementation to disallow disabling initiator state using scan disable. But allow disabling an already disabled scan state. Also, disallow enabling scan state while in initiator state. Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl> Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This commit is contained in:
parent
3fdedde967
commit
aa5bbd5dfe
3 changed files with 21 additions and 7 deletions
|
@ -10540,10 +10540,14 @@ u32_t radio_scan_enable(u8_t type, u8_t init_addr_type, u8_t *init_addr,
|
|||
return 0;
|
||||
}
|
||||
|
||||
u32_t radio_scan_disable(void)
|
||||
u32_t radio_scan_disable(bool scanner)
|
||||
{
|
||||
u32_t status;
|
||||
|
||||
if (scanner && _radio.scanner.conn) {
|
||||
return BT_HCI_ERR_CMD_DISALLOWED;
|
||||
}
|
||||
|
||||
status = role_disable(RADIO_TICKER_ID_SCAN,
|
||||
RADIO_TICKER_ID_SCAN_STOP);
|
||||
if (!status && !_radio.scanner.conn) {
|
||||
|
@ -10554,7 +10558,7 @@ u32_t radio_scan_disable(void)
|
|||
}
|
||||
}
|
||||
|
||||
return status ? BT_HCI_ERR_CMD_DISALLOWED : 0;
|
||||
return _radio.scanner.is_enabled ? BT_HCI_ERR_CMD_DISALLOWED : 0;
|
||||
}
|
||||
|
||||
u32_t ll_scan_is_enabled(void)
|
||||
|
@ -10745,7 +10749,7 @@ u32_t ll_connect_disable(void **node_rx)
|
|||
return BT_HCI_ERR_CMD_DISALLOWED;
|
||||
}
|
||||
|
||||
status = radio_scan_disable();
|
||||
status = radio_scan_disable(false);
|
||||
if (!status) {
|
||||
struct connection *conn = _radio.scanner.conn;
|
||||
struct radio_pdu_node_rx *rx;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue