diff options
author | Luiz Augusto von Dentz <luiz.dentz@openbossa.org> | 2008-09-23 15:20:20 -0700 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.dentz@openbossa.org> | 2008-09-23 17:54:01 -0700 |
commit | a34ec607308e143df09848025decbeae9c2d98f2 (patch) | |
tree | 463cd145c308326adf333424b211fd8710f991c2 /src/adapter.c | |
parent | 1906413abac75b33c05908d458fa74dc5de004c4 (diff) |
Make Powered/Discoverable property available in GetProperty.
Diffstat (limited to 'src/adapter.c')
-rw-r--r-- | src/adapter.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/adapter.c b/src/adapter.c index c02d0c2d..eb40f854 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -1509,7 +1509,7 @@ static DBusMessage *get_properties(DBusConnection *conn, DBusMessageIter iter; DBusMessageIter dict; char str[249], srcaddr[18]; - gboolean discov_active; + gboolean bproperty; char **devices; int i; GSList *l; @@ -1549,18 +1549,28 @@ static DBusMessage *get_properties(DBusConnection *conn, dbus_message_iter_append_dict_entry(&dict, "Mode", DBUS_TYPE_STRING, &property); + /* Powered */ + bproperty = adapter->up ? TRUE : FALSE; + dbus_message_iter_append_dict_entry(&dict, "Powered", + DBUS_TYPE_BOOLEAN, &bproperty); + + /* Discoverable */ + bproperty = adapter->scan_mode == SCAN_INQUIRY ? TRUE : FALSE; + dbus_message_iter_append_dict_entry(&dict, "Discoverable", + DBUS_TYPE_BOOLEAN, &bproperty); + /* DiscoverableTimeout */ dbus_message_iter_append_dict_entry(&dict, "DiscoverableTimeout", DBUS_TYPE_UINT32, &adapter->discov_timeout); if (adapter->state & PERIODIC_INQUIRY || adapter->state & STD_INQUIRY) - discov_active = TRUE; + bproperty = TRUE; else - discov_active = FALSE; + bproperty = FALSE; /* Discovering */ dbus_message_iter_append_dict_entry(&dict, "Discovering", - DBUS_TYPE_BOOLEAN, &discov_active); + DBUS_TYPE_BOOLEAN, &bproperty); /* Devices */ devices = g_new0(char *, g_slist_length(adapter->devices) + 1); |