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

Commit c5f42222 authored by Chris Manton's avatar Chris Manton Committed by Automerger Merge Worker
Browse files

legacy: Move btif_config:: functions from unexpected spot am: 91b7174c am: 498d451b

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/1901450

Change-Id: I2fb306e84a7c65e4792067ab83212e1b6d63705f
parents 089d04a9 498d451b
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -70,11 +70,4 @@ std::vector<RawAddress> btif_config_get_paired_devices();
void btif_config_save(void);
void btif_config_flush(void);
bool btif_config_clear(void);

// TODO(zachoverflow): Eww...we need to move these out. These are peer specific,
// not config general.
bool btif_get_address_type(const RawAddress& bd_addr,
                           tBLE_ADDR_TYPE* p_addr_type);
bool btif_get_device_type(const RawAddress& bd_addr, int* p_device_type);

void btif_debug_config_dump(int fd);
+0 −30
Original line number Diff line number Diff line
@@ -128,36 +128,6 @@ static BluetoothKeystoreInterface* get_bluetooth_keystore_interface() {
  return bluetooth::bluetooth_keystore::getBluetoothKeystoreInterface();
}

// TODO(zachoverflow): Move these two functions out, because they are too
// specific for this file
// {grumpy-cat/no, monty-python/you-make-me-sad}
bool btif_get_device_type(const RawAddress& bda, int* p_device_type) {
  if (p_device_type == NULL) return false;

  std::string addrstr = bda.ToString();
  const char* bd_addr_str = addrstr.c_str();

  if (!btif_config_get_int(bd_addr_str, "DevType", p_device_type)) return false;

  LOG_INFO("Device [%s] device type %d", bd_addr_str, *p_device_type);
  return true;
}

bool btif_get_address_type(const RawAddress& bda, tBLE_ADDR_TYPE* p_addr_type) {
  if (p_addr_type == NULL) return false;

  std::string addrstr = bda.ToString();
  const char* bd_addr_str = addrstr.c_str();

  int val = 0;
  if (!btif_config_get_int(bd_addr_str, "AddrType", &val)) return false;
  *p_addr_type = static_cast<tBLE_ADDR_TYPE>(val);

  LOG_DEBUG("Device [%s] address type %s", bd_addr_str,
            AddressTypeText(*p_addr_type).c_str());
  return true;
}

/**
 * Read metrics salt from config file, if salt is invalid or does not exist,
 * generate new one and save it to config
+29 −0
Original line number Diff line number Diff line
@@ -82,6 +82,8 @@
#include "stack_config.h"
#include "types/raw_address.h"

bool btif_get_device_type(const RawAddress& bda, int* p_device_type);

using bluetooth::Uuid;
/******************************************************************************
 *  Constants & Macros
@@ -3187,3 +3189,30 @@ void btif_debug_bond_event_dump(int fd) {
            event->bd_addr.ToString().c_str(), func_name, bond_state);
  }
}

bool btif_get_device_type(const RawAddress& bda, int* p_device_type) {
  if (p_device_type == NULL) return false;

  std::string addrstr = bda.ToString();
  const char* bd_addr_str = addrstr.c_str();

  if (!btif_config_get_int(bd_addr_str, "DevType", p_device_type)) return false;

  LOG_INFO("Device [%s] device type %d", bd_addr_str, *p_device_type);
  return true;
}

bool btif_get_address_type(const RawAddress& bda, tBLE_ADDR_TYPE* p_addr_type) {
  if (p_addr_type == NULL) return false;

  std::string addrstr = bda.ToString();
  const char* bd_addr_str = addrstr.c_str();

  int val = 0;
  if (!btif_config_get_int(bd_addr_str, "AddrType", &val)) return false;
  *p_addr_type = static_cast<tBLE_ADDR_TYPE>(val);

  LOG_DEBUG("Device [%s] address type %s", bd_addr_str,
            AddressTypeText(*p_addr_type).c_str());
  return true;
}
+4 −0
Original line number Diff line number Diff line
@@ -61,6 +61,10 @@ using base::Owned;
using bluetooth::Uuid;
using std::vector;

extern bool btif_get_address_type(const RawAddress& bda,
                                  tBLE_ADDR_TYPE* p_addr_type);
extern bool btif_get_device_type(const RawAddress& bda, int* p_device_type);

extern bt_status_t btif_gattc_test_command_impl(
    int command, const btgatt_test_params_t* params);
extern const btgatt_callbacks_t* bt_gatt_callbacks;
+4 −0
Original line number Diff line number Diff line
@@ -50,6 +50,10 @@
#include "types/bt_transport.h"
#include "types/raw_address.h"

extern bool btif_get_address_type(const RawAddress& bda,
                                  tBLE_ADDR_TYPE* p_addr_type);
extern bool btif_get_device_type(const RawAddress& bda, int* p_device_type);

using base::Bind;
using base::Owned;
using bluetooth::Uuid;
Loading