struct btp_device {
struct l_dbus_proxy *proxy;
+ uint8_t address_type;
+ bdaddr_t address;
};
static struct l_queue *adapters;
}
}
+static void btp_identity_resolved_ev(struct l_dbus_proxy *proxy)
+{
+ struct btp_device *dev = find_device_by_proxy(proxy);
+ struct btp_adapter *adapter = find_adapter_by_device(dev);
+ struct btp_gap_identity_resolved_ev ev;
+ char *str_addr, *str_addr_type;
+ uint8_t identity_address_type;
+
+ if (!l_dbus_proxy_get_property(proxy, "Address", "s", &str_addr))
+ return;
+
+ if (!l_dbus_proxy_get_property(proxy, "AddressType", "s",
+ &str_addr_type))
+ return;
+
+ identity_address_type = strcmp(str_addr_type, "public") ?
+ BTP_GAP_ADDR_RANDOM : BTP_GAP_ADDR_PUBLIC;
+
+ str2ba(str_addr, &ev.identity_address);
+ ev.identity_address_type = identity_address_type;
+
+ memcpy(&ev.address, &dev->address, sizeof(ev.address));
+ ev.address_type = dev->address_type;
+
+ btp_send(btp, BTP_GAP_SERVICE, BTP_EV_GAP_IDENTITY_RESOLVED,
+ adapter->index, sizeof(ev), &ev);
+}
+
static void register_gap_service(void)
{
btp_register(btp, BTP_GAP_SERVICE, BTP_OP_GAP_READ_SUPPORTED_COMMANDS,
if (!strcmp(interface, "org.bluez.Device1")) {
struct btp_adapter *adapter;
struct btp_device *device;
- char *str;
+ char *str, *str_addr, *str_addr_type;
if (!l_dbus_proxy_get_property(proxy, "Adapter", "o", &str))
return;
btp_gap_device_found_ev(proxy);
+ if (!l_dbus_proxy_get_property(proxy, "Address", "s",
+ &str_addr))
+ return;
+
+ if (!l_dbus_proxy_get_property(proxy, "AddressType", "s",
+ &str_addr_type))
+ return;
+
+ device->address_type = strcmp(str_addr_type, "public") ?
+ BTP_GAP_ADDR_RANDOM :
+ BTP_GAP_ADDR_PUBLIC;
+ if (!str2ba(str_addr, &device->address))
+ return;
+
return;
}
return;
btp_gap_device_connection_ev(proxy, prop);
+ } else if (!strcmp(name, "AddressType")) {
+ /* Addres property change came first along with address
+ * type.
+ */
+ btp_identity_resolved_ev(proxy);
}
}
}