diff options
author | Sven Gothel <[email protected]> | 2020-06-24 20:08:50 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2020-06-24 20:08:50 +0200 |
commit | 2a6a4569c992d3487fba497c92e361e95a498e17 (patch) | |
tree | c7ed9c514ecab68f02343032899ca2323a1b04a6 /api | |
parent | 548fa6e1bcf2518c3650e0149653826209117c44 (diff) |
L2CAPComm: Always use blocking mode, remove State::Connecting
Diffstat (limited to 'api')
-rw-r--r-- | api/direct_bt/L2CAPComm.hpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/api/direct_bt/L2CAPComm.hpp b/api/direct_bt/L2CAPComm.hpp index 4db7e84b..b8dd1fcc 100644 --- a/api/direct_bt/L2CAPComm.hpp +++ b/api/direct_bt/L2CAPComm.hpp @@ -54,8 +54,7 @@ namespace direct_bt { enum class State : int { Error = -1, Disconnected = 0, - Connecting = 1, - Connected = 2, + Connected = 1, }; static std::string getStateString(const State state); @@ -66,22 +65,21 @@ namespace direct_bt { static inline int number(const Defaults d) { return static_cast<int>(d); } private: - static int l2cap_open_dev(const EUI48 & adapterAddress, const uint16_t psm, const uint16_t cid, const bool pubaddr, const bool blocking); + static int l2cap_open_dev(const EUI48 & adapterAddress, const uint16_t psm, const uint16_t cid, const bool pubaddr); static int l2cap_close_dev(int dd); std::shared_ptr<DBTDevice> device; const uint16_t psm; const uint16_t cid; const bool pubaddr; - const bool blocking; std::atomic<State> state; std::atomic<int> _dd; // the l2cap socket std::atomic<bool> interruptFlag; // for forced disconnect std::atomic<pthread_t> tid_connect; public: - L2CAPComm(std::shared_ptr<DBTDevice> device, const uint16_t psm, const uint16_t cid, const bool pubaddr=true, const bool blocking=true) - : device(device), psm(psm), cid(cid), pubaddr(pubaddr), blocking(blocking), + L2CAPComm(std::shared_ptr<DBTDevice> device, const uint16_t psm, const uint16_t cid, const bool pubaddr=true) + : device(device), psm(psm), cid(cid), pubaddr(pubaddr), state(State::Disconnected), _dd(-1), interruptFlag(false), tid_connect(0) {} ~L2CAPComm() { disconnect(); } |