diff options
author | Sven Gothel <[email protected]> | 2020-09-24 10:47:43 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2020-09-24 10:47:43 +0200 |
commit | 0dff786ec6b19a0c2e79a6dfac2a36ff9fb1e8eb (patch) | |
tree | 1ce154dde98bcf238a451c90a89f1505b1003639 /api | |
parent | 2109236a2dc87f7c2470841085ce1dfcbd31c47e (diff) |
DBTDevice::disconnect(): Simplification, !isConnected is OK, only send event on HCIStatusCode error; decouple notifyDisconnect()
Have notifyDisconnect() cleanup itself, no abusing disconnect().
!isConnected is OK, b/c a disconnect event could have come before the user issuance.
Only send event on HCIStatusCode error, not on 'ioErrorCause' (WIP, testing - supervision timeout related).
After proving 'ioErrorCause' has no impact anymore, we shall drop it from method.
Diffstat (limited to 'api')
-rw-r--r-- | api/direct_bt/DBTAdapter.hpp | 2 | ||||
-rw-r--r-- | api/direct_bt/DBTDevice.hpp | 5 |
2 files changed, 4 insertions, 3 deletions
diff --git a/api/direct_bt/DBTAdapter.hpp b/api/direct_bt/DBTAdapter.hpp index cab976c4..763a4454 100644 --- a/api/direct_bt/DBTAdapter.hpp +++ b/api/direct_bt/DBTAdapter.hpp @@ -200,7 +200,7 @@ namespace direct_bt { friend std::shared_ptr<DBTDevice> DBTDevice::getSharedInstance() const; friend std::shared_ptr<ConnectionInfo> DBTDevice::getConnectionInfo(); - friend HCIStatusCode DBTDevice::disconnect(const bool sentFromManager, const bool ioErrorCause,const HCIStatusCode reason); + friend HCIStatusCode DBTDevice::disconnect(const bool ioErrorCause,const HCIStatusCode reason); friend void DBTDevice::remove(); friend HCIStatusCode DBTDevice::connectLE(uint16_t interval, uint16_t window, uint16_t min_interval, uint16_t max_interval, diff --git a/api/direct_bt/DBTDevice.hpp b/api/direct_bt/DBTDevice.hpp index 4daa07c7..8f130b30 100644 --- a/api/direct_bt/DBTDevice.hpp +++ b/api/direct_bt/DBTDevice.hpp @@ -90,7 +90,8 @@ namespace direct_bt { void notifyDisconnected(); void notifyConnected(const uint16_t handle); - HCIStatusCode disconnect(const bool fromDisconnectCB, const bool ioErrorCause, + void disconnectGATT(); + HCIStatusCode disconnect(const bool ioErrorCause, const HCIStatusCode reason=HCIStatusCode::REMOTE_USER_TERMINATED_CONNECTION ); public: @@ -331,7 +332,7 @@ namespace direct_bt { * @return HCIStatusCode::SUCCESS if the command has been accepted, otherwise HCIStatusCode may disclose reason for rejection. */ HCIStatusCode disconnect(const HCIStatusCode reason=HCIStatusCode::REMOTE_USER_TERMINATED_CONNECTION ) { - return disconnect(false /* fromDisconnectCB */, false /* ioErrorCause */, reason); + return disconnect(false /* ioErrorCause */, reason); } /** |