Skip to content

Commit

Permalink
gap: Don't attempt to read the appearance if already set
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Vudentz committed Apr 4, 2022
1 parent 3627edd commit bbeabca
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions profiles/gap/gas.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit bbeabca

Please sign in to comment.