l2cap: support ENABLE_EXPLICIT_CONNECTABLE_MODE_CONTROL

This commit is contained in:
Matthias Ringwald 2020-12-18 15:17:31 +01:00
parent f38f43d729
commit 47a155880c
2 changed files with 10 additions and 1 deletions

View File

@ -104,6 +104,8 @@ ENABLE_LE_LIMIT_ACL_FRAGMENT_BY_MAX_OCTETS | Force HCI to fragment ACL-LE packet
ENABLE_TLV_FLASH_EXPLICIT_DELETE_FIELD | Enable use of explicit delete field in TLV Flash implemenation - required when flash value cannot be overwritten with zero
ENABLE_CONTROLLER_WARM_BOOT | Enable stack startup without power cycle (if supported/possible)
ENABLE_SEGGER_RTT | Use SEGGER RTT for console output and packet log, see [additional options](#sec:rttConfiguration)
ENABLE_EXPLICIT_CONNECTABLE_MODE_CONTROL | Disable calls to control Connectable Mode by L2CAP
Notes:
- ENABLE_MICRO_ECC_FOR_LE_SECURE_CONNECTIONS: Only some Bluetooth 4.2+ controllers (e.g., EM9304, ESP32) support the necessary HCI commands for ECC. Other reason to enable the ECC software implementations are if the Host is much faster or if the micro-ecc library is already provided (e.g., ESP32, WICED, or if the ECC HCI Commands are unreliable.

View File

@ -913,9 +913,11 @@ void l2cap_init(void){
hci_register_acl_packet_handler(&l2cap_acl_handler);
#ifndef ENABLE_EXPLICIT_CONNECTABLE_MODE_CONTROL
#ifdef ENABLE_CLASSIC
gap_connectable_control(0); // no services yet
#endif
#endif
}
void l2cap_register_packet_handler(void (*handler)(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size)){
@ -3770,8 +3772,10 @@ uint8_t l2cap_register_service(btstack_packet_handler_t service_packet_handler,
// add to services list
btstack_linked_list_add(&l2cap_services, (btstack_linked_item_t *) service);
#ifndef ENABLE_EXPLICIT_CONNECTABLE_MODE_CONTROL
// enable page scan
gap_connectable_control(1);
#endif
return ERROR_CODE_SUCCESS;
}
@ -3784,11 +3788,14 @@ uint8_t l2cap_unregister_service(uint16_t psm){
if (!service) return L2CAP_SERVICE_DOES_NOT_EXIST;
btstack_linked_list_remove(&l2cap_services, (btstack_linked_item_t *) service);
btstack_memory_l2cap_service_free(service);
#ifndef ENABLE_EXPLICIT_CONNECTABLE_MODE_CONTROL
// disable page scan when no services registered
if (btstack_linked_list_empty(&l2cap_services)) {
gap_connectable_control(0);
}
#endif
return ERROR_CODE_SUCCESS;
}
#endif