summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2014-02-08 14:46:18 +0200
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2016-01-28 14:10:52 +0200
commit628ee2b4c5b082f6fad402814a6d1743c369af2a (patch)
tree1a53d0b6d781a95bb60bb9e3a65fe5f84390f8eb
parent7571f0d5e25c7c0d54aef18e0f38fdaf61237c10 (diff)
downloadbluez-628ee2b4c5b082f6fad402814a6d1743c369af2a.tar.gz
plugins/service: Add Blocked 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 9c1cb456a..43baec101 100644
--- a/plugins/service.c
+++ b/plugins/service.c
@@ -271,6 +271,39 @@ static void set_auto_connect(const GDBusPropertyTable *property,
g_dbus_pending_property_success(id);
}
+static gboolean get_blocked(const GDBusPropertyTable *property,
+ DBusMessageIter *iter, void *user_data)
+{
+ struct service_data *data = user_data;
+ dbus_bool_t value = btd_service_is_blocked(data->service);
+
+ dbus_message_iter_append_basic(iter, DBUS_TYPE_BOOLEAN, &value);
+
+ return TRUE;
+}
+
+static void set_blocked(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_blocked(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 },
@@ -278,6 +311,7 @@ static const GDBusPropertyTable service_properties[] = {
{ "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 },
+ { "Blocked", "b", get_blocked, set_blocked, NULL },
{ }
};