diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-09-05 09:51:20 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-09-05 09:51:20 -0500 |
commit | d3cfdd24fa0bd2f0c9fce7de57d29333e1e071e2 (patch) | |
tree | 8d1fe879a00b901e92c0afd7e973782a03dd4166 | |
parent | fe3dbd6e6f8748ec07184c09081bcc31096750f9 (diff) | |
download | tdelibs-d3cfdd24fa0bd2f0c9fce7de57d29333e1e071e2.tar.gz tdelibs-d3cfdd24fa0bd2f0c9fce7de57d29333e1e071e2.zip |
Populate wiFiDeviceInfo
4 files changed, 75 insertions, 3 deletions
diff --git a/tdecore/networkbackends/network-manager/network-manager.cpp b/tdecore/networkbackends/network-manager/network-manager.cpp index 2f25153f4..9d9d9e740 100644 --- a/tdecore/networkbackends/network-manager/network-manager.cpp +++ b/tdecore/networkbackends/network-manager/network-manager.cpp @@ -489,6 +489,44 @@ TQString tdeWiFiModeToNMWiFiMode(TDEWiFiMode::TDEWiFiMode mode) { return ret; } +TDEWiFiMode::TDEWiFiMode nmWiFiModeToTDEWiFiMode(TQ_UINT32 nm) { + TDEWiFiMode::TDEWiFiMode ret = TDEWiFiMode::Infrastructure; + + if (nm == NM_802_11_MODE_INFRASTRUCTURE) { + ret = TDEWiFiMode::Infrastructure; + } + else if (nm == NM_802_11_MODE_ADHOC) { + ret = TDEWiFiMode::AdHoc; + } + + return ret; +} + +TDENetworkWiFiClientFlags::TDENetworkWiFiClientFlags tdeWiFiFlagsToNMWiFiFlags(TQ_UINT32 nm) { + TDENetworkWiFiClientFlags::TDENetworkWiFiClientFlags ret = TDENetworkWiFiClientFlags::None; + + if (nm & NM_802_11_DEVICE_CAP_CIPHER_WEP40) { + ret | TDENetworkWiFiClientFlags::CipherWEP40; + } + if (nm & NM_802_11_DEVICE_CAP_CIPHER_WEP104) { + ret | TDENetworkWiFiClientFlags::CipherWEP104; + } + if (nm & NM_802_11_DEVICE_CAP_CIPHER_TKIP) { + ret | TDENetworkWiFiClientFlags::CipherTKIP; + } + if (nm & NM_802_11_DEVICE_CAP_CIPHER_CCMP) { + ret | TDENetworkWiFiClientFlags::CipherCCMP; + } + if (nm & NM_802_11_DEVICE_CAP_WPA) { + ret | TDENetworkWiFiClientFlags::CipherWPA; + } + if (nm & NM_802_11_DEVICE_CAP_RSN) { + ret | TDENetworkWiFiClientFlags::CipherRSN; + } + + return ret; +} + TDEBluetoothConnectionType::TDEBluetoothConnectionType nmBluetoothModeToTDEBluetoothMode(TQString nm) { TDEBluetoothConnectionType::TDEBluetoothConnectionType ret = TDEBluetoothConnectionType::PAN; @@ -1110,6 +1148,10 @@ TDENetworkConnectionManager_BackendNM::TDENetworkConnectionManager_BackendNM(TQS if (dbusDeviceString != "") { d->m_networkDeviceProxy = new DBus::DeviceProxy(NM_DBUS_SERVICE, dbusDeviceString); d->m_networkDeviceProxy->setConnection(TQT_DBusConnection::systemBus()); + if (deviceType() == TDENetworkDeviceType::WiFi) { + d->m_wiFiDeviceProxy = new DBus::WiFiDeviceProxy(NM_DBUS_SERVICE, dbusDeviceString); + d->m_wiFiDeviceProxy->setConnection(TQT_DBusConnection::systemBus()); + } } // Connect global signals @@ -1267,7 +1309,24 @@ 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)); - // FIXME wiFiInfo is not filled in + + // Populate wiFiInfo + if ((deviceType() == TDENetworkDeviceType::WiFi) && (d->m_wiFiDeviceProxy)) { + ret.wiFiInfo.valid = true; + ret.wiFiInfo.hwAddress.fromString(d->m_wiFiDeviceProxy->getHwAddress(error)); + ret.wiFiInfo.permanentHWAddress.fromString(d->m_wiFiDeviceProxy->getPermHwAddress(error)); + 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 (apInfo) { + ret.wiFiInfo.activeAccessPointBSSID = apInfo->BSSID; + delete apInfo; + } + ret.wiFiInfo.wirelessFlags = tdeWiFiFlagsToNMWiFiFlags(d->m_wiFiDeviceProxy->getWirelessCapabilities(error)); + } + else { + ret.wiFiInfo.valid = false; + } // Get active connection UUID TQT_DBusObjectPath connectionPath = d->m_networkDeviceProxy->getActiveConnection(error); diff --git a/tdecore/networkbackends/network-manager/network-manager.h b/tdecore/networkbackends/network-manager/network-manager.h index d0b2df302..8fa876728 100644 --- a/tdecore/networkbackends/network-manager/network-manager.h +++ b/tdecore/networkbackends/network-manager/network-manager.h @@ -114,6 +114,18 @@ #define NM_GSM_PREFER_3G 2 #define NM_GSM_PREFER_2G 3 //==================================================================================================== +#define NM_802_11_MODE_UNKNOWN 0 +#define NM_802_11_MODE_ADHOC 1 +#define NM_802_11_MODE_INFRASTRUCTURE 2 +//==================================================================================================== +#define NM_802_11_DEVICE_CAP_NONE 0x0 +#define NM_802_11_DEVICE_CAP_CIPHER_WEP40 0x1 +#define NM_802_11_DEVICE_CAP_CIPHER_WEP104 0x2 +#define NM_802_11_DEVICE_CAP_CIPHER_TKIP 0x4 +#define NM_802_11_DEVICE_CAP_CIPHER_CCMP 0x8 +#define NM_802_11_DEVICE_CAP_WPA 0x10 +#define NM_802_11_DEVICE_CAP_RSN 0x20 +//==================================================================================================== class TDENetworkConnectionManager_BackendNMPrivate; diff --git a/tdecore/networkbackends/network-manager/network-manager_p.h b/tdecore/networkbackends/network-manager/network-manager_p.h index e7356fd79..88c63a59f 100644 --- a/tdecore/networkbackends/network-manager/network-manager_p.h +++ b/tdecore/networkbackends/network-manager/network-manager_p.h @@ -68,12 +68,13 @@ class TDENetworkConnectionManager_BackendNMPrivate : public TQObject Q_OBJECT public: - TDENetworkConnectionManager_BackendNMPrivate() : m_networkManagerProxy(NULL), m_networkManagerSettings(NULL), m_networkDeviceProxy(NULL) {} + TDENetworkConnectionManager_BackendNMPrivate() : m_networkManagerProxy(NULL), m_networkManagerSettings(NULL), m_networkDeviceProxy(NULL), m_wiFiDeviceProxy(NULL) {} public: DBus::NetworkManagerProxy* m_networkManagerProxy; DBus::SettingsInterface* m_networkManagerSettings; DBus::DeviceProxy* m_networkDeviceProxy; + DBus::WiFiDeviceProxy* m_wiFiDeviceProxy; NMAsyncCallIDMap nmConnectionSettingsAsyncCallWaiting; NMAsyncSettingsResponseMap nmConnectionSettingsAsyncSettingsResponse; NMAddConnectionAsyncResponseMap nmAddConnectionAsyncResponse; diff --git a/tdecore/tdenetworkconnections.h b/tdecore/tdenetworkconnections.h index e6e8d42cf..4afdbc863 100644 --- a/tdecore/tdenetworkconnections.h +++ b/tdecore/tdenetworkconnections.h @@ -698,7 +698,7 @@ class TDECORE_EXPORT TDENetworkWiFiDeviceInfo TDEMACAddress permanentHWAddress; TDEWiFiMode::TDEWiFiMode operatingMode; unsigned int bitrate; - TQString activeAccessPointBSSID; + TDEMACAddress activeAccessPointBSSID; TDENetworkWiFiClientFlags::TDENetworkWiFiClientFlags wirelessFlags; }; |