mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-27 06:35:20 +00:00
l2cap: return error for l2cap_unregister_service
This commit is contained in:
parent
e981dfc496
commit
7e8856ebfd
@ -118,6 +118,7 @@ typedef uint8_t sm_key_t[16];
|
||||
|
||||
#define L2CAP_SERVICE_ALREADY_REGISTERED 0x69
|
||||
#define L2CAP_DATA_LEN_EXCEEDS_REMOTE_MTU 0x6A
|
||||
#define L2CAP_SERVICE_DOES_NOT_EXIST 0x6B
|
||||
|
||||
#define RFCOMM_MULTIPLEXER_STOPPED 0x70
|
||||
#define RFCOMM_CHANNEL_ALREADY_REGISTERED 0x71
|
||||
|
10
src/l2cap.c
10
src/l2cap.c
@ -1560,18 +1560,20 @@ uint8_t l2cap_register_service(btstack_packet_handler_t service_packet_handler,
|
||||
return 0;
|
||||
}
|
||||
|
||||
void l2cap_unregister_service(uint16_t psm){
|
||||
uint8_t l2cap_unregister_service(uint16_t psm){
|
||||
|
||||
log_info("L2CAP_UNREGISTER_SERVICE psm 0x%x", psm);
|
||||
|
||||
l2cap_service_t *service = l2cap_get_service(psm);
|
||||
if (!service) return;
|
||||
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);
|
||||
|
||||
// disable page scan when no services registered
|
||||
if (!btstack_linked_list_empty(&l2cap_services)) return;
|
||||
gap_connectable_control(0);
|
||||
if (btstack_linked_list_empty(&l2cap_services)) {
|
||||
gap_connectable_control(0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Bluetooth 4.0 - allows to register handler for Attribute Protocol and Security Manager Protocol
|
||||
|
@ -234,7 +234,7 @@ uint8_t l2cap_register_service(btstack_packet_handler_t packet_handler, uint16_t
|
||||
/**
|
||||
* @brief Unregisters L2CAP service with given PSM. On embedded systems, use NULL for connection parameter.
|
||||
*/
|
||||
void l2cap_unregister_service(uint16_t psm);
|
||||
uint8_t l2cap_unregister_service(uint16_t psm);
|
||||
|
||||
/**
|
||||
* @brief Accepts incoming L2CAP connection.
|
||||
|
Loading…
x
Reference in New Issue
Block a user