diff --git a/src/device.c b/src/device.c
index dc362d9..2102f23 100644
--- a/src/device.c
+++ b/src/device.c
}
device->gatt_cache_used = !gatt_db_isempty(device->db);
+
+ btd_gatt_client_connected(device->client_dbus);
}
static void gatt_server_init(struct btd_device *device, struct gatt_db *db)
diff --git a/src/gatt-client.c b/src/gatt-client.c
index d8a3429..225aa42 100644
--- a/src/gatt-client.c
+++ b/src/gatt-client.c
void btd_gatt_client_ready(struct btd_gatt_client *client)
{
- struct bt_gatt_client *gatt;
-
if (!client)
return;
- gatt = btd_device_get_gatt_client(client->device);
- if (!gatt) {
+ if (!client->gatt) {
error("GATT client not initialized");
return;
}
- bt_gatt_client_unref(client->gatt);
- client->gatt = bt_gatt_client_ref(gatt);
-
client->ready = true;
DBG("GATT client ready");
queue_foreach(client->all_notify_clients, register_notify, client);
}
+void btd_gatt_client_connected(struct btd_gatt_client *client)
+{
+ struct bt_gatt_client *gatt;
+
+ gatt = btd_device_get_gatt_client(client->device);
+ if (!gatt) {
+ error("GATT client not initialized");
+ return;
+ }
+
+ DBG("Device connected.");
+
+ bt_gatt_client_unref(client->gatt);
+ client->gatt = bt_gatt_client_ref(gatt);
+}
+
void btd_gatt_client_service_added(struct btd_gatt_client *client,
struct gatt_db_attribute *attrib)
{
diff --git a/src/gatt-client.h b/src/gatt-client.h
index a18db17..92a9255 100644
--- a/src/gatt-client.h
+++ b/src/gatt-client.h
void btd_gatt_client_destroy(struct btd_gatt_client *client);
void btd_gatt_client_ready(struct btd_gatt_client *client);
+void btd_gatt_client_connected(struct btd_gatt_client *client);
void btd_gatt_client_service_added(struct btd_gatt_client *client,
struct gatt_db_attribute *attrib);
void btd_gatt_client_service_removed(struct btd_gatt_client *client,