From 16f6ec984ea2b802d13cce07964ce386f3dcf3dc Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Fri, 2 Sep 2016 15:22:16 +0300 Subject: [PATCH] core/gatt-client: Fix not return empty array for ReadValue The response to ReadValue shall be an array which can be empty. --- src/gatt-client.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gatt-client.c b/src/gatt-client.c index 2af6979ac..57a1f66fb 100644 --- a/src/gatt-client.c +++ b/src/gatt-client.c @@ -297,7 +297,7 @@ static void write_descriptor_cb(struct gatt_db_attribute *attr, int err, } static void async_dbus_op_reply(struct async_dbus_op *op, int err, - const uint8_t *value, size_t length) + const uint8_t *value, ssize_t length) { const struct queue_entry *entry; DBusMessage *reply; @@ -319,7 +319,7 @@ static void async_dbus_op_reply(struct async_dbus_op *op, int err, return; } - if (value) + if (length >= 0) message_append_byte_array(reply, value, length); send_reply: @@ -489,7 +489,7 @@ static void write_result_cb(bool success, bool reliable_error, } done: - async_dbus_op_reply(op, err, NULL, 0); + async_dbus_op_reply(op, err, NULL, -1); } static void write_cb(bool success, uint8_t att_ecode, void *user_data) @@ -1126,7 +1126,7 @@ static void create_notify_reply(struct async_dbus_op *op, bool success, else err = att_ecode ? att_ecode : -ENOENT; - async_dbus_op_reply(op, err, NULL, 0); + async_dbus_op_reply(op, err, NULL, -1); } static void register_notify_cb(uint16_t att_ecode, void *user_data) -- 2.47.3