diff options
author | Lukasz Rymanowski <lukasz.rymanowski@tieto.com> | 2014-04-17 13:57:44 +0200 |
---|---|---|
committer | Szymon Janc <szymon.janc@tieto.com> | 2014-04-23 15:15:50 +0200 |
commit | a877e3a20b8be8bdb75357ff1f9249b094834c32 (patch) | |
tree | f52488ec81c95ed8da3407604be7d4525bd69a2f /attrib | |
parent | 641128bfb57e084e5f53a9f5ad2d373a72ef83f8 (diff) | |
download | bluez-a877e3a20b8be8bdb75357ff1f9249b094834c32.tar.gz |
attrib: Add API for reliable write
Android expose to application api for reliable write. Therefore we need
to add this support to gattrib
Diffstat (limited to 'attrib')
-rw-r--r-- | attrib/gatt.c | 18 | ||||
-rw-r--r-- | attrib/gatt.h | 5 |
2 files changed, 23 insertions, 0 deletions
diff --git a/attrib/gatt.c b/attrib/gatt.c index 49cd1a3bd..e461ab7e2 100644 --- a/attrib/gatt.c +++ b/attrib/gatt.c @@ -871,6 +871,24 @@ guint gatt_write_char(GAttrib *attrib, uint16_t handle, const uint8_t *value, return prepare_write(long_write); } +guint gatt_reliable_write_char(GAttrib *attrib, uint16_t handle, + const uint8_t *value, size_t vlen, + GAttribResultFunc func, + gpointer user_data) +{ + uint8_t *buf; + guint16 plen; + size_t buflen; + + buf = g_attrib_get_buffer(attrib, &buflen); + + plen = enc_prep_write_req(handle, 0, value, vlen, buf, buflen); + if (!plen) + return 0; + + return g_attrib_send(attrib, 0, buf, plen, func, user_data, NULL); +} + guint gatt_exchange_mtu(GAttrib *attrib, uint16_t mtu, GAttribResultFunc func, gpointer user_data) { diff --git a/attrib/gatt.h b/attrib/gatt.h index c65bf6c0d..585a8763e 100644 --- a/attrib/gatt.h +++ b/attrib/gatt.h @@ -84,6 +84,11 @@ guint gatt_write_char(GAttrib *attrib, uint16_t handle, const uint8_t *value, size_t vlen, GAttribResultFunc func, gpointer user_data); +guint gatt_reliable_write_char(GAttrib *attrib, uint16_t handle, + const uint8_t *value, size_t vlen, + GAttribResultFunc func, + gpointer user_data); + guint gatt_discover_char_desc(GAttrib *attrib, uint16_t start, uint16_t end, GAttribResultFunc func, gpointer user_data); |