} btif_debug_conn_state_t;
// Report a connection state change
-void btif_debug_conn_state(const RawAddress bda,
+void btif_debug_conn_state(const RawAddress& bda,
const btif_debug_conn_state_t state,
const tGATT_DISCONN_REASON disconnect_reason);
(type != BT_PROPERTY_BDNAME))
return BT_STATUS_NOT_READY;
- memset(&(req.read_req.bd_addr), 0, sizeof(RawAddress));
+ req.read_req.bd_addr = RawAddress::kEmpty;
req.read_req.type = type;
return btif_transfer_context(execute_storage_request,
if (!btif_is_enabled()) return BT_STATUS_NOT_READY;
- memcpy(&(req.write_req.bd_addr), remote_addr, sizeof(RawAddress));
+ req.write_req.bd_addr = *remote_addr;
memcpy(&(req.write_req.prop), property, sizeof(bt_property_t));
return btif_transfer_context(execute_storage_remote_request,
if (current_event == NUM_CONNECTION_EVENTS) current_event = 0;
}
-void btif_debug_conn_state(const RawAddress bda,
+void btif_debug_conn_state(const RawAddress& bda,
const btif_debug_conn_state_t state,
const tGATT_DISCONN_REASON disconnect_reason) {
next_event();
evt->ts = time_gettimeofday_us();
evt->state = state;
evt->disconnect_reason = disconnect_reason;
- memcpy(&evt->bda, &bda, sizeof(RawAddress));
+ evt->bda = bda;
}
void btif_debug_conn_dump(int fd) {
return NULL;
}
-
/*****************************************************************************
*
* btif hf api functions (no context switch)
}
}
bt_linkkey_file_found = true;
- memcpy(&p_bonded_devices->devices[p_bonded_devices->num_devices++],
- &bd_addr, sizeof(RawAddress));
+ p_bonded_devices->devices[p_bonded_devices->num_devices++] = bd_addr;
} else {
bt_linkkey_file_found = false;
}
LOG_ERROR(LOG_TAG,
"%s: Controller not ready! Unable to return Bluetooth Address",
__func__);
- memset(bd_addr, 0, sizeof(RawAddress));
+ *bd_addr = RawAddress::kEmpty;
return BT_STATUS_FAIL;
} else {
LOG_ERROR(LOG_TAG, "%s: Controller ready!", __func__);
- memcpy(bd_addr, controller->get_address(), sizeof(RawAddress));
+ *bd_addr = *controller->get_address();
}
- property->len = sizeof(RawAddress);
+ property->len = RawAddress::kLength;
return BT_STATUS_SUCCESS;
} else if (property->type == BT_PROPERTY_ADAPTER_BONDED_DEVICES) {
btif_bonded_devices_t bonded_devices;
__func__, bonded_devices.num_devices);
if (bonded_devices.num_devices > 0) {
- property->len = bonded_devices.num_devices * sizeof(RawAddress);
+ property->len = bonded_devices.num_devices * RawAddress::kLength;
memcpy(property->val, bonded_devices.devices, property->len);
}
bonded_devices.num_devices * sizeof(RawAddress);
adapter_props[num_props].val = devices_list;
for (i = 0; i < bonded_devices.num_devices; i++) {
- memcpy(devices_list + i, &bonded_devices.devices[i], sizeof(RawAddress));
+ devices_list[i] = bonded_devices.devices[i];
}
num_props++;
// Fill in the bonded devices
if (device_added) {
- memcpy(&p_bonded_devices->devices[p_bonded_devices->num_devices++],
- &bd_addr, sizeof(RawAddress));
+ p_bonded_devices->devices[p_bonded_devices->num_devices++] = bd_addr;
btif_gatts_add_bonded_dev_from_nv(bd_addr);
}
// 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.
-// |length| must be greater than 0 and less than sizeof(RawAddress).
+// |length| must be greater than 0 and less than RawAddress::kLength.
// As |interop_feature_t| is not exposed in the public API, feature must be a
// valid integer representing an option in the enum.
void interop_database_add(const uint16_t feature, const RawAddress* addr,
size_t length) {
CHECK(addr);
CHECK(length > 0);
- CHECK(length < sizeof(RawAddress));
+ CHECK(length < RawAddress::kLength);
interop_addr_entry_t* entry = static_cast<interop_addr_entry_t*>(
osi_calloc(sizeof(interop_addr_entry_t)));
static void parse_read_bd_addr_response(BT_HDR* response,
RawAddress* address_ptr) {
uint8_t* stream = read_command_complete_header(
- response, HCI_READ_BD_ADDR, sizeof(RawAddress) /* bytes after */);
+ response, HCI_READ_BD_ADDR, RawAddress::kLength /* bytes after */);
CHECK(stream != NULL);
STREAM_TO_BDADDR(*address_ptr, stream);
void FakeBluetoothInterface::NotifyAdapterAddressPropertyChanged(
const RawAddress* address) {
bt_property_t property;
- property.len = sizeof(RawAddress);
- property.val = (void*)address;
+ property.len = RawAddress::kLength;
+ property.val = (void*)address->address;
property.type = BT_PROPERTY_BDADDR;
NotifyAdapterPropertiesChanged(1, &property);