aboutsummaryrefslogtreecommitdiffstats
path: root/meta-ivi/recipes-connectivity/bluez5/bluez5/0010-plugins-service-Add-AutoConnect-property.patch
blob: 724d83288172155dd09dbb50112b9c65844f4382 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
From dfd1b1988fce28b402c2d6e483b2d07f79428431 Mon Sep 17 00:00:00 2001
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Date: Fri, 7 Feb 2014 16:56:41 +0200
Subject: [PATCH 10/12] plugins/service: Add AutoConnect property

---
 plugins/service.c | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/plugins/service.c b/plugins/service.c
index c2584c0..bca3abd 100644
--- a/plugins/service.c
+++ b/plugins/service.c
@@ -236,12 +236,46 @@ static gboolean get_version(const GDBusPropertyTable *property,
 	return TRUE;
 }
 
+static gboolean get_auto_connect(const GDBusPropertyTable *property,
+					DBusMessageIter *iter, void *user_data)
+{
+	struct service_data *data = user_data;
+	dbus_bool_t value = btd_service_get_auto_connect(data->service);
+
+	dbus_message_iter_append_basic(iter, DBUS_TYPE_BOOLEAN, &value);
+
+	return TRUE;
+}
+
+static void set_auto_connect(const GDBusPropertyTable *property,
+						DBusMessageIter *value,
+						GDBusPendingPropertySet id,
+						void *user_data)
+{
+	struct service_data *data = user_data;
+	dbus_bool_t b;
+
+	if (dbus_message_iter_get_arg_type(value) != DBUS_TYPE_BOOLEAN) {
+		g_dbus_pending_property_error(id,
+					ERROR_INTERFACE ".InvalidArguments",
+					"Invalid arguments in method call");
+		return;
+	}
+
+	dbus_message_iter_get_basic(value, &b);
+
+	btd_service_set_auto_connect(data->service, b);
+
+	g_dbus_pending_property_success(id);
+}
+
 static const GDBusPropertyTable service_properties[] = {
 	{ "Device", "o", get_device, NULL, NULL },
 	{ "State", "s", get_state, NULL, NULL },
 	{ "RemoteUUID", "s", get_remote_uuid, NULL, remote_uuid_exists },
 	{ "LocalUUID", "s", get_local_uuid, NULL, local_uuid_exists },
 	{ "Version", "q", get_version, NULL, version_exists },
+	{ "AutoConnect", "b", get_auto_connect, set_auto_connect, NULL },
 	{ }
 };
 
-- 
2.2.0