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

Commit 4886ea13 authored by shihchienc's avatar shihchienc Committed by Patrick Chang
Browse files

[HFP1.9] Add SDP related functions over HFP LC3

1. Add HFP 1.9
2. Implement LC3 functionality in HAL
3. Add LC3 supported features

Tag: #feature
Bug: 277338500
Test: manual
Test: atest --host net_test_btif_stack net_test_stack_btu net_test_stack_btm -c
Change-Id: I92e561e2e358620dfbc167b82e21380e96bd98a6
parent 54f5e30d
Loading
Loading
Loading
Loading
+12 −1
Original line number Original line Diff line number Diff line
@@ -34,7 +34,9 @@
#include "common/init_flags.h"
#include "common/init_flags.h"
#include "device/include/interop.h"
#include "device/include/interop.h"
#include "device/include/interop_config.h"
#include "device/include/interop_config.h"
#include "os/log.h"
#include "osi/include/allocator.h"
#include "osi/include/allocator.h"
#include "stack/btm/btm_sco_hfp_hal.h"
#include "stack/include/btm_api.h"
#include "stack/include/btm_api.h"
#include "stack/include/btu.h"  // do_in_main_thread
#include "stack/include/btu.h"  // do_in_main_thread
#include "stack/include/port_api.h"
#include "stack/include/port_api.h"
@@ -137,9 +139,11 @@ bool bta_ag_add_record(uint16_t service_uuid, const char* p_service_name,
  uint8_t network;
  uint8_t network;
  bool result = true;
  bool result = true;
  bool codec_supported = false;
  bool codec_supported = false;
  bool swb_supported = false;
  uint8_t buf[2];
  uint8_t buf[2];


  APPL_TRACE_DEBUG("%s uuid: %x", __func__, service_uuid);
  APPL_TRACE_DEBUG("%s uuid: %x", __func__, service_uuid);
  LOG_INFO("features: %d", features);


  for (auto& proto_element : proto_elem_list) {
  for (auto& proto_element : proto_elem_list) {
    proto_element = {};
    proto_element = {};
@@ -187,12 +191,19 @@ bool bta_ag_add_record(uint16_t service_uuid, const char* p_service_name,
    result &= SDP_AddAttribute(sdp_handle, ATTR_ID_DATA_STORES_OR_NETWORK,
    result &= SDP_AddAttribute(sdp_handle, ATTR_ID_DATA_STORES_OR_NETWORK,
                               UINT_DESC_TYPE, 1, &network);
                               UINT_DESC_TYPE, 1, &network);


    // check property for SWB support
    if (hfp_hal_interface::get_swb_supported()) {
      features |= BTA_AG_FEAT_SWB;
    }

    if (features & BTA_AG_FEAT_CODEC) codec_supported = true;
    if (features & BTA_AG_FEAT_CODEC) codec_supported = true;
    if (features & BTA_AG_FEAT_SWB) swb_supported = true;


    features &= BTA_AG_SDP_FEAT_SPEC;
    features &= BTA_AG_SDP_FEAT_SPEC;


    /* Codec bit position is different in SDP and in BRSF */
    /* Codec bit position is different in SDP and in BRSF */
    if (codec_supported) features |= 0x0020;
    if (codec_supported) features |= BTA_AG_FEAT_WBS_SUPPORT;
    if (swb_supported) features |= BTA_AG_FEAT_SWB_SUPPORT;


    UINT16_TO_BE_FIELD(buf, features);
    UINT16_TO_BE_FIELD(buf, features);
    result &= SDP_AddAttribute(sdp_handle, ATTR_ID_SUPPORTED_FEATURES,
    result &= SDP_AddAttribute(sdp_handle, ATTR_ID_SUPPORTED_FEATURES,
+2 −0
Original line number Original line Diff line number Diff line
@@ -52,9 +52,11 @@
#define BTA_AG_FEAT_ECC 0x00000080    /* Enhanced Call Control */
#define BTA_AG_FEAT_ECC 0x00000080    /* Enhanced Call Control */
#define BTA_AG_FEAT_EXTERR 0x00000100 /* Extended error codes */
#define BTA_AG_FEAT_EXTERR 0x00000100 /* Extended error codes */
#define BTA_AG_FEAT_CODEC 0x00000200  /* Codec Negotiation */
#define BTA_AG_FEAT_CODEC 0x00000200  /* Codec Negotiation */
#define BTA_AG_FEAT_SWB 0x00000400    /* Super Wide Band */


/* AG SDP feature masks */
/* AG SDP feature masks */
#define BTA_AG_FEAT_WBS_SUPPORT 0x0020 /* Supports WBS */
#define BTA_AG_FEAT_WBS_SUPPORT 0x0020 /* Supports WBS */
#define BTA_AG_FEAT_SWB_SUPPORT 0x0100 /* Supports SWB */


/* Only SDP feature bits 0 to 4 matches BRSF feature bits */
/* Only SDP feature bits 0 to 4 matches BRSF feature bits */
#define HFP_SDP_BRSF_FEATURES_MASK 0x001F
#define HFP_SDP_BRSF_FEATURES_MASK 0x001F
+2 −1
Original line number Original line Diff line number Diff line
@@ -25,6 +25,7 @@
#define HFP_VERSION_1_6 0x0106
#define HFP_VERSION_1_6 0x0106
#define HFP_VERSION_1_7 0x0107
#define HFP_VERSION_1_7 0x0107
#define HFP_VERSION_1_8 0x0108
#define HFP_VERSION_1_8 0x0108
#define HFP_VERSION_1_9 0x0109


#define HSP_VERSION_1_0 0x0100
#define HSP_VERSION_1_0 0x0100
#define HSP_VERSION_1_2 0x0102
#define HSP_VERSION_1_2 0x0102
+5 −0
Original line number Original line Diff line number Diff line
@@ -477,6 +477,10 @@ static bool get_wbs_supported() {
  return hfp_hal_interface::get_wbs_supported();
  return hfp_hal_interface::get_wbs_supported();
}
}


static bool get_swb_supported() {
  return hfp_hal_interface::get_swb_supported();
}

bool is_common_criteria_mode() {
bool is_common_criteria_mode() {
  return is_bluetooth_uid() && common_criteria_mode;
  return is_bluetooth_uid() && common_criteria_mode;
}
}
@@ -1130,6 +1134,7 @@ EXPORT_SYMBOL bt_interface_t bluetoothInterface = {
    .set_event_filter_connection_setup_all_devices =
    .set_event_filter_connection_setup_all_devices =
        set_event_filter_connection_setup_all_devices,
        set_event_filter_connection_setup_all_devices,
    .get_wbs_supported = get_wbs_supported,
    .get_wbs_supported = get_wbs_supported,
    .get_swb_supported = get_swb_supported,
    .metadata_changed = metadata_changed,
    .metadata_changed = metadata_changed,
    .interop_match_addr = interop_match_addr,
    .interop_match_addr = interop_match_addr,
    .interop_match_name = interop_match_name,
    .interop_match_name = interop_match_name,
+7 −0
Original line number Original line Diff line number Diff line
@@ -889,6 +889,13 @@ typedef struct {
   */
   */
  bool (*get_wbs_supported)();
  bool (*get_wbs_supported)();


  /**
   *
   * Is swb supported by the controller
   *
   */
  bool (*get_swb_supported)();

  /**
  /**
   * Data passed from BluetoothDevice.metadata_changed
   * Data passed from BluetoothDevice.metadata_changed
   *
   *
Loading