Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit aaff2a10 authored by Josh Wu's avatar Josh Wu
Browse files

HFP: Refactor HFP version flags

* Move common HFP flags to `bta_hfp_api.h`
* Let HF Client always reads BTA_HFP_VERSION for SDP advertising

Tag: #feature
Bug: 176778277
Test: atest BluetoothInstrumentationTests
Change-Id: Ie96668df4bd5480b2bae6ad55e025bee543bdd0b
parent a62a0109
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -25,10 +25,6 @@
/*****************************************************************************
 *  Constants
 ****************************************************************************/
#define HFP_VERSION_1_1 0x0101
#define HFP_VERSION_1_5 0x0105
#define HFP_VERSION_1_6 0x0106
#define HFP_VERSION_1_7 0x0107

/* RFCOMM MTU SIZE */
#define BTA_HF_CLIENT_MTU 256
+1 −4
Original line number Diff line number Diff line
@@ -124,10 +124,7 @@ bool bta_hf_client_add_record(const char* p_service_name, uint8_t scn,

  /* add profile descriptor list */
  profile_uuid = UUID_SERVCLASS_HF_HANDSFREE;
  version = HFP_VERSION_1_6;

  if (osi_property_get_bool("persist.bluetooth.hfpclient.sco_s4_supported", false))
    version = HFP_VERSION_1_7;
  version = BTA_HFP_VERSION;

  result &= SDP_AddProfileDescriptorList(sdp_handle, profile_uuid, version);

+3 −20
Original line number Diff line number Diff line
@@ -25,7 +25,9 @@
#ifndef BTA_AG_API_H
#define BTA_AG_API_H

#include <cstdint>
#include "bta_api.h"
#include "bta_hfp_api.h"

#include <string>
#include <vector>

@@ -39,25 +41,6 @@
/* Number of SCBs (AG service instances that can be registered) */
#define BTA_AG_MAX_NUM_CLIENTS 6

#define HFP_HSP_VERSION_UNKNOWN 0x0000
#define HFP_VERSION_1_1 0x0101
#define HFP_VERSION_1_5 0x0105
#define HFP_VERSION_1_6 0x0106
#define HFP_VERSION_1_7 0x0107

#define HSP_VERSION_1_0 0x0100
#define HSP_VERSION_1_2 0x0102

#define HFP_VERSION_CONFIG_KEY "HfpVersion"
#define HFP_SDP_FEATURES_CONFIG_KEY "HfpSdpFeatures"

/* Note, if you change the default version here, please also change the one in
 * bta_hs_api.h, they are meant to be the same.
 */
#ifndef BTA_HFP_VERSION
#define BTA_HFP_VERSION HFP_VERSION_1_7
#endif

/* AG feature masks */
#define BTA_AG_FEAT_3WAY 0x00000001   /* Three-way calling */
#define BTA_AG_FEAT_ECNR 0x00000002   /* Echo cancellation/noise reduction */
+2 −1
Original line number Diff line number Diff line
@@ -27,7 +27,8 @@

#include <cstdint>

#include "bta/include/bta_api.h"
#include "bta_api.h"
#include "bta_hfp_api.h"
#include "types/raw_address.h"

/*****************************************************************************
+39 −0
Original line number Diff line number Diff line
/*
 * Copyright 2021 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef BTA_HFP_API_H
#define BTA_HFP_API_H

/* HFP Versions */
#define HFP_HSP_VERSION_UNKNOWN 0x0000
#define HFP_HSP_VERSION_DONT_CARE 0xFFFF
#define HFP_VERSION_1_1 0x0101
#define HFP_VERSION_1_5 0x0105
#define HFP_VERSION_1_6 0x0106
#define HFP_VERSION_1_7 0x0107

#define HSP_VERSION_1_0 0x0100
#define HSP_VERSION_1_2 0x0102

#define HFP_VERSION_CONFIG_KEY "HfpVersion"
#define HFP_SDP_FEATURES_CONFIG_KEY "HfpSdpFeatures"

/* Default HFP Version */
#ifndef BTA_HFP_VERSION
#define BTA_HFP_VERSION HFP_VERSION_1_7
#endif

#endif /* BTA_HFP_API_H */
 No newline at end of file
Loading