Loading system/btcore/include/bdaddr.h +1 −8 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ #include <hardware/bluetooth.h> #include <stdbool.h> #include <stddef.h> #include "stack/include/bt_types.h" // Note: the string representation of a bdaddr is expected to have the format // xx:xx:xx:xx:xx:xx Loading @@ -34,14 +35,6 @@ typedef char bdstr_t[sizeof("xx:xx:xx:xx:xx:xx")]; // |addr| may not be NULL. bool bdaddr_is_empty(const bt_bdaddr_t* addr); // Returns true if |first| and |second| refer to the same address. Neither // may be NULL. bool bdaddr_equals(const bt_bdaddr_t* first, const bt_bdaddr_t* second); // Returns destination bdaddr |dest| after copying |src| to |dest|. // |dest| and |src| must not be NULL. bt_bdaddr_t* bdaddr_copy(bt_bdaddr_t* dest, const bt_bdaddr_t* src); // Makes a string representation of |addr| and places it into |string|. |size| // refers to the size of |string|'s buffer and must be >= 18. On success, this // function returns |string|, otherwise it returns NULL. Neither |addr| nor Loading system/btcore/src/bdaddr.cc +0 −14 Original line number Diff line number Diff line Loading @@ -30,20 +30,6 @@ bool bdaddr_is_empty(const bt_bdaddr_t* addr) { return memcmp(addr, &zero, sizeof(bt_bdaddr_t)) == 0; } bool bdaddr_equals(const bt_bdaddr_t* first, const bt_bdaddr_t* second) { CHECK(first != NULL); CHECK(second != NULL); return memcmp(first, second, sizeof(bt_bdaddr_t)) == 0; } bt_bdaddr_t* bdaddr_copy(bt_bdaddr_t* dest, const bt_bdaddr_t* src) { CHECK(dest != NULL); CHECK(src != NULL); return (bt_bdaddr_t*)memcpy(dest, src, sizeof(bt_bdaddr_t)); } const char* bdaddr_to_string(const bt_bdaddr_t* addr, char* string, size_t size) { CHECK(addr != NULL); Loading system/btcore/test/bdaddr_test.cc +4 −4 Original line number Diff line number Diff line Loading @@ -56,17 +56,17 @@ TEST(BdaddrTest, test_equals) { bt_bdaddr_t bdaddr3; string_to_bdaddr(test_addr, &bdaddr1); string_to_bdaddr(test_addr, &bdaddr2); EXPECT_TRUE(bdaddr_equals(&bdaddr1, &bdaddr2)); EXPECT_TRUE(bdaddr1 == bdaddr2); string_to_bdaddr(test_addr2, &bdaddr3); EXPECT_FALSE(bdaddr_equals(&bdaddr2, &bdaddr3)); EXPECT_FALSE(bdaddr2 == bdaddr3); } TEST(BdaddrTest, test_copy) { bt_bdaddr_t bdaddr1; bt_bdaddr_t bdaddr2; string_to_bdaddr(test_addr, &bdaddr1); bdaddr_copy(&bdaddr2, &bdaddr1); bdaddr2 = bdaddr1; EXPECT_TRUE(bdaddr_equals(&bdaddr1, &bdaddr2)); EXPECT_TRUE(bdaddr1 == bdaddr2); } system/btif/src/btif_core.cc +1 −3 Original line number Diff line number Diff line Loading @@ -381,9 +381,7 @@ void btif_enable_bluetooth_evt(tBTA_STATUS status) { BTIF_TRACE_DEBUG("%s: status %d", __func__, status); /* Fetch the local BD ADDR */ bt_bdaddr_t local_bd_addr; const controller_t* controller = controller_get_interface(); bdaddr_copy(&local_bd_addr, controller->get_address()); bt_bdaddr_t local_bd_addr = *controller_get_interface()->get_address(); bdstr_t bdstr; bdaddr_to_string(&local_bd_addr, bdstr, sizeof(bdstr)); Loading system/stack/btm/btm_ble_bgconn.cc +1 −8 Original line number Diff line number Diff line Loading @@ -66,14 +66,7 @@ struct BgConnHash { } }; struct BgConnKeyEqual { bool operator()(const bt_bdaddr_t& x, const bt_bdaddr_t& y) const { return bdaddr_equals(&x, &y); } }; static std::unordered_map<bt_bdaddr_t, background_connection_t, BgConnHash, BgConnKeyEqual> static std::unordered_map<bt_bdaddr_t, background_connection_t, BgConnHash> background_connections; static void background_connection_add(uint8_t addr_type, Loading Loading
system/btcore/include/bdaddr.h +1 −8 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ #include <hardware/bluetooth.h> #include <stdbool.h> #include <stddef.h> #include "stack/include/bt_types.h" // Note: the string representation of a bdaddr is expected to have the format // xx:xx:xx:xx:xx:xx Loading @@ -34,14 +35,6 @@ typedef char bdstr_t[sizeof("xx:xx:xx:xx:xx:xx")]; // |addr| may not be NULL. bool bdaddr_is_empty(const bt_bdaddr_t* addr); // Returns true if |first| and |second| refer to the same address. Neither // may be NULL. bool bdaddr_equals(const bt_bdaddr_t* first, const bt_bdaddr_t* second); // Returns destination bdaddr |dest| after copying |src| to |dest|. // |dest| and |src| must not be NULL. bt_bdaddr_t* bdaddr_copy(bt_bdaddr_t* dest, const bt_bdaddr_t* src); // Makes a string representation of |addr| and places it into |string|. |size| // refers to the size of |string|'s buffer and must be >= 18. On success, this // function returns |string|, otherwise it returns NULL. Neither |addr| nor Loading
system/btcore/src/bdaddr.cc +0 −14 Original line number Diff line number Diff line Loading @@ -30,20 +30,6 @@ bool bdaddr_is_empty(const bt_bdaddr_t* addr) { return memcmp(addr, &zero, sizeof(bt_bdaddr_t)) == 0; } bool bdaddr_equals(const bt_bdaddr_t* first, const bt_bdaddr_t* second) { CHECK(first != NULL); CHECK(second != NULL); return memcmp(first, second, sizeof(bt_bdaddr_t)) == 0; } bt_bdaddr_t* bdaddr_copy(bt_bdaddr_t* dest, const bt_bdaddr_t* src) { CHECK(dest != NULL); CHECK(src != NULL); return (bt_bdaddr_t*)memcpy(dest, src, sizeof(bt_bdaddr_t)); } const char* bdaddr_to_string(const bt_bdaddr_t* addr, char* string, size_t size) { CHECK(addr != NULL); Loading
system/btcore/test/bdaddr_test.cc +4 −4 Original line number Diff line number Diff line Loading @@ -56,17 +56,17 @@ TEST(BdaddrTest, test_equals) { bt_bdaddr_t bdaddr3; string_to_bdaddr(test_addr, &bdaddr1); string_to_bdaddr(test_addr, &bdaddr2); EXPECT_TRUE(bdaddr_equals(&bdaddr1, &bdaddr2)); EXPECT_TRUE(bdaddr1 == bdaddr2); string_to_bdaddr(test_addr2, &bdaddr3); EXPECT_FALSE(bdaddr_equals(&bdaddr2, &bdaddr3)); EXPECT_FALSE(bdaddr2 == bdaddr3); } TEST(BdaddrTest, test_copy) { bt_bdaddr_t bdaddr1; bt_bdaddr_t bdaddr2; string_to_bdaddr(test_addr, &bdaddr1); bdaddr_copy(&bdaddr2, &bdaddr1); bdaddr2 = bdaddr1; EXPECT_TRUE(bdaddr_equals(&bdaddr1, &bdaddr2)); EXPECT_TRUE(bdaddr1 == bdaddr2); }
system/btif/src/btif_core.cc +1 −3 Original line number Diff line number Diff line Loading @@ -381,9 +381,7 @@ void btif_enable_bluetooth_evt(tBTA_STATUS status) { BTIF_TRACE_DEBUG("%s: status %d", __func__, status); /* Fetch the local BD ADDR */ bt_bdaddr_t local_bd_addr; const controller_t* controller = controller_get_interface(); bdaddr_copy(&local_bd_addr, controller->get_address()); bt_bdaddr_t local_bd_addr = *controller_get_interface()->get_address(); bdstr_t bdstr; bdaddr_to_string(&local_bd_addr, bdstr, sizeof(bdstr)); Loading
system/stack/btm/btm_ble_bgconn.cc +1 −8 Original line number Diff line number Diff line Loading @@ -66,14 +66,7 @@ struct BgConnHash { } }; struct BgConnKeyEqual { bool operator()(const bt_bdaddr_t& x, const bt_bdaddr_t& y) const { return bdaddr_equals(&x, &y); } }; static std::unordered_map<bt_bdaddr_t, background_connection_t, BgConnHash, BgConnKeyEqual> static std::unordered_map<bt_bdaddr_t, background_connection_t, BgConnHash> background_connections; static void background_connection_add(uint8_t addr_type, Loading