mirror of
https://git.kernel.org/pub/scm/bluetooth/bluez.git
synced 2024-11-15 08:14:28 +08:00
client: Rename set-appearance to appearance
Make the command return the current value if no parameters: [bluetooth]# appearance 0x0001 [bluetooth]# appearance Appearance: Unknown (0x0001)
This commit is contained in:
parent
821ad2ecd4
commit
aebb7e1973
@ -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");
|
||||
}
|
||||
|
@ -31,6 +31,6 @@ void ad_advertise_tx_power(DBusConnection *conn, dbus_bool_t *value);
|
||||
void ad_advertise_name(DBusConnection *conn, bool value);
|
||||
void ad_advertise_appearance(DBusConnection *conn, bool value);
|
||||
void ad_advertise_local_name(DBusConnection *conn, const char *name);
|
||||
void ad_advertise_local_appearance(DBusConnection *conn, uint16_t value);
|
||||
void ad_advertise_local_appearance(DBusConnection *conn, long int *value);
|
||||
void ad_advertise_duration(DBusConnection *conn, uint16_t value);
|
||||
void ad_advertise_timeout(DBusConnection *conn, uint16_t value);
|
||||
|
@ -2241,11 +2241,16 @@ static void cmd_advertise_name(int argc, char *argv[])
|
||||
ad_advertise_local_name(dbus_conn, argv[1]);
|
||||
}
|
||||
|
||||
static void cmd_set_advertise_appearance(int argc, char *argv[])
|
||||
static void cmd_advertise_appearance(int argc, char *argv[])
|
||||
{
|
||||
long int value;
|
||||
char *endptr = NULL;
|
||||
|
||||
if (argc < 2) {
|
||||
ad_advertise_local_appearance(dbus_conn, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcmp(argv[1], "on") == 0 || strcmp(argv[1], "yes") == 0) {
|
||||
ad_advertise_appearance(dbus_conn, true);
|
||||
return;
|
||||
@ -2262,7 +2267,7 @@ static void cmd_set_advertise_appearance(int argc, char *argv[])
|
||||
return;
|
||||
}
|
||||
|
||||
ad_advertise_local_appearance(dbus_conn, value);
|
||||
ad_advertise_local_appearance(dbus_conn, &value);
|
||||
}
|
||||
|
||||
static void cmd_set_advertise_duration(int argc, char *argv[])
|
||||
@ -2309,7 +2314,7 @@ static const struct bt_shell_menu advertise_menu = {
|
||||
mode_generator },
|
||||
{ "name", "[on/off/name]", cmd_advertise_name,
|
||||
"Enable/disable local name to be advertised" },
|
||||
{ "set-appearance", "<value>", cmd_set_advertise_appearance,
|
||||
{ "appearance", "[value]", cmd_advertise_appearance,
|
||||
"Set custom appearance to be advertised" },
|
||||
{ "set-duration", "<seconds>", cmd_set_advertise_duration,
|
||||
"Set advertise duration" },
|
||||
|
Loading…
Reference in New Issue
Block a user