summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2012-12-15 05:30:57 +0100
committerMarcel Holtmann <marcel@holtmann.org>2012-12-15 05:32:40 +0100
commit2fdc266d1bb82755bf3a1d4950818d936dc5f357 (patch)
tree7af2c0a8343180072dd69fe82c21a797098ffb10 /client
parentb66db827f8c9b00de0b7dd7c846224c447f64f02 (diff)
client: Handle printing of properties with int16 type
Diffstat (limited to 'client')
-rw-r--r--client/main.c32
1 files changed, 29 insertions, 3 deletions
diff --git a/client/main.c b/client/main.c
index 9af3716a2..4d3157084 100644
--- a/client/main.c
+++ b/client/main.c
@@ -87,11 +87,33 @@ static void print_adapter(GDBusProxy *proxy, const char *description)
}
+static void print_device(GDBusProxy *proxy, const char *description)
+{
+ DBusMessageIter iter;
+ const char *address, *name;
+
+ if (g_dbus_proxy_get_property(proxy, "Address", &iter) == FALSE)
+ return;
+
+ dbus_message_iter_get_basic(&iter, &address);
+
+ if (g_dbus_proxy_get_property(proxy, "Alias", &iter) == TRUE)
+ dbus_message_iter_get_basic(&iter, &name);
+ else
+ name = "<unknown>";
+
+ if (description != NULL)
+ printf("[%s] ", description);
+
+ printf("Device %s %s\n", address, name);
+}
+
static void print_iter(const char *label, const char *name,
DBusMessageIter *iter)
{
dbus_bool_t valbool;
- dbus_uint32_t val32;
+ dbus_uint32_t valu32;
+ dbus_int16_t vals16;
const char *valstr;
if (iter == NULL) {
@@ -114,8 +136,12 @@ static void print_iter(const char *label, const char *name,
valbool == TRUE ? "yes" : "no");
break;
case DBUS_TYPE_UINT32:
- dbus_message_iter_get_basic(iter, &val32);
- printf("%s%s: 0x%06x\n", label, name, val32);
+ dbus_message_iter_get_basic(iter, &valu32);
+ printf("%s%s: 0x%06x\n", label, name, valu32);
+ break;
+ case DBUS_TYPE_INT16:
+ dbus_message_iter_get_basic(iter, &vals16);
+ printf("%s%s: %d\n", label, name, vals16);
break;
default:
printf("%s%s has unsupported type\n", label, name);