[PATCH v3] gatt: Mark Includes property of org.bluez.GattService1 as optional

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If property is not present treat it as no Include Services present.
---
 doc/gatt-api.txt    | 2 +-
 src/gatt-database.c | 7 +++++--
 2 files changed, 6 insertions(+), 3 deletions(-)


V3:
if property is present require it to be in proper format

diff --git a/doc/gatt-api.txt b/doc/gatt-api.txt
index f58de23c3..60a997cbf 100644
--- a/doc/gatt-api.txt
+++ b/doc/gatt-api.txt
@@ -45,7 +45,7 @@ Properties	string UUID [read-only]
 			belongs to. Only present on services from remote
 			devices.
 
-		array{object} Includes [read-only]
+		array{object} Includes [read-only, optional]
 
 			Array of object paths representing the included
 			services of this service.
diff --git a/src/gatt-database.c b/src/gatt-database.c
index c1ae91211..19f03c544 100644
--- a/src/gatt-database.c
+++ b/src/gatt-database.c
@@ -1676,8 +1676,9 @@ static bool parse_includes(GDBusProxy *proxy, struct external_service *service)
 	DBusMessageIter array;
 	char *obj;
 
+	/* Includes property is optional */
 	if (!g_dbus_proxy_get_property(proxy, "Includes", &iter))
-		return false;
+		return true;
 
 	if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_ARRAY)
 		return false;
@@ -2682,8 +2683,10 @@ static bool database_add_service(struct external_service *service)
 		return false;
 	}
 
-	if (!parse_includes(service->proxy, service))
+	if (!parse_includes(service->proxy, service)) {
 		error("Failed to read \"Includes\" property of service");
+		return false;
+	}
 
 	service->attrib = gatt_db_add_service(service->app->database->db, &uuid,
 						primary, service->attr_cnt);
-- 
2.14.3

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux