diff options
author | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2016-06-21 16:00:00 +0300 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2016-06-21 16:06:31 +0300 |
commit | 3e15a874c42ea8006ccb7b394f71238fc32d88a1 (patch) | |
tree | e913bfda87196806826a8617fe58de6347a6d2c0 /src/gatt-client.c | |
parent | 262145fb496cb33abaf212e8fd472c874c92ebe4 (diff) | |
download | bluez-3e15a874c42ea8006ccb7b394f71238fc32d88a1.tar.gz |
core/gatt-client: Always use bt_gatt_client_read_long_value
bt_gatt_client_read_long_value always reads the full value so the code
don't have to check if there is more data to be read.
Diffstat (limited to 'src/gatt-client.c')
-rw-r--r-- | src/gatt-client.c | 49 |
1 files changed, 3 insertions, 46 deletions
diff --git a/src/gatt-client.c b/src/gatt-client.c index c2a888ff1..7abb306e6 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"); |