Bluetooth: GATT: Pass data buffer as NULL if length is 0
So that application could check data pointer to see if any data have been received and if read operation is complete. Change-Id: I36c3ff81baefbc535374d937e5297938445eafa6 Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
This commit is contained in:
parent
1b7c219f8a
commit
748c00b31e
1 changed files with 2 additions and 11 deletions
|
@ -1346,7 +1346,7 @@ static void att_read_rsp(struct bt_conn *conn, uint8_t err, const void *pdu,
|
||||||
|
|
||||||
BT_DBG("err 0x%02x", err);
|
BT_DBG("err 0x%02x", err);
|
||||||
|
|
||||||
if (err) {
|
if (err || !length) {
|
||||||
params->func(conn, err, params, NULL, 0);
|
params->func(conn, err, params, NULL, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1355,11 +1355,6 @@ static void att_read_rsp(struct bt_conn *conn, uint8_t err, const void *pdu,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Stop if no data left */
|
|
||||||
if (!length) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Core Spec 4.2, Vol. 3, Part G, 4.8.1
|
* Core Spec 4.2, Vol. 3, Part G, 4.8.1
|
||||||
* If the Characteristic Value is greater than (ATT_MTU - 1) octets
|
* If the Characteristic Value is greater than (ATT_MTU - 1) octets
|
||||||
|
@ -1408,17 +1403,13 @@ static void att_read_multiple_rsp(struct bt_conn *conn, uint8_t err,
|
||||||
|
|
||||||
BT_DBG("err 0x%02x", err);
|
BT_DBG("err 0x%02x", err);
|
||||||
|
|
||||||
if (err) {
|
if (err || !length) {
|
||||||
params->func(conn, err, params, NULL, 0);
|
params->func(conn, err, params, NULL, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
params->func(conn, 0, params, pdu, length);
|
params->func(conn, 0, params, pdu, length);
|
||||||
|
|
||||||
if (!length) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* mark read as complete since read multiple is single response */
|
/* mark read as complete since read multiple is single response */
|
||||||
params->func(conn, 0, params, NULL, 0);
|
params->func(conn, 0, params, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue