From 642f227036520a1a616e27db086a2c82e7dd1489 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sat, 8 Sep 2012 23:53:47 -0500 Subject: Add requisite MAC address comparator for use in TQMap objects --- tdecore/tdenetworkconnections.cpp | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) (limited to 'tdecore/tdenetworkconnections.cpp') diff --git a/tdecore/tdenetworkconnections.cpp b/tdecore/tdenetworkconnections.cpp index 6139bd49f..9b435b2ac 100644 --- a/tdecore/tdenetworkconnections.cpp +++ b/tdecore/tdenetworkconnections.cpp @@ -247,6 +247,24 @@ bool operator==(const TDEMACAddress &a1, const TDEMACAddress &a2) { } } +bool operator<(const TDEMACAddress &a1, const TDEMACAddress &a2) { + if (a1.m_macAddress.count() < a2.m_macAddress.count()) { + return true; + } + else { + unsigned int i; + for (i=0; i a2.m_macAddress[i]) { + return false; + } + } + return false; + } +} + /*================================================================================================*/ /* TDENetworkSingleIPConfiguration */ /*================================================================================================*/ @@ -923,8 +941,22 @@ TDENetworkDevice* TDEGlobalNetworkManager::findDeviceByUUID(TQString uuid) { } TDENetworkWiFiAPInfo* TDEGlobalNetworkManager::findAccessPointByBSSID(TDEMACAddress bssid) { - if (!m_internalConnectionManager) return NULL; - return m_internalConnectionManager->findAccessPointByBSSID(bssid); + TDEHardwareDevices *hwdevices = KGlobal::hardwareDevices(); + if (!hwdevices) { + return NULL; + } + + TDENetworkWiFiAPInfo* ret = NULL; + TDEGenericHardwareList devices = hwdevices->listByDeviceClass(TDEGenericDeviceType::Network); + for (TDEGenericHardwareList::iterator it = devices.begin(); it != devices.end(); ++it) { + TDENetworkDevice* dev = dynamic_cast(*it); + if (dev) { + TDENetworkConnectionManager* deviceConnMan = dev->connectionManager(); + ret = deviceConnMan->findAccessPointByBSSID(bssid); + } + } + + return ret; } /*================================================================================================*/ -- cgit v1.2.1