summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2022-01-01 16:07:42 +0100
committerSven Gothel <[email protected]>2022-01-01 16:07:42 +0100
commit5ef8fcdd94661b911d8137579fa5fa1f474c4773 (patch)
tree5f214a4c4e76b77100bbc1bdc6215e1bc36c04b8 /api
parent20729ffdf91b85b65c0fe2cdbac20870f05f9ceb (diff)
SMPKeyBin::uses_SC() added to conveniently determine whether SC is being used via LTK keys.
Diffstat (limited to 'api')
-rw-r--r--api/direct_bt/SMPKeyBin.hpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/api/direct_bt/SMPKeyBin.hpp b/api/direct_bt/SMPKeyBin.hpp
index 2e3d64a9..27f4b51f 100644
--- a/api/direct_bt/SMPKeyBin.hpp
+++ b/api/direct_bt/SMPKeyBin.hpp
@@ -270,6 +270,12 @@ class SMPKeyBin {
/** Return the remote device address. */
constexpr const BDAddressAndType& getRemoteAddrAndType() const noexcept { return remoteAddress; }
+ /** Return whether Secure Connection (SC) is being used via LTK keys. */
+ constexpr bool uses_SC() const noexcept {
+ return ( hasLTKInit() && SMPLongTermKey::Property::NONE != ( getLTKInit().properties & SMPLongTermKey::Property::SC ) ) ||
+ ( hasLTKResp() && SMPLongTermKey::Property::NONE != ( getLTKResp().properties & SMPLongTermKey::Property::SC ) );
+ }
+
constexpr BTSecurityLevel getSecLevel() const noexcept { return sec_level; }
constexpr SMPIOCapability getIOCap() const noexcept { return io_cap; }