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

Commit 9a054332 authored by Eric Shih's avatar Eric Shih
Browse files

Add SDP related functions over LC3 for HFPC

- Add LC3 supported features in HFP 1.9

Bug: 278469604
Test: atest BtifHfClientTest
Change-Id: Ieb94cdeff6a3d85e22f4f6b2687172690fea5c24
parent 7eb69f8e
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -202,6 +202,7 @@ typedef struct {
  tBTA_HF_CLIENT_FEAT features;  /* features registered by application */
  uint16_t serv_handle;          /* RFCOMM server handle */
  bool deregister;               /* true if service shutting down */
  bool is_support_lc3;           /* true if enable lc3 codec support (HFP1.9) */

  // Maximum number of control blocks supported by the BTA layer.
  tBTA_HF_CLIENT_CB cb[HF_CLIENT_MAX_DEVICES];
+1 −0
Original line number Diff line number Diff line
@@ -431,6 +431,7 @@ tBTA_STATUS bta_hf_client_api_enable(tBTA_HF_CLIENT_CBACK* p_cback,

  bta_hf_client_cb_arr.p_cback = p_cback;
  bta_hf_client_cb_arr.features = features;
  bta_hf_client_cb_arr.is_support_lc3 = features & BTA_HF_CLIENT_FEAT_SWB;

  /* create SDP records */
  bta_hf_client_create_record(&bta_hf_client_cb_arr, p_service_name);
+8 −1
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@
#include "bta/include/bta_hf_client_api.h"
#include "bta/include/bta_rfcomm_scn.h"
#include "bta/sys/bta_sys.h"
#include "os/log.h"
#include "osi/include/allocator.h"
#include "osi/include/osi.h"  // UNUSED_ATTR
#include "stack/include/bt_uuid16.h"
@@ -106,6 +107,7 @@ bool bta_hf_client_add_record(const char* p_service_name, uint8_t scn,
  uint16_t sdp_features = 0;

  LOG_VERBOSE("bta_hf_client_add_record");
  LOG_INFO("features: %d", features);

  memset(proto_elem_list, 0,
         BTA_HF_CLIENT_NUM_PROTO_ELEMS * sizeof(tSDP_PROTOCOL_ELEM));
@@ -154,7 +156,12 @@ bool bta_hf_client_add_record(const char* p_service_name, uint8_t scn,
  if (features & BTA_HF_CLIENT_FEAT_VOL) sdp_features |= BTA_HF_CLIENT_FEAT_VOL;

  /* Codec bit position is different in SDP (bit 5) and in BRSF (bit 7) */
  if (features & BTA_HF_CLIENT_FEAT_CODEC) sdp_features |= 0x0020;
  if (features & BTA_HF_CLIENT_FEAT_CODEC)
    sdp_features |= BTA_HF_CLIENT_WBS_SUPPORT;

  /* Support swb */
  if (features & BTA_HF_CLIENT_FEAT_SWB)
    features |= BTA_HF_CLIENT_FEAT_SWB_SUPPORT;

  UINT16_TO_BE_FIELD(buf, sdp_features);
  result &= get_legacy_stack_sdp_api()->handle.SDP_AddAttribute(
+5 −0
Original line number Diff line number Diff line
@@ -68,6 +68,11 @@ typedef uint16_t tBTA_HF_CLIENT_PEER_FEAT;
#define BTA_HF_CLIENT_FEAT_CODEC 0x00000080 /* Codec Negotiation */
#define BTA_HF_CLIENT_FEAT_HF_IND 0x00000100  /* HF Indicators */
#define BTA_HF_CLIENT_FEAT_ESCO_S4 0x00000200 /* ESCO S4 link setting */
#define BTA_HF_CLIENT_FEAT_SWB 0x00000400     /* SWB feature (HFP 1.9) */

/* FP SDP feature masks */
#define BTA_HF_CLIENT_WBS_SUPPORT 0x0020      /* Supports WBS */
#define BTA_HF_CLIENT_FEAT_SWB_SUPPORT 0x0100 /* Supports SWB */

/* HFP HF extended call handling - masks not related to any spec */
#define BTA_HF_CLIENT_CHLD_REL \
+4 −1
Original line number Diff line number Diff line
@@ -513,6 +513,9 @@ cc_test {
    include_dirs: btifCommonIncludes,
    srcs: [
        ":TestCommonLogMsg",
        ":TestCommonMockFunctions",
        ":TestFakeOsi",
        ":TestMockStack",
        "test/btif_hf_client_service_test.cc",
    ],
    header_libs: ["libbluetooth_headers"],
@@ -522,11 +525,11 @@ cc_test {
    ],
    static_libs: [
        "libbluetooth-types",
        "libbt-platform-protos-lite",
        "libbt_shim_bridge",
        "libbt_shim_ffi",
        "libchrome",
        "libcom.android.sysprop.bluetooth",
        "libosi",
    ],
    cflags: [
        "-DBUILDCFG",
Loading