Populate wiFiDeviceInfo

pull/16/head
Timothy Pearson 12 years ago
parent fe3dbd6e6f
commit d3cfdd24fa

@ -489,6 +489,44 @@ TQString tdeWiFiModeToNMWiFiMode(TDEWiFiMode::TDEWiFiMode mode) {
return ret; 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 nmBluetoothModeToTDEBluetoothMode(TQString nm) {
TDEBluetoothConnectionType::TDEBluetoothConnectionType ret = TDEBluetoothConnectionType::PAN; TDEBluetoothConnectionType::TDEBluetoothConnectionType ret = TDEBluetoothConnectionType::PAN;
@ -1110,6 +1148,10 @@ TDENetworkConnectionManager_BackendNM::TDENetworkConnectionManager_BackendNM(TQS
if (dbusDeviceString != "") { if (dbusDeviceString != "") {
d->m_networkDeviceProxy = new DBus::DeviceProxy(NM_DBUS_SERVICE, dbusDeviceString); d->m_networkDeviceProxy = new DBus::DeviceProxy(NM_DBUS_SERVICE, dbusDeviceString);
d->m_networkDeviceProxy->setConnection(TQT_DBusConnection::systemBus()); 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 // Connect global signals
@ -1267,7 +1309,24 @@ TDENetworkDeviceInformation TDENetworkConnectionManager_BackendNM::deviceInforma
ret.autoConnect = d->m_networkDeviceProxy->getAutoconnect(error); ret.autoConnect = d->m_networkDeviceProxy->getAutoconnect(error);
ret.firmwareMissing = d->m_networkDeviceProxy->getFirmwareMissing(error); ret.firmwareMissing = d->m_networkDeviceProxy->getFirmwareMissing(error);
ret.deviceType = nmDeviceTypeToTDEDeviceType(d->m_networkDeviceProxy->getDeviceType(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 // Get active connection UUID
TQT_DBusObjectPath connectionPath = d->m_networkDeviceProxy->getActiveConnection(error); TQT_DBusObjectPath connectionPath = d->m_networkDeviceProxy->getActiveConnection(error);

@ -114,6 +114,18 @@
#define NM_GSM_PREFER_3G 2 #define NM_GSM_PREFER_3G 2
#define NM_GSM_PREFER_2G 3 #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; class TDENetworkConnectionManager_BackendNMPrivate;

@ -68,12 +68,13 @@ class TDENetworkConnectionManager_BackendNMPrivate : public TQObject
Q_OBJECT Q_OBJECT
public: 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: public:
DBus::NetworkManagerProxy* m_networkManagerProxy; DBus::NetworkManagerProxy* m_networkManagerProxy;
DBus::SettingsInterface* m_networkManagerSettings; DBus::SettingsInterface* m_networkManagerSettings;
DBus::DeviceProxy* m_networkDeviceProxy; DBus::DeviceProxy* m_networkDeviceProxy;
DBus::WiFiDeviceProxy* m_wiFiDeviceProxy;
NMAsyncCallIDMap nmConnectionSettingsAsyncCallWaiting; NMAsyncCallIDMap nmConnectionSettingsAsyncCallWaiting;
NMAsyncSettingsResponseMap nmConnectionSettingsAsyncSettingsResponse; NMAsyncSettingsResponseMap nmConnectionSettingsAsyncSettingsResponse;
NMAddConnectionAsyncResponseMap nmAddConnectionAsyncResponse; NMAddConnectionAsyncResponseMap nmAddConnectionAsyncResponse;

@ -698,7 +698,7 @@ class TDECORE_EXPORT TDENetworkWiFiDeviceInfo
TDEMACAddress permanentHWAddress; TDEMACAddress permanentHWAddress;
TDEWiFiMode::TDEWiFiMode operatingMode; TDEWiFiMode::TDEWiFiMode operatingMode;
unsigned int bitrate; unsigned int bitrate;
TQString activeAccessPointBSSID; TDEMACAddress activeAccessPointBSSID;
TDENetworkWiFiClientFlags::TDENetworkWiFiClientFlags wirelessFlags; TDENetworkWiFiClientFlags::TDENetworkWiFiClientFlags wirelessFlags;
}; };

Loading…
Cancel
Save