diff options
author | Sven Gothel <[email protected]> | 2021-01-30 01:34:06 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2021-01-30 01:34:06 +0100 |
commit | 14f3fa5e374d1fce1f6cc0a2df742fdc817e24b4 (patch) | |
tree | 4b0f0253105ea058d2def43392855ff9af568102 | |
parent | 4df98edb48b3dde8fb7403d0878eac82377d115e (diff) |
BTDevice.cpp connect*() methods are all noexcept, since all invoked methods are noexcept; Earmark in BTDevice.java for direct_bt.
-rw-r--r-- | api/direct_bt/BTAdapter.hpp | 4 | ||||
-rw-r--r-- | api/direct_bt/BTDevice.hpp | 6 | ||||
-rw-r--r-- | java/org/direct_bt/BTDevice.java | 1 | ||||
-rw-r--r-- | src/direct_bt/BTDevice.cpp | 6 |
4 files changed, 9 insertions, 8 deletions
diff --git a/api/direct_bt/BTAdapter.hpp b/api/direct_bt/BTAdapter.hpp index 62350022..012acbc8 100644 --- a/api/direct_bt/BTAdapter.hpp +++ b/api/direct_bt/BTAdapter.hpp @@ -273,8 +273,8 @@ namespace direct_bt { friend void BTDevice::remove() noexcept; friend HCIStatusCode BTDevice::connectLE(uint16_t interval, uint16_t window, uint16_t min_interval, uint16_t max_interval, - uint16_t latency, uint16_t supervision_timeout); - friend HCIStatusCode BTDevice::connectBREDR(const uint16_t pkt_type, const uint16_t clock_offset, const uint8_t role_switch); + uint16_t latency, uint16_t supervision_timeout) noexcept; + friend HCIStatusCode BTDevice::connectBREDR(const uint16_t pkt_type, const uint16_t clock_offset, const uint8_t role_switch) noexcept; friend void BTDevice::processL2CAPSetup(std::shared_ptr<BTDevice> sthis); friend bool BTDevice::updatePairingState(std::shared_ptr<BTDevice> sthis, const MgmtEvent& evt, const HCIStatusCode evtStatus, SMPPairingState claimed_state) noexcept; friend void BTDevice::hciSMPMsgCallback(std::shared_ptr<BTDevice> sthis, const SMPPDUMsg& msg, const HCIACLData::l2cap_frame& source) noexcept; diff --git a/api/direct_bt/BTDevice.hpp b/api/direct_bt/BTDevice.hpp index a2f529d6..ae12e33b 100644 --- a/api/direct_bt/BTDevice.hpp +++ b/api/direct_bt/BTDevice.hpp @@ -355,7 +355,7 @@ namespace direct_bt { */ HCIStatusCode connectLE(const uint16_t le_scan_interval=24, const uint16_t le_scan_window=24, const uint16_t conn_interval_min=12, const uint16_t conn_interval_max=12, - const uint16_t conn_latency=0, const uint16_t supervision_timeout=getHCIConnSupervisorTimeout(0, 15)); + const uint16_t conn_latency=0, const uint16_t supervision_timeout=getHCIConnSupervisorTimeout(0, 15)) noexcept; /** * Establish a HCI BDADDR_BREDR connection to this device. @@ -381,7 +381,7 @@ namespace direct_bt { * @return HCIStatusCode::SUCCESS if the command has been accepted, otherwise HCIStatusCode may disclose reason for rejection. */ HCIStatusCode connectBREDR(const uint16_t pkt_type=HCI_DM1 | HCI_DM3 | HCI_DM5 | HCI_DH1 | HCI_DH3 | HCI_DH5, - const uint16_t clock_offset=0x0000, const uint8_t role_switch=0x01); + const uint16_t clock_offset=0x0000, const uint8_t role_switch=0x01) noexcept; /** * Establish a default HCI connection to this device, using certain default parameter. @@ -406,7 +406,7 @@ namespace direct_bt { * </p> * @return HCIStatusCode::SUCCESS if the command has been accepted, otherwise HCIStatusCode may disclose reason for rejection. */ - HCIStatusCode connectDefault(); + HCIStatusCode connectDefault() noexcept; /** Return the HCI connection handle to the LE or BREDR peer, zero if not connected. */ diff --git a/java/org/direct_bt/BTDevice.java b/java/org/direct_bt/BTDevice.java index 50434584..27f547f7 100644 --- a/java/org/direct_bt/BTDevice.java +++ b/java/org/direct_bt/BTDevice.java @@ -123,6 +123,7 @@ public interface BTDevice extends BTObject * @return {@link HCIStatusCode#SUCCESS} if the command has been accepted, otherwise {@link HCIStatusCode} may disclose reason for rejection. * @see #connectLE(short, short, short, short, short, short) * @since 2.1.0 change API, i.e. return value from boolean to HCIStatusCode in favor of <i>direct_bt</i> + * @implNote {@code jau.direct_bt} does not throw a BTException on error, only a 'general' exception in case of fatality like NPE etc (FIXME: Remove throws) */ HCIStatusCode connect() throws BTException; diff --git a/src/direct_bt/BTDevice.cpp b/src/direct_bt/BTDevice.cpp index 3fa0a62d..27fd5be4 100644 --- a/src/direct_bt/BTDevice.cpp +++ b/src/direct_bt/BTDevice.cpp @@ -263,7 +263,7 @@ std::shared_ptr<ConnectionInfo> BTDevice::getConnectionInfo() noexcept { HCIStatusCode BTDevice::connectLE(uint16_t le_scan_interval, uint16_t le_scan_window, uint16_t conn_interval_min, uint16_t conn_interval_max, - uint16_t conn_latency, uint16_t supervision_timeout) + uint16_t conn_latency, uint16_t supervision_timeout) noexcept { const std::lock_guard<std::recursive_mutex> lock_conn(mtx_connect); // RAII-style acquire and relinquish via destructor if( !adapter.isPowered() ) { @@ -354,7 +354,7 @@ HCIStatusCode BTDevice::connectLE(uint16_t le_scan_interval, uint16_t le_scan_wi return status; } -HCIStatusCode BTDevice::connectBREDR(const uint16_t pkt_type, const uint16_t clock_offset, const uint8_t role_switch) +HCIStatusCode BTDevice::connectBREDR(const uint16_t pkt_type, const uint16_t clock_offset, const uint8_t role_switch) noexcept { const std::lock_guard<std::recursive_mutex> lock_conn(mtx_connect); // RAII-style acquire and relinquish via destructor if( !adapter.isPowered() ) { @@ -394,7 +394,7 @@ HCIStatusCode BTDevice::connectBREDR(const uint16_t pkt_type, const uint16_t clo return status; } -HCIStatusCode BTDevice::connectDefault() +HCIStatusCode BTDevice::connectDefault() noexcept { switch( addressAndType.type ) { case BDAddressType::BDADDR_LE_PUBLIC: |