mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-29 22:20:37 +00:00
gap: re-configure advertisements after power cycle
This commit is contained in:
parent
15537ea476
commit
a61834b6cb
@ -38,6 +38,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
||||
- GAP: only store link key for ssp if remote side has set bondable in io cap auth requirements as well
|
||||
- GAP: allow to disable link supervision timeout
|
||||
- GAP: fix `gap_connect` after `gap_connect_cancel`
|
||||
- GAP: re-configure advertisements after power cycle
|
||||
- HCI: handle start inquiry failure
|
||||
- L2CAP: fix create outgoing connection triggered in hci disconnect event callback
|
||||
- L2CAP: return unknown mandatory option in config response
|
||||
|
20
src/hci.c
20
src/hci.c
@ -3191,11 +3191,20 @@ static void hci_state_reset(void){
|
||||
hci_stack->le_random_address_set = 0;
|
||||
#endif
|
||||
#ifdef ENABLE_LE_CENTRAL
|
||||
hci_stack->le_scanning_active = 0;
|
||||
hci_stack->le_scanning_active = false;
|
||||
hci_stack->le_connecting_state = LE_CONNECTING_IDLE;
|
||||
hci_stack->le_connecting_request = LE_CONNECTING_IDLE;
|
||||
hci_stack->le_whitelist_capacity = 0;
|
||||
#endif
|
||||
#ifdef ENABLE_LE_PERIPHERAL
|
||||
hci_stack->le_advertisements_active = false;
|
||||
if ((hci_stack->le_advertisements_todo & LE_ADVERTISEMENT_TASKS_PARAMS_SET) != 0){
|
||||
hci_stack->le_advertisements_todo |= LE_ADVERTISEMENT_TASKS_SET_PARAMS;
|
||||
}
|
||||
if (hci_stack->le_advertisements_data != NULL){
|
||||
hci_stack->le_advertisements_todo |= LE_ADVERTISEMENT_TASKS_SET_ADV_DATA;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef ENABLE_CLASSIC
|
||||
@ -4046,9 +4055,10 @@ static bool hci_run_general_gap_le(void){
|
||||
// - it's disabled
|
||||
// - whitelist change required but used for advertisement filter policy
|
||||
// - resolving list modified
|
||||
bool advertising_uses_whitelist = hci_stack->le_advertisements_filter_policy > 0;
|
||||
if ((hci_stack->le_advertisements_todo != 0) ||
|
||||
!hci_stack->le_advertisements_enabled_for_current_roles ||
|
||||
bool advertising_uses_whitelist = hci_stack->le_advertisements_filter_policy != 0;
|
||||
bool advertising_change = (hci_stack->le_advertisements_todo & (LE_ADVERTISEMENT_TASKS_SET_PARAMS | LE_ADVERTISEMENT_TASKS_SET_ADV_DATA)) != 0;
|
||||
if (advertising_change ||
|
||||
(hci_stack->le_advertisements_enabled_for_current_roles == 0) ||
|
||||
(advertising_uses_whitelist & whitelist_modification_pending) ||
|
||||
resolving_list_modification_pending) {
|
||||
|
||||
@ -5715,7 +5725,7 @@ void gap_scan_response_set_data(uint8_t scan_response_data_length, uint8_t * sca
|
||||
(void)memcpy(hci_stack->le_advertisements_direct_address, direct_address,
|
||||
6);
|
||||
|
||||
hci_stack->le_advertisements_todo |= LE_ADVERTISEMENT_TASKS_SET_PARAMS;
|
||||
hci_stack->le_advertisements_todo |= LE_ADVERTISEMENT_TASKS_SET_PARAMS | LE_ADVERTISEMENT_TASKS_PARAMS_SET;
|
||||
hci_run();
|
||||
}
|
||||
|
||||
|
@ -761,9 +761,12 @@ typedef enum hci_init_state{
|
||||
} hci_substate_t;
|
||||
|
||||
enum {
|
||||
// Tasks
|
||||
LE_ADVERTISEMENT_TASKS_SET_ADV_DATA = 1 << 0,
|
||||
LE_ADVERTISEMENT_TASKS_SET_SCAN_DATA = 1 << 1,
|
||||
LE_ADVERTISEMENT_TASKS_SET_PARAMS = 1 << 2,
|
||||
// State
|
||||
LE_ADVERTISEMENT_TASKS_PARAMS_SET = 1 << 7,
|
||||
};
|
||||
|
||||
enum {
|
||||
|
Loading…
x
Reference in New Issue
Block a user