Bluetooth: GATT: Fix calculation of max data allowed in write req
This patch fixes the calculation of maximum data that can be sent by Write Request. Maximum data is MTU reduced by size of handle and command opcode. Change-Id: I2abeef9adffd65e24a2489ad084bfa3b810e4acf Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
This commit is contained in:
parent
6e28748e3e
commit
65e917c9ab
1 changed files with 1 additions and 1 deletions
|
@ -1349,7 +1349,7 @@ int bt_gatt_write(struct bt_conn *conn, uint16_t handle, uint16_t offset,
|
|||
}
|
||||
|
||||
/* Use Prepare Write if offset is set or Long Write is required */
|
||||
if (offset || length > bt_att_get_mtu(conn) - 1) {
|
||||
if (offset || length > (bt_att_get_mtu(conn) - sizeof(*req) - 1)) {
|
||||
return gatt_prepare_write(conn, handle, offset, data, length,
|
||||
func);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue