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>
(cherry picked from commit e0fd34a1bd)
pull/16/head
Slávek Banko 7 years ago
parent a8e587a973
commit 234f323f7b

@ -1137,7 +1137,7 @@ TQString tdeIBTransportToNMIBTransport(TDENetworkInfinibandTransportMode::TDENet
return ret; return ret;
} }
TQString TDENetworkConnectionManager_BackendNM::deviceInterfaceString(TQString macAddress) { TQString TDENetworkConnectionManager_BackendNM::deviceInterfaceString(TQString deviceNode) {
if (d->m_networkManagerProxy) { if (d->m_networkManagerProxy) {
TQT_DBusObjectPathList devices; TQT_DBusObjectPathList devices;
TQT_DBusError error; TQT_DBusError error;
@ -1148,75 +1148,16 @@ TQString TDENetworkConnectionManager_BackendNM::deviceInterfaceString(TQString m
for (it = devices.begin(); it != devices.end(); ++it) { for (it = devices.begin(); it != devices.end(); ++it) {
DBus::DeviceProxy genericDevice(NM_DBUS_SERVICE, (*it)); DBus::DeviceProxy genericDevice(NM_DBUS_SERVICE, (*it));
genericDevice.setConnection(TQT_DBusConnection::systemBus()); genericDevice.setConnection(TQT_DBusConnection::systemBus());
TDENetworkDeviceType::TDENetworkDeviceType deviceType = nmDeviceTypeToTDEDeviceType(genericDevice.getDeviceType(error)); TQString deviceInterface = genericDevice.getInterface(error);
if (error.isValid()) { if (error.isValid()) {
// Error! // Error!
PRINT_ERROR((error.name() + ": " + error.message())) PRINT_ERROR((error.name() + ": " + error.message()))
break; break;
} }
else if (deviceType == TDENetworkDeviceType::WiredEthernet) { else if (deviceInterface == deviceNode) {
DBus::EthernetDeviceProxy ethernetDevice(NM_DBUS_SERVICE, (*it));
ethernetDevice.setConnection(TQT_DBusConnection::systemBus());
TQString candidateMACAddress = ethernetDevice.getPermHwAddress(error);
if (!error.isValid()) {
if (candidateMACAddress.lower() == macAddress.lower()) {
return (*it);
}
}
}
else if (deviceType == TDENetworkDeviceType::Infiniband) {
DBus::InfinibandDeviceProxy infinibandDevice(NM_DBUS_SERVICE, (*it));
infinibandDevice.setConnection(TQT_DBusConnection::systemBus());
TQString candidateMACAddress = infinibandDevice.getHwAddress(error);
if (!error.isValid()) {
if (candidateMACAddress.lower() == macAddress.lower()) {
return (*it);
}
}
}
else if (deviceType == TDENetworkDeviceType::WiFi) {
DBus::WiFiDeviceProxy wiFiDevice(NM_DBUS_SERVICE, (*it));
wiFiDevice.setConnection(TQT_DBusConnection::systemBus());
TQString candidateMACAddress = wiFiDevice.getPermHwAddress(error);
if (!error.isValid()) {
if (candidateMACAddress.lower() == macAddress.lower()) {
return (*it);
}
}
}
else if (deviceType == TDENetworkDeviceType::WiMax) {
DBus::WiMaxDeviceProxy wiMaxDevice(NM_DBUS_SERVICE, (*it));
wiMaxDevice.setConnection(TQT_DBusConnection::systemBus());
TQString candidateMACAddress = wiMaxDevice.getHwAddress(error);
if (!error.isValid()) {
if (candidateMACAddress.lower() == macAddress.lower()) {
return (*it);
}
}
}
else if (deviceType == TDENetworkDeviceType::OLPCMesh) {
DBus::OlpcMeshDeviceProxy olpcMeshDevice(NM_DBUS_SERVICE, (*it));
olpcMeshDevice.setConnection(TQT_DBusConnection::systemBus());
TQString candidateMACAddress = olpcMeshDevice.getHwAddress(error);
if (!error.isValid()) {
if (candidateMACAddress.lower() == macAddress.lower()) {
return (*it); return (*it);
} }
} }
}
else if (deviceType == TDENetworkDeviceType::Bluetooth) {
DBus::BluetoothDeviceProxy bluetoothDevice(NM_DBUS_SERVICE, (*it));
bluetoothDevice.setConnection(TQT_DBusConnection::systemBus());
TQString candidateMACAddress = bluetoothDevice.getHwAddress(error);
if (!error.isValid()) {
if (candidateMACAddress.lower() == macAddress.lower()) {
return (*it);
}
}
}
// FIXME
// Add other supported device types here
}
return ""; return "";
} }
else { else {
@ -1230,72 +1171,15 @@ TQString TDENetworkConnectionManager_BackendNM::deviceInterfaceString(TQString m
} }
} }
TQString macAddressForGenericDevice(TQT_DBusObjectPath path) { TQString tdeDeviceUUIDForGenericDevice(TQT_DBusObjectPath path) {
TQT_DBusError error; TQT_DBusError error;
DBus::DeviceProxy genericDevice(NM_DBUS_SERVICE, path); DBus::DeviceProxy genericDevice(NM_DBUS_SERVICE, path);
genericDevice.setConnection(TQT_DBusConnection::systemBus()); genericDevice.setConnection(TQT_DBusConnection::systemBus());
TQ_UINT32 deviceType = genericDevice.getDeviceType(error); TQString deviceInterface = genericDevice.getInterface(error);
if (error.isValid()) { if (error.isValid()) {
// Error!
PRINT_ERROR((error.name() + ": " + error.message()))
return TQString();
}
else if (deviceType == NM_DEVICE_TYPE_ETHERNET) {
DBus::EthernetDeviceProxy ethernetDevice(NM_DBUS_SERVICE, path);
ethernetDevice.setConnection(TQT_DBusConnection::systemBus());
TQString candidateMACAddress = ethernetDevice.getPermHwAddress(error);
if (!error.isValid()) {
return candidateMACAddress.lower();
}
}
else if (deviceType == NM_DEVICE_TYPE_INFINIBAND) {
DBus::InfinibandDeviceProxy infinibandDevice(NM_DBUS_SERVICE, path);
infinibandDevice.setConnection(TQT_DBusConnection::systemBus());
TQString candidateMACAddress = infinibandDevice.getHwAddress(error);
if (!error.isValid()) {
return candidateMACAddress.lower();
}
}
else if (deviceType == NM_DEVICE_TYPE_WIFI) {
DBus::WiFiDeviceProxy wiFiDevice(NM_DBUS_SERVICE, path);
wiFiDevice.setConnection(TQT_DBusConnection::systemBus());
TQString candidateMACAddress = wiFiDevice.getPermHwAddress(error);
if (!error.isValid()) {
return candidateMACAddress.lower();
}
}
else if (deviceType == NM_DEVICE_TYPE_WIMAX) {
DBus::WiMaxDeviceProxy wiMaxDevice(NM_DBUS_SERVICE, path);
wiMaxDevice.setConnection(TQT_DBusConnection::systemBus());
TQString candidateMACAddress = wiMaxDevice.getHwAddress(error);
if (!error.isValid()) {
return candidateMACAddress.lower();
}
}
else if (deviceType == NM_DEVICE_TYPE_OLPC_MESH) {
DBus::OlpcMeshDeviceProxy olpcMeshDevice(NM_DBUS_SERVICE, path);
olpcMeshDevice.setConnection(TQT_DBusConnection::systemBus());
TQString candidateMACAddress = olpcMeshDevice.getHwAddress(error);
if (!error.isValid()) {
return candidateMACAddress.lower();
}
}
else if (deviceType == NM_DEVICE_TYPE_BT) {
DBus::BluetoothDeviceProxy bluetoothDevice(NM_DBUS_SERVICE, path);
bluetoothDevice.setConnection(TQT_DBusConnection::systemBus());
TQString candidateMACAddress = bluetoothDevice.getHwAddress(error);
if (!error.isValid()) {
return candidateMACAddress.lower();
}
}
// FIXME
// Add other supported device types here
return TQString::null; return TQString::null;
} }
TQString tdeDeviceUUIDForMACAddress(TQString macAddress) {
TDEHardwareDevices *hwdevices = TDEGlobal::hardwareDevices(); TDEHardwareDevices *hwdevices = TDEGlobal::hardwareDevices();
if (!hwdevices) { if (!hwdevices) {
return TQString::null; return TQString::null;
@ -1305,7 +1189,7 @@ TQString tdeDeviceUUIDForMACAddress(TQString macAddress) {
for (TDEGenericHardwareList::iterator it = devices.begin(); it != devices.end(); ++it) { for (TDEGenericHardwareList::iterator it = devices.begin(); it != devices.end(); ++it) {
TDENetworkDevice* dev = dynamic_cast<TDENetworkDevice*>(*it); TDENetworkDevice* dev = dynamic_cast<TDENetworkDevice*>(*it);
if (dev) { if (dev) {
if (macAddress.lower() == dev->macAddress().lower()) { if (deviceInterface == dev->deviceNode()) {
return dev->uniqueID(); return dev->uniqueID();
} }
} }
@ -1355,7 +1239,7 @@ void TDENetworkConnectionManager_BackendNM_DBusSignalReceiver::dbusSignal(const
} }
} }
TDENetworkConnectionManager_BackendNM::TDENetworkConnectionManager_BackendNM(TQString macAddress) : TDENetworkConnectionManager(macAddress) { TDENetworkConnectionManager_BackendNM::TDENetworkConnectionManager_BackendNM(TDENetworkDevice* networkDevice) : TDENetworkConnectionManager(networkDevice) {
d = new TDENetworkConnectionManager_BackendNMPrivate(this); d = new TDENetworkConnectionManager_BackendNMPrivate(this);
// Set up proxy interfaces // Set up proxy interfaces
@ -1366,7 +1250,7 @@ TDENetworkConnectionManager_BackendNM::TDENetworkConnectionManager_BackendNM(TQS
d->m_vpnProxy = new DBus::VPNPluginProxy(NM_VPN_DBUS_PLUGIN_SERVICE, NM_VPN_DBUS_PLUGIN_PATH); d->m_vpnProxy = new DBus::VPNPluginProxy(NM_VPN_DBUS_PLUGIN_SERVICE, NM_VPN_DBUS_PLUGIN_PATH);
d->m_vpnProxy->setConnection(TQT_DBusConnection::systemBus()); d->m_vpnProxy->setConnection(TQT_DBusConnection::systemBus());
d->m_dbusDeviceString = deviceInterfaceString(macAddress); d->m_dbusDeviceString = deviceInterfaceString(deviceNode());
if (d->m_dbusDeviceString != "") { if (d->m_dbusDeviceString != "") {
d->m_networkDeviceProxy = new DBus::DeviceProxy(NM_DBUS_SERVICE, d->m_dbusDeviceString); d->m_networkDeviceProxy = new DBus::DeviceProxy(NM_DBUS_SERVICE, d->m_dbusDeviceString);
d->m_networkDeviceProxy->setConnection(TQT_DBusConnection::systemBus()); d->m_networkDeviceProxy->setConnection(TQT_DBusConnection::systemBus());
@ -1618,7 +1502,7 @@ void TDENetworkConnectionManager_BackendNMPrivate::internalProcessDeviceStateCha
m_parent->internalNetworkDeviceEvent(TDENetworkDeviceEventType::Failure, errorString); m_parent->internalNetworkDeviceEvent(TDENetworkDeviceEventType::Failure, errorString);
} }
m_parent->internalNetworkDeviceStateChanged(nmDeviceStateToTDEDeviceState(newState), m_parent->m_macAddress); m_parent->internalNetworkDeviceStateChanged(nmDeviceStateToTDEDeviceState(newState), m_parent->deviceNode());
} }
void TDENetworkConnectionManager_BackendNMPrivate::internalProcessWiFiAccessPointAdded(const TQT_DBusObjectPath& dbuspath) { void TDENetworkConnectionManager_BackendNMPrivate::internalProcessWiFiAccessPointAdded(const TQT_DBusObjectPath& dbuspath) {
@ -1682,14 +1566,14 @@ void TDENetworkConnectionManager_BackendNMPrivate::internalProcessAPPropertiesCh
} }
TDENetworkDeviceType::TDENetworkDeviceType TDENetworkConnectionManager_BackendNM::deviceType() { TDENetworkDeviceType::TDENetworkDeviceType TDENetworkConnectionManager_BackendNM::deviceType() {
if (m_macAddress == "") { if (!m_networkDevice) {
return TDENetworkDeviceType::BackendOnly; return TDENetworkDeviceType::BackendOnly;
} }
else { else {
if (d->m_dbusDeviceString != "") { if (d->m_dbusDeviceString != "") {
// Query NM for the device type // Query NM for the device type
TQT_DBusError error; TQT_DBusError error;
d->m_dbusDeviceString = deviceInterfaceString(m_macAddress); d->m_dbusDeviceString = deviceInterfaceString(deviceNode());
DBus::DeviceProxy genericDevice(NM_DBUS_SERVICE, d->m_dbusDeviceString); DBus::DeviceProxy genericDevice(NM_DBUS_SERVICE, d->m_dbusDeviceString);
genericDevice.setConnection(TQT_DBusConnection::systemBus()); genericDevice.setConnection(TQT_DBusConnection::systemBus());
TDENetworkDeviceType::TDENetworkDeviceType ret = nmDeviceTypeToTDEDeviceType(genericDevice.getDeviceType(error)); TDENetworkDeviceType::TDENetworkDeviceType ret = nmDeviceTypeToTDEDeviceType(genericDevice.getDeviceType(error));
@ -1981,7 +1865,7 @@ void TDENetworkConnectionManager_BackendNM::loadConnectionInformation() {
d->nonReentrantCallActive = true; d->nonReentrantCallActive = true;
TDEMACAddress deviceMACAddress; TDEMACAddress deviceMACAddress;
deviceMACAddress.fromString(m_macAddress); deviceMACAddress.fromString(this->deviceMACAddress());
if (d->m_networkManagerSettings) { if (d->m_networkManagerSettings) {
clearTDENetworkConnectionList(); clearTDENetworkConnectionList();
@ -4953,11 +4837,11 @@ TDENetworkConnectionStatus::TDENetworkConnectionStatus TDENetworkConnectionManag
if ((d->m_networkManagerSettings) && (d->m_networkManagerProxy)) { if ((d->m_networkManagerSettings) && (d->m_networkManagerProxy)) {
ret = d->m_networkManagerSettings->GetConnectionByUuid(uuid, existingConnection, error); ret = d->m_networkManagerSettings->GetConnectionByUuid(uuid, existingConnection, error);
if (ret) { if (ret) {
if (m_macAddress == "") { if (!m_networkDevice) {
d->m_dbusDeviceString = "/"; d->m_dbusDeviceString = "/";
} }
else { else {
d->m_dbusDeviceString = deviceInterfaceString(m_macAddress); d->m_dbusDeviceString = deviceInterfaceString(deviceNode());
} }
#ifndef USE_ASYNC_DBUS_CONNECTION_COMMAND_CALLS #ifndef USE_ASYNC_DBUS_CONNECTION_COMMAND_CALLS
TQT_DBusObjectPath active_connection; TQT_DBusObjectPath active_connection;
@ -5087,8 +4971,7 @@ TQStringList TDENetworkConnectionManager_BackendNM::connectionPhysicalDeviceUUID
TQValueList<TQT_DBusObjectPath> deviceList = activeConnection.getDevices(error); TQValueList<TQT_DBusObjectPath> deviceList = activeConnection.getDevices(error);
TQT_DBusObjectPathList::iterator it2; TQT_DBusObjectPathList::iterator it2;
for (it2 = deviceList.begin(); it2 != deviceList.end(); ++it2) { for (it2 = deviceList.begin(); it2 != deviceList.end(); ++it2) {
TQString macAddress = macAddressForGenericDevice(*it2); TQString devUUID = tdeDeviceUUIDForGenericDevice(*it2);
TQString devUUID = tdeDeviceUUIDForMACAddress(macAddress);
if (devUUID != "") { if (devUUID != "") {
ret.append(devUUID); ret.append(devUUID);
} }
@ -5147,11 +5030,11 @@ TDENetworkConnectionStatus::TDENetworkConnectionStatus TDENetworkConnectionManag
if ((d->m_networkManagerSettings) && (d->m_networkManagerProxy)) { if ((d->m_networkManagerSettings) && (d->m_networkManagerProxy)) {
existingConnection = getActiveConnectionPath(uuid); existingConnection = getActiveConnectionPath(uuid);
if (existingConnection.isValid()) { if (existingConnection.isValid()) {
if (m_macAddress == "") { if (!m_networkDevice) {
d->m_dbusDeviceString = "/"; d->m_dbusDeviceString = "/";
} }
else { else {
d->m_dbusDeviceString = deviceInterfaceString(m_macAddress); d->m_dbusDeviceString = deviceInterfaceString(deviceNode());
} }
#ifndef USE_ASYNC_DBUS_CONNECTION_COMMAND_CALLS #ifndef USE_ASYNC_DBUS_CONNECTION_COMMAND_CALLS
ret = d->m_networkManagerProxy->DeactivateConnection(existingConnection, error); ret = d->m_networkManagerProxy->DeactivateConnection(existingConnection, error);
@ -5435,7 +5318,7 @@ TDENetworkHWNeighborList* TDENetworkConnectionManager_BackendNM::siteSurvey() {
bool ret; bool ret;
TDENetworkDeviceType::TDENetworkDeviceType myDeviceType = deviceType(); TDENetworkDeviceType::TDENetworkDeviceType myDeviceType = deviceType();
d->m_dbusDeviceString = deviceInterfaceString(m_macAddress); d->m_dbusDeviceString = deviceInterfaceString(deviceNode());
clearTDENetworkHWNeighborList(); clearTDENetworkHWNeighborList();
if (myDeviceType == TDENetworkDeviceType::WiFi) { if (myDeviceType == TDENetworkDeviceType::WiFi) {

@ -213,7 +213,7 @@ class TDECORE_EXPORT TDENetworkConnectionManager_BackendNM : public TDENetworkCo
Q_OBJECT Q_OBJECT
public: public:
TDENetworkConnectionManager_BackendNM(TQString macAddress); TDENetworkConnectionManager_BackendNM(TDENetworkDevice* networkDevice);
~TDENetworkConnectionManager_BackendNM(); ~TDENetworkConnectionManager_BackendNM();
virtual TQString backendName(); virtual TQString backendName();
@ -249,7 +249,7 @@ class TDECORE_EXPORT TDENetworkConnectionManager_BackendNM : public TDENetworkCo
private: private:
TDENetworkDeviceType::TDENetworkDeviceType nmDeviceTypeToTDEDeviceType(TQ_UINT32 nmType); TDENetworkDeviceType::TDENetworkDeviceType nmDeviceTypeToTDEDeviceType(TQ_UINT32 nmType);
TQString deviceInterfaceString(TQString macAddress); TQString deviceInterfaceString(TQString deviceNode);
bool loadConnectionSecretsForGroup(TQString uuid, TQString group); bool loadConnectionSecretsForGroup(TQString uuid, TQString group);
TDENetworkWiFiAPInfo* getAccessPointDetails(TQString dbusPath); TDENetworkWiFiAPInfo* getAccessPointDetails(TQString dbusPath);
TDENetworkConnectionType::TDENetworkConnectionType connectionType(TQString dbusPath); TDENetworkConnectionType::TDENetworkConnectionType connectionType(TQString dbusPath);

@ -698,7 +698,7 @@ TDEWiFiConnection::~TDEWiFiConnection() {
/* TDENetworkConnectionManager */ /* 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(); m_emissionTimer = new TQTimer();
connect(m_emissionTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(emitQueuedSignals())); connect(m_emissionTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(emitQueuedSignals()));
if (!m_emissionTimer->isActive()) m_emissionTimer->start(0, TRUE); if (!m_emissionTimer->isActive()) m_emissionTimer->start(0, TRUE);
@ -709,8 +709,12 @@ TDENetworkConnectionManager::~TDENetworkConnectionManager() {
delete m_emissionTimer; delete m_emissionTimer;
} }
TQString TDENetworkConnectionManager::deviceNode() {
return m_networkDevice ? m_networkDevice->deviceNode() : TQString();
}
TQString TDENetworkConnectionManager::deviceMACAddress() { TQString TDENetworkConnectionManager::deviceMACAddress() {
return m_macAddress; return m_networkDevice ? m_networkDevice->macAddress() : TQString();
} }
TDENetworkConnectionList* TDENetworkConnectionManager::connections() { TDENetworkConnectionList* TDENetworkConnectionManager::connections() {
@ -856,20 +860,20 @@ void TDENetworkConnectionManager::internalNetworkConnectionStateChanged(TDENetwo
m_prevConnectionStatus = newState; m_prevConnectionStatus = newState;
} }
void TDENetworkConnectionManager::internalNetworkDeviceStateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus newState, TQString hwAddress) { void TDENetworkConnectionManager::internalNetworkDeviceStateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus newState, TQString deviceNodeName) {
if (!m_prevDeviceStatus.contains(hwAddress)) { if (!m_prevDeviceStatus.contains(deviceNodeName)) {
m_prevDeviceStatus[hwAddress] = TDENetworkConnectionStatus::Invalid; m_prevDeviceStatus[deviceNodeName] = TDENetworkConnectionStatus::Invalid;
} }
TDENetworkEventQueueEvent_Private queuedEvent; TDENetworkEventQueueEvent_Private queuedEvent;
queuedEvent.eventType = 1; queuedEvent.eventType = 1;
queuedEvent.newConnStatus = newState; queuedEvent.newConnStatus = newState;
queuedEvent.previousConnStatus = m_prevDeviceStatus[hwAddress]; queuedEvent.previousConnStatus = m_prevDeviceStatus[deviceNodeName];
queuedEvent.hwAddress = hwAddress; queuedEvent.deviceNode = deviceNodeName;
m_globalEventQueueEventList.append(queuedEvent); m_globalEventQueueEventList.append(queuedEvent);
if (!m_emissionTimer->isActive()) m_emissionTimer->start(0, TRUE); 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) { void TDENetworkConnectionManager::internalAccessPointStatusChanged(TDEMACAddress BSSID, TDENetworkAPEventType::TDENetworkAPEventType event) {
@ -921,7 +925,7 @@ void TDENetworkConnectionManager::emitQueuedSignals() {
emit(networkConnectionStateChanged(event.newState, event.previousState)); emit(networkConnectionStateChanged(event.newState, event.previousState));
} }
else if (event.eventType == 1) { 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) { else if (event.eventType == 2) {
emit(accessPointStatusChanged(event.BSSID, event.apevent)); emit(accessPointStatusChanged(event.BSSID, event.apevent));
@ -948,7 +952,7 @@ void TDENetworkConnectionManager::emitQueuedSignals() {
TDEGlobalNetworkManager::TDEGlobalNetworkManager() : m_internalConnectionManager(NULL) { TDEGlobalNetworkManager::TDEGlobalNetworkManager() : m_internalConnectionManager(NULL) {
#ifdef WITH_NETWORK_MANAGER_BACKEND #ifdef WITH_NETWORK_MANAGER_BACKEND
m_internalConnectionManager = new TDENetworkConnectionManager_BackendNM(TQString::null); m_internalConnectionManager = new TDENetworkConnectionManager_BackendNM(NULL);
#endif // WITH_NETWORK_MANAGER_BACKEND #endif // WITH_NETWORK_MANAGER_BACKEND
if (m_internalConnectionManager) { if (m_internalConnectionManager) {
connect(m_internalConnectionManager, SIGNAL(networkConnectionStateChanged(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags, TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags)), this, SIGNAL(networkConnectionStateChanged(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags, TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags))); connect(m_internalConnectionManager, SIGNAL(networkConnectionStateChanged(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags, TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags)), this, SIGNAL(networkConnectionStateChanged(TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags, TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags)));

@ -1003,7 +1003,7 @@ class TDENetworkEventQueueEvent_Private
TDENetworkConnectionStatus::TDENetworkConnectionStatus previousConnStatus; TDENetworkConnectionStatus::TDENetworkConnectionStatus previousConnStatus;
TDEMACAddress BSSID; TDEMACAddress BSSID;
TQString message; TQString message;
TQString hwAddress; TQString deviceNode;
TDENetworkAPEventType::TDENetworkAPEventType apevent; TDENetworkAPEventType::TDENetworkAPEventType apevent;
TDENetworkDeviceEventType::TDENetworkDeviceEventType ndevent; TDENetworkDeviceEventType::TDENetworkDeviceEventType ndevent;
TDENetworkVPNEventType::TDENetworkVPNEventType vpnevent; TDENetworkVPNEventType::TDENetworkVPNEventType vpnevent;
@ -1020,11 +1020,11 @@ class TDECORE_EXPORT TDENetworkConnectionManager : public TQObject
public: public:
/** /**
* Constructor. * Constructor.
* @param macAddress The MAC address of the hardware device * @param networkDevice Pointer to holder network device
* If an empty MAC address is passed, this object will make global networking backend * If the network device is passed null, this object will make global networking backend
* methods available exclusively (TDENetworkDeviceType::BackendOnly). * methods available exclusively (TDENetworkDeviceType::BackendOnly).
*/ */
TDENetworkConnectionManager(TQString macAddress); TDENetworkConnectionManager(TDENetworkDevice *networkDevice);
/** /**
* Destructor. * Destructor.
@ -1209,7 +1209,7 @@ class TDECORE_EXPORT TDENetworkConnectionManager : public TQObject
* If the global connection state has changed, @param hwAddress will be empty, otherwise it will contain the MAC address * If the global connection state has changed, @param hwAddress will be empty, otherwise it will contain the MAC address
* of the networking hardware that has changed state. * of the networking hardware that has changed state.
*/ */
void networkDeviceStateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus newState, TDENetworkConnectionStatus::TDENetworkConnectionStatus previousState, TQString hwAddress); void networkDeviceStateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus newState, TDENetworkConnectionStatus::TDENetworkConnectionStatus previousState, TQString deviceNode);
/** /**
* Emitted whenever the status of a wireless access point changes * Emitted whenever the status of a wireless access point changes
@ -1253,6 +1253,11 @@ class TDECORE_EXPORT TDENetworkConnectionManager : public TQObject
*/ */
virtual TDENetworkConnectionList* connections(); virtual TDENetworkConnectionList* connections();
/**
* @return the interface name of this device
*/
TQString deviceNode();
/** /**
* @return the MAC address of this device * @return the MAC address of this device
*/ */
@ -1318,7 +1323,7 @@ class TDECORE_EXPORT TDENetworkConnectionManager : public TQObject
* @internal This method must be called by the network backend whenever a device changes state * @internal This method must be called by the network backend whenever a device changes state
* It emits the appropriate signals to notify client applications of the state change * It emits the appropriate signals to notify client applications of the state change
*/ */
void internalNetworkDeviceStateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus newState, TQString hwAddress=TQString::null); void internalNetworkDeviceStateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus newState, TQString deviceNode=TQString::null);
/** /**
* @internal This method must be called by the network backend whenever a wireless access point changes state * @internal This method must be called by the network backend whenever a wireless access point changes state
@ -1350,7 +1355,7 @@ class TDECORE_EXPORT TDENetworkConnectionManager : public TQObject
protected: protected:
TDENetworkConnectionList* m_connectionList; TDENetworkConnectionList* m_connectionList;
TDENetworkHWNeighborList* m_hwNeighborList; TDENetworkHWNeighborList* m_hwNeighborList;
TQString m_macAddress; TDENetworkDevice* m_networkDevice;
TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags m_prevConnectionStatus; TDENetworkGlobalManagerFlags::TDENetworkGlobalManagerFlags m_prevConnectionStatus;
TQMap<TQString, TDENetworkConnectionStatus::TDENetworkConnectionStatus> m_prevDeviceStatus; TQMap<TQString, TDENetworkConnectionStatus::TDENetworkConnectionStatus> m_prevDeviceStatus;
TQTimer* m_emissionTimer; TQTimer* m_emissionTimer;
@ -1528,7 +1533,7 @@ class TDECORE_EXPORT TDEGlobalNetworkManager : public TQObject
* If the global connection state has changed, @param hwAddress will be empty, otherwise it will contain the MAC address * If the global connection state has changed, @param hwAddress will be empty, otherwise it will contain the MAC address
* of the networking hardware that has changed state. * of the networking hardware that has changed state.
*/ */
void networkDeviceStateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus newState, TDENetworkConnectionStatus::TDENetworkConnectionStatus previousState, TQString hwAddress); void networkDeviceStateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus newState, TDENetworkConnectionStatus::TDENetworkConnectionStatus previousState, TQString deviceNode);
/** /**
* Emitted whenever the status of a wireless access point changes * Emitted whenever the status of a wireless access point changes

@ -174,7 +174,7 @@ void TDENetworkDevice::internalSetTxPackets(double tx) {
TDENetworkConnectionManager* TDENetworkDevice::connectionManager() { TDENetworkConnectionManager* TDENetworkDevice::connectionManager() {
#ifdef WITH_NETWORK_MANAGER_BACKEND #ifdef WITH_NETWORK_MANAGER_BACKEND
if (!m_connectionManager) { if (!m_connectionManager) {
m_connectionManager = new TDENetworkConnectionManager_BackendNM(m_macAddress); m_connectionManager = new TDENetworkConnectionManager_BackendNM(this);
} }
#endif // WITH_NETWORK_MANAGER_BACKEND #endif // WITH_NETWORK_MANAGER_BACKEND

Loading…
Cancel
Save