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

Commit f5491b87 authored by Myles Watson's avatar Myles Watson
Browse files

device: Apply clang-format

clang-format -i --style=file device/include/* \
  device/src/* device/test/*

Test: mma -j32
Change-Id: I1a0f9e1cd838c025fca487347358cc0079265004
parent 99833937
Loading
Loading
Loading
Loading
+36 −19
Original line number Diff line number Diff line
@@ -44,7 +44,8 @@ typedef enum {
  INTEROP_AUTO_RETRY_PAIRING,

  // Devices requiring this workaround do not handle Bluetooth Absolute Volume
  // control correctly, leading to undesirable (potentially harmful) volume levels
  // control correctly, leading to undesirable (potentially harmful) volume
  // levels
  // or general lack of controlability.
  INTEROP_DISABLE_ABSOLUTE_VOLUME,

@@ -60,36 +61,52 @@ typedef enum {
  // those keyboards.
  INTEROP_KEYBOARD_REQUIRES_FIXED_PIN,

  // Some headsets have audio jitter issues because of increased re-transmissions as the
  // 3 Mbps packets have a lower link margin, and are more prone to interference. We can
  // disable 3DH packets (use only 2DH packets) for the ACL link to improve sensitivity
  // Some headsets have audio jitter issues because of increased
  // re-transmissions as the
  // 3 Mbps packets have a lower link margin, and are more prone to
  // interference. We can
  // disable 3DH packets (use only 2DH packets) for the ACL link to improve
  // sensitivity
  // when streaming A2DP audio to the headset. Air sniffer logs show reduced
  // re-transmissions after switching to 2DH packets.
  //
  // Disable 3Mbps packets and use only 2Mbps packets for ACL links when streaming audio.
  // Disable 3Mbps packets and use only 2Mbps packets for ACL links when
  // streaming audio.
  INTEROP_2MBPS_LINK_ONLY
} interop_feature_t;

// Check if a given |addr| matches a known interoperability workaround as identified
// by the |interop_feature_t| enum. This API is used for simple address based lookups
// where more information is not available. No look-ups or random address resolution
// Check if a given |addr| matches a known interoperability workaround as
// identified
// by the |interop_feature_t| enum. This API is used for simple address based
// lookups
// where more information is not available. No look-ups or random address
// resolution
// are performed on |addr|.
bool interop_match_addr(const interop_feature_t feature, const bt_bdaddr_t *addr);

// Check if a given remote device |name| matches a known interoperability workaround.
// Name comparisons are case sensitive and do not allow for partial matches. As in, if
// |name| is "TEST" and a workaround exists for "TESTING", then this function will
// return false. But, if |name| is "TESTING" and a workaround exists for "TEST", this
bool interop_match_addr(const interop_feature_t feature,
                        const bt_bdaddr_t* addr);

// Check if a given remote device |name| matches a known interoperability
// workaround.
// Name comparisons are case sensitive and do not allow for partial matches. As
// in, if
// |name| is "TEST" and a workaround exists for "TESTING", then this function
// will
// return false. But, if |name| is "TESTING" and a workaround exists for "TEST",
// this
// function will return true.
// |name| cannot be null and must be null terminated.
bool interop_match_name(const interop_feature_t feature, const char* name);

// Add a dynamic interop database entry for a device matching the first |length| bytes
// of |addr|, implementing the workaround identified by |feature|. |addr| may not be
// Add a dynamic interop database entry for a device matching the first |length|
// bytes
// of |addr|, implementing the workaround identified by |feature|. |addr| may
// not be
// null and |length| must be greater than 0 and less than sizeof(bt_bdaddr_t).
// As |interop_feature_t| is not exposed in the public API, feature must be a valid
// As |interop_feature_t| is not exposed in the public API, feature must be a
// valid
// integer representing an optoin in the enum.
void interop_database_add(const uint16_t feature, const bt_bdaddr_t *addr, size_t length);
void interop_database_add(const uint16_t feature, const bt_bdaddr_t* addr,
                          size_t length);

// Clear the dynamic portion of the interoperability workaround database.
void interop_database_clear(void);
+63 −56
Original line number Diff line number Diff line
@@ -30,9 +30,15 @@ static const interop_addr_entry_t interop_addr_database[] = {
    // Nexus Remote (Spike)
    // Note: May affect other Asus brand devices
    {{{0x08, 0x62, 0x66, 0, 0, 0}}, 3, INTEROP_DISABLE_LE_SECURE_CONNECTIONS},
  {{{0x38, 0x2c, 0x4a, 0xc9,  0,0}}, 4, INTEROP_DISABLE_LE_SECURE_CONNECTIONS},
  {{{0x38, 0x2c, 0x4a, 0xe6,  0,0}}, 4, INTEROP_DISABLE_LE_SECURE_CONNECTIONS},
  {{{0x54, 0xa0, 0x50, 0xd9,  0,0}}, 4, INTEROP_DISABLE_LE_SECURE_CONNECTIONS},
    {{{0x38, 0x2c, 0x4a, 0xc9, 0, 0}},
     4,
     INTEROP_DISABLE_LE_SECURE_CONNECTIONS},
    {{{0x38, 0x2c, 0x4a, 0xe6, 0, 0}},
     4,
     INTEROP_DISABLE_LE_SECURE_CONNECTIONS},
    {{{0x54, 0xa0, 0x50, 0xd9, 0, 0}},
     4,
     INTEROP_DISABLE_LE_SECURE_CONNECTIONS},
    {{{0xac, 0x9e, 0x17, 0, 0, 0}}, 3, INTEROP_DISABLE_LE_SECURE_CONNECTIONS},
    {{{0xf0, 0x79, 0x59, 0, 0, 0}}, 3, INTEROP_DISABLE_LE_SECURE_CONNECTIONS},

@@ -43,7 +49,9 @@ static const interop_addr_entry_t interop_addr_database[] = {
    {{{0x9c, 0xdf, 0x03, 0, 0, 0}}, 3, INTEROP_AUTO_RETRY_PAIRING},

    // Flic smart button
  {{{0x80, 0xe4, 0xda, 0x70,  0,0}}, 4, INTEROP_DISABLE_LE_SECURE_CONNECTIONS},
    {{{0x80, 0xe4, 0xda, 0x70, 0, 0}},
     4,
     INTEROP_DISABLE_LE_SECURE_CONNECTIONS},

    // iKross IKBT83B HS - unacceptably loud volume
    {{{0x00, 0x14, 0x02, 0, 0, 0}}, 3, INTEROP_DISABLE_ABSOLUTE_VOLUME},
@@ -111,4 +119,3 @@ static const interop_name_entry_t interop_name_database[] = {
    // Subaru car kits ("CAR M_MEDIA")
    {"CAR", 3, INTEROP_DISABLE_AUTO_PAIRING},
};
+119 −137
Original line number Diff line number Diff line
@@ -31,8 +31,7 @@
#include "stack/include/btm_ble_api.h"

const bt_event_mask_t BLE_EVENT_MASK = {
  {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x7f}
};
    {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x7f}};

#if (BLE_INCLUDED)
const bt_event_mask_t CLASSIC_EVENT_MASK = {HCI_DUMO_EVENT_MASK_EXT};
@@ -78,7 +77,8 @@ static bool ble_supported;
static bool simple_pairing_supported;
static bool secure_connections_supported;

#define AWAIT_COMMAND(command) static_cast<BT_HDR *>(future_await(hci->transmit_command_futured(command)))
#define AWAIT_COMMAND(command) \
  static_cast<BT_HDR*>(future_await(hci->transmit_command_futured(command)))

// Module lifecycle functions

@@ -95,15 +95,10 @@ static future_t *start_up(void) {
      response, &acl_data_size_classic, &acl_buffer_count_classic);

  // Tell the controller about our buffer sizes and buffer counts next
  // TODO(zachoverflow): factor this out. eww l2cap contamination. And why just a hardcoded 10?
  response = AWAIT_COMMAND(
    packet_factory->make_host_buffer_size(
      L2CAP_MTU_SIZE,
      SCO_HOST_BUFFER_SIZE,
      L2CAP_HOST_FC_ACL_BUFS,
      10
    )
  );
  // TODO(zachoverflow): factor this out. eww l2cap contamination. And why just
  // a hardcoded 10?
  response = AWAIT_COMMAND(packet_factory->make_host_buffer_size(
      L2CAP_MTU_SIZE, SCO_HOST_BUFFER_SIZE, L2CAP_HOST_FC_ACL_BUFS, 10));

  packet_parser->parse_generic_command_complete(response);

@@ -117,23 +112,18 @@ static future_t *start_up(void) {
  packet_parser->parse_read_bd_addr_response(response, &address);

  // Request the controller's supported commands next
  response = AWAIT_COMMAND(packet_factory->make_read_local_supported_commands());
  response =
      AWAIT_COMMAND(packet_factory->make_read_local_supported_commands());
  packet_parser->parse_read_local_supported_commands_response(
    response,
    supported_commands,
    HCI_SUPPORTED_COMMANDS_ARRAY_SIZE
  );
      response, supported_commands, HCI_SUPPORTED_COMMANDS_ARRAY_SIZE);

  // Read page 0 of the controller features next
  uint8_t page_number = 0;
  response = AWAIT_COMMAND(packet_factory->make_read_local_extended_features(page_number));
  response = AWAIT_COMMAND(
      packet_factory->make_read_local_extended_features(page_number));
  packet_parser->parse_read_local_extended_features_response(
    response,
    &page_number,
    &last_features_classic_page_index,
    features_classic,
    MAX_FEATURES_CLASSIC_PAGE_COUNT
  );
      response, &page_number, &last_features_classic_page_index,
      features_classic, MAX_FEATURES_CLASSIC_PAGE_COUNT);

  assert(page_number == 0);
  page_number++;
@@ -142,18 +132,22 @@ static future_t *start_up(void) {
  // it told us it supports. We need to do this first before we request the
  // next page, because the controller's response for page 1 may be
  // dependent on what we configure from page 0
  simple_pairing_supported = HCI_SIMPLE_PAIRING_SUPPORTED(features_classic[0].as_array);
  simple_pairing_supported =
      HCI_SIMPLE_PAIRING_SUPPORTED(features_classic[0].as_array);
  if (simple_pairing_supported) {
    response = AWAIT_COMMAND(packet_factory->make_write_simple_pairing_mode(HCI_SP_MODE_ENABLED));
    response = AWAIT_COMMAND(
        packet_factory->make_write_simple_pairing_mode(HCI_SP_MODE_ENABLED));
    packet_parser->parse_generic_command_complete(response);
  }

#if (BLE_INCLUDED == TRUE)
  if (HCI_LE_SPT_SUPPORTED(features_classic[0].as_array)) {
    uint8_t simultaneous_le_host = HCI_SIMUL_LE_BREDR_SUPPORTED(features_classic[0].as_array) ? BTM_BLE_SIMULTANEOUS_HOST : 0;
    response = AWAIT_COMMAND(
      packet_factory->make_ble_write_host_support(BTM_BLE_HOST_SUPPORT, simultaneous_le_host)
    );
    uint8_t simultaneous_le_host =
        HCI_SIMUL_LE_BREDR_SUPPORTED(features_classic[0].as_array)
            ? BTM_BLE_SIMULTANEOUS_HOST
            : 0;
    response = AWAIT_COMMAND(packet_factory->make_ble_write_host_support(
        BTM_BLE_HOST_SUPPORT, simultaneous_le_host));

    packet_parser->parse_generic_command_complete(response);

@@ -167,91 +161,87 @@ static future_t *start_up(void) {
  // Request the remaining feature pages
  while (page_number <= last_features_classic_page_index &&
         page_number < MAX_FEATURES_CLASSIC_PAGE_COUNT) {
    response = AWAIT_COMMAND(packet_factory->make_read_local_extended_features(page_number));
    response = AWAIT_COMMAND(
        packet_factory->make_read_local_extended_features(page_number));
    packet_parser->parse_read_local_extended_features_response(
      response,
      &page_number,
      &last_features_classic_page_index,
      features_classic,
      MAX_FEATURES_CLASSIC_PAGE_COUNT
    );
        response, &page_number, &last_features_classic_page_index,
        features_classic, MAX_FEATURES_CLASSIC_PAGE_COUNT);

    page_number++;
  }

#if (SC_MODE_INCLUDED == TRUE)
  secure_connections_supported = HCI_SC_CTRLR_SUPPORTED(features_classic[2].as_array);
  secure_connections_supported =
      HCI_SC_CTRLR_SUPPORTED(features_classic[2].as_array);
  if (secure_connections_supported) {
    response = AWAIT_COMMAND(packet_factory->make_write_secure_connections_host_support(HCI_SC_MODE_ENABLED));
    response = AWAIT_COMMAND(
        packet_factory->make_write_secure_connections_host_support(
            HCI_SC_MODE_ENABLED));
    packet_parser->parse_generic_command_complete(response);
  }
#endif

#if (BLE_INCLUDED == TRUE)
  ble_supported = last_features_classic_page_index >= 1 && HCI_LE_HOST_SUPPORTED(features_classic[1].as_array);
  ble_supported = last_features_classic_page_index >= 1 &&
                  HCI_LE_HOST_SUPPORTED(features_classic[1].as_array);
  if (ble_supported) {
    // Request the ble white list size next
    response = AWAIT_COMMAND(packet_factory->make_ble_read_white_list_size());
    packet_parser->parse_ble_read_white_list_size_response(response, &ble_white_list_size);
    packet_parser->parse_ble_read_white_list_size_response(
        response, &ble_white_list_size);

    // Request the ble buffer size next
    response = AWAIT_COMMAND(packet_factory->make_ble_read_buffer_size());
    packet_parser->parse_ble_read_buffer_size_response(
      response,
      &acl_data_size_ble,
      &acl_buffer_count_ble
    );
        response, &acl_data_size_ble, &acl_buffer_count_ble);

    // Response of 0 indicates ble has the same buffer size as classic
    if (acl_data_size_ble == 0)
      acl_data_size_ble = acl_data_size_classic;
    if (acl_data_size_ble == 0) acl_data_size_ble = acl_data_size_classic;

    // Request the ble supported states next
    response = AWAIT_COMMAND(packet_factory->make_ble_read_supported_states());
    packet_parser->parse_ble_read_supported_states_response(
      response,
      ble_supported_states,
      sizeof(ble_supported_states)
    );
        response, ble_supported_states, sizeof(ble_supported_states));

    // Request the ble supported features next
    response = AWAIT_COMMAND(packet_factory->make_ble_read_local_supported_features());
    response =
        AWAIT_COMMAND(packet_factory->make_ble_read_local_supported_features());
    packet_parser->parse_ble_read_local_supported_features_response(
      response,
      &features_ble
    );
        response, &features_ble);

    if (HCI_LE_ENHANCED_PRIVACY_SUPPORTED(features_ble.as_array)) {
        response = AWAIT_COMMAND(packet_factory->make_ble_read_resolving_list_size());
      response =
          AWAIT_COMMAND(packet_factory->make_ble_read_resolving_list_size());
      packet_parser->parse_ble_read_resolving_list_size_response(
            response,
            &ble_resolving_list_max_size);
          response, &ble_resolving_list_max_size);
    }

    if (HCI_LE_DATA_LEN_EXT_SUPPORTED(features_ble.as_array)) {
        response = AWAIT_COMMAND(packet_factory->make_ble_read_suggested_default_data_length());
      response = AWAIT_COMMAND(
          packet_factory->make_ble_read_suggested_default_data_length());
      packet_parser->parse_ble_read_suggested_default_data_length_response(
            response,
            &ble_suggested_default_data_length);
          response, &ble_suggested_default_data_length);
    }

    // Set the ble event mask next
    response = AWAIT_COMMAND(packet_factory->make_ble_set_event_mask(&BLE_EVENT_MASK));
    response =
        AWAIT_COMMAND(packet_factory->make_ble_set_event_mask(&BLE_EVENT_MASK));
    packet_parser->parse_generic_command_complete(response);
  }
#endif

  if (simple_pairing_supported) {
    response = AWAIT_COMMAND(packet_factory->make_set_event_mask(&CLASSIC_EVENT_MASK));
    response =
        AWAIT_COMMAND(packet_factory->make_set_event_mask(&CLASSIC_EVENT_MASK));
    packet_parser->parse_generic_command_complete(response);
  }

  // read local supported codecs
  if (HCI_READ_LOCAL_CODECS_SUPPORTED(supported_commands)) {
    response = AWAIT_COMMAND(packet_factory->make_read_local_supported_codecs());
    response =
        AWAIT_COMMAND(packet_factory->make_read_local_supported_codecs());
    packet_parser->parse_read_local_supported_codecs_response(
        response,
        &number_of_local_supported_codecs, local_supported_codecs);
        response, &number_of_local_supported_codecs, local_supported_codecs);
  }

  readable = true;
@@ -269,17 +259,11 @@ EXPORT_SYMBOL extern const module_t controller_module = {
    .start_up = start_up,
    .shut_down = shut_down,
    .clean_up = NULL,
  .dependencies = {
    HCI_MODULE,
    NULL
  }
};
    .dependencies = {HCI_MODULE, NULL}};

// Interface functions

static bool get_is_ready(void) {
  return readable;
}
static bool get_is_ready(void) { return readable; }

static const bt_bdaddr_t* get_address(void) {
  assert(readable);
@@ -487,8 +471,7 @@ static const controller_t interface = {

    get_ble_resolving_list_max_size,
    set_ble_resolving_list_max_size,
  get_local_supported_codecs
};
    get_local_supported_codecs};

const controller_t* controller_get_interface() {
  static bool loaded = false;
@@ -507,7 +490,6 @@ const controller_t *controller_get_test_interface(
    const hci_t* hci_interface,
    const hci_packet_factory_t* packet_factory_interface,
    const hci_packet_parser_t* packet_parser_interface) {

  hci = hci_interface;
  packet_factory = packet_factory_interface;
  packet_parser = packet_parser_interface;
+49 −37
Original line number Diff line number Diff line
@@ -28,22 +28,28 @@
#include "osi/include/list.h"
#include "osi/include/log.h"

#define CASE_RETURN_STR(const) case const: return #const;
#define CASE_RETURN_STR(const) \
  case const:                  \
    return #const;

static list_t* interop_list = NULL;

static const char* interop_feature_string_(const interop_feature_t feature);
static void interop_free_entry_(void* data);
static void interop_lazy_init_(void);
static bool interop_match_fixed_(const interop_feature_t feature, const bt_bdaddr_t *addr);
static bool interop_match_dynamic_(const interop_feature_t feature, const bt_bdaddr_t *addr);
static bool interop_match_fixed_(const interop_feature_t feature,
                                 const bt_bdaddr_t* addr);
static bool interop_match_dynamic_(const interop_feature_t feature,
                                   const bt_bdaddr_t* addr);

// Interface functions

bool interop_match_addr(const interop_feature_t feature, const bt_bdaddr_t *addr) {
bool interop_match_addr(const interop_feature_t feature,
                        const bt_bdaddr_t* addr) {
  assert(addr);

  if (interop_match_fixed_(feature, addr) || interop_match_dynamic_(feature, addr)) {
  if (interop_match_fixed_(feature, addr) ||
      interop_match_dynamic_(feature, addr)) {
    char bdstr[20] = {0};
    LOG_WARN(LOG_TAG, "%s() Device %s is a match for interop workaround %s.",
             __func__, bdaddr_to_string(addr, bdstr, sizeof(bdstr)),
@@ -57,11 +63,13 @@ bool interop_match_addr(const interop_feature_t feature, const bt_bdaddr_t *addr
bool interop_match_name(const interop_feature_t feature, const char* name) {
  assert(name);

  const size_t db_size = sizeof(interop_name_database) / sizeof(interop_name_entry_t);
  const size_t db_size =
      sizeof(interop_name_database) / sizeof(interop_name_entry_t);
  for (size_t i = 0; i != db_size; ++i) {
    if (feature == interop_name_database[i].feature &&
        strlen(name) >= interop_name_database[i].length &&
        strncmp(name, interop_name_database[i].name, interop_name_database[i].length) == 0) {
        strncmp(name, interop_name_database[i].name,
                interop_name_database[i].length) == 0) {
      return true;
    }
  }
@@ -69,13 +77,14 @@ bool interop_match_name(const interop_feature_t feature, const char *name) {
  return false;
}

void interop_database_add(const uint16_t feature, const bt_bdaddr_t *addr, size_t length) {
void interop_database_add(const uint16_t feature, const bt_bdaddr_t* addr,
                          size_t length) {
  assert(addr);
  assert(length > 0);
  assert(length < sizeof(bt_bdaddr_t));

  interop_addr_entry_t *entry =
      static_cast<interop_addr_entry_t *>(osi_calloc(sizeof(interop_addr_entry_t)));
  interop_addr_entry_t* entry = static_cast<interop_addr_entry_t*>(
      osi_calloc(sizeof(interop_addr_entry_t)));
  memcpy(&entry->addr, addr, length);
  entry->feature = static_cast<interop_feature_t>(feature);
  entry->length = length;
@@ -85,8 +94,7 @@ void interop_database_add(const uint16_t feature, const bt_bdaddr_t *addr, size_
}

void interop_database_clear() {
  if (interop_list)
    list_clear(interop_list);
  if (interop_list) list_clear(interop_list);
}

// Module life-cycle functions
@@ -132,9 +140,9 @@ static void interop_lazy_init_(void) {
  }
}

static bool interop_match_dynamic_(const interop_feature_t feature, const bt_bdaddr_t *addr) {
  if (interop_list == NULL || list_length(interop_list) == 0)
    return false;
static bool interop_match_dynamic_(const interop_feature_t feature,
                                   const bt_bdaddr_t* addr) {
  if (interop_list == NULL || list_length(interop_list) == 0) return false;

  const list_node_t* node = list_begin(interop_list);
  while (node != list_end(interop_list)) {
@@ -142,7 +150,8 @@ static bool interop_match_dynamic_(const interop_feature_t feature, const bt_bda
        static_cast<interop_addr_entry_t*>(list_node(node));
    assert(entry);

    if (feature == entry->feature && memcmp(addr, &entry->addr, entry->length) == 0)
    if (feature == entry->feature &&
        memcmp(addr, &entry->addr, entry->length) == 0)
      return true;

    node = list_next(node);
@@ -150,13 +159,16 @@ static bool interop_match_dynamic_(const interop_feature_t feature, const bt_bda
  return false;
}

static bool interop_match_fixed_(const interop_feature_t feature, const bt_bdaddr_t *addr) {
static bool interop_match_fixed_(const interop_feature_t feature,
                                 const bt_bdaddr_t* addr) {
  assert(addr);

  const size_t db_size = sizeof(interop_addr_database) / sizeof(interop_addr_entry_t);
  const size_t db_size =
      sizeof(interop_addr_database) / sizeof(interop_addr_entry_t);
  for (size_t i = 0; i != db_size; ++i) {
    if (feature == interop_addr_database[i].feature &&
        memcmp(addr, &interop_addr_database[i].addr, interop_addr_database[i].length) == 0) {
        memcmp(addr, &interop_addr_database[i].addr,
               interop_addr_database[i].length) == 0) {
      return true;
    }
  }
+14 −7
Original line number Diff line number Diff line
@@ -23,7 +23,8 @@
TEST(InteropTest, test_lookup_hit) {
  bt_bdaddr_t test_address;
  string_to_bdaddr("38:2c:4a:e6:67:89", &test_address);
  EXPECT_TRUE(interop_match_addr(INTEROP_DISABLE_LE_SECURE_CONNECTIONS, &test_address));
  EXPECT_TRUE(
      interop_match_addr(INTEROP_DISABLE_LE_SECURE_CONNECTIONS, &test_address));
  string_to_bdaddr("9c:df:03:12:34:56", &test_address);
  EXPECT_TRUE(interop_match_addr(INTEROP_AUTO_RETRY_PAIRING, &test_address));
}
@@ -31,11 +32,13 @@ TEST(InteropTest, test_lookup_hit) {
TEST(InteropTest, test_lookup_miss) {
  bt_bdaddr_t test_address;
  string_to_bdaddr("00:00:00:00:00:00", &test_address);
  EXPECT_FALSE(interop_match_addr(INTEROP_DISABLE_LE_SECURE_CONNECTIONS, &test_address));
  EXPECT_FALSE(
      interop_match_addr(INTEROP_DISABLE_LE_SECURE_CONNECTIONS, &test_address));
  string_to_bdaddr("ff:ff:ff:ff:ff:ff", &test_address);
  EXPECT_FALSE(interop_match_addr(INTEROP_AUTO_RETRY_PAIRING, &test_address));
  string_to_bdaddr("42:08:15:ae:ae:ae", &test_address);
  EXPECT_FALSE(interop_match_addr(INTEROP_DISABLE_LE_SECURE_CONNECTIONS, &test_address));
  EXPECT_FALSE(
      interop_match_addr(INTEROP_DISABLE_LE_SECURE_CONNECTIONS, &test_address));
  string_to_bdaddr("38:2c:4a:59:67:89", &test_address);
  EXPECT_FALSE(interop_match_addr(INTEROP_AUTO_RETRY_PAIRING, &test_address));
}
@@ -44,10 +47,12 @@ TEST(InteropTest, test_dynamic) {
  bt_bdaddr_t test_address;

  string_to_bdaddr("11:22:33:44:55:66", &test_address);
  EXPECT_FALSE(interop_match_addr(INTEROP_DISABLE_LE_SECURE_CONNECTIONS, &test_address));
  EXPECT_FALSE(
      interop_match_addr(INTEROP_DISABLE_LE_SECURE_CONNECTIONS, &test_address));

  interop_database_add(INTEROP_DISABLE_LE_SECURE_CONNECTIONS, &test_address, 3);
  EXPECT_TRUE(interop_match_addr(INTEROP_DISABLE_LE_SECURE_CONNECTIONS, &test_address));
  EXPECT_TRUE(
      interop_match_addr(INTEROP_DISABLE_LE_SECURE_CONNECTIONS, &test_address));
  EXPECT_FALSE(interop_match_addr(INTEROP_AUTO_RETRY_PAIRING, &test_address));

  string_to_bdaddr("66:55:44:33:22:11", &test_address);
@@ -55,7 +60,8 @@ TEST(InteropTest, test_dynamic) {

  interop_database_add(INTEROP_AUTO_RETRY_PAIRING, &test_address, 3);
  EXPECT_TRUE(interop_match_addr(INTEROP_AUTO_RETRY_PAIRING, &test_address));
  EXPECT_FALSE(interop_match_addr(INTEROP_DISABLE_LE_SECURE_CONNECTIONS, &test_address));
  EXPECT_FALSE(
      interop_match_addr(INTEROP_DISABLE_LE_SECURE_CONNECTIONS, &test_address));

  interop_database_clear();
  EXPECT_FALSE(interop_match_addr(INTEROP_AUTO_RETRY_PAIRING, &test_address));
@@ -64,7 +70,8 @@ TEST(InteropTest, test_dynamic) {
TEST(InteropTest, test_name_hit) {
  EXPECT_TRUE(interop_match_name(INTEROP_DISABLE_AUTO_PAIRING, "BMW M3"));
  EXPECT_TRUE(interop_match_name(INTEROP_DISABLE_AUTO_PAIRING, "Audi"));
  EXPECT_TRUE(interop_match_name(INTEROP_DISABLE_AUTO_PAIRING, "Caramel")); // Starts with "Car" ;)
  EXPECT_TRUE(interop_match_name(INTEROP_DISABLE_AUTO_PAIRING,
                                 "Caramel"));  // Starts with "Car" ;)
}

TEST(InteropTest, test_name_miss) {
+11 −11

File changed.

Contains only whitespace changes.

Loading