diff --git a/doc/advertising-api.txt b/doc/advertising-api.txt
index c9bc9a1..36fe130 100644
--- a/doc/advertising-api.txt
+++ b/doc/advertising-api.txt
If this property is available 'local-name' cannot be
present in the Includes.
+ uint16 Appearance
+
+ Appearance to be used in the advertising report.
+
+ Possible values: as found on GAP Service.
+
LE Advertising Manager hierarchy
================================
diff --git a/src/advertising.c b/src/advertising.c
index e452070..9eb22b9 100644
--- a/src/advertising.c
+++ b/src/advertising.c
char *owner;
char *path;
char *name;
+ uint16_t appearance;
GDBusClient *client;
GDBusProxy *proxy;
DBusMessage *reg;
return true;
}
+static bool parse_appearance(DBusMessageIter *iter,
+ struct btd_adv_client *client)
+{
+ if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_UINT16)
+ return false;
+
+ if (client->flags & MGMT_ADV_FLAG_APPEARANCE) {
+ error("Appearance already included");
+ return false;
+ }
+
+ dbus_message_iter_get_basic(iter, &client->appearance);
+
+ return true;
+}
+
static struct adv_parser {
const char *name;
bool (*func)(DBusMessageIter *iter, struct btd_adv_client *client);
{ "ServiceData", parse_service_data },
{ "Includes", parse_includes },
{ "LocalName", parse_local_name },
+ { "Appearance", parse_appearance },
{ },
};
static uint8_t *generate_adv_data(struct btd_adv_client *client,
uint32_t *flags, size_t *len)
{
- if ((*flags & MGMT_ADV_FLAG_APPEARANCE)) {
- *flags &= ~MGMT_ADV_FLAG_APPEARANCE;
- /* TODO: Get the appearance from the adaptor once supported. */
- bt_ad_add_appearance(client->data, 0x0000);
+ if ((*flags & MGMT_ADV_FLAG_APPEARANCE) ||
+ client->appearance != UINT16_MAX) {
+ uint16_t appearance;
+
+ appearance = client->appearance;
+ if (appearance == UINT16_MAX)
+ /* TODO: Get the appearance from the adaptor once
+ * supported.
+ */
+ appearance = 0x000;
+
+ bt_ad_add_appearance(client->data, appearance);
}
return bt_ad_generate(client->data, len);
goto fail;
client->manager = manager;
+ client->appearance = UINT16_MAX;
return client;