summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudio Takahasi <claudio.takahasi@openbossa.org>2011-03-09 16:03:50 -0300
committerJohan Hedberg <johan.hedberg@nokia.com>2011-03-10 11:20:08 +0200
commit4fce91f1cf62df7b2da07475c032ddaa9f447f12 (patch)
tree311c4dc17f443ad6f57288d85e7855fe6b19755f
parent39454251efae92460f2beb3b593b02219266a11b (diff)
downloadbluez-4fce91f1cf62df7b2da07475c032ddaa9f447f12.tar.gz
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.
-rw-r--r--attrib/gatt.c8
1 files 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);
}