Skip to content

Commit

Permalink
Merge pull request #15 from br101/method-return
Browse files Browse the repository at this point in the history
Return after WriteValue method, fixes #12 #6
  • Loading branch information
nettlep committed Jan 8, 2019
2 parents cec6f34 + 2cfc676 commit 820d11e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 820d11e

Please sign in to comment.