aboutsummaryrefslogtreecommitdiffstats
path: root/attrib/client.c
diff options
context:
space:
mode:
authorBruna Moreira <bruna.moreira@openbossa.org>2010-09-29 15:45:27 -0400
committerJohan Hedberg <johan.hedberg@nokia.com>2010-10-04 17:06:48 +0200
commit420d5b33139dc2883332db09c955de657ea17e00 (patch)
tree3a9379339625d4b6b094967bdbea87ed5ba1c5d0 /attrib/client.c
parent8edb7f03cfa2b1b562e3cbf54e077df938ec31a3 (diff)
downloadbluez-420d5b33139dc2883332db09c955de657ea17e00.tar.gz
bluez-420d5b33139dc2883332db09c955de657ea17e00.tar.xz
bluez-420d5b33139dc2883332db09c955de657ea17e00.zip
Write new value for characteristic value
Note only client is implemented by now. The server implementation will be done later.
Diffstat (limited to 'attrib/client.c')
-rw-r--r--attrib/client.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/attrib/client.c b/attrib/client.c
index e699e758..8eabfea2 100644
--- a/attrib/client.c
+++ b/attrib/client.c
@@ -536,7 +536,9 @@ static GDBusMethodTable prim_methods[] = {
static DBusMessage *set_value(DBusConnection *conn, DBusMessage *msg,
DBusMessageIter *iter, struct characteristic *chr)
{
+ struct gatt_service *gatt = chr->prim->gatt;
DBusMessageIter sub;
+ GError *gerr = NULL;
uint8_t *value;
int len;
@@ -548,7 +550,16 @@ static DBusMessage *set_value(DBusConnection *conn, DBusMessage *msg,
dbus_message_iter_get_fixed_array(&sub, &value, &len);
- /* FIXME: missing set the new value */
+ if (l2cap_connect(gatt, &gerr, FALSE) < 0) {
+ DBusMessage *reply;
+ reply = g_dbus_create_error(msg, ERROR_INTERFACE ".Failed",
+ "%s", gerr->message);
+ g_error_free(gerr);
+
+ return reply;
+ }
+
+ gatt_write_cmd(gatt->attrib, chr->handle, value, len, NULL, NULL);
g_free(chr->value);
chr->value = g_malloc(len);