mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-04-18 05:42:49 +00:00
track advertisements enable
This commit is contained in:
parent
a828a7565a
commit
171293d35a
@ -1552,8 +1552,8 @@ static void event_handler(uint8_t *packet, int size){
|
|||||||
bt_flip_addr(addr, &packet[8]);
|
bt_flip_addr(addr, &packet[8]);
|
||||||
addr_type = (bd_addr_type_t)packet[7];
|
addr_type = (bd_addr_type_t)packet[7];
|
||||||
log_info("LE Connection_complete (status=%u) type %u, %s", packet[3], addr_type, bd_addr_to_str(addr));
|
log_info("LE Connection_complete (status=%u) type %u, %s", packet[3], addr_type, bd_addr_to_str(addr));
|
||||||
// LE connections are auto-accepted, so just create a connection if there isn't one already
|
|
||||||
conn = hci_connection_for_bd_addr_and_type(addr, addr_type);
|
conn = hci_connection_for_bd_addr_and_type(addr, addr_type);
|
||||||
|
// handle error first
|
||||||
if (packet[3]){
|
if (packet[3]){
|
||||||
if (conn){
|
if (conn){
|
||||||
// outgoing connection failed, remove entry
|
// outgoing connection failed, remove entry
|
||||||
@ -1567,6 +1567,9 @@ static void event_handler(uint8_t *packet, int size){
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!conn){
|
if (!conn){
|
||||||
|
// advertisemts are stopped on incoming connection
|
||||||
|
hci_stack->le_advertisements_active = 0;
|
||||||
|
// LE connections are auto-accepted, so just create a connection if there isn't one already
|
||||||
conn = create_connection_for_bd_addr_and_type(addr, addr_type);
|
conn = create_connection_for_bd_addr_and_type(addr, addr_type);
|
||||||
}
|
}
|
||||||
if (!conn){
|
if (!conn){
|
||||||
@ -2443,6 +2446,9 @@ int hci_send_cmd_packet(uint8_t *packet, int size){
|
|||||||
if (IS_COMMAND(packet, hci_le_set_random_address)){
|
if (IS_COMMAND(packet, hci_le_set_random_address)){
|
||||||
bt_flip_addr(hci_stack->adv_address, &packet[3]);
|
bt_flip_addr(hci_stack->adv_address, &packet[3]);
|
||||||
}
|
}
|
||||||
|
if (IS_COMMAND(packet, hci_le_set_advertise_enable)){
|
||||||
|
hci_stack->le_advertisements_active = packet[3];
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
hci_stack->num_cmd_packets--;
|
hci_stack->num_cmd_packets--;
|
||||||
|
@ -682,6 +682,8 @@ typedef struct {
|
|||||||
|
|
||||||
le_connection_parameter_range_t le_connection_parameter_range;
|
le_connection_parameter_range_t le_connection_parameter_range;
|
||||||
|
|
||||||
|
uint8_t le_advertisements_active;
|
||||||
|
|
||||||
// custom BD ADDR
|
// custom BD ADDR
|
||||||
bd_addr_t custom_bd_addr;
|
bd_addr_t custom_bd_addr;
|
||||||
uint8_t custom_bd_addr_set;
|
uint8_t custom_bd_addr_set;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user