summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2020-07-28 01:00:47 +0200
committerSven Gothel <[email protected]>2020-07-28 01:00:47 +0200
commitf417fc491acd502fb5ed7ae2d3c6fc887bba8630 (patch)
tree0d46d15951fb51a50be7615e5bbc8fdce2de6a3f /src
parent5779e14403e88d05f9e8dcfe387d93c389ae8032 (diff)
DBTAdapter: Increase verbosity DBG -> INFO + enhance output (shall moved to DBG later on)
Diffstat (limited to 'src')
-rw-r--r--src/direct_bt/DBTAdapter.cpp23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/direct_bt/DBTAdapter.cpp b/src/direct_bt/DBTAdapter.cpp
index c5275104..ad001c5a 100644
--- a/src/direct_bt/DBTAdapter.cpp
+++ b/src/direct_bt/DBTAdapter.cpp
@@ -371,16 +371,19 @@ void DBTAdapter::startDiscoveryBackground() {
}
void DBTAdapter::stopDiscovery() {
+ INFO_PRINT("DBTAdapter::stopDiscovery: pre-lock");
const std::lock_guard<std::recursive_mutex> lock(mtx_discovery); // RAII-style acquire and relinquish via destructor
keepDiscoveringAlive = false;
if( ScanType::SCAN_TYPE_NONE == currentScanType ) {
+ INFO_PRINT("DBTAdapter::stopDiscovery: X0 (nop)");
return;
}
- DBG_PRINT("DBTAdapter::stopDiscovery: ...");
- if( mgmt.stopDiscovery(dev_id, currentScanType) ) {
+ INFO_PRINT("DBTAdapter::stopDiscovery: ...");
+ bool r;
+ if( ( r = mgmt.stopDiscovery(dev_id, currentScanType) ) == true ) {
currentScanType = ScanType::SCAN_TYPE_NONE;
}
- DBG_PRINT("DBTAdapter::stopDiscovery: X");
+ INFO_PRINT("DBTAdapter::stopDiscovery: X1 (done, res %d)", r);
}
std::shared_ptr<DBTDevice> DBTAdapter::findDiscoveredDevice (EUI48 const & mac, const BDAddressType macType) {
@@ -645,8 +648,10 @@ bool DBTAdapter::mgmtEvConnectFailedHCI(std::shared_ptr<MgmtEvent> e) {
const MgmtEvtDeviceConnectFailed &event = *static_cast<const MgmtEvtDeviceConnectFailed *>(e.get());
std::shared_ptr<DBTDevice> device = findConnectedDevice(event.getAddress(), event.getAddressType());
if( nullptr != device ) {
- DBG_PRINT("DBTAdapter::EventHCI:ConnectFailed(dev_id %d): %s\n -> %s",
- dev_id, event.toString().c_str(), device->toString().c_str());
+ INFO_PRINT("DBTAdapter::EventHCI:ConnectFailed(dev_id %d): %s, handle %s -> zero,\n -> %s",
+ dev_id, event.toString().c_str(), uint16HexString(device->getConnectionHandle()).c_str(),
+ device->toString().c_str());
+
device->notifyDisconnected();
removeConnectedDevice(*device);
@@ -665,7 +670,7 @@ bool DBTAdapter::mgmtEvConnectFailedHCI(std::shared_ptr<MgmtEvent> e) {
});
removeDiscoveredDevice(*device); // ensure device will cause a deviceFound event after disconnect
} else {
- DBG_PRINT("DBTAdapter::EventHCI:DeviceDisconnected(dev_id %d): %s\n -> Device not tracked",
+ INFO_PRINT("DBTAdapter::EventHCI:DeviceDisconnected(dev_id %d): %s\n -> Device not tracked",
dev_id, event.toString().c_str());
}
return true;
@@ -680,8 +685,10 @@ bool DBTAdapter::mgmtEvDeviceDisconnectedHCI(std::shared_ptr<MgmtEvent> e) {
dev_id, event.toString().c_str(), device->toString().c_str());
return true;
}
- DBG_PRINT("DBTAdapter::EventHCI:DeviceDisconnected(dev_id %d): %s\n -> %s",
- dev_id, event.toString().c_str(), device->toString().c_str());
+ INFO_PRINT("DBTAdapter::EventHCI:DeviceDisconnected(dev_id %d): %s, handle %s -> zero,\n -> %s",
+ dev_id, event.toString().c_str(), uint16HexString(device->getConnectionHandle()).c_str(),
+ device->toString().c_str());
+
device->notifyDisconnected();
removeConnectedDevice(*device);