Diff between f5c4a04e177676a435ef93b4d8c700af7320e90d and ce9eca54c664d0d8c9d09c77348b29a9748508f7

Changed Files

File Additions Deletions Status
doc/device-api.txt +4 -0 modified
src/adapter.c +4 -2 modified
src/device.c +4 -1 modified

Full Patch

diff --git a/doc/device-api.txt b/doc/device-api.txt
index 3b84033..1f0dc96 100644
--- a/doc/device-api.txt
+++ b/doc/device-api.txt
@@ -116,6 +116,10 @@ Properties	string Address [readonly]
 
 			The Bluetooth class of device of the remote device.
 
+		uint16 Appearance [readonly]
+
+			External appearance of device, as found on GAP service.
+
 		array{string} UUIDs [readonly]
 
 			List of 128-bit UUIDs that represents the available
diff --git a/src/adapter.c b/src/adapter.c
index d46f3c3..d471720 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -2700,12 +2700,14 @@ void adapter_emit_device_found(struct btd_adapter *adapter,
 		if (read_remote_appearance(&adapter->bdaddr, &dev->bdaddr,
 						dev->bdaddr_type, &app) == 0)
 			icon = gap_appearance_to_icon(app);
-		else
+		else {
+			app = 0;
 			icon = NULL;
+		}
 
 		emit_device_found(adapter->path, paddr,
 				"Address", DBUS_TYPE_STRING, &paddr,
-				"Class", DBUS_TYPE_UINT32, &dev->class,
+				"Appearance", DBUS_TYPE_UINT16, &app,
 				"Icon", DBUS_TYPE_STRING, &icon,
 				"RSSI", DBUS_TYPE_INT16, &rssi,
 				"Name", DBUS_TYPE_STRING, &dev->name,
diff --git a/src/device.c b/src/device.c
index cd571f7..72d11f5 100644
--- a/src/device.c
+++ b/src/device.c
@@ -373,10 +373,13 @@ static DBusMessage *get_properties(DBusConnection *conn,
 
 		dict_append_entry(&dict, "Class", DBUS_TYPE_UINT32, &class);
 	} else if (read_remote_appearance(&src, &device->bdaddr,
-						device->bdaddr_type, &app) == 0)
+					device->bdaddr_type, &app) == 0) {
 		/* Appearance */
 		icon = gap_appearance_to_icon(app);
 
+		dict_append_entry(&dict, "Appearance", DBUS_TYPE_UINT16, &app);
+	}
+
 	dict_append_entry(&dict, "Icon", DBUS_TYPE_STRING, &icon);
 
 	/* Vendor */