Qt 4.8
Classes | Functions
qicdengine.cpp File Reference
#include "qicdengine.h"
#include "qnetworksession_impl.h"
#include <wlancond.h>
#include <wlan-utils.h>
#include <iapconf.h>
#include <iapmonitor.h>
#include "qicdengine.moc"

Go to the source code of this file.

Classes

class  _IapAddTimer
 
class  IapAddTimer
 
class  IapMonitor
 
struct  SSIDInfo
 

Functions

static quint32 getNetworkAttrs (bool is_iap_id, const QString &iap_id, const QString &iap_type, QString security_method)
 
static QString network_attrs_to_security (uint network_attrs)
 

Function Documentation

◆ getNetworkAttrs()

static quint32 getNetworkAttrs ( bool  is_iap_id,
const QString iap_id,
const QString iap_type,
QString  security_method 
)
static

Definition at line 367 of file qicdengine.cpp.

Referenced by QIcdEngine::addConfiguration(), and QIcdEngine::doRequestUpdate().

371 {
372  guint network_attr = 0;
373  dbus_uint32_t cap = 0;
374 
375  if (iap_type == "WLAN_INFRA")
376  cap |= WLANCOND_INFRA;
377  else if (iap_type == "WLAN_ADHOC")
378  cap |= WLANCOND_ADHOC;
379 
380  if (security_method.isEmpty() && (cap & (WLANCOND_INFRA | WLANCOND_ADHOC))) {
381  Maemo::IAPConf saved_ap(iap_id);
382  security_method = saved_ap.value("wlan_security").toString();
383  }
384 
385  if (!security_method.isEmpty()) {
386  if (security_method == "WEP")
387  cap |= WLANCOND_WEP;
388  else if (security_method == "WPA_PSK")
389  cap |= WLANCOND_WPA_PSK;
390  else if (security_method == "WPA_EAP")
391  cap |= WLANCOND_WPA_EAP;
392  else if (security_method == "NONE")
393  cap |= WLANCOND_OPEN;
394 
395  if (cap & (WLANCOND_WPA_PSK | WLANCOND_WPA_EAP)) {
396  Maemo::IAPConf saved_iap(iap_id);
397  bool wpa2_only = saved_iap.value("EAP_wpa2_only_mode").toBool();
398  if (wpa2_only) {
399  cap |= WLANCOND_WPA2;
400  }
401  }
402  }
403 
404  cap2nwattr(cap, &network_attr);
405  if (is_iap_id)
406  network_attr |= ICD_NW_ATTR_IAPNAME;
407 
408  return quint32(network_attr);
409 }
static guint cap2nwattr(dbus_uint32_t cap, guint *nwattrs)
Definition: wlan-utils.h:91
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
unsigned int quint32
Definition: qglobal.h:938

◆ network_attrs_to_security()

static QString network_attrs_to_security ( uint  network_attrs)
inlinestatic

Definition at line 321 of file qicdengine.cpp.

Referenced by QIcdEngine::doRequestUpdate().

322 {
323  uint cap = 0;
324  nwattr2cap(network_attrs, &cap); /* from libicd-network-wlan-dev.h */
325  if (cap & WLANCOND_OPEN)
326  return "NONE";
327  else if (cap & WLANCOND_WEP)
328  return "WEP";
329  else if (cap & WLANCOND_WPA_PSK)
330  return "WPA_PSK";
331  else if (cap & WLANCOND_WPA_EAP)
332  return "WPA_EAP";
333  return "";
334 }
unsigned int uint
Definition: qglobal.h:996
static dbus_uint32_t nwattr2cap(guint nwattrs, dbus_uint32_t *cap)
Definition: wlan-utils.h:72