From: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@codecoup.pl>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ v2 2/3] gatt: Add org.bluez.Error.InvalidOffset for long read procedure
Date: Fri, 9 Mar 2018 16:29:06 +0100 [thread overview]
Message-ID: <20180309152907.16347-2-grzegorz.kolodziejczyk@codecoup.pl> (raw)
In-Reply-To: <20180309152907.16347-1-grzegorz.kolodziejczyk@codecoup.pl>
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
---
doc/gatt-api.txt | 1 +
src/gatt-database.c | 3 +++
2 files changed, 4 insertions(+)
diff --git a/doc/gatt-api.txt b/doc/gatt-api.txt
index ccf3a8b6d..3f542b5eb 100644
--- a/doc/gatt-api.txt
+++ b/doc/gatt-api.txt
@@ -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)
diff --git a/src/gatt-database.c b/src/gatt-database.c
index 9a33ae7f9..8e09a6a40 100644
--- a/src/gatt-database.c
+++ b/src/gatt-database.c
@@ -1649,6 +1649,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;
--
2.13.6
next prev parent reply other threads:[~2018-03-09 15:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-09 15:29 [PATCH BlueZ v2 1/3] client: Fix reading long values Grzegorz Kolodziejczyk
2018-03-09 15:29 ` Grzegorz Kolodziejczyk [this message]
2018-03-09 15:29 ` [PATCH BlueZ v2 3/3] client: Update read callbacks with invalid offset error handlers Grzegorz Kolodziejczyk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180309152907.16347-2-grzegorz.kolodziejczyk@codecoup.pl \
--to=grzegorz.kolodziejczyk@codecoup.pl \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.