Loading system/btif/src/btif_core.cc +8 −4 Original line number Diff line number Diff line Loading @@ -591,7 +591,7 @@ bt_status_t btif_dut_mode_send(uint16_t opcode, uint8_t* buf, uint8_t len) { static bt_status_t btif_in_get_adapter_properties(void) { bt_property_t properties[6]; uint32_t num_props; uint32_t num_props = 0; bt_bdaddr_t addr; bt_bdname_t name; Loading @@ -599,13 +599,17 @@ static bt_status_t btif_in_get_adapter_properties(void) { uint32_t disc_timeout; bt_bdaddr_t bonded_devices[BTM_SEC_MAX_DEVICE_RECORDS]; bt_uuid_t local_uuids[BT_MAX_NUM_UUIDS]; num_props = 0; bt_status_t status; /* BD_ADDR */ BTIF_STORAGE_FILL_PROPERTY(&properties[num_props], BT_PROPERTY_BDADDR, sizeof(addr), &addr); btif_storage_get_adapter_property(&properties[num_props]); status = btif_storage_get_adapter_property(&properties[num_props]); // Add BT_PROPERTY_BDADDR property into list only when successful. // Otherwise, skip this property entry. if (status == BT_STATUS_SUCCESS) { num_props++; } /* BD_NAME */ BTIF_STORAGE_FILL_PROPERTY(&properties[num_props], BT_PROPERTY_BDNAME, Loading system/btif/src/btif_storage.cc +25 −14 Original line number Diff line number Diff line Loading @@ -83,14 +83,16 @@ /* This is a local property to add a device found */ #define BT_PROPERTY_REMOTE_DEVICE_TIMESTAMP 0xFF #define BTIF_STORAGE_GET_ADAPTER_PROP(t, v, l, p) \ // TODO: This macro should be converted to a function #define BTIF_STORAGE_GET_ADAPTER_PROP(s, t, v, l, p) \ do { \ (p).type = (t); \ (p).val = (v); \ (p).len = (l); \ btif_storage_get_adapter_property(&(p)); \ s = btif_storage_get_adapter_property(&(p)); \ } while (0) // TODO: This macro should be converted to a function #define BTIF_STORAGE_GET_REMOTE_PROP(b, t, v, l, p) \ do { \ (p).type = (t); \ Loading Loading @@ -548,7 +550,11 @@ bt_status_t btif_storage_get_adapter_property(bt_property_t* property) { /* Fetch the local BD ADDR */ const controller_t* controller = controller_get_interface(); if (controller->get_is_ready() == false) { LOG_ERROR(LOG_TAG, "%s: Controller not ready!", __func__); LOG_ERROR(LOG_TAG, "%s: Controller not ready! Unable to return Bluetooth Address", __func__); memset(bd_addr, 0, sizeof(bt_bdaddr_t)); return BT_STATUS_FAIL; } else { LOG_ERROR(LOG_TAG, "%s: Controller ready!", __func__); memcpy(bd_addr, controller->get_address(), sizeof(bt_bdaddr_t)); Loading Loading @@ -794,6 +800,7 @@ bt_status_t btif_storage_load_bonded_devices(void) { uint32_t disc_timeout; bt_uuid_t local_uuids[BT_MAX_NUM_UUIDS]; bt_uuid_t remote_uuids[BT_MAX_NUM_UUIDS]; bt_status_t status; btif_in_fetch_bonded_devices(&bonded_devices, 1); Loading @@ -802,13 +809,17 @@ bt_status_t btif_storage_load_bonded_devices(void) { memset(adapter_props, 0, sizeof(adapter_props)); /* BD_ADDR */ BTIF_STORAGE_GET_ADAPTER_PROP(BT_PROPERTY_BDADDR, &addr, sizeof(addr), adapter_props[num_props]); BTIF_STORAGE_GET_ADAPTER_PROP(status, BT_PROPERTY_BDADDR, &addr, sizeof(addr), adapter_props[num_props]); // Add BT_PROPERTY_BDADDR property into list only when successful. // Otherwise, skip this property entry. if (status == BT_STATUS_SUCCESS) { num_props++; } /* BD_NAME */ BTIF_STORAGE_GET_ADAPTER_PROP(BT_PROPERTY_BDNAME, &name, sizeof(name), adapter_props[num_props]); BTIF_STORAGE_GET_ADAPTER_PROP(status, BT_PROPERTY_BDNAME, &name, sizeof(name), adapter_props[num_props]); num_props++; /* SCAN_MODE */ Loading @@ -823,7 +834,7 @@ bt_status_t btif_storage_load_bonded_devices(void) { num_props++; /* DISC_TIMEOUT */ BTIF_STORAGE_GET_ADAPTER_PROP(BT_PROPERTY_ADAPTER_DISCOVERY_TIMEOUT, BTIF_STORAGE_GET_ADAPTER_PROP(status, BT_PROPERTY_ADAPTER_DISCOVERY_TIMEOUT, &disc_timeout, sizeof(disc_timeout), adapter_props[num_props]); num_props++; Loading @@ -841,7 +852,7 @@ bt_status_t btif_storage_load_bonded_devices(void) { num_props++; /* LOCAL UUIDs */ BTIF_STORAGE_GET_ADAPTER_PROP(BT_PROPERTY_UUIDS, local_uuids, BTIF_STORAGE_GET_ADAPTER_PROP(status, BT_PROPERTY_UUIDS, local_uuids, sizeof(local_uuids), adapter_props[num_props]); num_props++; Loading Loading
system/btif/src/btif_core.cc +8 −4 Original line number Diff line number Diff line Loading @@ -591,7 +591,7 @@ bt_status_t btif_dut_mode_send(uint16_t opcode, uint8_t* buf, uint8_t len) { static bt_status_t btif_in_get_adapter_properties(void) { bt_property_t properties[6]; uint32_t num_props; uint32_t num_props = 0; bt_bdaddr_t addr; bt_bdname_t name; Loading @@ -599,13 +599,17 @@ static bt_status_t btif_in_get_adapter_properties(void) { uint32_t disc_timeout; bt_bdaddr_t bonded_devices[BTM_SEC_MAX_DEVICE_RECORDS]; bt_uuid_t local_uuids[BT_MAX_NUM_UUIDS]; num_props = 0; bt_status_t status; /* BD_ADDR */ BTIF_STORAGE_FILL_PROPERTY(&properties[num_props], BT_PROPERTY_BDADDR, sizeof(addr), &addr); btif_storage_get_adapter_property(&properties[num_props]); status = btif_storage_get_adapter_property(&properties[num_props]); // Add BT_PROPERTY_BDADDR property into list only when successful. // Otherwise, skip this property entry. if (status == BT_STATUS_SUCCESS) { num_props++; } /* BD_NAME */ BTIF_STORAGE_FILL_PROPERTY(&properties[num_props], BT_PROPERTY_BDNAME, Loading
system/btif/src/btif_storage.cc +25 −14 Original line number Diff line number Diff line Loading @@ -83,14 +83,16 @@ /* This is a local property to add a device found */ #define BT_PROPERTY_REMOTE_DEVICE_TIMESTAMP 0xFF #define BTIF_STORAGE_GET_ADAPTER_PROP(t, v, l, p) \ // TODO: This macro should be converted to a function #define BTIF_STORAGE_GET_ADAPTER_PROP(s, t, v, l, p) \ do { \ (p).type = (t); \ (p).val = (v); \ (p).len = (l); \ btif_storage_get_adapter_property(&(p)); \ s = btif_storage_get_adapter_property(&(p)); \ } while (0) // TODO: This macro should be converted to a function #define BTIF_STORAGE_GET_REMOTE_PROP(b, t, v, l, p) \ do { \ (p).type = (t); \ Loading Loading @@ -548,7 +550,11 @@ bt_status_t btif_storage_get_adapter_property(bt_property_t* property) { /* Fetch the local BD ADDR */ const controller_t* controller = controller_get_interface(); if (controller->get_is_ready() == false) { LOG_ERROR(LOG_TAG, "%s: Controller not ready!", __func__); LOG_ERROR(LOG_TAG, "%s: Controller not ready! Unable to return Bluetooth Address", __func__); memset(bd_addr, 0, sizeof(bt_bdaddr_t)); return BT_STATUS_FAIL; } else { LOG_ERROR(LOG_TAG, "%s: Controller ready!", __func__); memcpy(bd_addr, controller->get_address(), sizeof(bt_bdaddr_t)); Loading Loading @@ -794,6 +800,7 @@ bt_status_t btif_storage_load_bonded_devices(void) { uint32_t disc_timeout; bt_uuid_t local_uuids[BT_MAX_NUM_UUIDS]; bt_uuid_t remote_uuids[BT_MAX_NUM_UUIDS]; bt_status_t status; btif_in_fetch_bonded_devices(&bonded_devices, 1); Loading @@ -802,13 +809,17 @@ bt_status_t btif_storage_load_bonded_devices(void) { memset(adapter_props, 0, sizeof(adapter_props)); /* BD_ADDR */ BTIF_STORAGE_GET_ADAPTER_PROP(BT_PROPERTY_BDADDR, &addr, sizeof(addr), adapter_props[num_props]); BTIF_STORAGE_GET_ADAPTER_PROP(status, BT_PROPERTY_BDADDR, &addr, sizeof(addr), adapter_props[num_props]); // Add BT_PROPERTY_BDADDR property into list only when successful. // Otherwise, skip this property entry. if (status == BT_STATUS_SUCCESS) { num_props++; } /* BD_NAME */ BTIF_STORAGE_GET_ADAPTER_PROP(BT_PROPERTY_BDNAME, &name, sizeof(name), adapter_props[num_props]); BTIF_STORAGE_GET_ADAPTER_PROP(status, BT_PROPERTY_BDNAME, &name, sizeof(name), adapter_props[num_props]); num_props++; /* SCAN_MODE */ Loading @@ -823,7 +834,7 @@ bt_status_t btif_storage_load_bonded_devices(void) { num_props++; /* DISC_TIMEOUT */ BTIF_STORAGE_GET_ADAPTER_PROP(BT_PROPERTY_ADAPTER_DISCOVERY_TIMEOUT, BTIF_STORAGE_GET_ADAPTER_PROP(status, BT_PROPERTY_ADAPTER_DISCOVERY_TIMEOUT, &disc_timeout, sizeof(disc_timeout), adapter_props[num_props]); num_props++; Loading @@ -841,7 +852,7 @@ bt_status_t btif_storage_load_bonded_devices(void) { num_props++; /* LOCAL UUIDs */ BTIF_STORAGE_GET_ADAPTER_PROP(BT_PROPERTY_UUIDS, local_uuids, BTIF_STORAGE_GET_ADAPTER_PROP(status, BT_PROPERTY_UUIDS, local_uuids, sizeof(local_uuids), adapter_props[num_props]); num_props++; Loading