Skip to content

Commit

Permalink
plugins/service: Add Blocked property
Browse files Browse the repository at this point in the history
  • Loading branch information
Vudentz committed May 25, 2017
1 parent 9bd6dce commit 42a7e47
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions plugins/service.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,13 +271,47 @@ 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 },
{ "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 },
{ "Blocked", "b", get_blocked, set_blocked, NULL },
{ }
};

Expand Down

0 comments on commit 42a7e47

Please sign in to comment.