set le scan parameters from hci_stack

This commit is contained in:
matthias.ringwald 2014-06-07 07:54:27 +00:00
parent 8ebb5506d7
commit e2602ea29f
2 changed files with 14 additions and 0 deletions

View File

@ -1009,6 +1009,7 @@ void hci_state_reset(){
hci_stack->adv_addr_type = 0; hci_stack->adv_addr_type = 0;
memset(hci_stack->adv_address, 0, 6); memset(hci_stack->adv_address, 0, 6);
hci_stack->le_scanning_state = LE_SCAN_IDLE; hci_stack->le_scanning_state = LE_SCAN_IDLE;
hci_stack->le_scan_type = 0xff;
} }
void hci_init(hci_transport_t *transport, void *config, bt_control_t *control, remote_device_db_t const* remote_device_db){ void hci_init(hci_transport_t *transport, void *config, bt_control_t *control, remote_device_db_t const* remote_device_db){
@ -1399,6 +1400,13 @@ void hci_run(){
default: default:
break; break;
} }
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->adv_addr_type, 0);
return;
}
} }
#endif #endif

View File

@ -408,7 +408,13 @@ typedef struct {
uint8_t adv_addr_type; uint8_t adv_addr_type;
bd_addr_t adv_address; bd_addr_t adv_address;
le_scanning_state_t le_scanning_state; le_scanning_state_t le_scanning_state;
// buffer for le scan type command - 0xff not set
uint8_t le_scan_type;
uint16_t le_scan_interval;
uint16_t le_scan_window;
} hci_stack_t; } hci_stack_t;
//*************** le client start //*************** le client start