summaryrefslogtreecommitdiffstats
path: root/tdecore/tdehw/tdenetworkconnections.cpp
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2017-06-17 12:57:10 +0200
committerSlávek Banko <slavek.banko@axis.cz>2017-06-17 12:57:10 +0200
commite0fd34a1bd2c6412171bcceb19520d129bbcb66d (patch)
tree2043092f6f3f3c8075ea802f9e6ba1b1d543f59c /tdecore/tdehw/tdenetworkconnections.cpp
parenteb6f8213d42aac2911c7b8880628c786b0223935 (diff)
downloadtdelibs-e0fd34a1bd2c6412171bcceb19520d129bbcb66d.tar.gz
tdelibs-e0fd34a1bd2c6412171bcceb19520d129bbcb66d.zip
tdehwlib: Use TDENetworkDevice in TDENetworkConnectionManager instead of MAC address
Use interface name in TDENetworkConnectionManager_BackendNM instead of MAC address This relates to bug 2748 The name of the network interface seems to be a more stable identifier than the MAC address because the MAC address can be changed easily or even automatically - see randomization of MAC addresses on wireless interfaces. Therefore, the use of the MAC address as a network interface identifier was abandoned. Beware, this change is an API / ABI change! However, most changes are internal and the only one affected is application TDENetworkManager. Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
Diffstat (limited to 'tdecore/tdehw/tdenetworkconnections.cpp')
-rw-r--r--tdecore/tdehw/tdenetworkconnections.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/tdecore/tdehw/tdenetworkconnections.cpp b/tdecore/tdehw/tdenetworkconnections.cpp
index dec04e86b..7cef67cf3 100644
--- a/tdecore/tdehw/tdenetworkconnections.cpp
+++ b/tdecore/tdehw/tdenetworkconnections.cpp
@@ -698,7 +698,7 @@ TDEWiFiConnection::~TDEWiFiConnection() {
/* TDENetworkConnectionManager */
/*================================================================================================*/
-TDENetworkConnectionManager::TDENetworkConnectionManager(TQString macAddress) : TQObject(), m_connectionList(NULL), m_hwNeighborList(NULL), m_macAddress(macAddress), m_prevConnectionStatus(TDENetworkGlobalManagerFlags::Unknown) {
+TDENetworkConnectionManager::TDENetworkConnectionManager(TDENetworkDevice *networkDevice) : TQObject(), m_connectionList(NULL), m_hwNeighborList(NULL), m_networkDevice(networkDevice), m_prevConnectionStatus(TDENetworkGlobalManagerFlags::Unknown) {
m_emissionTimer = new TQTimer();
connect(m_emissionTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(emitQueuedSignals()));
if (!m_emissionTimer->isActive()) m_emissionTimer->start(0, TRUE);
@@ -709,8 +709,12 @@ TDENetworkConnectionManager::~TDENetworkConnectionManager() {
delete m_emissionTimer;
}
+TQString TDENetworkConnectionManager::deviceNode() {
+ return m_networkDevice ? m_networkDevice->deviceNode() : TQString();
+}
+
TQString TDENetworkConnectionManager::deviceMACAddress() {
- return m_macAddress;
+ return m_networkDevice ? m_networkDevice->macAddress() : TQString();
}
TDENetworkConnectionList* TDENetworkConnectionManager::connections() {
@@ -856,20 +860,20 @@ void TDENetworkConnectionManager::internalNetworkConnectionStateChanged(TDENetwo
m_prevConnectionStatus = newState;
}
-void TDENetworkConnectionManager::internalNetworkDeviceStateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus newState, TQString hwAddress) {
- if (!m_prevDeviceStatus.contains(hwAddress)) {
- m_prevDeviceStatus[hwAddress] = TDENetworkConnectionStatus::Invalid;
+void TDENetworkConnectionManager::internalNetworkDeviceStateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus newState, TQString deviceNodeName) {
+ if (!m_prevDeviceStatus.contains(deviceNodeName)) {
+ m_prevDeviceStatus[deviceNodeName] = TDENetworkConnectionStatus::Invalid;
}
TDENetworkEventQueueEvent_Private queuedEvent;
queuedEvent.eventType = 1;
queuedEvent.newConnStatus = newState;
- queuedEvent.previousConnStatus = m_prevDeviceStatus[hwAddress];
- queuedEvent.hwAddress = hwAddress;
+ queuedEvent.previousConnStatus = m_prevDeviceStatus[deviceNodeName];
+ queuedEvent.deviceNode = deviceNodeName;
m_globalEventQueueEventList.append(queuedEvent);
if (!m_emissionTimer->isActive()) m_emissionTimer->start(0, TRUE);
- m_prevDeviceStatus[hwAddress] = newState;
+ m_prevDeviceStatus[deviceNodeName] = newState;
}
void TDENetworkConnectionManager::internalAccessPointStatusChanged(TDEMACAddress BSSID, TDENetworkAPEventType::TDENetworkAPEventType event) {
@@ -921,7 +925,7 @@ void TDENetworkConnectionManager::emitQueuedSignals() {
emit(networkConnectionStateChanged(event.newState, event.previousState));
}
else if (event.eventType == 1) {
- emit(networkDeviceStateChanged(event.newConnStatus, event.previousConnStatus, event.hwAddress));
+ emit(networkDeviceStateChanged(event.newConnStatus, event.previousConnStatus, event.deviceNode));
}
else if (event.eventType == 2) {
emit(accessPointStatusChanged(event.BSSID, event.apevent));
@@ -948,7 +952,7 @@ void TDENetworkConnectionManager::emitQueuedSignals() {
TDEGlobalNetworkManager::TDEGlobalNetworkManager() : m_internalConnectionManager(NULL) {
#ifdef WITH_NETWORK_MANAGER_BACKEND
- m_internalConnectionManager = new TDENetworkConnectionManager_BackendNM(TQString::null);
+ m_internalConnectionManager = new TDENetworkConnectionManager_BackendNM(NULL);
#endif // WITH_NETWORK_MANAGER_BACKEND
if (m_internalConnectionManager) {
connect(m_internalConnectionManager, SIGNAL(networkConnectionStateChanged(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags, TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags)), this, SIGNAL(networkConnectionStateChanged(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags, TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags)));