summaryrefslogtreecommitdiffstats
path: root/src/direct_bt/DBTDevice.cpp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2020-11-08 06:11:00 +0100
committerSven Gothel <[email protected]>2020-11-08 06:11:00 +0100
commit28fd3a2ea5bdfcd9392f45b5760c0150dc8a7671 (patch)
tree1ee839e8dc692be6b93c0fc9260113358d2b56bd /src/direct_bt/DBTDevice.cpp
parent6f3e08562f4f990b579ff2540d25dac06beea15a (diff)
SMPHandler: Add define SMP_SUPPORTED_BY_OS and have DBTDevice exclude compilation/usage if false, removing costs.
Diffstat (limited to 'src/direct_bt/DBTDevice.cpp')
-rw-r--r--src/direct_bt/DBTDevice.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/direct_bt/DBTDevice.cpp b/src/direct_bt/DBTDevice.cpp
index 5996593d..8ef71dec 100644
--- a/src/direct_bt/DBTDevice.cpp
+++ b/src/direct_bt/DBTDevice.cpp
@@ -507,6 +507,7 @@ void DBTDevice::remove() noexcept {
}
void DBTDevice::disconnectSMP(int caller) noexcept {
+ #if SMP_SUPPORTED_BY_OS
const std::lock_guard<std::recursive_mutex> lock_conn(mtx_smpHandler);
if( nullptr != smpHandler ) {
DBG_PRINT("DBTDevice::disconnectSMP: start (has smpHandler, caller %d)", caller);
@@ -516,16 +517,20 @@ void DBTDevice::disconnectSMP(int caller) noexcept {
}
smpHandler = nullptr;
DBG_PRINT("DBTDevice::disconnectSMP: end");
+ #else
+ (void)caller;
+ #endif
}
bool DBTDevice::connectSMP() noexcept {
+ #if SMP_SUPPORTED_BY_OS
if( !isConnected || !allowDisconnect) {
ERR_PRINT("DBTDevice::connectSMP: Device not connected: %s", toString().c_str());
return false;
}
if( !SMPHandler::IS_SUPPORTED_BY_OS ) {
- ERR_PRINT("DBTDevice::connectSMP: SMP Not supported by OS: %s", toString().c_str());
+ DBG_PRINT("DBTDevice::connectSMP: SMP Not supported by OS (1): %s", toString().c_str());
return false;
}
@@ -551,6 +556,10 @@ bool DBTDevice::connectSMP() noexcept {
}
smpHandler->addSMPSecurityReqCallback(jau::bindMemberFunc(this, &DBTDevice::smpSecurityReqCallback));
return true;
+ #else
+ DBG_PRINT("DBTDevice::connectSMP: SMP Not supported by OS (0): %s", toString().c_str());
+ return false;
+ #endif
}
bool DBTDevice::smpSecurityReqCallback(std::shared_ptr<const SMPPDUMsg> msg) {