aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2020-08-26 06:54:21 +0200
committerSven Gothel <[email protected]>2020-08-26 06:54:21 +0200
commit7e093634148fd5571fb810f53eb7e63650cf3e7b (patch)
tree41fdfb56622ff1d2658a05b37b8eae5e6efb4971
parentc72fc96761b64da0399070a82fd65d26ef6139cb (diff)
GATTHandler:: Introduce a GATT_WRITE_COMMAND_REPLY_TIMEOUT for writeValue(..) - WIP
On certain adapter we receive a GATT write timeout just after ~10s (BCM) We need to analyse this issue further, hence increasing the timeout for this cause. Discussion: May remove all timeout parameters in DBTManager, HCIHandler and GATTHandler and use default to be set via environment variables. The latter can be fed via Java properties (See DBTEnv) and hence also benefit from a config file.
-rw-r--r--api/direct_bt/GATTHandler.hpp2
-rw-r--r--src/direct_bt/GATTHandler.cpp2
2 files changed, 3 insertions, 1 deletions
diff --git a/api/direct_bt/GATTHandler.hpp b/api/direct_bt/GATTHandler.hpp
index 28647bb1..4fc2f328 100644
--- a/api/direct_bt/GATTHandler.hpp
+++ b/api/direct_bt/GATTHandler.hpp
@@ -81,6 +81,8 @@ namespace direct_bt {
L2CAP_READER_THREAD_POLL_TIMEOUT = 3000,
/** 500ms timeout for GATT read command replies */
GATT_READ_COMMAND_REPLY_TIMEOUT = 500,
+ /** 20,000ms timeout for GATT write command replies, extremely long as seen on certain adapter / command combinations. */
+ GATT_WRITE_COMMAND_REPLY_TIMEOUT = 20000, // FIXME: Needs to be analyzed further
/** 2500ms timeout for l2cap _initial_ command reply, long timeout. */
GATT_INITIAL_COMMAND_REPLY_TIMEOUT = 2500,
diff --git a/src/direct_bt/GATTHandler.cpp b/src/direct_bt/GATTHandler.cpp
index d8efdf3b..78c971c2 100644
--- a/src/direct_bt/GATTHandler.cpp
+++ b/src/direct_bt/GATTHandler.cpp
@@ -838,7 +838,7 @@ bool GATTHandler::writeValue(const uint16_t handle, const TROOctets & value, con
}
bool res = false;
- std::shared_ptr<const AttPDUMsg> pdu = sendWithReply(req, replyTimeoutMS);
+ std::shared_ptr<const AttPDUMsg> pdu = sendWithReply(req, number(Defaults::GATT_WRITE_COMMAND_REPLY_TIMEOUT));
if( nullptr != pdu ) {
COND_PRINT(debug_data, "GATT WV recv: %s", pdu->toString().c_str());
if( pdu->getOpcode() == AttPDUMsg::ATT_WRITE_RSP ) {