summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2014-02-07 16:56:41 +0200
committerPedro Alvarez <pedro.alvarez@codethink.co.uk>2014-04-10 14:16:15 +0000
commit55b463d859579c107f643ad8b9ec1a1d58655ffd (patch)
tree7d22e568196e3c851d67481ff0a9b841975544a4
parent7499c5e6ed27495f20959063c83c438e0dca51a6 (diff)
downloadbluez-55b463d859579c107f643ad8b9ec1a1d58655ffd.tar.gz
plugins/service: Add AutoConnect property
-rw-r--r--plugins/service.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/plugins/service.c b/plugins/service.c
index c2584c07b..bca3abd81 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 },
{ }
};