1 2 /* 3 * Copyright (C) 2014 BlueKitchen GmbH 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 3. Neither the name of the copyright holders nor the names of 15 * contributors may be used to endorse or promote products derived 16 * from this software without specific prior written permission. 17 * 4. Any redistribution, use, or modification is done solely for 18 * personal benefit and not for any commercial purpose or for 19 * monetary gain. 20 * 21 * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS 22 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 24 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS 25 * RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 27 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 28 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 29 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 30 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 31 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 * SUCH DAMAGE. 33 * 34 * Please inquire about commercial licensing options at 35 * [email protected] 36 * 37 */ 38 39 /* 40 * hfp_hs_demo.c 41 */ 42 43 // ***************************************************************************** 44 /* EXAMPLE_START(hfp_hs_demo): HFP Hands-Free (HF) Demo 45 * 46 * @text This HFP Hands-Free example demonstrates how to receive 47 * an output from a remote HFP audio gateway (AG), and, 48 * if HAVE_POSIX_STDIN is defined, how to control the HFP AG. 49 */ 50 // ***************************************************************************** 51 52 53 #include "btstack_config.h" 54 55 #include <stdint.h> 56 #include <stdio.h> 57 #include <stdlib.h> 58 #include <string.h> 59 #include <unistd.h> 60 61 #include "btstack.h" 62 63 #include "sco_demo_util.h" 64 #ifdef HAVE_POSIX_STDIN 65 #include "stdin_support.h" 66 #endif 67 68 uint8_t hfp_service_buffer[150]; 69 const uint8_t rfcomm_channel_nr = 1; 70 const char hfp_hf_service_name[] = "BTstack HFP HF Demo"; 71 72 #ifdef HAVE_POSIX_STDIN 73 static bd_addr_t device_addr = {0x80,0xbe,0x05,0xd5,0x28,0x48}; 74 // 80:BE:05:D5:28:48 75 // prototypes 76 static void show_usage(void); 77 #endif 78 static hci_con_handle_t acl_handle = -1; 79 static hci_con_handle_t sco_handle; 80 static uint8_t codecs[] = {HFP_CODEC_CVSD, HFP_CODEC_MSBC}; 81 static uint16_t indicators[1] = {0x01}; 82 static uint8_t negotiated_codec = HFP_CODEC_CVSD; 83 char cmd; 84 85 86 #ifdef HAVE_POSIX_STDIN 87 88 // Testig User Interface 89 static void show_usage(void){ 90 bd_addr_t iut_address; 91 gap_local_bd_addr(iut_address); 92 93 printf("\n--- Bluetooth HFP Hands-Free (HF) unit Test Console %s ---\n", bd_addr_to_str(iut_address)); 94 printf("---\n"); 95 96 printf("a - establish SLC connection to device %s\n", bd_addr_to_str(device_addr)); 97 printf("A - release SLC connection to device\n"); 98 99 printf("b - establish Audio connection\n"); 100 printf("B - release Audio connection\n"); 101 102 printf("c - disable registration status update for all AG indicators\n"); 103 printf("C - enable registration status update for all AG indicators\n"); 104 105 printf("d - query network operator.\n"); 106 printf("D - set HFP AG registration status update for individual indicators (IIA)\n"); 107 108 printf("e - disable reporting of the extended AG error result code\n"); 109 printf("E - enable reporting of the extended AG error result code\n"); 110 111 printf("f - answer incoming call\n"); 112 printf("F - Hangup call\n"); 113 114 printf("g - query network operator name\n"); 115 printf("G - reject incoming call\n"); 116 117 printf("i - dial 1234567\n"); 118 printf("I - dial 7654321\n"); 119 120 printf("j - dial #1\n"); 121 printf("J - dial #99\n"); 122 123 printf("k - deactivate call waiting notification\n"); 124 printf("K - activate call waiting notification\n"); 125 126 printf("l - deactivate calling line notification\n"); 127 printf("L - activate calling line notification\n"); 128 129 printf("m - deactivate echo canceling and noise reduction\n"); 130 printf("M - activate echo canceling and noise reduction\n"); 131 132 printf("n - deactivate voice recognition\n"); 133 printf("N - activate voice recognition\n"); 134 135 printf("o - Set speaker volume to 0 (minimum)\n"); 136 printf("O - Set speaker volume to 9 (default)\n"); 137 printf("p - Set speaker volume to 12 (higher)\n"); 138 printf("P - Set speaker volume to 15 (maximum)\n"); 139 140 printf("q - Set microphone gain to 0 (minimum)\n"); 141 printf("Q - Set microphone gain to 9 (default)\n"); 142 printf("s - Set microphone gain to 12 (higher)\n"); 143 printf("S - Set microphone gain to 15 (maximum)\n"); 144 145 printf("t - terminate connection\n"); 146 147 printf("u - send 'user busy' (TWC 0)\n"); 148 printf("U - end active call and accept other call' (TWC 1)\n"); 149 printf("v - Swap active call and hold/waiting call (TWC 2)\n"); 150 printf("V - Join held call (TWC 3)\n"); 151 printf("w - Connect calls (TWC 4)\n"); 152 printf("W - redial\n"); 153 154 printf("0123456789#*-+ - send DTMF dial tones\n"); 155 156 printf("x - request phone number for voice tag\n"); 157 printf("X - current call status (ECS)\n"); 158 printf("y - release call with index 2 (ECC)\n"); 159 printf("Y - private consulation with call 2(ECC)\n"); 160 161 printf("[ - Query Response and Hold status (RHH ?)\n"); 162 printf("] - Place call in a response and held state(RHH 0)\n"); 163 printf("{ - Accept held call(RHH 1)\n"); 164 printf("} - Reject held call(RHH 2)\n"); 165 166 printf("? - Query Subscriber Number (NUM)\n"); 167 168 printf("! - Update HF indicator with assigned number 1 (HFI)\n"); 169 170 printf("---\n"); 171 printf("Ctrl-c - exit\n"); 172 printf("---\n"); 173 } 174 175 static void stdin_process(btstack_data_source_t *ds, btstack_data_source_callback_type_t callback_type){ 176 read(ds->fd, &cmd, 1); 177 178 if (cmd >= '0' && cmd <= '9'){ 179 printf("DTMF Code: %c\n", cmd); 180 hfp_hf_send_dtmf_code(acl_handle, cmd); 181 return; 182 } 183 184 switch (cmd){ 185 case '#': 186 case '-': 187 case '+': 188 case '*': 189 log_info("USER:\'%c\'", cmd); 190 printf("DTMF Code: %c\n", cmd); 191 hfp_hf_send_dtmf_code(acl_handle, cmd); 192 break; 193 case 'a': 194 log_info("USER:\'%c\'", cmd); 195 printf("Establish Service level connection to device with Bluetooth address %s...\n", bd_addr_to_str(device_addr)); 196 hfp_hf_establish_service_level_connection(device_addr); 197 break; 198 case 'A': 199 log_info("USER:\'%c\'", cmd); 200 printf("Release Service level connection.\n"); 201 hfp_hf_release_service_level_connection(acl_handle); 202 break; 203 case 'b': 204 log_info("USER:\'%c\'", cmd); 205 printf("Establish Audio connection to device with Bluetooth address %s...\n", bd_addr_to_str(device_addr)); 206 hfp_hf_establish_audio_connection(acl_handle); 207 break; 208 case 'B': 209 log_info("USER:\'%c\'", cmd); 210 printf("Release Audio service level connection.\n"); 211 hfp_hf_release_audio_connection(acl_handle); 212 break; 213 case 'C': 214 log_info("USER:\'%c\'", cmd); 215 printf("Enable registration status update for all AG indicators.\n"); 216 hfp_hf_enable_status_update_for_all_ag_indicators(acl_handle); 217 case 'c': 218 log_info("USER:\'%c\'", cmd); 219 printf("Disable registration status update for all AG indicators.\n"); 220 hfp_hf_disable_status_update_for_all_ag_indicators(acl_handle); 221 break; 222 case 'D': 223 log_info("USER:\'%c\'", cmd); 224 printf("Set HFP AG registration status update for individual indicators (0111111).\n"); 225 hfp_hf_set_status_update_for_individual_ag_indicators(acl_handle, 63); 226 break; 227 case 'd': 228 log_info("USER:\'%c\'", cmd); 229 printf("Query network operator.\n"); 230 hfp_hf_query_operator_selection(acl_handle); 231 break; 232 case 'E': 233 log_info("USER:\'%c\'", cmd); 234 printf("Enable reporting of the extended AG error result code.\n"); 235 hfp_hf_enable_report_extended_audio_gateway_error_result_code(acl_handle); 236 break; 237 case 'e': 238 log_info("USER:\'%c\'", cmd); 239 printf("Disable reporting of the extended AG error result code.\n"); 240 hfp_hf_disable_report_extended_audio_gateway_error_result_code(acl_handle); 241 break; 242 case 'f': 243 log_info("USER:\'%c\'", cmd); 244 printf("Answer incoming call.\n"); 245 hfp_hf_answer_incoming_call(acl_handle); 246 break; 247 case 'F': 248 log_info("USER:\'%c\'", cmd); 249 printf("Hangup call.\n"); 250 hfp_hf_terminate_call(acl_handle); 251 break; 252 case 'G': 253 log_info("USER:\'%c\'", cmd); 254 printf("Reject incoming call.\n"); 255 hfp_hf_reject_incoming_call(acl_handle); 256 break; 257 case 'g': 258 log_info("USER:\'%c\'", cmd); 259 printf("Query operator.\n"); 260 hfp_hf_query_operator_selection(acl_handle); 261 break; 262 case 't': 263 log_info("USER:\'%c\'", cmd); 264 printf("Terminate HCI connection.\n"); 265 gap_disconnect(acl_handle); 266 break; 267 case 'i': 268 log_info("USER:\'%c\'", cmd); 269 printf("Dial 1234567\n"); 270 hfp_hf_dial_number(acl_handle, "1234567"); 271 break; 272 case 'I': 273 log_info("USER:\'%c\'", cmd); 274 printf("Dial 7654321\n"); 275 hfp_hf_dial_number(acl_handle, "7654321"); 276 break; 277 case 'j': 278 log_info("USER:\'%c\'", cmd); 279 printf("Dial #1\n"); 280 hfp_hf_dial_memory(acl_handle,1); 281 break; 282 case 'J': 283 log_info("USER:\'%c\'", cmd); 284 printf("Dial #99\n"); 285 hfp_hf_dial_memory(acl_handle,99); 286 break; 287 case 'k': 288 log_info("USER:\'%c\'", cmd); 289 printf("Deactivate call waiting notification\n"); 290 hfp_hf_deactivate_call_waiting_notification(acl_handle); 291 break; 292 case 'K': 293 log_info("USER:\'%c\'", cmd); 294 printf("Activate call waiting notification\n"); 295 hfp_hf_activate_call_waiting_notification(acl_handle); 296 break; 297 case 'l': 298 log_info("USER:\'%c\'", cmd); 299 printf("Deactivate calling line notification\n"); 300 hfp_hf_deactivate_calling_line_notification(acl_handle); 301 break; 302 case 'L': 303 log_info("USER:\'%c\'", cmd); 304 printf("Activate calling line notification\n"); 305 hfp_hf_activate_calling_line_notification(acl_handle); 306 break; 307 case 'm': 308 log_info("USER:\'%c\'", cmd); 309 printf("Deactivate echo canceling and noise reduction\n"); 310 hfp_hf_deactivate_echo_canceling_and_noise_reduction(acl_handle); 311 break; 312 case 'M': 313 log_info("USER:\'%c\'", cmd); 314 printf("Activate echo canceling and noise reduction\n"); 315 hfp_hf_activate_echo_canceling_and_noise_reduction(acl_handle); 316 break; 317 case 'n': 318 log_info("USER:\'%c\'", cmd); 319 printf("Deactivate voice recognition\n"); 320 hfp_hf_deactivate_voice_recognition_notification(acl_handle); 321 break; 322 case 'N': 323 log_info("USER:\'%c\'", cmd); 324 printf("Activate voice recognition %s\n", bd_addr_to_str(device_addr)); 325 hfp_hf_activate_voice_recognition_notification(acl_handle); 326 break; 327 case 'o': 328 log_info("USER:\'%c\'", cmd); 329 printf("Set speaker gain to 0 (minimum)\n"); 330 hfp_hf_set_speaker_gain(acl_handle, 0); 331 break; 332 case 'O': 333 log_info("USER:\'%c\'", cmd); 334 printf("Set speaker gain to 9 (default)\n"); 335 hfp_hf_set_speaker_gain(acl_handle, 9); 336 break; 337 case 'p': 338 log_info("USER:\'%c\'", cmd); 339 printf("Set speaker gain to 12 (higher)\n"); 340 hfp_hf_set_speaker_gain(acl_handle, 12); 341 break; 342 case 'P': 343 log_info("USER:\'%c\'", cmd); 344 printf("Set speaker gain to 15 (maximum)\n"); 345 hfp_hf_set_speaker_gain(acl_handle, 15); 346 break; 347 case 'q': 348 log_info("USER:\'%c\'", cmd); 349 printf("Set microphone gain to 0\n"); 350 hfp_hf_set_microphone_gain(acl_handle, 0); 351 break; 352 case 'Q': 353 log_info("USER:\'%c\'", cmd); 354 printf("Set microphone gain to 9\n"); 355 hfp_hf_set_microphone_gain(acl_handle, 9); 356 break; 357 case 's': 358 log_info("USER:\'%c\'", cmd); 359 printf("Set microphone gain to 12\n"); 360 hfp_hf_set_microphone_gain(acl_handle, 12); 361 break; 362 case 'S': 363 log_info("USER:\'%c\'", cmd); 364 printf("Set microphone gain to 15\n"); 365 hfp_hf_set_microphone_gain(acl_handle, 15); 366 break; 367 case 'u': 368 log_info("USER:\'%c\'", cmd); 369 printf("Send 'user busy' (Three-Way Call 0)\n"); 370 hfp_hf_user_busy(acl_handle); 371 break; 372 case 'U': 373 log_info("USER:\'%c\'", cmd); 374 printf("End active call and accept waiting/held call (Three-Way Call 1)\n"); 375 hfp_hf_end_active_and_accept_other(acl_handle); 376 break; 377 case 'v': 378 log_info("USER:\'%c\'", cmd); 379 printf("Swap active call and hold/waiting call (Three-Way Call 2)\n"); 380 hfp_hf_swap_calls(acl_handle); 381 break; 382 case 'V': 383 log_info("USER:\'%c\'", cmd); 384 printf("Join hold call (Three-Way Call 3)\n"); 385 hfp_hf_join_held_call(acl_handle); 386 break; 387 case 'w': 388 log_info("USER:\'%c\'", cmd); 389 printf("Connect calls (Three-Way Call 4)\n"); 390 hfp_hf_connect_calls(acl_handle); 391 break; 392 case 'W': 393 log_info("USER:\'%c\'", cmd); 394 printf("Redial\n"); 395 hfp_hf_redial_last_number(acl_handle); 396 break; 397 case 'x': 398 log_info("USER:\'%c\'", cmd); 399 printf("Request phone number for voice tag\n"); 400 hfp_hf_request_phone_number_for_voice_tag(acl_handle); 401 break; 402 case 'X': 403 log_info("USER:\'%c\'", cmd); 404 printf("Query current call status\n"); 405 hfp_hf_query_current_call_status(acl_handle); 406 break; 407 case 'y': 408 log_info("USER:\'%c\'", cmd); 409 printf("Release call with index 2\n"); 410 hfp_hf_release_call_with_index(acl_handle, 2); 411 break; 412 case 'Y': 413 log_info("USER:\'%c\'", cmd); 414 printf("Private consulation with call 2\n"); 415 hfp_hf_private_consultation_with_call(acl_handle, 2); 416 break; 417 case '[': 418 log_info("USER:\'%c\'", cmd); 419 printf("Query Response and Hold status (RHH ?)\n"); 420 hfp_hf_rrh_query_status(acl_handle); 421 break; 422 case ']': 423 log_info("USER:\'%c\'", cmd); 424 printf("Place call in a response and held state (RHH 0)\n"); 425 hfp_hf_rrh_hold_call(acl_handle); 426 break; 427 case '{': 428 log_info("USER:\'%c\'", cmd); 429 printf("Accept held call (RHH 1)\n"); 430 hfp_hf_rrh_accept_held_call(acl_handle); 431 break; 432 case '}': 433 log_info("USER:\'%c\'", cmd); 434 printf("Reject held call (RHH 2)\n"); 435 hfp_hf_rrh_reject_held_call(acl_handle); 436 break; 437 case '?': 438 log_info("USER:\'%c\'", cmd); 439 printf("Query Subscriber Number\n"); 440 hfp_hf_query_subscriber_number(acl_handle); 441 break; 442 case '!': 443 log_info("USER:\'%c\'", cmd); 444 printf("Update HF indicator with assigned number 1 (HFI)\n"); 445 hfp_hf_set_hf_indicator(acl_handle, 1, 1); 446 break; 447 448 default: 449 show_usage(); 450 break; 451 } 452 } 453 #endif 454 455 static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t * event, uint16_t event_size){ 456 457 switch (packet_type){ 458 459 case HCI_SCO_DATA_PACKET: 460 sco_demo_receive(event, event_size); 461 break; 462 463 case HCI_EVENT_PACKET: 464 switch (event[0]){ 465 case HCI_EVENT_SCO_CAN_SEND_NOW: 466 sco_demo_send(sco_handle); 467 break; 468 469 case HCI_EVENT_HFP_META: 470 switch (event[2]) { 471 case HFP_SUBEVENT_SERVICE_LEVEL_CONNECTION_ESTABLISHED: 472 acl_handle = hfp_subevent_service_level_connection_established_get_con_handle(event); 473 hfp_subevent_service_level_connection_established_get_bd_addr(event, device_addr); 474 printf("Service level connection established %s.\n\n", bd_addr_to_str(device_addr)); 475 if (hci_extended_sco_link_supported()){ 476 printf("Supported Codecs: CVSD, mSBC.\n"); 477 } else { 478 printf("Supported Codecs: CVSD. mSBC disabled, eSCO not supported by controller).\n"); 479 } 480 break; 481 case HFP_SUBEVENT_SERVICE_LEVEL_CONNECTION_RELEASED: 482 printf("Service level connection released.\n\n"); 483 break; 484 case HFP_SUBEVENT_AUDIO_CONNECTION_ESTABLISHED: 485 if (hfp_subevent_audio_connection_established_get_status(event)){ 486 sco_handle = 0; 487 printf("Audio connection establishment failed with status %u\n", hfp_subevent_audio_connection_established_get_status(event)); 488 } else { 489 sco_handle = hfp_subevent_audio_connection_established_get_handle(event); 490 printf("Audio connection established with SCO handle 0x%04x.\n", sco_handle); 491 negotiated_codec = hfp_subevent_audio_connection_established_get_negotiated_codec(event); 492 printf("Using codec 0x%02x.\n", negotiated_codec); 493 sco_demo_set_codec(negotiated_codec); 494 hci_request_sco_can_send_now_event(); 495 } 496 break; 497 case HFP_SUBEVENT_AUDIO_CONNECTION_RELEASED: 498 sco_handle = 0; 499 printf("Audio connection released\n"); 500 sco_demo_close(); 501 break; 502 case HFP_SUBEVENT_COMPLETE: 503 switch (cmd){ 504 case 'd': 505 printf("HFP AG registration status update enabled.\n"); 506 break; 507 case 'e': 508 printf("HFP AG registration status update for individual indicators set.\n"); 509 default: 510 break; 511 } 512 break; 513 case HFP_SUBEVENT_AG_INDICATOR_STATUS_CHANGED: 514 printf("AG_INDICATOR_STATUS_CHANGED, AG indicator '%s' (index: %d) to: %d\n", (const char*) &event[5], event[3], event[4]); 515 break; 516 case HFP_SUBEVENT_NETWORK_OPERATOR_CHANGED: 517 printf("NETWORK_OPERATOR_CHANGED, operator mode: %d, format: %d, name: %s\n", event[3], event[4], (char *) &event[5]); 518 break; 519 case HFP_SUBEVENT_EXTENDED_AUDIO_GATEWAY_ERROR: 520 printf("EXTENDED_AUDIO_GATEWAY_ERROR_REPORT, status : %d\n", event[3]); 521 break; 522 case HFP_SUBEVENT_RING: 523 printf("** Ring **\n"); 524 break; 525 case HFP_SUBEVENT_NUMBER_FOR_VOICE_TAG: 526 printf("Phone number for voice tag: %s\n", (const char *) &event[3]); 527 break; 528 case HFP_SUBEVENT_SPEAKER_VOLUME: 529 printf("Speaker volume: %u\n", event[3]); 530 break; 531 case HFP_SUBEVENT_MICROPHONE_VOLUME: 532 printf("Microphone volume: %u\n", event[3]); 533 break; 534 default: 535 printf("event not handled %u\n", event[2]); 536 break; 537 } 538 break; 539 540 default: 541 break; 542 } 543 break; 544 545 default: 546 break; 547 } 548 549 if (event[0] != HCI_EVENT_HFP_META) return; 550 } 551 552 /* @section Main Application Setup 553 * 554 * @text Listing MainConfiguration shows main application code. 555 * To run a HFP HF service you need to initialize the SDP, and to create and register HFP HF record with it. 556 * The packet_handler is used for sending commands to the HFP AG. It also receives the HFP AG's answers. 557 * The stdin_process callback allows for sending commands to the HFP AG. 558 * At the end the Bluetooth stack is started. 559 */ 560 561 /* LISTING_START(MainConfiguration): Setup HFP Hands-Free unit */ 562 int btstack_main(int argc, const char * argv[]); 563 int btstack_main(int argc, const char * argv[]){ 564 sco_demo_init(); 565 gap_discoverable_control(1); 566 567 // HFP AG address is hardcoded, please change it 568 // init L2CAP 569 l2cap_init(); 570 rfcomm_init(); 571 sdp_init(); 572 573 uint16_t hf_supported_features = 574 (1<<HFP_HFSF_ESCO_S4) | 575 (1<<HFP_HFSF_HF_INDICATORS) | 576 (1<<HFP_HFSF_CODEC_NEGOTIATION) | 577 (1<<HFP_HFSF_ENHANCED_CALL_STATUS) | 578 (1<<HFP_HFSF_REMOTE_VOLUME_CONTROL); 579 int wide_band_speech = 1; 580 581 hfp_hf_init(rfcomm_channel_nr); 582 hfp_hf_init_supported_features(hf_supported_features); 583 hfp_hf_init_hf_indicators(sizeof(indicators)/sizeof(uint16_t), indicators); 584 hfp_hf_init_codecs(sizeof(codecs), codecs); 585 586 hfp_hf_register_packet_handler(packet_handler); 587 hci_register_sco_packet_handler(&packet_handler); 588 589 memset(hfp_service_buffer, 0, sizeof(hfp_service_buffer)); 590 hfp_hf_create_sdp_record(hfp_service_buffer, 0x10001, rfcomm_channel_nr, hfp_hf_service_name, hf_supported_features, wide_band_speech); 591 printf("SDP service record size: %u\n", de_get_len(hfp_service_buffer)); 592 sdp_register_service(hfp_service_buffer); 593 gap_set_class_of_device(0x200408); 594 595 #ifdef HAVE_POSIX_STDIN 596 btstack_stdin_setup(stdin_process); 597 #endif 598 // turn on! 599 hci_power_control(HCI_POWER_ON); 600 return 0; 601 } 602 /* LISTING_END */ 603 /* EXAMPLE_END */ 604