mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-04-09 21:45:54 +00:00
gap: fixed gap_set_scan_parameters() if issued right before gap_start_scan() - issue #275
This commit is contained in:
parent
e71d6c14a5
commit
3251a10887
@ -16,6 +16,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|||||||
|
|
||||||
## Changes March 2020
|
## Changes March 2020
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- GAP: fixed gap_set_scan_parameters() if issued right before gap_start_scan()
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
GATT Client: allow to register for any notification/indication and/or any connection
|
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
|
hci_cmd: added hci_read_inquiry_scan_activity and hci_write_inquiry_scan_activity
|
||||||
|
23
src/hci.c
23
src/hci.c
@ -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)){
|
&& ((hci_stack->le_own_addr_type == BD_ADDR_TYPE_LE_PUBLIC) || hci_stack->le_random_address_set)){
|
||||||
|
|
||||||
#ifdef ENABLE_LE_CENTRAL
|
#ifdef ENABLE_LE_CENTRAL
|
||||||
// handle le scan
|
// parameter change requires scanning to be stopped first
|
||||||
if ((hci_stack->le_scanning_enabled != hci_stack->le_scanning_active)){
|
if (hci_stack->le_scan_type != 0xff) {
|
||||||
hci_stack->le_scanning_active = hci_stack->le_scanning_enabled;
|
if (hci_stack->le_scanning_active){
|
||||||
hci_send_cmd(&hci_le_set_scan_enable, hci_stack->le_scanning_enabled, 0);
|
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;
|
return;
|
||||||
}
|
}
|
||||||
if (hci_stack->le_scan_type != 0xff){
|
// finally, we can enable/disable le scan
|
||||||
// defaults: active scanning, accept all advertisement packets
|
if ((hci_stack->le_scanning_enabled && !hci_stack->le_scanning_active)){
|
||||||
int scan_type = hci_stack->le_scan_type;
|
hci_stack->le_scanning_active = hci_stack->le_scanning_enabled;
|
||||||
hci_stack->le_scan_type = 0xff;
|
hci_send_cmd(&hci_le_set_scan_enable, hci_stack->le_scanning_enabled, 0);
|
||||||
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;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user