hfp_hf.c (2b99f6edb79273b515105c989b97a7ddce9e5415) hfp_hf.c (c169df2f885b47a4b0894cfd04e316df94bbf2f2)
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

--- 579 unchanged lines hidden (view full) ---

588
589 if (hfp_connection->local_role != HFP_ROLE_HF) {
590 log_info("HFP HF%p, wrong role %u", hfp_connection, hfp_connection->local_role);
591 return;
592 }
593
594 if (hfp_connection->hf_accept_sco && hci_can_send_command_packet_now()){
595
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

--- 579 unchanged lines hidden (view full) ---

588
589 if (hfp_connection->local_role != HFP_ROLE_HF) {
590 log_info("HFP HF%p, wrong role %u", hfp_connection, hfp_connection->local_role);
591 return;
592 }
593
594 if (hfp_connection->hf_accept_sco && hci_can_send_command_packet_now()){
595
596 bool eSCO = hfp_connection->hf_accept_sco == 2;
596 hfp_connection->hf_accept_sco = 0;
597
598 // notify about codec selection if not done already
599 if (hfp_connection->negotiated_codec == 0){
600 hfp_connection->negotiated_codec = HFP_CODEC_CVSD;
601 }
602
603 // remote supported feature eSCO is set if link type is eSCO
604 // eSCO: S4 - max latency == transmission interval = 0x000c == 12 ms,
605 uint16_t max_latency;
606 uint8_t retransmission_effort;
607 uint16_t packet_types;
608
597 hfp_connection->hf_accept_sco = 0;
598
599 // notify about codec selection if not done already
600 if (hfp_connection->negotiated_codec == 0){
601 hfp_connection->negotiated_codec = HFP_CODEC_CVSD;
602 }
603
604 // remote supported feature eSCO is set if link type is eSCO
605 // eSCO: S4 - max latency == transmission interval = 0x000c == 12 ms,
606 uint16_t max_latency;
607 uint8_t retransmission_effort;
608 uint16_t packet_types;
609
609 if (hci_extended_sco_link_supported() && hci_remote_esco_supported(hfp_connection->acl_handle)){
610 if (eSCO && hci_extended_sco_link_supported() && hci_remote_esco_supported(hfp_connection->acl_handle)){
610 max_latency = 0x000c;
611 retransmission_effort = 0x02;
612 packet_types = 0x388;
613 } else {
614 max_latency = 0xffff;
615 retransmission_effort = 0xff;
616 packet_types = 0x003f;
617 }

--- 1121 unchanged lines hidden ---
611 max_latency = 0x000c;
612 retransmission_effort = 0x02;
613 packet_types = 0x388;
614 } else {
615 max_latency = 0xffff;
616 retransmission_effort = 0xff;
617 packet_types = 0x003f;
618 }

--- 1121 unchanged lines hidden ---