hfp_hf.c (d703d377e15b680e2fb5455f041abf0c7e136524) | hfp_hf.c (cb81d35d7c3b357e822fcc8ed88aa49b7661232f) |
---|---|
1/* 2 * Copyright (C) 2014 BlueKitchen GmbH 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright --- 590 unchanged lines hidden (view full) --- 599#endif 600#if defined (ENABLE_CC256X_ASSISTED_HFP) || defined (ENABLE_BCM_PCM_WBS) 601 if (hfp_connection->state == HFP_W4_WBS_SHUTDOWN){ 602 hfp_finalize_connection_context(hfp_connection); 603 return; 604 } 605#endif 606 | 1/* 2 * Copyright (C) 2014 BlueKitchen GmbH 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright --- 590 unchanged lines hidden (view full) --- 599#endif 600#if defined (ENABLE_CC256X_ASSISTED_HFP) || defined (ENABLE_BCM_PCM_WBS) 601 if (hfp_connection->state == HFP_W4_WBS_SHUTDOWN){ 602 hfp_finalize_connection_context(hfp_connection); 603 return; 604 } 605#endif 606 |
607 if (hfp_connection->hf_accept_sco){ 608 609 bool eSCO = hfp_connection->hf_accept_sco == 2; 610 hfp_connection->hf_accept_sco = 0; 611 | 607 if (hfp_connection->accept_sco){ 608 bool incoming_eSCO = hfp_connection->accept_sco == 2; 609 hfp_connection->accept_sco = 0; |
612 // notify about codec selection if not done already 613 if (hfp_connection->negotiated_codec == 0){ 614 hfp_connection->negotiated_codec = HFP_CODEC_CVSD; 615 } | 610 // notify about codec selection if not done already 611 if (hfp_connection->negotiated_codec == 0){ 612 hfp_connection->negotiated_codec = HFP_CODEC_CVSD; 613 } |
616 617 // remote supported feature eSCO is set if link type is eSCO 618 // eSCO: S4 - max latency == transmission interval = 0x000c == 12 ms, 619 uint16_t max_latency; 620 uint8_t retransmission_effort; 621 uint16_t packet_types; 622 623 if (eSCO && hci_extended_sco_link_supported() && hci_remote_esco_supported(hfp_connection->acl_handle)){ 624 max_latency = 0x000c; 625 retransmission_effort = 0x02; 626 // eSCO: EV3 and 2-EV3 627 packet_types = 0x0048; 628 } else { 629 max_latency = 0xffff; 630 retransmission_effort = 0xff; 631 // sco: HV1 and HV3 632 packet_types = 0x005; 633 } 634 635 // mSBC only allows for transparent data 636 uint16_t sco_voice_setting = hci_get_sco_voice_setting(); 637 if (hfp_connection->negotiated_codec == HFP_CODEC_MSBC){ 638#ifdef ENABLE_BCM_PCM_WBS 639 sco_voice_setting = 0x0063; // Transparent data, 16-bit for BCM controllers 640#else 641 sco_voice_setting = 0x0043; // Transparent data, 8-bit otherwise 642#endif 643 } 644 645 // filter packet types 646 packet_types &= hfp_get_sco_packet_types(); 647 648 // bits 6-9 are 'don't allow' 649 packet_types ^= 0x3c0; 650 651 log_info("HFP: sending hci_accept_connection_request, packet types 0x%04x, sco_voice_setting 0x%02x", packet_types, sco_voice_setting); 652 hci_send_cmd(&hci_accept_synchronous_connection, hfp_connection->remote_addr, 8000, 8000, max_latency, 653 sco_voice_setting, retransmission_effort, packet_types); | 614 hfp_accept_synchronous_connection(hfp_connection, incoming_eSCO); |
654 return; 655 } 656 657 if (!rfcomm_can_send_packet_now(hfp_connection->rfcomm_cid)) { 658 rfcomm_request_can_send_now_event(hfp_connection->rfcomm_cid); 659 return; 660 } 661 int done = hfp_hf_run_for_context_service_level_connection(hfp_connection); --- 1196 unchanged lines hidden --- | 615 return; 616 } 617 618 if (!rfcomm_can_send_packet_now(hfp_connection->rfcomm_cid)) { 619 rfcomm_request_can_send_now_event(hfp_connection->rfcomm_cid); 620 return; 621 } 622 int done = hfp_hf_run_for_context_service_level_connection(hfp_connection); --- 1196 unchanged lines hidden --- |