[RFC v1 04/11] device: Find services instead of profiles

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

 



From: Mikel Astiz <mikel.astiz@xxxxxxxxxxxx>

Trivially replace the former find_connectable_profile() with
find_connectable_service().
---
 src/device.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/src/device.c b/src/device.c
index 4b814c8..8b66ad9 100644
--- a/src/device.c
+++ b/src/device.c
@@ -1195,7 +1195,7 @@ static int device_resolve_svc(struct btd_device *dev, DBusMessage *msg)
 		return device_browse_primary(dev, msg, FALSE);
 }
 
-static struct btd_profile *find_connectable_profile(struct btd_device *dev,
+static struct btd_service *find_connectable_service(struct btd_device *dev,
 							const char *uuid)
 {
 	GSList *l;
@@ -1208,7 +1208,7 @@ static struct btd_profile *find_connectable_profile(struct btd_device *dev,
 			continue;
 
 		if (strcasecmp(uuid, p->remote_uuid) == 0)
-			return p;
+			return service;
 	}
 
 	return NULL;
@@ -1245,10 +1245,11 @@ static DBusMessage *connect_profiles(struct btd_device *dev, DBusMessage *msg,
 	}
 
 	if (uuid) {
-		p = find_connectable_profile(dev, uuid);
-		if (!p)
+		service = find_connectable_service(dev, uuid);
+		if (!service)
 			return btd_error_invalid_args(msg);
 
+		p = btd_service_get_profile(service);
 		dev->pending = g_slist_prepend(dev->pending, p);
 
 		goto start_connect;
@@ -1364,7 +1365,6 @@ static DBusMessage *disconnect_profile(DBusConnection *conn, DBusMessage *msg,
 	const char *pattern;
 	char *uuid;
 	int err;
-	GSList *l;
 
 	if (!dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &pattern,
 							DBUS_TYPE_INVALID))
@@ -1374,14 +1374,13 @@ static DBusMessage *disconnect_profile(DBusConnection *conn, DBusMessage *msg,
 	if (uuid == NULL)
 		return btd_error_invalid_args(msg);
 
-	p = find_connectable_profile(dev, uuid);
+	service = find_connectable_service(dev, uuid);
 	g_free(uuid);
 
-	if (!p)
+	if (!service)
 		return btd_error_invalid_args(msg);
 
-	l = g_slist_find_custom(dev->services, p, service_profile_cmp);
-	service = l->data;
+	p = btd_service_get_profile(service);
 
 	if (!p->disconnect)
 		return btd_error_not_supported(msg);
-- 
1.8.1.4

--
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