diff options
author | DoHyun Pyun <dh79.pyun@samsung.com> | 2017-05-23 10:31:39 +0900 |
---|---|---|
committer | DoHyun Pyun <dh79.pyun@samsung.com> | 2017-05-23 10:31:39 +0900 |
commit | d228be3cc4a1d930b3652a7f03c155761433086b (patch) | |
tree | 9f97703ccc4c93ae0c61c949301ac6864d4cce6f | |
parent | 12a21d40294330e60b748da488658740254ba2ea (diff) | |
download | bluez-d228be3cc4a1d930b3652a7f03c155761433086b.tar.gz bluez-d228be3cc4a1d930b3652a7f03c155761433086b.tar.bz2 bluez-d228be3cc4a1d930b3652a7f03c155761433086b.zip |
Fix Web TCT issue for GATT client write callbacktizen_4.0.m1_releasesubmit/tizen/20170523.020648submit/tizen/20170523.013340accepted/tizen/unified/20170523.153442
Change-Id: Ib02828785381e9f72598c8b1bdcc77a16faed13b
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
-rwxr-xr-x | src/gatt-client.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/gatt-client.c b/src/gatt-client.c index a7d08296..fde8ae97 100755 --- a/src/gatt-client.c +++ b/src/gatt-client.c @@ -362,6 +362,47 @@ send_reply: } } +#ifdef TIZEN_FEATURE_BLUEZ_MODIFY +static void async_dbus_op_write_reply(struct async_dbus_op *op, int err, + const uint8_t *value, ssize_t length) +{ + const struct queue_entry *entry; + DBusMessage *reply; + + op->id = 0; + + for (entry = queue_get_entries(op->msgs); entry; entry = entry->next) { + DBusMessage *msg = entry->data; + + if (err) { + reply = err > 0 ? create_gatt_dbus_error(msg, err) : + btd_error_failed(msg, strerror(-err)); + if (err > 0) + dbus_message_append_args(reply, + DBUS_TYPE_BYTE, &err, + DBUS_TYPE_INVALID); + goto send_reply; + } + + reply = g_dbus_create_reply(msg, DBUS_TYPE_INVALID); + if (!reply) { + error("Failed to allocate D-Bus message reply"); + return; + } + + dbus_message_append_args(reply, + DBUS_TYPE_BYTE, &err, + DBUS_TYPE_INVALID); + + if (length >= 0) + message_append_byte_array(reply, value, length); + +send_reply: + g_dbus_send_message(btd_get_dbus_connection(), reply); + } +} +#endif + static void read_op_cb(struct gatt_db_attribute *attrib, int err, const uint8_t *value, size_t length, void *user_data) @@ -524,7 +565,11 @@ static void write_result_cb(bool success, bool reliable_error, } done: +#ifdef TIZEN_FEATURE_BLUEZ_MODIFY + async_dbus_op_write_reply(op, err, NULL, -1); +#else async_dbus_op_reply(op, err, NULL, -1); +#endif } static void write_cb(bool success, uint8_t att_ecode, void *user_data) |