From 2cfc676a76d566a1438923115dbaed3c2c691a78 Mon Sep 17 00:00:00 2001 From: Bruno Randolf Date: Tue, 8 Jan 2019 19:12:11 +0000 Subject: Return after WriteValue method, fixes #12 It's necessary to return the method call on dbus, because otherwise the clients get an error after writing to the characteristic as in issue #12 See the code comments for more details. Signed-off-by: Bruno Randolf --- src/Server.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Server.cpp b/src/Server.cpp index 47a74da..db1aa76 100644 --- a/src/Server.cpp +++ b/src/Server.cpp @@ -406,6 +406,11 @@ Server::Server(const std::string &serviceName, const std::string &advertisingNam // Characteristic interface (which just so happens to be the same interface passed into our self // parameter) we can that parameter to call our own onUpdatedValue method self.callOnUpdatedValue(pConnection, pUserData); + + // Note: Even though the WriteValue method returns void, it's important to return like this, so that a + // dbus "method_return" is sent, otherwise the client gets an error (ATT error code 0x0e"unlikely"). + // Only "write-without-response" works without this + self.methodReturnVariant(pInvocation, NULL); }) // Here we use the onUpdatedValue to set a callback that isn't exposed to BlueZ, but rather allows us to manage -- cgit v1.2.3