From 13c7d1b1dfb44450a18ea042d5302cf82e8ab2d6 Mon Sep 17 00:00:00 2001 From: Hyuk Lee Date: Tue, 10 May 2016 16:59:02 +0900 Subject: [PATCH] Modify the GattConnected signal emit sequence Change-Id: I275000a51c92aebfed484019238d7666e961312b Signed-off-by: Hyuk Lee --- src/device.c | 4 ---- src/gatt-client.c | 7 ++++++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/device.c b/src/device.c index 06f582d..b5b9bc2 100644 --- a/src/device.c +++ b/src/device.c @@ -6454,10 +6454,6 @@ static void gatt_client_init(struct btd_device *device) gatt_client_cleanup(device); return; } - - 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 38435ec..71b4c2d 100644 --- a/src/gatt-client.c +++ b/src/gatt-client.c @@ -2183,14 +2183,19 @@ static gboolean check_all_chrcs_ready(gpointer user_data) void btd_gatt_client_ready(struct btd_gatt_client *client) { + struct bt_gatt_client *gatt; + if (!client) return; - if (!client->gatt) { + gatt = btd_device_get_gatt_client(client->device); + if (!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"); -- 2.7.4