summaryrefslogtreecommitdiff
path: root/profiles
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2022-04-04 13:15:18 -0700
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2022-04-04 13:15:18 -0700
commitbbeabca44a3da3e1efd8e57b0366bbb45aadbb5b (patch)
treece3821a9f3fc45d610548c5d42bf0645a777be86 /profiles
parent3627eddea13042ffc0848ae37356f30335ce2e4b (diff)
downloadbluez-bbeabca44a3da3e1efd8e57b0366bbb45aadbb5b.tar.gz
gap: Don't attempt to read the appearance if already set
Devices are unlikely to change appearance over time which is the reason why we cache then on the storage so this skips reading it on every reconnection.
Diffstat (limited to 'profiles')
-rw-r--r--profiles/gap/gas.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/profiles/gap/gas.c b/profiles/gap/gas.c
index ea3249be9..400818d67 100644
--- a/profiles/gap/gas.c
+++ b/profiles/gap/gas.c
@@ -142,6 +142,11 @@ static void read_appearance_cb(bool success, uint8_t att_ecode,
static void handle_appearance(struct gas *gas, uint16_t value_handle)
{
+ uint16_t value;
+
+ if (!device_get_appearance(gas->device, &value))
+ return;
+
if (!bt_gatt_client_read_value(gas->client, value_handle,
read_appearance_cb, gas, NULL))
DBG("Failed to send request to read appearance");