aboutsummaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2020-05-30 15:02:18 +0200
committerSven Gothel <[email protected]>2020-05-30 15:02:18 +0200
commit821dd9b08e30000b0758080fcf149d153eedf1d4 (patch)
tree5b872aa2bc40473c5590889f7e93915cae3cbdc1 /api
parent2d81d44f281283472b9b87153a5dd9527749ade3 (diff)
GATTHandler robustness: Fail hard on 'send' and 'sendWithReply': disconnect GATT and device, then throw exception
The hard failure (low tolerance) for GATT/L2CAP communication with one device is mandatory to allow the user to rewind into a proper device disconnect state and retry later. The exception is essential for the user to give up GATT communication and end processing, waiting for the next discovery or connect. The device disconnect is therefor important to get back into a clean state and have the user consume the DISCONNECT event.
Diffstat (limited to 'api')
-rw-r--r--api/direct_bt/GATTHandler.hpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/api/direct_bt/GATTHandler.hpp b/api/direct_bt/GATTHandler.hpp
index 2306fad6..bc77abab 100644
--- a/api/direct_bt/GATTHandler.hpp
+++ b/api/direct_bt/GATTHandler.hpp
@@ -117,7 +117,10 @@ namespace direct_bt {
State validateState();
void l2capReaderThreadImpl();
+
std::shared_ptr<const AttPDUMsg> receiveNext();
+ void send(const AttPDUMsg & msg);
+ std::shared_ptr<const AttPDUMsg> sendWithReply(const AttPDUMsg & msg);
/**
* BT Core Spec v5.2: Vol 3, Part G GATT: 3.4.2 MTU Exchange
@@ -143,9 +146,6 @@ namespace direct_bt {
bool disconnect();
bool isOpen() const { return Disconnected < state && l2cap.isOpen(); }
- bool send(const AttPDUMsg & msg);
- std::shared_ptr<const AttPDUMsg> sendWithReply(const AttPDUMsg & msg);
-
uint16_t getServerMTU() const { return serverMTU; }
uint16_t getUsedMTU() const { return usedMTU; }