summaryrefslogtreecommitdiff
path: root/android/gatt.c
diff options
context:
space:
mode:
authorSzymon Janc <szymon.janc@tieto.com>2015-02-27 10:26:01 +0100
committerSzymon Janc <szymon.janc@tieto.com>2015-02-27 21:41:21 +0100
commit82f925a58610ccd5258f86a4b3cdafe003eaeea4 (patch)
tree9ab252ac93cbb9fc5638e76d9ce713a919d0cc85 /android/gatt.c
parente6c4edbf2fb0ef1b4216b791de51464f4234bd99 (diff)
downloadbluez-82f925a58610ccd5258f86a4b3cdafe003eaeea4.tar.gz
android/gatt: Fix client signed write on encrypted link
As defined in Core Specification 4.2: "If a connection is already encrypted with LE security mode 1, level 2 or level 3 as defined in [Vol 3] Part C, Section 10.2 then, a Write Without Response as defined in Section 4.9.1 shall be used instead of a Signed Write Without Response."
Diffstat (limited to 'android/gatt.c')
-rw-r--r--android/gatt.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/android/gatt.c b/android/gatt.c
index 0296788cf..9eaa0a12d 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -3366,14 +3366,14 @@ static void handle_client_write_characteristic(const void *buf, uint16_t len)
goto failed;
}
- if (get_sec_level(conn->device) != BT_SECURITY_LOW) {
- error("gatt: Cannot write signed on encrypted link");
- status = HAL_STATUS_FAILED;
- goto failed;
- }
-
- res = signed_write_cmd(conn->device, ch->ch.value_handle,
- cmd->value, cmd->len);
+ if (get_sec_level(conn->device) > BT_SECURITY_LOW)
+ res = gatt_write_cmd(conn->device->attrib,
+ ch->ch.value_handle, cmd->value,
+ cmd->len, NULL, NULL);
+ else
+ res = signed_write_cmd(conn->device,
+ ch->ch.value_handle, cmd->value,
+ cmd->len);
break;
default:
error("gatt: Write type %d unsupported", cmd->write_type);