diff --git a/attrib/gatt.h b/attrib/gatt.h
index 7690fba..a15e92f 100644
--- a/attrib/gatt.h
+++ b/attrib/gatt.h
struct gatt_primary {
char uuid[MAX_LEN_UUID_STR + 1];
+ gboolean changed;
struct att_range range;
};
diff --git a/profiles/gatt/gas.c b/profiles/gatt/gas.c
index 3e3c3db..de23a13 100644
--- a/profiles/gatt/gas.c
+++ b/profiles/gatt/gas.c
gas->changed.start = start;
gas->changed.end = end;
- device_browse_primary(gas->device, NULL, NULL, FALSE);
+ btd_device_gatt_set_service_changed(gas->device, start, end);
}
static void gatt_service_changed_cb(guint8 status, const guint8 *pdu,
DBG("GATT Service Changed start: 0x%04X end: 0x%04X", start, end);
- device_browse_primary(gas->device, NULL, NULL, FALSE);
+ btd_device_gatt_set_service_changed(gas->device, start, end);
}
static void gatt_descriptors_cb(guint8 status, const guint8 *pdu, guint16 len,
diff --git a/src/device.c b/src/device.c
index 8626ad6..c4b5554 100644
--- a/src/device.c
+++ b/src/device.c
return device->primaries;
}
+void btd_device_gatt_set_service_changed(struct btd_device *device,
+ uint16_t start, uint16_t end)
+{
+ GSList *l;
+
+ for (l = device->primaries; l; l = g_slist_next(l)) {
+ struct gatt_primary *prim = l->data;
+
+ if (start <= prim->range.end && end >= prim->range.start)
+ prim->changed = TRUE;
+ }
+
+ device_browse_primary(device, NULL, NULL, FALSE);
+}
+
void btd_device_add_uuid(struct btd_device *device, const char *uuid)
{
GSList *uuid_list;
diff --git a/src/device.h b/src/device.h
index 85d265a..a65de26 100644
--- a/src/device.h
+++ b/src/device.h
const sdp_record_t *btd_device_get_record(struct btd_device *device,
const char *uuid);
GSList *btd_device_get_primaries(struct btd_device *device);
+void btd_device_gatt_set_service_changed(struct btd_device *device,
+ uint16_t start, uint16_t end);
void device_register_services(DBusConnection *conn, struct btd_device *device,
GSList *prim_list, int psm);
GSList *device_services_from_record(struct btd_device *device,