gap: fixed gap_set_scan_parameters() if issued right before gap_start_scan() - issue #275

This commit is contained in:
Matthias Ringwald 2020-03-13 15:25:42 +01:00
parent e71d6c14a5
commit 3251a10887
2 changed files with 17 additions and 9 deletions

View File

@ -16,6 +16,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## Changes March 2020
### Fixed
- GAP: fixed gap_set_scan_parameters() if issued right before gap_start_scan()
### Added
GATT Client: allow to register for any notification/indication and/or any connection
hci_cmd: added hci_read_inquiry_scan_activity and hci_write_inquiry_scan_activity

View File

@ -3413,17 +3413,22 @@ static void hci_run(void){
&& ((hci_stack->le_own_addr_type == BD_ADDR_TYPE_LE_PUBLIC) || hci_stack->le_random_address_set)){
#ifdef ENABLE_LE_CENTRAL
// handle le scan
if ((hci_stack->le_scanning_enabled != hci_stack->le_scanning_active)){
hci_stack->le_scanning_active = hci_stack->le_scanning_enabled;
hci_send_cmd(&hci_le_set_scan_enable, hci_stack->le_scanning_enabled, 0);
// parameter change requires scanning to be stopped first
if (hci_stack->le_scan_type != 0xff) {
if (hci_stack->le_scanning_active){
hci_stack->le_scanning_active = 0;
hci_send_cmd(&hci_le_set_scan_enable, 0, 0);
} else {
int scan_type = (int) hci_stack->le_scan_type;
hci_stack->le_scan_type = 0xff;
hci_send_cmd(&hci_le_set_scan_parameters, scan_type, hci_stack->le_scan_interval, hci_stack->le_scan_window, hci_stack->le_own_addr_type, 0);
}
return;
}
if (hci_stack->le_scan_type != 0xff){
// defaults: active scanning, accept all advertisement packets
int scan_type = hci_stack->le_scan_type;
hci_stack->le_scan_type = 0xff;
hci_send_cmd(&hci_le_set_scan_parameters, scan_type, hci_stack->le_scan_interval, hci_stack->le_scan_window, hci_stack->le_own_addr_type, 0);
// finally, we can enable/disable le scan
if ((hci_stack->le_scanning_enabled && !hci_stack->le_scanning_active)){
hci_stack->le_scanning_active = hci_stack->le_scanning_enabled;
hci_send_cmd(&hci_le_set_scan_enable, hci_stack->le_scanning_enabled, 0);
return;
}
#endif