diff --git a/attrib/gatt.c b/attrib/gatt.c
index d21dd39..9de07e4 100644
--- a/attrib/gatt.c
+++ b/attrib/gatt.c
{
uint8_t *buf;
size_t buflen;
- guint16 plen;
struct write_long_data *long_write;
buf = g_attrib_get_buffer(attrib, &buflen);
- /* Only use Write Request/Command if payload fits on a single transfer,
- * including 3 bytes for the header. */
+ /* Use Write Request if payload fits on a single transfer, including 3
+ * bytes for the header. */
if (vlen <= buflen - 3) {
- if (func)
- plen = enc_write_req(handle, value, vlen, buf,
- buflen);
- else
- plen = enc_write_cmd(handle, value, vlen, buf,
- buflen);
-
- return g_attrib_send(attrib, 0, buf, plen, func,
- user_data, NULL);
+ uint16_t plen;
+
+ plen = enc_write_req(handle, value, vlen, buf, buflen);
+ if (plen == 0)
+ return 0;
+
+ return g_attrib_send(attrib, 0, buf, plen, func, user_data,
+ NULL);
}
/* Write Long Characteristic Values */
diff --git a/attrib/interactive.c b/attrib/interactive.c
index 1f3122f..5bd27af 100644
--- a/attrib/interactive.c
+++ b/attrib/interactive.c
gatt_write_char(attrib, handle, value, plen,
char_write_req_cb, NULL);
else
- gatt_write_char(attrib, handle, value, plen, NULL, NULL);
+ gatt_write_cmd(attrib, handle, value, plen, NULL, NULL);
g_free(value);
}
diff --git a/profiles/input/hog.c b/profiles/input/hog.c
index 6bbf35f..91c2802 100644
--- a/profiles/input/hog.c
+++ b/profiles/input/hog.c
DBG("HoG device 0x%04X is operating in Boot Procotol Mode",
hogdev->id);
- gatt_write_char(hogdev->attrib, hogdev->proto_mode_handle, &nval,
+ gatt_write_cmd(hogdev->attrib, hogdev->proto_mode_handle, &nval,
sizeof(nval), NULL, NULL);
} else if (value == HOG_PROTO_MODE_REPORT)
DBG("HoG device 0x%04X is operating in Report Protocol Mode",
gatt_write_char(hogdev->attrib, report->decl->value_handle,
data, size, output_written_cb, hogdev);
else if (report->decl->properties & ATT_CHAR_PROPER_WRITE_WITHOUT_RESP)
- gatt_write_char(hogdev->attrib, report->decl->value_handle,
+ gatt_write_cmd(hogdev->attrib, report->decl->value_handle,
data, size, NULL, NULL);
}
if (hogdev->ctrlpt_handle == 0)
return -ENOTSUP;
- gatt_write_char(hogdev->attrib, hogdev->ctrlpt_handle, &value,
+ gatt_write_cmd(hogdev->attrib, hogdev->ctrlpt_handle, &value,
sizeof(value), NULL, NULL);
return 0;
diff --git a/profiles/scanparam/scan.c b/profiles/scanparam/scan.c
index 5982c38..f5db5ed 100644
--- a/profiles/scanparam/scan.c
+++ b/profiles/scanparam/scan.c
att_put_u16(SCAN_INTERVAL, &value[0]);
att_put_u16(SCAN_WINDOW, &value[2]);
- gatt_write_char(attrib, handle, value, sizeof(value), NULL, NULL);
+ gatt_write_cmd(attrib, handle, value, sizeof(value), NULL, NULL);
}
static void refresh_value_cb(const uint8_t *pdu, uint16_t len,