Diff between 0161a7c9bbf6df67b1453267485e71e98d1bc179 and b48572be30ed2df164c23c0b975b674b7b580143

Changed Files

File Additions Deletions Status
src/device.c +14 -0 modified
src/device.h +2 -0 modified

Full Patch

diff --git a/src/device.c b/src/device.c
index eabbe0a..ce307c3 100644
--- a/src/device.c
+++ b/src/device.c
@@ -2300,6 +2300,20 @@ void device_set_class(struct btd_device *device, uint32_t class)
 						DEVICE_INTERFACE, "Icon");
 }
 
+void device_update_addr(struct btd_device *device, const bdaddr_t *bdaddr,
+							uint8_t bdaddr_type)
+{
+	if (!bacmp(bdaddr, &device->bdaddr) &&
+					bdaddr_type == device->bdaddr_type)
+		return;
+
+	bacpy(&device->bdaddr, bdaddr);
+	device->bdaddr_type = bdaddr_type;
+
+	g_dbus_emit_property_changed(dbus_conn, device->path,
+						DEVICE_INTERFACE, "Address");
+}
+
 uint32_t btd_device_get_class(struct btd_device *device)
 {
 	return device->class;
diff --git a/src/device.h b/src/device.h
index 3a33cb2..f896a00 100644
--- a/src/device.h
+++ b/src/device.h
@@ -38,6 +38,8 @@ void device_store_cached_name(struct btd_device *dev, const char *name);
 void device_get_name(struct btd_device *device, char *name, size_t len);
 bool device_name_known(struct btd_device *device);
 void device_set_class(struct btd_device *device, uint32_t class);
+void device_update_addr(struct btd_device *device, const bdaddr_t *bdaddr,
+							uint8_t bdaddr_type);
 uint32_t btd_device_get_class(struct btd_device *device);
 uint16_t btd_device_get_vendor(struct btd_device *device);
 uint16_t btd_device_get_vendor_src(struct btd_device *device);