mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-02-03 20:54:18 +00:00
link page scan enable to registered l2cap services
This commit is contained in:
parent
758b46ce19
commit
c0e866bf37
@ -689,9 +689,7 @@ void hci_init(hci_transport_t *transport, void *config, bt_control_t *control, r
|
||||
// no connections yet
|
||||
hci_stack.connections = NULL;
|
||||
hci_stack.discoverable = 0;
|
||||
|
||||
// enable page scan by until l2cap takes over control
|
||||
hci_stack.connectable = 1;
|
||||
hci_stack.connectable = 0;
|
||||
|
||||
// no pending cmds
|
||||
hci_stack.decline_reason = 0;
|
||||
|
@ -94,6 +94,7 @@ void l2cap_init(){
|
||||
// register callback with HCI
|
||||
//
|
||||
hci_register_packet_handler(&l2cap_packet_handler);
|
||||
hci_connectable_control(0); // no services yet
|
||||
}
|
||||
|
||||
|
||||
@ -982,6 +983,9 @@ void l2cap_register_service_internal(void *connection, btstack_packet_handler_t
|
||||
|
||||
// add to services list
|
||||
linked_list_add(&l2cap_services, (linked_item_t *) service);
|
||||
|
||||
// enable page scan
|
||||
hci_connectable_control(1);
|
||||
}
|
||||
|
||||
void l2cap_unregister_service_internal(void *connection, uint16_t psm){
|
||||
@ -989,6 +993,10 @@ void l2cap_unregister_service_internal(void *connection, uint16_t psm){
|
||||
if (!service) return;
|
||||
linked_list_remove(&l2cap_services, (linked_item_t *) service);
|
||||
btstack_memory_l2cap_service_free(service);
|
||||
|
||||
// disable page scan when no services registered
|
||||
if (!linked_list_empty(&l2cap_services)) return;
|
||||
hci_connectable_control(0);
|
||||
}
|
||||
|
||||
//
|
||||
|
Loading…
x
Reference in New Issue
Block a user