diff options
author | Sven Gothel <[email protected]> | 2020-10-24 03:36:52 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2020-10-24 03:36:52 +0200 |
commit | d75417bf5fe047e7eeaa6d0783f2069a79816d5c (patch) | |
tree | 40c9c3ff5c0b0e94920640e1224aa3d9552c580b /src | |
parent | 65e706721ed1ffa3800d8d2eb1d34f779cf55b85 (diff) |
DBTAdapter/Manager: Callback DBG/PRINT: Use common source prefix 'mgmt' or 'hci'
Diffstat (limited to 'src')
-rw-r--r-- | src/direct_bt/DBTAdapter.cpp | 35 | ||||
-rw-r--r-- | src/direct_bt/DBTManager.cpp | 28 |
2 files changed, 32 insertions, 31 deletions
diff --git a/src/direct_bt/DBTAdapter.cpp b/src/direct_bt/DBTAdapter.cpp index bd7101c5..821e6217 100644 --- a/src/direct_bt/DBTAdapter.cpp +++ b/src/direct_bt/DBTAdapter.cpp @@ -702,6 +702,7 @@ bool DBTAdapter::mgmtEvDeviceDiscoveringMgmt(std::shared_ptr<MgmtEvent> e) noexc } bool DBTAdapter::mgmtEvDeviceDiscoveringAny(std::shared_ptr<MgmtEvent> e, const bool hciSourced) noexcept { + const std::string srctkn = hciSourced ? "hci" : "mgmt"; const MgmtEvtDiscovering &event = *static_cast<const MgmtEvtDiscovering *>(e.get()); const ScanType eventScanType = event.getScanType(); const bool eventEnabled = event.getEnabled(); @@ -729,16 +730,16 @@ bool DBTAdapter::mgmtEvDeviceDiscoveringAny(std::shared_ptr<MgmtEvent> e, const if( !hciSourced ) { // update HCIHandler's currentNativeScanType from other source const ScanType nextNativeScanType = changeScanType(currentNativeScanType, eventScanType, eventEnabled); - DBG_PRINT("DBTAdapter::DeviceDiscovering: dev_id %d, keepDiscoveringAlive %d: scanType[native %s -> %s, meta %s -> %s]): %s - HCI Updated", - dev_id, keep_le_scan_alive.load(), + DBG_PRINT("DBTAdapter:%s:DeviceDiscovering: dev_id %d, keepDiscoveringAlive %d: scanType[native %s -> %s, meta %s -> %s]): %s", + srctkn.c_str(), dev_id, keep_le_scan_alive.load(), getScanTypeString(currentNativeScanType).c_str(), getScanTypeString(nextNativeScanType).c_str(), getScanTypeString(currentMetaScanType).c_str(), getScanTypeString(nextMetaScanType).c_str(), event.toString().c_str()); currentNativeScanType = nextNativeScanType; hci.setCurrentScanType(currentNativeScanType); } else { - DBG_PRINT("DBTAdapter::DeviceDiscovering: dev_id %d, keepDiscoveringAlive %d: scanType[native %s, meta %s -> %s]): %s - HCI Event", - dev_id, keep_le_scan_alive.load(), + DBG_PRINT("DBTAdapter:%s:DeviceDiscovering: dev_id %d, keepDiscoveringAlive %d: scanType[native %s, meta %s -> %s]): %s", + srctkn.c_str(), dev_id, keep_le_scan_alive.load(), getScanTypeString(currentNativeScanType).c_str(), getScanTypeString(currentMetaScanType).c_str(), getScanTypeString(nextMetaScanType).c_str(), event.toString().c_str()); @@ -752,8 +753,8 @@ bool DBTAdapter::mgmtEvDeviceDiscoveringAny(std::shared_ptr<MgmtEvent> e, const try { l->discoveringChanged(*this, currentMetaScanType, eventScanType, eventEnabled, keep_le_scan_alive, event.getTimestamp()); } catch (std::exception &except) { - ERR_PRINT("DBTAdapter::EventCB:DeviceDiscovering-CBs %d/%zd: %s of %s: Caught exception %s", - i+1, statusListenerList.size(), + ERR_PRINT("DBTAdapter:%s:DeviceDiscovering-CBs %d/%zd: %s of %s: Caught exception %s", + srctkn.c_str(), i+1, statusListenerList.size(), l->toString().c_str(), toString().c_str(), except.what()); } i++; @@ -767,7 +768,7 @@ bool DBTAdapter::mgmtEvDeviceDiscoveringAny(std::shared_ptr<MgmtEvent> e, const } bool DBTAdapter::mgmtEvNewSettingsMgmt(std::shared_ptr<MgmtEvent> e) noexcept { - COND_PRINT(debug_event, "DBTAdapter::EventCB:NewSettings: %s", e->toString().c_str()); + COND_PRINT(debug_event, "DBTAdapter:mgmt:NewSettings: %s", e->toString().c_str()); const MgmtEvtNewSettings &event = *static_cast<const MgmtEvtNewSettings *>(e.get()); const AdapterSetting old_settings = adapterInfo->getCurrentSettingMask(); const AdapterSetting new_settings = adapterInfo->setCurrentSettingMask(event.getSettings()); @@ -827,7 +828,7 @@ void DBTAdapter::sendAdapterSettingsChanged(AdapterStatusListener & asl, } bool DBTAdapter::mgmtEvLocalNameChangedMgmt(std::shared_ptr<MgmtEvent> e) noexcept { - COND_PRINT(debug_event, "DBTAdapter::EventCB:LocalNameChanged: %s", e->toString().c_str()); + COND_PRINT(debug_event, "DBTAdapter:mgmt:LocalNameChanged: %s", e->toString().c_str()); const MgmtEvtLocalNameChanged &event = *static_cast<const MgmtEvtLocalNameChanged *>(e.get()); std::string old_name = localName.getName(); std::string old_shortName = localName.getShortName(); @@ -839,7 +840,7 @@ bool DBTAdapter::mgmtEvLocalNameChangedMgmt(std::shared_ptr<MgmtEvent> e) noexce if( shortNameChanged ) { localName.setShortName(event.getShortName()); } - COND_PRINT(debug_event, "DBTAdapter::EventCB:LocalNameChanged: Local name: %d: '%s' -> '%s'; short_name: %d: '%s' -> '%s'", + COND_PRINT(debug_event, "DBTAdapter:mgmt:LocalNameChanged: Local name: %d: '%s' -> '%s'; short_name: %d: '%s' -> '%s'", nameChanged, old_name.c_str(), localName.getName().c_str(), shortNameChanged, old_shortName.c_str(), localName.getShortName().c_str()); (void)nameChanged; @@ -864,7 +865,7 @@ void DBTAdapter::sendDeviceUpdated(std::string cause, std::shared_ptr<DBTDevice> } bool DBTAdapter::mgmtEvDeviceConnectedHCI(std::shared_ptr<MgmtEvent> e) noexcept { - COND_PRINT(debug_event, "DBTAdapter::EventCB:DeviceConnected(dev_id %d): %s", dev_id, e->toString().c_str()); + COND_PRINT(debug_event, "DBTAdapter:hci:DeviceConnected(dev_id %d): %s", dev_id, e->toString().c_str()); const MgmtEvtDeviceConnected &event = *static_cast<const MgmtEvtDeviceConnected *>(e.get()); EInfoReport ad_report; { @@ -1015,14 +1016,14 @@ bool DBTAdapter::mgmtEvDeviceDisconnectedHCI(std::shared_ptr<MgmtEvent> e) noexc } bool DBTAdapter::mgmtEvDeviceDisconnectedMgmt(std::shared_ptr<MgmtEvent> e) noexcept { - COND_PRINT(debug_event, "DBTAdapter::EventCB:DeviceDisconnected: %s", e->toString().c_str()); + COND_PRINT(debug_event, "DBTAdapter:mgmt:DeviceDisconnected: %s", e->toString().c_str()); const MgmtEvtDeviceDisconnected &event = *static_cast<const MgmtEvtDeviceDisconnected *>(e.get()); (void)event; return true; } bool DBTAdapter::mgmtEvDeviceFoundHCI(std::shared_ptr<MgmtEvent> e) noexcept { - COND_PRINT(debug_event, "DBTAdapter::EventCB:DeviceFound(dev_id %d): %s", dev_id, e->toString().c_str()); + COND_PRINT(debug_event, "DBTAdapter:hci:DeviceFound(dev_id %d): %s", dev_id, e->toString().c_str()); const MgmtEvtDeviceFound &deviceFoundEvent = *static_cast<const MgmtEvtDeviceFound *>(e.get()); std::shared_ptr<EInfoReport> eir = deviceFoundEvent.getEIR(); @@ -1044,7 +1045,7 @@ bool DBTAdapter::mgmtEvDeviceFoundHCI(std::shared_ptr<MgmtEvent> e) noexcept { // drop existing device // EIRDataType updateMask = dev->update(*eir); - COND_PRINT(debug_event, "DBTAdapter::EventCB:DeviceFound: Drop already discovered %s, %s", + COND_PRINT(debug_event, "DBTAdapter:hci:DeviceFound: Drop already discovered %s, %s", dev->getAddressString().c_str(), eir->toString().c_str()); if( EIRDataType::NONE != updateMask ) { sendDeviceUpdated("DiscoveredDeviceFound", dev, eir->getTimestamp(), updateMask); @@ -1063,7 +1064,7 @@ bool DBTAdapter::mgmtEvDeviceFoundHCI(std::shared_ptr<MgmtEvent> e) noexcept { EIRDataType updateMask = dev->update(*eir); addDiscoveredDevice(dev); // re-add to discovered devices! dev->ts_last_discovery = eir->getTimestamp(); - COND_PRINT(debug_event, "DBTAdapter::EventCB:DeviceFound: Use already shared %s, %s", + COND_PRINT(debug_event, "DBTAdapter:hci:DeviceFound: Use already shared %s, %s", dev->getAddressString().c_str(), eir->toString().c_str()); int i=0; @@ -1073,7 +1074,7 @@ bool DBTAdapter::mgmtEvDeviceFoundHCI(std::shared_ptr<MgmtEvent> e) noexcept { l->deviceFound(dev, eir->getTimestamp()); } } catch (std::exception &except) { - ERR_PRINT("DBTAdapter::EventCB:DeviceFound: %d/%zd: %s of %s: Caught exception %s", + ERR_PRINT("DBTAdapter:hci:DeviceFound: %d/%zd: %s of %s: Caught exception %s", i+1, statusListenerList.size(), l->toString().c_str(), dev->toString().c_str(), except.what()); } @@ -1091,7 +1092,7 @@ bool DBTAdapter::mgmtEvDeviceFoundHCI(std::shared_ptr<MgmtEvent> e) noexcept { dev = std::shared_ptr<DBTDevice>(new DBTDevice(*this, *eir)); addDiscoveredDevice(dev); addSharedDevice(dev); - COND_PRINT(debug_event, "DBTAdapter::EventCB:DeviceFound: Use new %s, %s", + COND_PRINT(debug_event, "DBTAdapter:hci:DeviceFound: Use new %s, %s", dev->getAddressString().c_str(), eir->toString().c_str()); int i=0; @@ -1101,7 +1102,7 @@ bool DBTAdapter::mgmtEvDeviceFoundHCI(std::shared_ptr<MgmtEvent> e) noexcept { l->deviceFound(dev, eir->getTimestamp()); } } catch (std::exception &except) { - ERR_PRINT("DBTAdapter::EventCB:DeviceFound-CBs %d/%zd: %s of %s: Caught exception %s", + ERR_PRINT("DBTAdapter:hci:DeviceFound-CBs %d/%zd: %s of %s: Caught exception %s", i+1, statusListenerList.size(), l->toString().c_str(), dev->toString().c_str(), except.what()); } diff --git a/src/direct_bt/DBTManager.cpp b/src/direct_bt/DBTManager.cpp index 111ef4b1..3039160c 100644 --- a/src/direct_bt/DBTManager.cpp +++ b/src/direct_bt/DBTManager.cpp @@ -841,84 +841,84 @@ void DBTManager::clearAllMgmtEventCallbacks() noexcept { } bool DBTManager::mgmtEvClassOfDeviceChangedCB(std::shared_ptr<MgmtEvent> e) noexcept { - jau::PLAIN_PRINT("DBTManager::EventCB:ClassOfDeviceChanged: %s", e->toString().c_str()); + jau::PLAIN_PRINT("DBTManager:mgmt:ClassOfDeviceChanged: %s", e->toString().c_str()); (void)e; return true; } bool DBTManager::mgmtEvDeviceDiscoveringCB(std::shared_ptr<MgmtEvent> e) noexcept { - jau::PLAIN_PRINT("DBTManager::EventCB:DeviceDiscovering: %s", e->toString().c_str()); + jau::PLAIN_PRINT("DBTManager:mgmt:DeviceDiscovering: %s", e->toString().c_str()); const MgmtEvtDiscovering &event = *static_cast<const MgmtEvtDiscovering *>(e.get()); (void)event; return true; } bool DBTManager::mgmtEvDeviceFoundCB(std::shared_ptr<MgmtEvent> e) noexcept { - jau::PLAIN_PRINT("DBTManager::EventCB:DeviceFound: %s", e->toString().c_str()); + jau::PLAIN_PRINT("DBTManager:mgmt:DeviceFound: %s", e->toString().c_str()); const MgmtEvtDeviceFound &event = *static_cast<const MgmtEvtDeviceFound *>(e.get()); (void)event; return true; } bool DBTManager::mgmtEvDeviceDisconnectedCB(std::shared_ptr<MgmtEvent> e) noexcept { - jau::PLAIN_PRINT("DBTManager::EventCB:DeviceDisconnected: %s", e->toString().c_str()); + jau::PLAIN_PRINT("DBTManager:mgmt:DeviceDisconnected: %s", e->toString().c_str()); const MgmtEvtDeviceDisconnected &event = *static_cast<const MgmtEvtDeviceDisconnected *>(e.get()); (void)event; return true; } bool DBTManager::mgmtEvDeviceConnectedCB(std::shared_ptr<MgmtEvent> e) noexcept { - jau::PLAIN_PRINT("DBTManager::EventCB:DeviceConnected: %s", e->toString().c_str()); + jau::PLAIN_PRINT("DBTManager:mgmt:DeviceConnected: %s", e->toString().c_str()); const MgmtEvtDeviceConnected &event = *static_cast<const MgmtEvtDeviceConnected *>(e.get()); (void)event; return true; } bool DBTManager::mgmtEvConnectFailedCB(std::shared_ptr<MgmtEvent> e) noexcept { - jau::PLAIN_PRINT("DBTManager::EventCB:ConnectFailed: %s", e->toString().c_str()); + jau::PLAIN_PRINT("DBTManager:mgmt:ConnectFailed: %s", e->toString().c_str()); const MgmtEvtDeviceConnectFailed &event = *static_cast<const MgmtEvtDeviceConnectFailed *>(e.get()); (void)event; return true; } bool DBTManager::mgmtEvDeviceBlockedCB(std::shared_ptr<MgmtEvent> e) noexcept { - jau::PLAIN_PRINT("DBTManager::EventCB:DeviceBlocked: %s", e->toString().c_str()); + jau::PLAIN_PRINT("DBTManager:mgmt:DeviceBlocked: %s", e->toString().c_str()); const MgmtEvtDeviceBlocked &event = *static_cast<const MgmtEvtDeviceBlocked *>(e.get()); (void)event; return true; } bool DBTManager::mgmtEvDeviceUnblockedCB(std::shared_ptr<MgmtEvent> e) noexcept { - jau::PLAIN_PRINT("DBTManager::EventCB:DeviceUnblocked: %s", e->toString().c_str()); + jau::PLAIN_PRINT("DBTManager:mgmt:DeviceUnblocked: %s", e->toString().c_str()); const MgmtEvtDeviceUnblocked &event = *static_cast<const MgmtEvtDeviceUnblocked *>(e.get()); (void)event; return true; } bool DBTManager::mgmtEvDeviceUnpairedCB(std::shared_ptr<MgmtEvent> e) noexcept { - jau::PLAIN_PRINT("DBTManager::EventCB:DeviceUnpaired: %s", e->toString().c_str()); + jau::PLAIN_PRINT("DBTManager:mgmt:DeviceUnpaired: %s", e->toString().c_str()); const MgmtEvtDeviceUnpaired &event = *static_cast<const MgmtEvtDeviceUnpaired *>(e.get()); (void)event; return true; } bool DBTManager::mgmtEvNewConnectionParamCB(std::shared_ptr<MgmtEvent> e) noexcept { - jau::PLAIN_PRINT("DBTManager::EventCB:NewConnectionParam: %s", e->toString().c_str()); + jau::PLAIN_PRINT("DBTManager:mgmt:NewConnectionParam: %s", e->toString().c_str()); const MgmtEvtNewConnectionParam &event = *static_cast<const MgmtEvtNewConnectionParam *>(e.get()); (void)event; return true; } bool DBTManager::mgmtEvDeviceWhitelistAddedCB(std::shared_ptr<MgmtEvent> e) noexcept { - jau::PLAIN_PRINT("DBTManager::EventCB:DeviceWhitelistAdded: %s", e->toString().c_str()); + jau::PLAIN_PRINT("DBTManager:mgmt:DeviceWhitelistAdded: %s", e->toString().c_str()); const MgmtEvtDeviceWhitelistAdded &event = *static_cast<const MgmtEvtDeviceWhitelistAdded *>(e.get()); (void)event; return true; } bool DBTManager::mgmtEvDeviceWhilelistRemovedCB(std::shared_ptr<MgmtEvent> e) noexcept { - jau::PLAIN_PRINT("DBTManager::EventCB:DeviceWhitelistRemoved: %s", e->toString().c_str()); + jau::PLAIN_PRINT("DBTManager:mgmt:DeviceWhitelistRemoved: %s", e->toString().c_str()); const MgmtEvtDeviceWhitelistRemoved &event = *static_cast<const MgmtEvtDeviceWhitelistRemoved *>(e.get()); (void)event; return true; } bool DBTManager::mgmtEvPinCodeRequestCB(std::shared_ptr<MgmtEvent> e) noexcept { - jau::PLAIN_PRINT("DBTManager::EventCB:PinCodeRequest: %s", e->toString().c_str()); + jau::PLAIN_PRINT("DBTManager:mgmt:PinCodeRequest: %s", e->toString().c_str()); const MgmtEvtPinCodeRequest &event = *static_cast<const MgmtEvtPinCodeRequest *>(e.get()); (void)event; return true; } bool DBTManager::mgmtEvUserPasskeyRequestCB(std::shared_ptr<MgmtEvent> e) noexcept { - jau::PLAIN_PRINT("DBTManager::EventCB:UserPasskeyRequest: %s", e->toString().c_str()); + jau::PLAIN_PRINT("DBTManager:mgmt:UserPasskeyRequest: %s", e->toString().c_str()); const MgmtEvtUserPasskeyRequest &event = *static_cast<const MgmtEvtUserPasskeyRequest *>(e.get()); (void)event; return true; |