diff options
author | Sven Gothel <[email protected]> | 2020-05-31 05:21:54 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2020-05-31 05:21:54 +0200 |
commit | 7850f58d81c2262cc52baa72cf05de7e24a73588 (patch) | |
tree | f318a9ccab0cb269a7c57c14e177152b8af94b26 /api/direct_bt/DBTAdapter.hpp | |
parent | dc43013a6df42ca425386520cbc40065ba1c3a43 (diff) |
Differentiate disconnect w/ IO-Error, i.e. DBTDevice shall not issue HCI nor Mgmt disconnect (device gone)
It has shown that the extreme 6-9s delay in forced disconnect (device shutdown)
is caused by the HCI and Mgmt disconnect command. Both fail, always.
Hence, in case of a GATT send error or short read-reply timeout (ringbuffer.getBlocking(500ms))
we can cleanup the device w/o explicit disconnect command.
+++
The usual disconnect signal from a device forced shutdown is as follows:
L2CAP send or GATT read-reply -> Device -> HCI(1) + Mgmt(2)
(1) HCI disconnect skipped if IO-Error
(2) Mgmt disconnect skipped if IO-Error, but sends DISCONNECT event
+++
Mgmt and GATTHandler also differentiate timeouts,
lenghthly 3s for the ringbuffer read w/o any impact and 1s (mgmt) or 500ms (gatt) for command replies
on the user thread.
This leads to fast DISCONNECT events for the user and actual device cleanup.
Subsequent connection works w/o issues.
If using HCI connect via discovery (not whitelist),
the turnaround time from forced disconnect to next connect is below 1s.
However, using whitelist, the subsequent connect after the forced disconnect
consumes 'a few seconds' and hence is seemingly not suitable for a responsive system (???).
The latter is true with or without Mgmt disconnect attempts!
Misc:
- L2CAPComm disconnect: Show potention pthread_kill error
- HCIComm send_req/send: Refine ERR_PRINT, remove unsused case HCI_EV_REMOTE_NAME
Diffstat (limited to 'api/direct_bt/DBTAdapter.hpp')
-rw-r--r-- | api/direct_bt/DBTAdapter.hpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/api/direct_bt/DBTAdapter.hpp b/api/direct_bt/DBTAdapter.hpp index c55a0bd8..855c79a3 100644 --- a/api/direct_bt/DBTAdapter.hpp +++ b/api/direct_bt/DBTAdapter.hpp @@ -167,7 +167,7 @@ namespace direct_bt { friend std::shared_ptr<DBTDevice> DBTDevice::getSharedInstance() const; friend void DBTDevice::releaseSharedInstance() const; friend std::shared_ptr<ConnectionInfo> DBTDevice::getConnectionInfo(); - friend void DBTDevice::disconnect(const bool disconnectManager, const uint8_t reason); + friend void DBTDevice::disconnect(const bool sentFromManager, const bool ioErrorCause,const uint8_t reason); friend uint16_t DBTDevice::connectLE(HCIAddressType peer_mac_type, HCIAddressType own_mac_type, uint16_t interval, uint16_t window, uint16_t min_interval, uint16_t max_interval, |