From 441a7ef1e84834d6179201d6f6670b399fca9888 Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Tue, 16 Nov 2021 11:09:15 +0100 Subject: [PATCH] example: fix build --- example/hog_mouse_demo.c | 9 ++++++--- example/le_data_channel_server.c | 11 +++++++---- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/example/hog_mouse_demo.c b/example/hog_mouse_demo.c index 87232123d..265e3e0a6 100644 --- a/example/hog_mouse_demo.c +++ b/example/hog_mouse_demo.c @@ -98,6 +98,7 @@ const uint8_t hid_descriptor_mouse_boot_mode[] = { }; static btstack_packet_callback_registration_t hci_event_callback_registration; +static btstack_packet_callback_registration_t l2cap_event_callback_registration; static btstack_packet_callback_registration_t sm_event_callback_registration; static uint8_t battery = 100; static hci_con_handle_t con_handle = HCI_CON_HANDLE_INVALID; @@ -119,10 +120,8 @@ const uint8_t adv_data_len = sizeof(adv_data); static void hog_mouse_setup(void){ - - // setup l2cap and register for connection parameter updates + // setup l2cap and l2cap_init(); - l2cap_register_packet_handler(&packet_handler); // setup le device db le_device_db_init(); @@ -159,6 +158,10 @@ static void hog_mouse_setup(void){ hci_event_callback_registration.callback = &packet_handler; hci_add_event_handler(&hci_event_callback_registration); + // register for connection parameter updates + l2cap_event_callback_registration.callback = &packet_handler; + l2cap_add_event_handler(&l2cap_event_callback_registration); + sm_event_callback_registration.callback = &packet_handler; sm_add_event_handler(&sm_event_callback_registration); diff --git a/example/le_data_channel_server.c b/example/le_data_channel_server.c index 018b70291..15484cb53 100644 --- a/example/le_data_channel_server.c +++ b/example/le_data_channel_server.c @@ -73,7 +73,8 @@ const uint8_t adv_data[] = { }; const uint8_t adv_data_len = sizeof(adv_data); -static btstack_packet_callback_registration_t event_callback_registration; +static btstack_packet_callback_registration_t hci_event_callback_registration; +static btstack_packet_callback_registration_t l2cap_event_callback_registration; static btstack_packet_callback_registration_t sm_event_callback_registration; // support for multiple clients @@ -117,14 +118,16 @@ static void le_data_channel_setup(void){ att_server_init(profile_data, NULL, NULL); // register for HCI events - event_callback_registration.callback = &packet_handler; - hci_add_event_handler(&event_callback_registration); + hci_event_callback_registration.callback = &packet_handler; + hci_add_event_handler(&hci_event_callback_registration); // register for SM events sm_event_callback_registration.callback = &sm_packet_handler; sm_add_event_handler(&sm_event_callback_registration); - l2cap_register_packet_handler(&packet_handler); + // register for L2CAP events + l2cap_event_callback_registration.callback = &packet_handler; + l2cap_add_event_handler(&sm_event_callback_registration); // le data channel setup l2cap_le_register_service(&packet_handler, TSPX_le_psm, LEVEL_0);