summaryrefslogtreecommitdiffstats
path: root/tdecore/networkbackends
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-11-26 13:09:21 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-11-26 13:09:21 -0600
commit1351acec11a5f985ef664119c54aba254195f8b2 (patch)
treec2fc19cd9fc5f97ff68bddd8c4531b729f41c6ae /tdecore/networkbackends
parent08df31ba2c9f242e74a4e61743db1a808a80a356 (diff)
downloadtdelibs-1351acec11a5f985ef664119c54aba254195f8b2.tar.gz
tdelibs-1351acec11a5f985ef664119c54aba254195f8b2.zip
Fix network-manager backend
Add Bluetooth device detection
Diffstat (limited to 'tdecore/networkbackends')
-rw-r--r--tdecore/networkbackends/network-manager/network-manager.cpp48
-rw-r--r--tdecore/networkbackends/network-manager/network-manager.h5
-rw-r--r--tdecore/networkbackends/network-manager/network-manager_p.h1
3 files changed, 49 insertions, 5 deletions
diff --git a/tdecore/networkbackends/network-manager/network-manager.cpp b/tdecore/networkbackends/network-manager/network-manager.cpp
index a3ebba325..a4ff24a90 100644
--- a/tdecore/networkbackends/network-manager/network-manager.cpp
+++ b/tdecore/networkbackends/network-manager/network-manager.cpp
@@ -26,10 +26,10 @@
// #define DEBUG_NETWORK_MANAGER_COMMUNICATIONS
-#define PRINT_ERROR(x) printf("[TDE NM Backend ERROR] %s\n\r", x.ascii());
+#define PRINT_ERROR(x) printf("[TDE NM Backend ERROR] [%s:%d] %s\n\r", __FILE__, __LINE__, x.ascii());
#ifdef DEBUG_NETWORK_MANAGER_COMMUNICATIONS
-#define PRINT_WARNING(x) printf("[TDE NM Backend WARNING] %s\n\r", x.ascii());
+#define PRINT_WARNING(x) printf("[TDE NM Backend WARNING] [%s:%d] %s\n\r", __FILE__, __LINE__, x.ascii());
#else
#define PRINT_WARNING(x)
#endif
@@ -1592,6 +1592,9 @@ TDENetworkDeviceInformation TDENetworkConnectionManager_BackendNM::deviceInforma
ret.autoConnect = d->m_networkDeviceProxy->getAutoconnect(error);
ret.firmwareMissing = d->m_networkDeviceProxy->getFirmwareMissing(error);
ret.deviceType = nmDeviceTypeToTDEDeviceType(d->m_networkDeviceProxy->getDeviceType(error));
+ if (error.isValid()) {
+ PRINT_ERROR(error.name())
+ }
// Populate wiFiInfo
if ((deviceType() == TDENetworkDeviceType::WiFi) && (d->m_wiFiDeviceProxy)) {
@@ -1601,8 +1604,15 @@ TDENetworkDeviceInformation TDENetworkConnectionManager_BackendNM::deviceInforma
ret.wiFiInfo.operatingMode = nmWiFiModeToTDEWiFiMode(d->m_wiFiDeviceProxy->getMode(error));
ret.wiFiInfo.bitrate = d->m_wiFiDeviceProxy->getBitrate(error);
TDENetworkWiFiAPInfo* apInfo = getAccessPointDetails(d->m_wiFiDeviceProxy->getActiveAccessPoint(error));
+ if (error.isValid()) {
+ PRINT_ERROR(error.name())
+ }
if (apInfo) {
ret.wiFiInfo.activeAccessPointBSSID = apInfo->BSSID;
+ TDENetworkWiFiAPInfo* neighborListAPInfo = findAccessPointByBSSID(ret.wiFiInfo.activeAccessPointBSSID);
+ if (neighborListAPInfo) {
+ *neighborListAPInfo = *apInfo;
+ }
delete apInfo;
}
else {
@@ -1646,6 +1656,10 @@ void TDENetworkConnectionManager_BackendNMPrivate::processAddConnectionAsyncRepl
}
void TDENetworkConnectionManager_BackendNM::loadConnectionInformation() {
+ if (d->nonReentrantCallActive) return;
+
+ d->nonReentrantCallActive = true;
+
TDEMACAddress deviceMACAddress;
deviceMACAddress.fromString(m_macAddress);
@@ -2755,6 +2769,8 @@ void TDENetworkConnectionManager_BackendNM::loadConnectionInformation() {
}
internalNetworkManagementEvent(TDENetworkGlobalEventType::ConnectionListChanged);
}
+
+ d->nonReentrantCallActive = false;
}
void TDENetworkConnectionManager_BackendNM::loadConnectionAllowedValues(TDENetworkConnection* connection) {
@@ -4590,6 +4606,28 @@ TDENetworkConnectionStatus::TDENetworkConnectionStatus TDENetworkConnectionManag
}
}
+TQCString TDENetworkConnectionManager_BackendNM::getActiveConnectionPath(TQString uuid) {
+ TQT_DBusObjectPath existingConnection;
+ TQT_DBusError error;
+ if (d->m_networkManagerProxy) {
+ TQT_DBusObjectPathList activeConnections = d->m_networkManagerProxy->getActiveConnections(error);
+ TQT_DBusObjectPathList::iterator it;
+ for (it = activeConnections.begin(); it != activeConnections.end(); ++it) {
+ DBus::ActiveConnectionProxy activeConnection(NM_DBUS_SERVICE, (*it));
+ activeConnection.setConnection(TQT_DBusConnection::systemBus());
+ if (activeConnection.getUuid(error) == uuid) {
+ return (*it);
+ }
+ }
+ PRINT_WARNING(TQString("active connection for provided uuid '%1' was not found").arg(uuid));
+ return TQT_DBusObjectPath();
+ }
+ else {
+ PRINT_ERROR(TQString("invalid internal network-manager settings proxy object"));
+ return TQT_DBusObjectPath();
+ }
+}
+
TQStringList TDENetworkConnectionManager_BackendNM::connectionPhysicalDeviceUUIDs(TQString uuid) {
if (deviceType() == TDENetworkDeviceType::BackendOnly) {
return TQStringList();
@@ -4666,8 +4704,8 @@ TDENetworkConnectionStatus::TDENetworkConnectionStatus TDENetworkConnectionManag
TQT_DBusError error;
bool ret;
if ((d->m_networkManagerSettings) && (d->m_networkManagerProxy)) {
- ret = d->m_networkManagerSettings->GetConnectionByUuid(uuid, existingConnection, error);
- if (ret) {
+ existingConnection = getActiveConnectionPath(uuid);
+ if (existingConnection.isValid()) {
TQString dbusDeviceString;
if (m_macAddress == "") {
dbusDeviceString = "/";
@@ -5104,7 +5142,7 @@ TQStringList TDENetworkConnectionManager_BackendNM::defaultNetworkDevices() {
}
}
-TDENetworkConnectionManager_BackendNMPrivate::TDENetworkConnectionManager_BackendNMPrivate(TDENetworkConnectionManager_BackendNM* parent) : m_networkManagerProxy(NULL), m_networkManagerSettings(NULL), m_networkDeviceProxy(NULL), m_wiFiDeviceProxy(NULL), m_vpnProxy(NULL), m_parent(parent) {
+TDENetworkConnectionManager_BackendNMPrivate::TDENetworkConnectionManager_BackendNMPrivate(TDENetworkConnectionManager_BackendNM* parent) : m_networkManagerProxy(NULL), m_networkManagerSettings(NULL), m_networkDeviceProxy(NULL), m_wiFiDeviceProxy(NULL), m_vpnProxy(NULL), nonReentrantCallActive(false), m_parent(parent) {
//
}
diff --git a/tdecore/networkbackends/network-manager/network-manager.h b/tdecore/networkbackends/network-manager/network-manager.h
index 5b475eea7..15c3a8fad 100644
--- a/tdecore/networkbackends/network-manager/network-manager.h
+++ b/tdecore/networkbackends/network-manager/network-manager.h
@@ -29,6 +29,10 @@
#define NM_VPN_DBUS_PLUGIN_PATH "/org/freedesktop/NetworkManager/VPN/Plugin"
#define NM_DBUS_SERVICE "org.freedesktop.NetworkManager"
+#define NM_DBUS_ACTIVE_CONNECTION_SERVICE "org.freedesktop.NetworkManager.Connection.Active"
+#define NM_DBUS_DEVICE_SERVICE "org.freedesktop.NetworkManager.Device"
+#define NM_DBUS_WIRED_DEVICE_SERVICE "org.freedesktop.NetworkManager.Device.Wired"
+#define NM_DBUS_WIRELESS_DEVICE_SERVICE "org.freedesktop.NetworkManager.Device.Wireless"
#define NM_DBUS_SETTINGS_SERVICE "org.freedesktop.NetworkManager.Settings"
#define NM_DBUS_SETTINGS_CONNECTION_SERVICE "org.freedesktop.NetworkManager.Settings.Connection"
#define NM_VPN_DBUS_PLUGIN_SERVICE "org.freedesktop.NetworkManager.VPN.Plugin"
@@ -186,6 +190,7 @@ class TDECORE_EXPORT TDENetworkConnectionManager_BackendNM : public TDENetworkCo
bool loadConnectionSecretsForGroup(TQString uuid, TQString group);
TDENetworkWiFiAPInfo* getAccessPointDetails(TQString dbusPath);
TDENetworkConnectionType::TDENetworkConnectionType connectionType(TQString dbusPath);
+ TQCString getActiveConnectionPath(TQString uuid);
private:
TDENetworkConnectionManager_BackendNMPrivate* d;
diff --git a/tdecore/networkbackends/network-manager/network-manager_p.h b/tdecore/networkbackends/network-manager/network-manager_p.h
index 4ef3affe8..299f539f2 100644
--- a/tdecore/networkbackends/network-manager/network-manager_p.h
+++ b/tdecore/networkbackends/network-manager/network-manager_p.h
@@ -84,6 +84,7 @@ class TDENetworkConnectionManager_BackendNMPrivate : public TQObject
NMAsyncCallIDMap nmConnectionSettingsAsyncCallWaiting;
NMAsyncSettingsResponseMap nmConnectionSettingsAsyncSettingsResponse;
NMAddConnectionAsyncResponseMap nmAddConnectionAsyncResponse;
+ bool nonReentrantCallActive;
public slots:
void processConnectionSettingsAsyncReply(int, const TQT_DBusDataMap<TQString>&);