diff --git a/profiles/gatt/gas.c b/profiles/gatt/gas.c
index 4bf8090..3e3c3db 100644
--- a/profiles/gatt/gas.c
+++ b/profiles/gatt/gas.c
struct btd_device *device;
struct att_range gap; /* GAP Primary service range */
struct att_range gatt; /* GATT Primary service range */
+ struct att_range changed; /* Affected handle range */
GAttrib *attrib;
guint attioid;
guint changed_ind;
opdu = g_attrib_get_buffer(gas->attrib, &plen);
olen = enc_confirmation(opdu, plen);
g_attrib_send(gas->attrib, 0, opdu[0], opdu, olen, NULL, NULL, NULL);
+
+ if (gas->changed.start == start && gas->changed.end == end)
+ return;
+
+ gas->changed.start = start;
+ gas->changed.end = end;
+
+ device_browse_primary(gas->device, NULL, NULL, FALSE);
}
static void gatt_service_changed_cb(guint8 status, const guint8 *pdu,
guint16 plen, gpointer user_data)
{
+ struct gas *gas = user_data;
uint16_t start, end;
if (status) {
start = att_get_u16(&pdu[1]);
end = att_get_u16(&pdu[3]);
+ if (gas->changed.start == start && gas->changed.end == end)
+ return;
+
+ gas->changed.start = start;
+ gas->changed.end = end;
+
DBG("GATT Service Changed start: 0x%04X end: 0x%04X", start, end);
+
+ device_browse_primary(gas->device, NULL, NULL, FALSE);
}
static void gatt_descriptors_cb(guint8 status, const guint8 *pdu, guint16 len,
diff --git a/src/device.c b/src/device.c
index f6161aa..5fee11e 100644
--- a/src/device.c
+++ b/src/device.c
if (device->browse)
return -EBUSY;
- /* FIXME: GATT service updates (implemented in update_services() for
- * SDP) are not supported yet. It will be supported once client side
- * "Services Changed" characteristic handling is implemented. */
- if (device->primaries) {
- error("Could not update GATT services");
- return -ENOSYS;
- }
-
req = g_new0(struct browse_req, 1);
req->device = btd_device_ref(device);
adapter_get_address(adapter, &src);