mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-02-25 15:41:00 +00:00
track le connecting state
This commit is contained in:
parent
5877c8b7fb
commit
b04dfa37ba
20
src/hci.c
20
src/hci.c
@ -1705,6 +1705,7 @@ static void hci_state_reset(void){
|
||||
memset(hci_stack->adv_address, 0, 6);
|
||||
hci_stack->le_scanning_state = LE_SCAN_IDLE;
|
||||
hci_stack->le_scan_type = 0xff;
|
||||
hci_stack->le_connecting_state = LE_CONNECTING_IDLE;
|
||||
hci_stack->le_connection_parameter_range.le_conn_interval_min = 0x0006;
|
||||
hci_stack->le_connection_parameter_range.le_conn_interval_max = 0x0C80;
|
||||
hci_stack->le_connection_parameter_range.le_conn_latency_min = 0x0000;
|
||||
@ -2505,6 +2506,25 @@ int hci_send_cmd_packet(uint8_t *packet, int size){
|
||||
if (IS_COMMAND(packet, hci_le_set_advertise_enable)){
|
||||
hci_stack->le_advertisements_active = packet[3];
|
||||
}
|
||||
if (IS_COMMAND(packet, hci_le_create_connection)){
|
||||
// white list used?
|
||||
uint8_t initiator_filter_policy = packet[7];
|
||||
switch (initiator_filter_policy){
|
||||
case 0:
|
||||
// whitelist not used
|
||||
hci_stack->le_connecting_state = LE_CONNECTING_DIRECT;
|
||||
break;
|
||||
case 1:
|
||||
hci_stack->le_connecting_state = LE_CONNECTING_WHITELIST;
|
||||
break;
|
||||
default:
|
||||
log_error("Invalid initiator_filter_policy in LE Create Connection %u", initiator_filter_policy);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (IS_COMMAND(packet, hci_le_create_connection_cancel)){
|
||||
hci_stack->le_connecting_state = LE_CONNECTING_IDLE;
|
||||
}
|
||||
#endif
|
||||
|
||||
hci_stack->num_cmd_packets--;
|
||||
|
@ -322,6 +322,12 @@ typedef enum {
|
||||
LE_STOP_SCAN,
|
||||
} le_scanning_state_t;
|
||||
|
||||
typedef enum {
|
||||
LE_CONNECTING_IDLE,
|
||||
LE_CONNECTING_DIRECT,
|
||||
LE_CONNECTING_WHITELIST,
|
||||
} le_connecting_state_t;
|
||||
|
||||
//
|
||||
// SM internal types and globals
|
||||
//
|
||||
@ -699,6 +705,7 @@ typedef struct {
|
||||
bd_addr_t adv_address;
|
||||
|
||||
le_scanning_state_t le_scanning_state;
|
||||
le_connecting_state_t le_connecting_state;
|
||||
|
||||
// buffer for le scan type command - 0xff not set
|
||||
uint8_t le_scan_type;
|
||||
|
Loading…
x
Reference in New Issue
Block a user