aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Randolf <br1@einfach.org>2019-01-08 19:12:11 +0000
committerBruno Randolf <br1@einfach.org>2019-01-08 19:14:33 +0000
commit2cfc676a76d566a1438923115dbaed3c2c691a78 (patch)
treed91efa82328ce2d3f90bd2e53faf6f1d057aaecf
parentMerge pull request #13 from br101/disc-fix (diff)
downloadgobbledegook-2cfc676a76d566a1438923115dbaed3c2c691a78.tar.gz
gobbledegook-2cfc676a76d566a1438923115dbaed3c2c691a78.tar.bz2
gobbledegook-2cfc676a76d566a1438923115dbaed3c2c691a78.zip
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 <br1@einfach.org>
-rw-r--r--src/Server.cpp5
1 files changed, 5 insertions, 0 deletions
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