mirror of
https://git.kernel.org/pub/scm/bluetooth/bluez.git
synced 2024-12-04 01:24:42 +08:00
gatt: Primary service interval may not change
This patch address the "Service Changed" scenario on which the start and end Primary Service attribute handle interval doesn't change.
This commit is contained in:
parent
8bea94707a
commit
31706d23e5
@ -57,6 +57,7 @@ typedef void (*gatt_cb_t) (GSList *l, guint8 status, gpointer user_data);
|
||||
|
||||
struct gatt_primary {
|
||||
char uuid[MAX_LEN_UUID_STR + 1];
|
||||
gboolean changed;
|
||||
struct att_range range;
|
||||
};
|
||||
|
||||
|
@ -154,7 +154,7 @@ static void indication_cb(const uint8_t *pdu, uint16_t len, gpointer user_data)
|
||||
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,
|
||||
@ -185,7 +185,7 @@ 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,
|
||||
|
15
src/device.c
15
src/device.c
@ -2938,6 +2938,21 @@ GSList *btd_device_get_primaries(struct btd_device *device)
|
||||
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;
|
||||
|
@ -53,6 +53,8 @@ void device_probe_drivers(struct btd_device *device, GSList *profiles);
|
||||
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,
|
||||
|
Loading…
Reference in New Issue
Block a user