diff options
author | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2017-12-18 11:35:10 -0200 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2018-01-19 11:44:09 -0200 |
commit | aebb7e197384658d1a579442089bf8e52aa2e2c0 (patch) | |
tree | fc0e9b2efd80390d4d5e99b9e7e80c3484a19361 /client/advertising.c | |
parent | 821ad2ecd40fcfab5fd0bc06897d8b53d31deacd (diff) | |
download | bluez-aebb7e197384658d1a579442089bf8e52aa2e2c0.tar.gz |
client: Rename set-appearance to appearance
Make the command return the current value if no parameters:
[bluetooth]# appearance 0x0001
[bluetooth]# appearance
Appearance: Unknown (0x0001)
Diffstat (limited to 'client/advertising.c')
-rw-r--r-- | client/advertising.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/client/advertising.c b/client/advertising.c index 5e63f6dbb..944251db0 100644 --- a/client/advertising.c +++ b/client/advertising.c @@ -650,12 +650,24 @@ void ad_advertise_appearance(DBusConnection *conn, bool value) g_dbus_emit_property_changed(conn, AD_PATH, AD_IFACE, "Includes"); } -void ad_advertise_local_appearance(DBusConnection *conn, uint16_t value) +void ad_advertise_local_appearance(DBusConnection *conn, long int *value) { - if (ad.local_appearance == value) + if (!value) { + if (ad.local_appearance != UINT16_MAX) + bt_shell_printf("Appearance: %s (0x%04x)\n", + bt_appear_to_str(ad.local_appearance), + ad.local_appearance); + else + bt_shell_printf("Apperance: %s\n", + ad.appearance ? "on" : "off"); + + return; + } + + if (ad.local_appearance == *value) return; - ad.local_appearance = value; + ad.local_appearance = *value; g_dbus_emit_property_changed(conn, AD_PATH, AD_IFACE, "Appearance"); } |