From 5f6c0dc2aee02b62c856c1afc66ca751b49e9d2f Mon Sep 17 00:00:00 2001 From: Claudio Takahasi Date: Fri, 17 Aug 2012 11:43:24 -0300 Subject: [PATCH] core: Add device method to access "Appearance" This patch adds a new device method to access the Appearance GAP characteristic value stored previously as result of the discovery procedure or GATT characteristic read procedure. --- src/device.c | 19 +++++++++++++++++++ src/device.h | 1 + 2 files changed, 20 insertions(+) diff --git a/src/device.c b/src/device.c index f781298d9..09a154d20 100644 --- a/src/device.c +++ b/src/device.c @@ -3047,6 +3047,25 @@ void device_set_class(struct btd_device *device, uint32_t value) DBUS_TYPE_UINT32, &value); } +int device_get_appearance(struct btd_device *device, uint16_t *value) +{ + bdaddr_t src; + uint16_t app; + int err; + + adapter_get_address(device_get_adapter(device), &src); + + err = read_remote_appearance(&src, &device->bdaddr, + device->bdaddr_type, &app); + if (err < 0) + return err; + + if (value) + *value = app; + + return 0; +} + static gboolean notify_attios(gpointer user_data) { struct btd_device *device = user_data; diff --git a/src/device.h b/src/device.h index 26e17f7eb..eb4b41e90 100644 --- a/src/device.h +++ b/src/device.h @@ -103,6 +103,7 @@ guint device_add_disconnect_watch(struct btd_device *device, GDestroyNotify destroy); void device_remove_disconnect_watch(struct btd_device *device, guint id); void device_set_class(struct btd_device *device, uint32_t value); +int device_get_appearance(struct btd_device *device, uint16_t *value); #define BTD_UUIDS(args...) ((const char *[]) { args, NULL } ) -- 2.47.3