mirror of https://github.com/ARMmbed/mbed-os.git
BLE: Remove uses of tr_as_array in favour of to_string.
parent
c674990820
commit
65c61a1ca9
|
@ -39,12 +39,6 @@ const char* att_client_callback_event_to_string(uint8_t code);
|
|||
const char* att_error_code_to_string(uint8_t code);
|
||||
#endif //MBED_CONF_MBED_TRACE_ENABLE
|
||||
|
||||
template<typename T>
|
||||
const char* tr_as_array(T item)
|
||||
{
|
||||
return (mbed_trace_array)((const uint8_t*)&item, sizeof(item));
|
||||
}
|
||||
|
||||
template<size_t size>
|
||||
const char* to_string(const ble::byte_array_t<size> &array)
|
||||
{
|
||||
|
|
|
@ -186,7 +186,7 @@ void FileSecurityDb::set_entry_local_ltk(
|
|||
|
||||
entry->flags.ltk_sent = true;
|
||||
|
||||
tr_info("Write DB entry %d: local ltk %s", get_index(db_handle), tr_as_array(ltk));
|
||||
tr_info("Write DB entry %d: local ltk %s", get_index(db_handle), to_string(ltk));
|
||||
db_write(<k, entry->file_offset + DB_STORE_OFFSET_LOCAL_KEYS_LTK);
|
||||
}
|
||||
|
||||
|
@ -201,7 +201,7 @@ void FileSecurityDb::set_entry_local_ediv_rand(
|
|||
return;
|
||||
}
|
||||
|
||||
tr_info("Write DB entry %d: local ediv %s rand %s", get_index(db_handle), tr_as_array(ediv), tr_as_array(rand));
|
||||
tr_info("Write DB entry %d: local ediv %s rand %s", get_index(db_handle), to_string(ediv), to_string(rand));
|
||||
db_write(&ediv, entry->file_offset + DB_STORE_OFFSET_LOCAL_KEYS_EDIV);
|
||||
db_write(&rand, entry->file_offset + DB_STORE_OFFSET_LOCAL_KEYS_RAND);
|
||||
}
|
||||
|
@ -222,7 +222,7 @@ void FileSecurityDb::set_entry_peer_ltk(
|
|||
|
||||
entry->flags.ltk_stored = true;
|
||||
|
||||
tr_info("Write DB entry %d: peer ltk %s", get_index(db_handle), tr_as_array(ltk));
|
||||
tr_info("Write DB entry %d: peer ltk %s", get_index(db_handle), to_string(ltk));
|
||||
db_write(<k, entry->file_offset + DB_STORE_OFFSET_PEER_KEYS_LTK);
|
||||
}
|
||||
|
||||
|
@ -237,7 +237,7 @@ void FileSecurityDb::set_entry_peer_ediv_rand(
|
|||
return;
|
||||
}
|
||||
|
||||
tr_info("Write DB entry %d: peer ediv %s rand %s", get_index(db_handle), tr_as_array(ediv), tr_as_array(rand));
|
||||
tr_info("Write DB entry %d: peer ediv %s rand %s", get_index(db_handle), to_string(ediv), to_string(rand));
|
||||
db_write(&ediv, entry->file_offset + DB_STORE_OFFSET_PEER_KEYS_EDIV);
|
||||
db_write(&rand, entry->file_offset + DB_STORE_OFFSET_PEER_KEYS_RAND);
|
||||
}
|
||||
|
@ -254,7 +254,7 @@ void FileSecurityDb::set_entry_peer_irk(
|
|||
|
||||
entry->flags.irk_stored = true;
|
||||
|
||||
tr_info("Write DB entry %d: peer irk %s", get_index(db_handle), tr_as_array(irk));
|
||||
tr_info("Write DB entry %d: peer irk %s", get_index(db_handle), to_string(irk));
|
||||
db_write(&irk, entry->file_offset + DB_STORE_OFFSET_PEER_IDENTITY_IRK);
|
||||
}
|
||||
|
||||
|
@ -269,7 +269,7 @@ void FileSecurityDb::set_entry_peer_bdaddr(
|
|||
return;
|
||||
}
|
||||
|
||||
tr_info("Write DB entry %d: %s peer address %s", get_index(db_handle), address_is_public? "public" : "private", tr_as_array(peer_address));
|
||||
tr_info("Write DB entry %d: %s peer address %s", get_index(db_handle), address_is_public? "public" : "private", to_string(peer_address));
|
||||
db_write(&peer_address, entry->file_offset + DB_STORE_OFFSET_PEER_IDENTITY_ADDRESS);
|
||||
db_write(&address_is_public, entry->file_offset + DB_STORE_OFFSET_PEER_IDENTITY_ADDRESS_IS_PUBLIC);
|
||||
}
|
||||
|
@ -286,7 +286,7 @@ void FileSecurityDb::set_entry_peer_csrk(
|
|||
|
||||
entry->flags.csrk_stored = true;
|
||||
|
||||
tr_info("Write DB entry %d: peer csrk %s", get_index(db_handle), tr_as_array(csrk));
|
||||
tr_info("Write DB entry %d: peer csrk %s", get_index(db_handle), to_string(csrk));
|
||||
db_write(&csrk, entry->file_offset + DB_STORE_OFFSET_PEER_SIGNING);
|
||||
}
|
||||
|
||||
|
@ -307,7 +307,7 @@ void FileSecurityDb::set_local_csrk(
|
|||
{
|
||||
this->SecurityDb::set_local_csrk(csrk);
|
||||
|
||||
tr_info("Write DB: local csrk %s", tr_as_array(csrk));
|
||||
tr_info("Write DB: local csrk %s", to_string(csrk));
|
||||
db_write(&_local_csrk, DB_OFFSET_LOCAL_CSRK);
|
||||
}
|
||||
|
||||
|
@ -319,7 +319,7 @@ void FileSecurityDb::set_local_identity(
|
|||
{
|
||||
this->SecurityDb::set_local_identity(irk, identity_address, public_address);
|
||||
|
||||
tr_info("Write DB: %s peer address %s", public_address? "public" : "private", tr_as_array(identity_address));
|
||||
tr_info("Write DB: %s peer address %s", public_address? "public" : "private", to_string(identity_address));
|
||||
db_write(&_local_identity, DB_OFFSET_LOCAL_IDENTITY);
|
||||
}
|
||||
|
||||
|
|
|
@ -150,7 +150,7 @@ void KVStoreSecurityDb::set_entry_local_ltk(
|
|||
SecurityEntryKeys_t* current_entry = read_in_entry_local_keys(db_handle);
|
||||
current_entry->ltk = ltk;
|
||||
|
||||
tr_info("Write DB entry %d: local ltk %s", get_index(db_handle), tr_as_array(ltk));
|
||||
tr_info("Write DB entry %d: local ltk %s", get_index(db_handle), to_string(ltk));
|
||||
db_write_entry(current_entry, DB_ENTRY_LOCAL_KEYS, get_index(entry));
|
||||
}
|
||||
|
||||
|
@ -169,7 +169,7 @@ void KVStoreSecurityDb::set_entry_local_ediv_rand(
|
|||
current_entry->ediv = ediv;
|
||||
current_entry->rand = rand;
|
||||
|
||||
tr_info("Write DB entry %d: local ediv %s rand %s", get_index(db_handle), tr_as_array(ediv), tr_as_array(rand));
|
||||
tr_info("Write DB entry %d: local ediv %s rand %s", get_index(db_handle), to_string(ediv), to_string(rand));
|
||||
db_write_entry(current_entry, DB_ENTRY_LOCAL_KEYS, get_index(entry));
|
||||
}
|
||||
|
||||
|
@ -192,7 +192,7 @@ void KVStoreSecurityDb::set_entry_peer_ltk(
|
|||
SecurityEntryKeys_t* current_entry = read_in_entry_peer_keys(db_handle);
|
||||
current_entry->ltk = ltk;
|
||||
|
||||
tr_info("Write DB entry %d: peer ltk %s", get_index(db_handle), tr_as_array(ltk));
|
||||
tr_info("Write DB entry %d: peer ltk %s", get_index(db_handle), to_string(ltk));
|
||||
db_write_entry(current_entry, DB_ENTRY_PEER_KEYS, get_index(entry));
|
||||
}
|
||||
|
||||
|
@ -211,7 +211,7 @@ void KVStoreSecurityDb::set_entry_peer_ediv_rand(
|
|||
current_entry->ediv = ediv;
|
||||
current_entry->rand = rand;
|
||||
|
||||
tr_info("Write DB entry %d: peer ediv %s rand %s", get_index(db_handle), tr_as_array(ediv), tr_as_array(rand));
|
||||
tr_info("Write DB entry %d: peer ediv %s rand %s", get_index(db_handle), to_string(ediv), to_string(rand));
|
||||
db_write_entry(current_entry, DB_ENTRY_PEER_KEYS, get_index(entry));
|
||||
}
|
||||
|
||||
|
@ -230,7 +230,7 @@ void KVStoreSecurityDb::set_entry_peer_irk(
|
|||
SecurityEntryIdentity_t* current_entry = read_in_entry_peer_identity(db_handle);
|
||||
current_entry->irk = irk;
|
||||
|
||||
tr_info("Write DB entry %d: peer irk %s", get_index(db_handle), tr_as_array(irk));
|
||||
tr_info("Write DB entry %d: peer irk %s", get_index(db_handle), to_string(irk));
|
||||
db_write_entry(current_entry, DB_ENTRY_PEER_IDENTITY, get_index(entry));
|
||||
}
|
||||
|
||||
|
@ -249,7 +249,7 @@ void KVStoreSecurityDb::set_entry_peer_bdaddr(
|
|||
current_entry->identity_address = peer_address;
|
||||
current_entry->identity_address_is_public = address_is_public;
|
||||
|
||||
tr_info("Write DB entry %d: %s peer address %s", get_index(db_handle), address_is_public? "public" : "private", tr_as_array(peer_address));
|
||||
tr_info("Write DB entry %d: %s peer address %s", get_index(db_handle), address_is_public? "public" : "private", to_string(peer_address));
|
||||
db_write_entry(current_entry, DB_ENTRY_PEER_IDENTITY, get_index(entry));
|
||||
}
|
||||
|
||||
|
@ -268,7 +268,7 @@ void KVStoreSecurityDb::set_entry_peer_csrk(
|
|||
SecurityEntrySigning_t* current_entry = read_in_entry_peer_signing(db_handle);
|
||||
current_entry->csrk = csrk;
|
||||
|
||||
tr_info("Write DB entry %d: peer csrk %s", get_index(db_handle), tr_as_array(csrk));
|
||||
tr_info("Write DB entry %d: peer csrk %s", get_index(db_handle), to_string(csrk));
|
||||
db_write_entry(current_entry, DB_ENTRY_PEER_SIGNING, get_index(entry));
|
||||
}
|
||||
|
||||
|
@ -288,7 +288,7 @@ void KVStoreSecurityDb::set_local_csrk(
|
|||
)
|
||||
{
|
||||
this->SecurityDb::set_local_csrk(csrk);
|
||||
tr_info("Write DB: local csrk %s", tr_as_array(csrk));
|
||||
tr_info("Write DB: local csrk %s", to_string(csrk));
|
||||
db_write(&_local_csrk, DB_LOCAL_CSRK);
|
||||
}
|
||||
|
||||
|
@ -299,7 +299,7 @@ void KVStoreSecurityDb::set_local_identity(
|
|||
)
|
||||
{
|
||||
this->SecurityDb::set_local_identity(irk, identity_address, public_address);
|
||||
tr_info("Write DB: %s peer address %s", public_address? "public" : "private", tr_as_array(identity_address));
|
||||
tr_info("Write DB: %s peer address %s", public_address? "public" : "private", to_string(identity_address));
|
||||
db_write(&_local_identity, DB_LOCAL_IDENTITY);
|
||||
}
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ public:
|
|||
) override {
|
||||
entry_t *entry = as_entry(db_handle);
|
||||
if (entry) {
|
||||
tr_info("Write DB entry %d: local ltk %s", get_index(db_handle), tr_as_array(ltk));
|
||||
tr_info("Write DB entry %d: local ltk %s", get_index(db_handle), to_string(ltk));
|
||||
entry->flags.ltk_sent = true;
|
||||
entry->local_keys.ltk = ltk;
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ public:
|
|||
) override {
|
||||
entry_t *entry = as_entry(db_handle);
|
||||
if (entry) {
|
||||
tr_info("Write DB entry %d: local ediv %s rand %s", get_index(db_handle), tr_as_array(ediv), tr_as_array(rand));
|
||||
tr_info("Write DB entry %d: local ediv %s rand %s", get_index(db_handle), to_string(ediv), to_string(rand));
|
||||
entry->local_keys.ediv = ediv;
|
||||
entry->local_keys.rand = rand;
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ public:
|
|||
) override {
|
||||
entry_t *entry = as_entry(db_handle);
|
||||
if (entry) {
|
||||
tr_info("Write DB entry %d: peer ltk %s", get_index(db_handle), tr_as_array(ltk));
|
||||
tr_info("Write DB entry %d: peer ltk %s", get_index(db_handle), to_string(ltk));
|
||||
entry->peer_keys.ltk = ltk;
|
||||
entry->flags.ltk_stored = true;
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ public:
|
|||
) override {
|
||||
entry_t *entry = as_entry(db_handle);
|
||||
if (entry) {
|
||||
tr_info("Write DB entry %d: peer ediv %s rand %s", get_index(db_handle), tr_as_array(ediv), tr_as_array(rand));
|
||||
tr_info("Write DB entry %d: peer ediv %s rand %s", get_index(db_handle), to_string(ediv), to_string(rand));
|
||||
entry->peer_keys.ediv = ediv;
|
||||
entry->peer_keys.rand = rand;
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ public:
|
|||
) override {
|
||||
entry_t *entry = as_entry(db_handle);
|
||||
if (entry) {
|
||||
tr_info("Write DB entry %d: peer irk %s", get_index(db_handle), tr_as_array(irk));
|
||||
tr_info("Write DB entry %d: peer irk %s", get_index(db_handle), to_string(irk));
|
||||
entry->peer_identity.irk = irk;
|
||||
entry->flags.irk_stored = true;
|
||||
}
|
||||
|
@ -143,7 +143,7 @@ public:
|
|||
) override {
|
||||
entry_t *entry = as_entry(db_handle);
|
||||
if (entry) {
|
||||
tr_info("Write DB entry %d: %s peer address %s", get_index(db_handle), address_is_public? "public" : "private", tr_as_array(peer_address));
|
||||
tr_info("Write DB entry %d: %s peer address %s", get_index(db_handle), address_is_public? "public" : "private", to_string(peer_address));
|
||||
entry->peer_identity.identity_address = peer_address;
|
||||
entry->peer_identity.identity_address_is_public = address_is_public;
|
||||
}
|
||||
|
@ -155,7 +155,7 @@ public:
|
|||
) override {
|
||||
entry_t *entry = as_entry(db_handle);
|
||||
if (entry) {
|
||||
tr_info("Write DB entry %d: peer csrk %s", get_index(db_handle), tr_as_array(csrk));
|
||||
tr_info("Write DB entry %d: peer csrk %s", get_index(db_handle), to_string(csrk));
|
||||
entry->flags.csrk_stored = true;
|
||||
entry->peer_signing.csrk = csrk;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue