50 #ifndef QT_NO_BEARERMANAGEMENT 55 : service_attrs(0), network_attrs(0)
86 if (
timer.isActive()) {
108 if (
timer.isActive()) {
112 timer.setSingleShot(
true);
120 d->addConfiguration(iap_id);
139 QHashIterator<QString, _IapAddTimer* > i(timers);
140 while (i.hasNext()) {
151 if (timers.contains(iap_id)) {
157 timers.insert(iap_id, iap);
163 if (timers.contains(iap_id)) {
182 void iapAdded(
const QString &iapId);
183 void iapRemoved(
const QString &iapId);
223 d->deleteConfiguration(
id);
232 :
QBearerEngine(parent), iapMonitor(0), m_dbusInterface(0), m_icdServiceWatcher(0),
233 firstUpdate(true), m_scanGoingOn(false)
259 ICD_DBUS_API_INTERFACE,
292 cpPriv->
name =
"UserChoice";
295 cpPriv->
id = OSSO_IAP_ANY;
325 if (cap & WLANCOND_OPEN)
327 else if (cap & WLANCOND_WEP)
329 else if (cap & WLANCOND_WPA_PSK)
331 else if (cap & WLANCOND_WPA_EAP)
353 #ifdef BEARER_MANAGEMENT_DEBUG 354 qDebug() <<
"IAP" << iap_id <<
"was removed from storage.";
360 #ifdef BEARER_MANAGEMENT_DEBUG 372 guint network_attr = 0;
373 dbus_uint32_t cap = 0;
375 if (iap_type ==
"WLAN_INFRA")
376 cap |= WLANCOND_INFRA;
377 else if (iap_type ==
"WLAN_ADHOC")
378 cap |= WLANCOND_ADHOC;
380 if (security_method.
isEmpty() && (cap & (WLANCOND_INFRA | WLANCOND_ADHOC))) {
382 security_method = saved_ap.
value(
"wlan_security").
toString();
385 if (!security_method.
isEmpty()) {
386 if (security_method ==
"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;
395 if (cap & (WLANCOND_WPA_PSK | WLANCOND_WPA_EAP)) {
397 bool wpa2_only = saved_iap.
value(
"EAP_wpa2_only_mode").
toBool();
399 cap |= WLANCOND_WPA2;
406 network_attr |= ICD_NW_ATTR_IAPNAME;
461 cpPriv->
name = iap_id;
472 qWarning() <<
"Cannot get ssid for" << iap_id;
486 #ifdef BEARER_MANAGEMENT_DEBUG 494 qWarning(
"IAP %s does not have \"type\" or \"name\" fields defined, skipping this IAP.", iap_id.
toAscii().
data());
497 #ifdef BEARER_MANAGEMENT_DEBUG 498 qDebug() <<
"IAP" << iap_id <<
"already in db.";
507 bool update_needed =
false;
523 update_needed =
true;
528 qWarning() <<
"Cannot get ssid for" << iap_id;
532 update_needed =
true;
558 qWarning(
"Cannot find IAP %s from current configuration although it should be there.", iap_id.
toAscii().
data());
574 foreach (
const QString &iap_id, all_iaps) {
578 bool is_temporary = saved_ap.
value(
"temporary").
toBool();
580 #ifdef BEARER_MANAGEMENT_DEBUG 581 qDebug() <<
"IAP" << iap_id <<
"is temporary, skipping it.";
596 notDiscoveredWLANConfigs.
insert(ssid, info);
597 }
else if (iap_type.
isEmpty()) {
600 #ifdef BEARER_MANAGEMENT_DEBUG 601 qDebug() <<
"IAP" << iap_id <<
"network type is" << iap_type;
614 cpPriv->
name = iap_id;
634 #ifdef BEARER_MANAGEMENT_DEBUG 635 qDebug(
"IAP: %s, name: %s, ssid: %s, added to known list",
641 #ifdef BEARER_MANAGEMENT_DEBUG 642 qDebug(
"IAP: %s, ssid: %s, already exists in the known list",
650 for (
int i=0; i<scanned.
size(); ++i) {
658 bool changed =
false;
681 #ifdef BEARER_MANAGEMENT_DEBUG 682 qDebug(
"IAP: %s, ssid: %s, discovered",
704 for (
int k=0; k<known_iaps.
size(); ++k) {
711 #ifdef BEARER_MANAGEMENT_DEBUG 712 qDebug() <<
"Removed IAP" << iap->
iap_id <<
"from unknown config";
731 cpPriv->
id = scanned_ssid.
data();
743 #ifdef BEARER_MANAGEMENT_DEBUG 744 qDebug() <<
"IAP with network id" << cpPriv->
id <<
"was found in the scan.";
763 QHashIterator<QByteArray, SSIDInfo* > i(notDiscoveredWLANConfigs);
764 while (i.hasNext()) {
788 foreach (
const QString &oldIface, knownConfigs) {
800 QMutableHashIterator<QByteArray, SSIDInfo* > i(notDiscoveredWLANConfigs);
801 while (i.hasNext()) {
834 ICD_DBUS_API_INTERFACE,
835 ICD_DBUS_API_STATE_SIG,
854 if (icd.
state(state_results) && !state_results.
isEmpty()) {
860 case ICD_STATE_CONNECTED:
886 if (arguments[1].toUInt() != 0 || arguments.
count() < 8) {
890 QString iapid = arguments[5].toByteArray().data();
891 uint icd_connection_state = arguments[7].toUInt();
893 switch (icd_connection_state) {
894 case ICD_STATE_CONNECTED:
920 case ICD_STATE_DISCONNECTED:
984 while (i.hasNext()) {
1020 ICD_DBUS_API_INTERFACE,
1021 ICD_DBUS_API_SCAN_SIG,
1025 (
uint)ICD_SCAN_REQUEST_ACTIVE);
1045 ICD_DBUS_API_INTERFACE,
1046 ICD_DBUS_API_SCAN_SIG,
1070 if (icd_scan_status == ICD_SCAN_COMPLETE) {
1079 scanResult.
status = icd_scan_status;
1123 #include "qicdengine.moc" 1127 #endif // QT_NO_BEARERMANAGEMENT The QMultiHash class is a convenience QHash subclass that provides multi-valued hashes.
void setSingleShot(bool singleShot)
QList< Maemo::IcdScanResult > m_scanResult
static mach_timebase_info_data_t info
#define QT_END_NAMESPACE
This macro expands to.
void lock()
Locks the mutex.
char * data()
Returns a pointer to the data stored in the byte array.
QHash< QString, QNetworkConfigurationPrivatePointer > userChoiceConfigurations
void add(QString &iap_id, QIcdEngine *d)
void deleteConfiguration(const QString &iap_id)
QNetworkConfiguration::StateFlags state
bool isValid() const
Returns true if this is a valid reference to a remote object.
void addConfiguration(QString &iap_id)
void configurationChanged(QNetworkConfigurationPrivatePointer config)
QNetworkConfigurationManager::Capabilities capabilities() const
QDBusServiceWatcher * m_icdServiceWatcher
The QByteArray class provides an array of bytes.
void asyncUpdateConfigurationsSlot(QDBusMessage msg)
QDBusConnection connection() const
Returns the connection this interface is assocated with.
void icdServiceOwnerChanged(const QString &serviceName, const QString &oldOwner, const QString &newOwner)
void unlock()
Unlocks this mutex locker.
QString toString() const
Returns the variant as a QString if the variant has type() String , Bool , ByteArray ...
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
The QDBusInterface class is a proxy for interfaces on remote objects.
void iapAdded(const QString &iapId)
bool toBool() const
Returns the variant as a bool if the variant has type() Bool.
static QDBusConnection systemBus()
Returns a QDBusConnection object opened with the system bus.
virtual QString bearerTypeName() const
int count(const T &t) const
Returns the number of occurrences of value in the list.
The QString class provides a Unicode character string.
The QHash class is a template class that provides a hash-table-based dictionary.
Q_INVOKABLE void initialize()
The QObject class is the base class of all Qt objects.
void add(QString &iap_id, QIcdEngine *d)
Q_INVOKABLE void requestUpdate()
QNetworkConfiguration::BearerType bearerType
QByteArray toByteArray() const
Returns the variant as a QByteArray if the variant has type() ByteArray or String (converted using QS...
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
int toInt(bool *ok=0) const
Returns the variant as an int if the variant has type() Int , Bool , ByteArray , Char ...
void relock()
Relocks an unlocked mutex locker.
Q_CORE_EXPORT void qDebug(const char *,...)
static guint cap2nwattr(dbus_uint32_t cap, guint *nwattrs)
bool removeOne(const T &t)
Removes the first occurrence of value in the list and returns true on success; otherwise returns fals...
bool ensureDBusConnection()
static QString toString(Register *reg, int type, bool *ok=0)
void append(const T &t)
Inserts value at the end of the list.
void connectionStateSignalsSlot(QDBusMessage msg)
#define QT_BEGIN_NAMESPACE
This macro expands to.
QList< QVariant > arguments() const
Returns the list of arguments that are going to be sent or were received from D-Bus.
QHash< QString, QNetworkConfigurationPrivatePointer > accessPointConfigurations
T takeFirst()
Removes the first item in the list and returns it.
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
void iapRemoved(const QString &iapId)
static QString network_attrs_to_security(uint network_attrs)
const T & at(int i) const
Returns the item at index position i in the list.
QStringList m_typesToBeScanned
The QStringList class provides a list of strings.
void configurationAdded(QNetworkConfigurationPrivatePointer config)
Q_CORE_EXPORT void qWarning(const char *,...)
QIcdEngine(QObject *parent=0)
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal...
bool isActive() const
Returns true if the timer is running (pending); otherwise returns false.
~IcdNetworkConfigurationPrivate()
void iapStateChanged(const QString &iapid, uint icd_connection_state)
T value(int i) const
Returns the value at index position i in the list.
const T * ptr(const T &t)
QHash< QString, QNetworkConfigurationPrivatePointer > snapConfigurations
QDBusInterface * m_dbusInterface
void clear()
Removes all items from the list.
struct CommonParams params
void unlock()
Unlocks the mutex.
T & first()
Returns a reference to the first item in the list.
uint state(QString &service_type, uint service_attrs, QString &service_id, QString &network_type, uint network_attrs, QByteArray &network_id, IcdStateResult &state_result)
QHash< Key, T >::iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
Disconnects signal in object sender from method in object receiver.
#define ICD_SHORT_SCAN_TIMEOUT
bool connect(const QString &service, const QString &path, const QString &interface, const QString &name, QObject *receiver, const char *slot)
Connects the signal specified by the service, path, interface and name parameters to the slot slot in...
void cancelAsyncConfigurationUpdate()
The QMutexLocker class is a convenience class that simplifies locking and unlocking mutexes...
int remove(const Key &key, const T &value)
Removes all the items that have the key and the value value from the hash.
QNetworkConfiguration::Purpose purpose
IcdNetworkConfigurationPrivate * toIcdConfig(QNetworkConfigurationPrivatePointer ptr)
QExplicitlySharedDataPointer< QNetworkConfigurationPrivate > QNetworkConfigurationPrivatePointer
bool hasIdentifier(const QString &id)
void finishAsyncConfigurationUpdate()
void clear()
Clears the contents of the string and makes it empty.
QNetworkConfiguration::Type type
QList< T > values() const
Returns a list containing all the values in the hash, in an arbitrary order.
QNetworkConfigurationPrivatePointer defaultConfiguration()
uint toUInt(bool *ok=0) const
Returns the variant as an unsigned int if the variant has type() UInt , Bool , ByteArray ...
IcdNetworkConfigurationPrivate()
void startListeningStateSignalsForAllConnections()
int size() const
Returns the number of items in the list.
void configurationRemoved(QNetworkConfigurationPrivatePointer config)
QByteArray toAscii() const Q_REQUIRED_RESULT
Returns an 8-bit representation of the string as a QByteArray.
static void getAll(QList< QString > &all_iaps, bool return_path=false)
if(void) toggleToolbarShown
void setup(QIcdEngine *d)
QHash< QString, _IapAddTimer *> timers
int size() const
Returns the number of bytes in this byte array.
The QDBusMessage class represents one message sent or received over the D-Bus bus.
bool isEmpty() const
Returns true if the byte array has size 0; otherwise returns false.
QNetworkSessionPrivate * createSessionBackend()
The QTimer class provides repetitive and single-shot timers.
The QDBusServiceWatcher class allows the user to watch for a bus service change.
void stop()
Stops the timer.
bool disconnect(const QString &service, const QString &path, const QString &interface, const QString &name, QObject *receiver, const char *slot)
Disconnects the signal specified by the service, path, interface and name parameters from the slot sl...
void start(int msec)
Starts or restarts the timer with a timeout interval of msec milliseconds.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
void doRequestUpdate(QList< Maemo::IcdScanResult > scanned=QList< Maemo::IcdScanResult >())
static dbus_uint32_t nwattr2cap(guint nwattrs, dbus_uint32_t *cap)
void getIcdInitialState()
void clear()
Clears the contents of the byte array and makes it empty.
static quint32 getNetworkAttrs(bool is_iap_id, const QString &iap_id, const QString &iap_type, QString security_method)
void del(QString &iap_id)
QVariant value(const QString &key) const
QNetworkConfiguration::BearerType bearerTypeFromIapType(const QString &iapType)
QDBusMessage call(const QString &method, const QVariant &arg1=QVariant(), const QVariant &arg2=QVariant(), const QVariant &arg3=QVariant(), const QVariant &arg4=QVariant(), const QVariant &arg5=QVariant(), const QVariant &arg6=QVariant(), const QVariant &arg7=QVariant(), const QVariant &arg8=QVariant())
Calls the method method on this interface and passes the parameters to this function to the method...
void removeAt(int i)
Removes the item at index position i.