diff --git a/example/hsp_ag_demo.c b/example/hsp_ag_demo.c index cc92a82f4..bb2be61be 100644 --- a/example/hsp_ag_demo.c +++ b/example/hsp_ag_demo.c @@ -334,7 +334,7 @@ int btstack_main(int argc, const char * argv[]){ gap_set_local_name("BTstack HSP AG"); gap_discoverable_control(1); gap_ssp_set_io_capability(SSP_IO_CAPABILITY_DISPLAY_YES_NO); - hci_set_class_of_device(0x400204); + gap_set_class_of_device(0x400204); // turn on! hci_power_control(HCI_POWER_ON); diff --git a/example/hsp_hs_demo.c b/example/hsp_hs_demo.c index 7cd0d7f5d..d48d19cf6 100644 --- a/example/hsp_hs_demo.c +++ b/example/hsp_hs_demo.c @@ -343,7 +343,7 @@ int btstack_main(int argc, const char * argv[]){ gap_set_local_name("BTstack HSP HS"); gap_discoverable_control(1); gap_ssp_set_io_capability(SSP_IO_CAPABILITY_DISPLAY_YES_NO); - hci_set_class_of_device(0x240404); + gap_set_class_of_device(0x240404); // turn on! hci_power_control(HCI_POWER_ON); diff --git a/src/gap.h b/src/gap.h index 51de2f7f7..843e56285 100644 --- a/src/gap.h +++ b/src/gap.h @@ -128,6 +128,12 @@ gap_connection_type_t gap_get_connection_type(hci_con_handle_t connection_handle */ void gap_set_local_name(const char * local_name); +/** + * @brief Set class of device that will be set during Bluetooth init. + * @note has to be done before stack starts up + */ +void gap_set_class_of_device(uint32_t class_of_device); + /** * @brief Enable/disable bonding. Default is enabled. * @param enabled diff --git a/src/hci.c b/src/hci.c index 0928ba9ee..38c9898da 100644 --- a/src/hci.c +++ b/src/hci.c @@ -1997,7 +1997,7 @@ void hci_close(void){ hci_stack = NULL; } -void hci_set_class_of_device(uint32_t class_of_device){ +void gap_set_class_of_device(uint32_t class_of_device){ hci_stack->class_of_device = class_of_device; } diff --git a/src/hci.h b/src/hci.h index 16c6a3de6..07a144ee1 100644 --- a/src/hci.h +++ b/src/hci.h @@ -690,11 +690,6 @@ void hci_set_control(const btstack_control_t *hardware_control); */ void hci_set_link_key_db(btstack_link_key_db_t const * link_key_db); -/** - * @brief Set class of device that will be set during Bluetooth init. - */ -void hci_set_class_of_device(uint32_t class_of_device); - /** * @brief Set callback for Bluetooth Hardware Error */ diff --git a/test/pts/classic_test.c b/test/pts/classic_test.c index f08728c12..5ae6471c0 100644 --- a/test/pts/classic_test.c +++ b/test/pts/classic_test.c @@ -761,12 +761,14 @@ int btstack_main(int argc, const char * argv[]){ printf("Starting up..\n"); - hci_set_class_of_device(0x220404); hci_disable_l2cap_timeout_check(); + + gap_set_class_of_device(0x220404); gap_ssp_set_io_capability(IO_CAPABILITY_NO_INPUT_NO_OUTPUT); gap_io_capabilities = "IO_CAPABILITY_NO_INPUT_NO_OUTPUT"; gap_ssp_set_authentication_requirement(0); gap_ssp_set_auto_accept(0); + update_auth_req(); // register for HCI events diff --git a/test/pts/hsp_hs_test.c b/test/pts/hsp_hs_test.c index 00485707c..992103db7 100644 --- a/test/pts/hsp_hs_test.c +++ b/test/pts/hsp_hs_test.c @@ -226,7 +226,7 @@ int btstack_main(int argc, const char * argv[]){ sdp_register_service((uint8_t *)hsp_service_buffer); gap_discoverable_control(1); - hci_set_class_of_device(0x200418); + gap_set_class_of_device(0x200418); gap_set_local_name("BTstack HSP HS PTS"); btstack_stdin_setup(stdin_process); diff --git a/test/pts/iopt.c b/test/pts/iopt.c index 454cdddee..ec7193dc2 100644 --- a/test/pts/iopt.c +++ b/test/pts/iopt.c @@ -87,9 +87,6 @@ static uint8_t hfp_hf_service_buffer[200]; // rfcomm 5 int btstack_main(int argc, const char * argv[]); int btstack_main(int argc, const char * argv[]){ - hci_set_class_of_device(0x220404); - gap_discoverable_control(1); - l2cap_init(); sdp_init(); @@ -116,7 +113,9 @@ int btstack_main(int argc, const char * argv[]){ sdp_register_service((uint8_t *)hfp_hf_service_buffer); // set CoD for all this - hci_set_class_of_device(0x6A0000); // Networking, Capturing, Audio, Telehpony / Misc + gap_set_class_of_device(0x6A0000); // Networking, Capturing, Audio, Telehpony / Misc + + gap_discoverable_control(1); // turn on! hci_power_control(HCI_POWER_ON); diff --git a/test/pts/l2cap_test.c b/test/pts/l2cap_test.c index 7f6968ef1..3fe86fbca 100644 --- a/test/pts/l2cap_test.c +++ b/test/pts/l2cap_test.c @@ -155,7 +155,7 @@ static int stdin_process(btstack_data_source_t *ds){ int btstack_main(int argc, const char * argv[]); int btstack_main(int argc, const char * argv[]){ - hci_set_class_of_device(0x220404); + gap_set_class_of_device(0x220404); gap_discoverable_control(1); /* Register for HCI events */ diff --git a/tool/migration_to_v1.0/migration.sed b/tool/migration_to_v1.0/migration.sed index f9905675b..b8e7a23bf 100644 --- a/tool/migration_to_v1.0/migration.sed +++ b/tool/migration_to_v1.0/migration.sed @@ -72,6 +72,7 @@ s/bt_store_24/little_endian_store_24/g s/bt_store_32/little_endian_store_32/g s/hci_discoverable_control/gap_discoverable_control/g s/hci_ssp_set_io_capability/gap_ssp_set_io_capability/g +s/hci_set_class_of_device/gap_set_class_of_device/g s/le_central_connect/gap_connect/g s/le_central_connect_cancel/gap_connect_cancel/g s/le_central_set_scan_parameters/gap_set_scan_parameters/g