From 6259b5df56598ec9aea6e413ea69083f1b2cbdbd Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Wed, 9 Oct 2019 15:58:27 +0200 Subject: [PATCH] daemon/l2cap_example: use scraped PSMs --- platform/daemon/example/l2cap_server.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/platform/daemon/example/l2cap_server.c b/platform/daemon/example/l2cap_server.c index dd181d277..ee1b6f002 100644 --- a/platform/daemon/example/l2cap_server.c +++ b/platform/daemon/example/l2cap_server.c @@ -51,6 +51,7 @@ #include "btstack_client.h" #include "hci_cmd.h" #include "classic/sdp_util.h" +#include "bluetooth_psm.h" #ifdef _WIN32 #include "btstack_run_loop_windows.h" @@ -107,7 +108,7 @@ void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint if (status) { l2cap_reg_fail = 1; } else { - if (psm == PSM_HID_INTERRUPT && !l2cap_reg_fail) { // The second of the two + if (psm == BLUETOOTH_PSM_HID_INTERRUPT && !l2cap_reg_fail) { // The second of the two bt_send_cmd(&btstack_set_discoverable, 1); printf("Both PSMs registered.\n"); } @@ -164,10 +165,10 @@ void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint printf("Channel successfully opened: %s, handle 0x%02x, psm 0x%02x, local cid 0x%02x, remote cid 0x%02x\n", bd_addr_to_str(event_addr), con_handle, psm, local_cid, l2cap_event_channel_opened_get_remote_cid(packet)); - if (psm == PSM_HID_CONTROL){ + if (psm == BLUETOOTH_PSM_HID_CONTROL){ hid_control = local_cid; } - if (psm == PSM_HID_INTERRUPT){ + if (psm == BLUETOOTH_PSM_HID_INTERRUPT){ hid_interrupt = local_cid; } if (hid_control && hid_interrupt){ @@ -217,8 +218,8 @@ int main (int argc, const char * argv[]){ return err; } bt_register_packet_handler(packet_handler); - bt_send_cmd(&l2cap_register_service_cmd, PSM_HID_CONTROL, 250); - bt_send_cmd(&l2cap_register_service_cmd, PSM_HID_INTERRUPT, 250); + bt_send_cmd(&l2cap_register_service_cmd, BLUETOOTH_PSM_HID_CONTROL, 250); + bt_send_cmd(&l2cap_register_service_cmd, BLUETOOTH_PSM_HID_INTERRUPT, 250); bt_send_cmd(&btstack_set_power_mode, HCI_POWER_ON ); btstack_run_loop_execute();