From 4fce91f1cf62df7b2da07475c032ddaa9f447f12 Mon Sep 17 00:00:00 2001 From: Claudio Takahasi Date: Wed, 9 Mar 2011 16:03:50 -0300 Subject: [PATCH] Extend Characteristic Write to support Write Without Response If callback is not informed, Write Command will be used to execute a Write Without Response sub-procedure. Error is not returned by the server no matter the result of the operation. --- attrib/gatt.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/attrib/gatt.c b/attrib/gatt.c index ae482f1c2..2b0d82746 100644 --- a/attrib/gatt.c +++ b/attrib/gatt.c @@ -502,8 +502,12 @@ guint gatt_write_char(GAttrib *attrib, uint16_t handle, uint8_t *value, uint8_t pdu[ATT_DEFAULT_LE_MTU]; guint16 plen; - plen = enc_write_req(handle, value, vlen, pdu, sizeof(pdu)); - return g_attrib_send(attrib, 0, ATT_OP_WRITE_REQ, pdu, plen, func, + if (func) + plen = enc_write_req(handle, value, vlen, pdu, sizeof(pdu)); + else + plen = enc_write_cmd(handle, value, vlen, pdu, sizeof(pdu)); + + return g_attrib_send(attrib, 0, pdu[0], pdu, plen, func, user_data, NULL); } -- 2.47.3