if (device == NULL)
return btd_error_invalid_args(msg);
- if (!device->le)
- return btd_error_not_supported(msg);
-
- if (device->bdaddr_type != BDADDR_LE_RANDOM)
+ if (!device->le) {
+ error("It doesn't support LE");
return btd_error_not_supported(msg);
+ }
if (device->rpa) {
+ // There is the first RPA. So it's paired device.
if (device->bredr)
ba2str(device->rpa, device_idaddr);
else
ba2str(&device->bdaddr, device_idaddr);
- } else if ((device->bdaddr.b[5] >> 6) == 0x01)
+ } else if (device->bdaddr_type != BDADDR_LE_RANDOM) {
+ // device->bdaddr is identity address.
+ ba2str(&device->bdaddr, device_idaddr);
+ } else if ((device->bdaddr.b[5] >> 6) == 0x01) {
+ // RPA but it's not paired
return btd_error_does_not_exist(msg);
- else
+ } else if ((device->bdaddr.b[5] >> 6) == 0x03) {
+ // Static Random address
+ ba2str(&device->bdaddr, device_idaddr);
+ } else {
+ // Non-RPA case
return btd_error_not_supported(msg);
+ }
reply = dbus_message_new_method_return(msg);
if (!reply)