gatt: Add org.bluez.Error.InvalidOffset for long read procedure

This patch adds handling of invalid offset error for gatt database in
case if offset in read blob would be invalid.

"The Read Blob Request is repeated until the Read Blob Response’s Part
Attribute Value parameter is zero or an Error Response is sent by the server
with the Error Code set to Invalid Offset." Bluetooth Core 5.0, 4.12.2

"If the prepare Value Offset is greater than the current length of the attribute
value then all pending prepare write values shall be discarded for this client,
the queue shall be cleared and then an Error Response shall be sent with the
«Invalid Offset»." Bluetooth Core 5.0, 3.4.6.3
This commit is contained in:
Grzegorz Kolodziejczyk 2018-03-20 15:05:17 +01:00 committed by Szymon Janc
parent 1abee58711
commit 4c22678e96
2 changed files with 4 additions and 0 deletions

View File

@ -74,6 +74,7 @@ Methods array{byte} ReadValue(dict options)
org.bluez.Error.InProgress
org.bluez.Error.NotPermitted
org.bluez.Error.NotAuthorized
org.bluez.Error.InvalidOffset
org.bluez.Error.NotSupported
void WriteValue(array{byte} value, dict options)

View File

@ -1692,6 +1692,9 @@ static uint8_t dbus_error_to_att_ecode(const char *error_name)
if (strcmp(error_name, "org.bluez.Error.InvalidValueLength") == 0)
return BT_ATT_ERROR_INVALID_ATTRIBUTE_VALUE_LEN;
if (strcmp(error_name, "org.bluez.Error.InvalidOffset") == 0)
return BT_ATT_ERROR_INVALID_OFFSET;
if (strcmp(error_name, "org.bluez.Error.InProgress") == 0)
return BT_ERROR_ALREADY_IN_PROGRESS;