Diff between 262145fb496cb33abaf212e8fd472c874c92ebe4 and 3e15a874c42ea8006ccb7b394f71238fc32d88a1

Changed Files

File Additions Deletions Status
src/gatt-client.c +3 -46 modified

Full Patch

diff --git a/src/gatt-client.c b/src/gatt-client.c
index c2a888f..7abb306 100644
--- a/src/gatt-client.c
+++ b/src/gatt-client.c
@@ -342,7 +342,6 @@ static void desc_read_cb(bool success, uint8_t att_ecode,
 {
 	struct async_dbus_op *op = user_data;
 	struct descriptor *desc = op->data;
-	struct service *service = desc->chrc->service;
 
 	if (!success)
 		goto fail;
@@ -357,23 +356,6 @@ static void desc_read_cb(bool success, uint8_t att_ecode,
 		goto fail;
 	}
 
-	/*
-	 * If the value length is exactly MTU-1, then we may not have read the
-	 * entire value. Perform a long read to obtain the rest, otherwise,
-	 * we're done.
-	 */
-	if (length == bt_gatt_client_get_mtu(service->client->gatt) - 1) {
-		op->offset += length;
-		op->id = bt_gatt_client_read_long_value(service->client->gatt,
-							desc->handle,
-							op->offset,
-							desc_read_cb,
-							async_dbus_op_ref(op),
-							async_dbus_op_unref);
-		if (op->id)
-			return;
-	}
-
 	/* Read the stored data from db */
 	if (!gatt_db_attribute_read(desc->attr, 0, 0, NULL, read_op_cb, op)) {
 		error("Failed to read database");
@@ -446,16 +428,9 @@ static struct async_dbus_op *read_value(struct bt_gatt_client *gatt,
 	op = async_dbus_op_new(msg, data);
 	op->offset = offset;
 
-	if (op->offset)
-		op->id = bt_gatt_client_read_long_value(gatt, handle, offset,
-							callback,
-							async_dbus_op_ref(op),
-							async_dbus_op_unref);
-	else
-		op->id = bt_gatt_client_read_value(gatt, handle, callback,
-							async_dbus_op_ref(op),
-							async_dbus_op_unref);
-
+	op->id = bt_gatt_client_read_long_value(gatt, handle, offset, callback,
+						async_dbus_op_ref(op),
+						async_dbus_op_unref);
 	if (op->id)
 		return op;
 
@@ -859,7 +834,6 @@ static void chrc_read_cb(bool success, uint8_t att_ecode, const uint8_t *value,
 {
 	struct async_dbus_op *op = user_data;
 	struct characteristic *chrc = op->data;
-	struct service *service = chrc->service;
 
 	if (!success)
 		goto fail;
@@ -874,23 +848,6 @@ static void chrc_read_cb(bool success, uint8_t att_ecode, const uint8_t *value,
 		goto fail;
 	}
 
-	/*
-	 * If the value length is exactly MTU-1, then we may not have read the
-	 * entire value. Perform a long read to obtain the rest, otherwise,
-	 * we're done.
-	 */
-	if (length == bt_gatt_client_get_mtu(service->client->gatt) - 1) {
-		op->offset += length;
-		op->id = bt_gatt_client_read_long_value(service->client->gatt,
-							chrc->value_handle,
-							op->offset,
-							chrc_read_cb,
-							async_dbus_op_ref(op),
-							async_dbus_op_unref);
-		if (op->id)
-			return;
-	}
-
 	/* Read the stored data from db */
 	if (!gatt_db_attribute_read(chrc->attr, 0, 0, NULL, read_op_cb, op)) {
 		error("Failed to read database");