summaryrefslogtreecommitdiffstats
path: root/src/direct_bt/SMPHandler.cpp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2021-01-25 18:44:32 +0100
committerSven Gothel <[email protected]>2021-01-25 18:44:32 +0100
commite7d892210343dc50c8978954f8daa71395584f2e (patch)
tree4d5f1dfcede30af5cad2a7afb97b535f40600a85 /src/direct_bt/SMPHandler.cpp
parentfeaff07f5942ee6ff2bd94e70bf140c678379490 (diff)
Java: New API Layout: Shorten named [Bluetooth -> BT], [Characteristic -> Char] etc (align naming with direct_bt == java; reduce java code footprint and too long code lines)
Diffstat (limited to 'src/direct_bt/SMPHandler.cpp')
-rw-r--r--src/direct_bt/SMPHandler.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/direct_bt/SMPHandler.cpp b/src/direct_bt/SMPHandler.cpp
index cc4e97ff..ae2898f6 100644
--- a/src/direct_bt/SMPHandler.cpp
+++ b/src/direct_bt/SMPHandler.cpp
@@ -52,8 +52,8 @@ extern "C" {
#include "SMPHandler.hpp"
-#include "DBTDevice.hpp"
-#include "DBTAdapter.hpp"
+#include <BTDevice.hpp>
+#include <BTAdapter.hpp>
using namespace direct_bt;
@@ -72,8 +72,8 @@ SMPEnv::SMPEnv() noexcept
bool SMPHandler::IS_SUPPORTED_BY_OS = false;
#endif
-std::shared_ptr<DBTDevice> SMPHandler::getDeviceChecked() const {
- std::shared_ptr<DBTDevice> ref = wbr_device.lock();
+std::shared_ptr<BTDevice> SMPHandler::getDeviceChecked() const {
+ std::shared_ptr<BTDevice> ref = wbr_device.lock();
if( nullptr == ref ) {
throw jau::IllegalStateException("SMPHandler's device already destructed: "+deviceString, E_FILE_LINE);
}
@@ -155,7 +155,7 @@ void SMPHandler::l2capReaderThreadImpl() {
disconnect(true /* disconnectDevice */, has_ioerror);
}
-SMPHandler::SMPHandler(const std::shared_ptr<DBTDevice> &device) noexcept
+SMPHandler::SMPHandler(const std::shared_ptr<BTDevice> &device) noexcept
: env(SMPEnv::get()),
wbr_device(device), deviceString(device->getAddressAndType().toString()), rbuffer(number(Defaults::SMP_MTU_BUFFER_SZ)),
l2cap(device->getAdapter().getAddress(), L2CAP_PSM_UNDEF, L2CAP_CID_SMP),
@@ -256,7 +256,7 @@ bool SMPHandler::disconnect(const bool disconnectDevice, const bool ioErrorCause
PERF3_TS_TD("SMPHandler::disconnect.2");
if( disconnectDevice ) {
- std::shared_ptr<DBTDevice> device = getDeviceUnchecked();
+ std::shared_ptr<BTDevice> device = getDeviceUnchecked();
if( nullptr != device ) {
// Cleanup device resources, proper connection state
// Intentionally giving the POWER_OFF reason for the device in case of ioErrorCause!
@@ -287,14 +287,14 @@ void SMPHandler::send(const SMPPDUMsg & msg) {
IRQ_PRINT("SMPHandler::send: l2cap write error -> disconnect: %s to %s", msg.toString().c_str(), deviceString.c_str());
has_ioerror = true;
disconnect(true /* disconnectDevice */, true /* ioErrorCause */); // state -> Disconnected
- throw BluetoothException("SMPHandler::send: l2cap write error: req "+msg.toString()+" to "+deviceString, E_FILE_LINE);
+ throw BTException("SMPHandler::send: l2cap write error: req "+msg.toString()+" to "+deviceString, E_FILE_LINE);
}
if( static_cast<size_t>(res) != msg.pdu.getSize() ) {
ERR_PRINT("SMPHandler::send: l2cap write count error, %zd != %zu: %s -> disconnect: %s",
res, msg.pdu.getSize(), msg.toString().c_str(), deviceString.c_str());
has_ioerror = true;
disconnect(true /* disconnectDevice */, true /* ioErrorCause */); // state -> Disconnected
- throw BluetoothException("SMPHandler::send: l2cap write count error, "+std::to_string(res)+" != "+std::to_string(res)
+ throw BTException("SMPHandler::send: l2cap write count error, "+std::to_string(res)+" != "+std::to_string(res)
+": "+msg.toString()+" -> disconnect: "+deviceString, E_FILE_LINE);
}
}
@@ -309,7 +309,7 @@ std::unique_ptr<const SMPPDUMsg> SMPHandler::sendWithReply(const SMPPDUMsg & msg
IRQ_PRINT("SMPHandler::sendWithReply: nullptr result (timeout %d): req %s to %s", timeout, msg.toString().c_str(), deviceString.c_str());
has_ioerror = true;
disconnect(true /* disconnectDevice */, true /* ioErrorCause */);
- throw BluetoothException("SMPHandler::sendWithReply: nullptr result (timeout "+std::to_string(timeout)+"): req "+msg.toString()+" to "+deviceString, E_FILE_LINE);
+ throw BTException("SMPHandler::sendWithReply: nullptr result (timeout "+std::to_string(timeout)+"): req "+msg.toString()+" to "+deviceString, E_FILE_LINE);
}
return res;
}