aboutsummaryrefslogtreecommitdiffstats
path: root/api/direct_bt/GATTHandler.hpp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2020-07-02 08:28:19 +0200
committerSven Gothel <[email protected]>2020-07-02 08:28:19 +0200
commit6f67d72923b31dd5db32227a0a8f46c11bc9a9f3 (patch)
treeb405c278d25a9c3c413550e1417778cf5a3656ad /api/direct_bt/GATTHandler.hpp
parent7939a5df8faf1cf33eddde06848933d528a71cbf (diff)
GATTHandler: Tolerate a 3x usual reply timeout (3x 500ms) for first GATT exchange (MTU)
Certain devices might require more time for their first GATT response, which usually shall lie within 500ms. This patch tolerates 1500ms.
Diffstat (limited to 'api/direct_bt/GATTHandler.hpp')
-rw-r--r--api/direct_bt/GATTHandler.hpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/api/direct_bt/GATTHandler.hpp b/api/direct_bt/GATTHandler.hpp
index 3e291f35..f15f3b16 100644
--- a/api/direct_bt/GATTHandler.hpp
+++ b/api/direct_bt/GATTHandler.hpp
@@ -75,6 +75,8 @@ namespace direct_bt {
L2CAP_READER_THREAD_POLL_TIMEOUT = 3000,
/** 500ms timeout for l2cap command replies */
L2CAP_COMMAND_REPLY_TIMEOUT = 500,
+ /** 1500ms timeout for l2cap _initial_ command reply, long timeout. */
+ L2CAP_INITIAL_COMMAND_REPLY_TIMEOUT = 1500,
/** Medium ringbuffer capacity... */
ATTPDU_RING_CAPACITY = 128
@@ -118,7 +120,7 @@ namespace direct_bt {
void l2capReaderThreadImpl();
void send(const AttPDUMsg & msg);
- std::shared_ptr<const AttPDUMsg> sendWithReply(const AttPDUMsg & msg);
+ std::shared_ptr<const AttPDUMsg> sendWithReply(const AttPDUMsg & msg, const int timeout);
/**
* BT Core Spec v5.2: Vol 3, Part G GATT: 3.4.2 MTU Exchange
@@ -126,7 +128,7 @@ namespace direct_bt {
* Returns the server-mtu if successful, otherwise 0.
* </p>
*/
- uint16_t exchangeMTU(const uint16_t clientMaxMTU=number(Defaults::MAX_ATT_MTU));
+ uint16_t exchangeMTU(const uint16_t clientMaxMTU, const int timeout);
public:
GATTHandler(const std::shared_ptr<DBTDevice> & device, const int replyTimeoutMS = number(Defaults::L2CAP_COMMAND_REPLY_TIMEOUT));