int btstack_main(int argc, const char * argv[]){ (void)argc; (void)argv; // register for HCI events hci_event_callback_registration.callback = &packet_handler; hci_add_event_handler(&hci_event_callback_registration); hci_register_sco_packet_handler(&packet_handler); gap_discoverable_control(1); gap_set_class_of_device(0x2540); gap_set_local_name("HID Mouse Demo 00:00:00:00:00:00"); // L2CAP l2cap_init(); // SDP Server sdp_init(); memset(hid_service_buffer, 0, sizeof(hid_service_buffer)); // hid sevice subclass 2540 Keyboard, hid counntry code 33 US, hid virtual cable off, hid reconnect initiate off, hid boot device off hid_create_sdp_record(hid_service_buffer, 0x10001, 0x2540, 33, 0, 0, 0, hid_descriptor_mouse_boot_mode, sizeof(hid_descriptor_mouse_boot_mode), hid_device_name); printf("SDP service record size: %u\n", de_get_len( hid_service_buffer)); sdp_register_service(hid_service_buffer); // HID Device hid_device_init(); hid_device_register_packet_handler(&packet_handler); #ifdef HAVE_BTSTACK_STDIN btstack_stdin_setup(stdin_process); #endif // turn on! hci_power_control(HCI_POWER_ON); return 0; }
int btstack_main(int argc, const char * argv[]){ gap_set_class_of_device(0x220404); gap_discoverable_control(1); /* Register for HCI events */ hci_event_callback_registration.callback = &packet_handler; hci_add_event_handler(&hci_event_callback_registration); l2cap_init(); l2cap_register_service(packet_handler, PSM_SDP, 100, LEVEL_0); // turn on! hci_power_control(HCI_POWER_ON); btstack_stdin_setup(stdin_process); return 0; }
int btstack_main(int argc, const char * argv[]){ UNUSED(argc); (void)argv; /* Register for HCI events */ hci_event_callback_registration.callback = &packet_handler; hci_add_event_handler(&hci_event_callback_registration); l2cap_init(); // Initialize AVDTP Sink avdtp_sink_init(&a2dp_sink_context); avdtp_sink_register_packet_handler(&packet_handler); avdtp_stream_endpoint_t * local_stream_endpoint = avdtp_sink_create_stream_endpoint(AVDTP_SINK, AVDTP_AUDIO); if (!local_stream_endpoint) { printf("AVDTP Sink: not enough memory to create local_stream_endpoint\n"); return 1; } local_seid = avdtp_local_seid(local_stream_endpoint); avdtp_sink_register_media_transport_category(local_seid); avdtp_sink_register_media_codec_category(local_seid, AVDTP_AUDIO, AVDTP_CODEC_SBC, media_sbc_codec_capabilities, sizeof(media_sbc_codec_capabilities)); avdtp_sink_register_media_handler(&handle_l2cap_media_data_packet); // Initialize SDP sdp_init(); memset(sdp_avdtp_sink_service_buffer, 0, sizeof(sdp_avdtp_sink_service_buffer)); a2dp_sink_create_sdp_record(sdp_avdtp_sink_service_buffer, 0x10001, 1, NULL, NULL); sdp_register_service(sdp_avdtp_sink_service_buffer); // printf("BTstack AVDTP Sink, supported features 0x%04x\n", ); gap_set_local_name("BTstack AVDTP Sink PTS 00:00:00:00:00:00"); gap_discoverable_control(1); gap_set_class_of_device(0x200408); #ifdef HAVE_BTSTACK_STDIN // parse human readable Bluetooth address sscanf_bd_addr(device_addr_string, device_addr); btstack_stdin_setup(stdin_process); #endif // turn on! hci_power_control(HCI_POWER_ON); return 0; }
int btstack_main(int argc, const char * argv[]){ UNUSED(argc); (void)argv; /* Register for HCI events */ hci_event_callback_registration.callback = &packet_handler; hci_add_event_handler(&hci_event_callback_registration); l2cap_init(); // Initialize AVDTP Sink avdtp_source_init(&a2dp_source_context); avdtp_source_register_packet_handler(&packet_handler); sc.local_stream_endpoint = a2dp_source_create_stream_endpoint(AVDTP_AUDIO, AVDTP_CODEC_SBC, (uint8_t *) media_sbc_codec_capabilities, sizeof(media_sbc_codec_capabilities), (uint8_t*) media_sbc_codec_configuration, sizeof(media_sbc_codec_configuration)); media_tracker.local_seid = avdtp_local_seid(sc.local_stream_endpoint); media_tracker.remote_seid = 1; // Initialize SDP sdp_init(); memset(sdp_avdtp_source_service_buffer, 0, sizeof(sdp_avdtp_source_service_buffer)); a2dp_source_create_sdp_record(sdp_avdtp_source_service_buffer, 0x10002, 1, NULL, NULL); sdp_register_service(sdp_avdtp_source_service_buffer); gap_set_local_name("BTstack AVDTP Source PTS 00:00:00:00:00:00"); gap_discoverable_control(1); gap_set_class_of_device(0x200408); sscanf_bd_addr(device_addr_string, device_addr); #ifdef HAVE_BTSTACK_STDIN // parse human readable Bluetooth address sscanf_bd_addr(device_addr_string, device_addr); btstack_stdin_setup(stdin_process); #endif // turn on! hci_power_control(HCI_POWER_ON); return 0; }
int btstack_main(int argc, const char * argv[]){ l2cap_init(); rfcomm_init(); hsp_hs_init(rfcomm_channel_nr); hsp_hs_register_packet_handler(packet_handler); sdp_init(); memset((uint8_t *)hsp_service_buffer, 0, sizeof(hsp_service_buffer)); hsp_hs_create_sdp_record((uint8_t *)hsp_service_buffer, 0x10004, rfcomm_channel_nr, hsp_hs_service_name, 0); sdp_register_service((uint8_t *)hsp_service_buffer); gap_discoverable_control(1); gap_set_class_of_device(0x200418); gap_set_local_name("BTstack HSP HS PTS"); btstack_stdin_setup(stdin_process); // turn on! hci_power_control(HCI_POWER_ON); return 0; }