Qt 4.8
Public Functions | Private Slots | Properties | Friends | List of all members
QNlaEngine Class Reference

#include <qnlaengine.h>

Inheritance diagram for QNlaEngine:
QBearerEngineImpl QBearerEngine QObject

Public Functions

QNetworkConfigurationManager::Capabilities capabilities () const
 
void connectToId (const QString &id)
 
QNetworkSessionPrivatecreateSessionBackend ()
 
QNetworkConfigurationPrivatePointer defaultConfiguration ()
 
void disconnectFromId (const QString &id)
 
QString getInterfaceFromId (const QString &id)
 
bool hasIdentifier (const QString &id)
 
 QNlaEngine (QObject *parent=0)
 
Q_INVOKABLE void requestUpdate ()
 
QNetworkSession::State sessionStateForId (const QString &id)
 
 ~QNlaEngine ()
 
- Public Functions inherited from QBearerEngineImpl
virtual quint64 bytesReceived (const QString &)
 
virtual quint64 bytesWritten (const QString &)
 
 QBearerEngineImpl (QObject *parent=0)
 
virtual quint64 startTime (const QString &)
 
 ~QBearerEngineImpl ()
 
- Public Functions inherited from QBearerEngine
bool configurationsInUse () const
 
 QBearerEngine (QObject *parent=0)
 
virtual bool requiresPolling () const
 
virtual ~QBearerEngine ()
 
- Public Functions inherited from QObject
bool blockSignals (bool b)
 If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it). More...
 
const QObjectListchildren () const
 Returns a list of child objects. More...
 
bool connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const
 
bool disconnect (const char *signal=0, const QObject *receiver=0, const char *member=0)
 
bool disconnect (const QObject *receiver, const char *member=0)
 
void dumpObjectInfo ()
 Dumps information about signal connections, etc. More...
 
void dumpObjectTree ()
 Dumps a tree of children to the debug output. More...
 
QList< QByteArraydynamicPropertyNames () const
 Returns the names of all properties that were dynamically added to the object using setProperty(). More...
 
virtual bool event (QEvent *)
 This virtual function receives events to an object and should return true if the event e was recognized and processed. More...
 
virtual bool eventFilter (QObject *, QEvent *)
 Filters events if this object has been installed as an event filter for the watched object. More...
 
template<typename T >
findChild (const QString &aName=QString()) const
 Returns the child of this object that can be cast into type T and that is called name, or 0 if there is no such object. More...
 
template<typename T >
QList< T > findChildren (const QString &aName=QString()) const
 Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects. More...
 
template<typename T >
QList< T > findChildren (const QRegExp &re) const
 
bool inherits (const char *classname) const
 Returns true if this object is an instance of a class that inherits className or a QObject subclass that inherits className; otherwise returns false. More...
 
void installEventFilter (QObject *)
 Installs an event filter filterObj on this object. More...
 
bool isWidgetType () const
 Returns true if the object is a widget; otherwise returns false. More...
 
void killTimer (int id)
 Kills the timer with timer identifier, id. More...
 
virtual const QMetaObjectmetaObject () const
 Returns a pointer to the meta-object of this object. More...
 
void moveToThread (QThread *thread)
 Changes the thread affinity for this object and its children. More...
 
QString objectName () const
 
QObjectparent () const
 Returns a pointer to the parent object. More...
 
QVariant property (const char *name) const
 Returns the value of the object's name property. More...
 
Q_INVOKABLE QObject (QObject *parent=0)
 Constructs an object with parent object parent. More...
 
void removeEventFilter (QObject *)
 Removes an event filter object obj from this object. More...
 
void setObjectName (const QString &name)
 
void setParent (QObject *)
 Makes the object a child of parent. More...
 
bool setProperty (const char *name, const QVariant &value)
 Sets the value of the object's name property to value. More...
 
void setUserData (uint id, QObjectUserData *data)
 
bool signalsBlocked () const
 Returns true if signals are blocked; otherwise returns false. More...
 
int startTimer (int interval)
 Starts a timer and returns a timer identifier, or returns zero if it could not start a timer. More...
 
QThreadthread () const
 Returns the thread in which the object lives. More...
 
QObjectUserDatauserData (uint id) const
 
virtual ~QObject ()
 Destroys the object, deleting all its child objects. More...
 

Private Slots

void networksChanged ()
 

Properties

QMap< uint, QStringconfigurationInterface
 
QNlaThreadnlaThread
 
QWindowsSockInit2 winSock
 

Friends

class QNlaThread
 

Additional Inherited Members

- Public Types inherited from QBearerEngineImpl
enum  ConnectionError { InterfaceLookupError = 0, ConnectError, OperationNotSupported, DisconnectionError }
 
- Public Slots inherited from QObject
void deleteLater ()
 Schedules this object for deletion. More...
 
- Signals inherited from QBearerEngineImpl
void connectionError (const QString &id, QBearerEngineImpl::ConnectionError error)
 
- Signals inherited from QBearerEngine
void configurationAdded (QNetworkConfigurationPrivatePointer config)
 
void configurationChanged (QNetworkConfigurationPrivatePointer config)
 
void configurationRemoved (QNetworkConfigurationPrivatePointer config)
 
void updateCompleted ()
 
- Signals inherited from QObject
void destroyed (QObject *=0)
 This signal is emitted immediately before the object obj is destroyed, and can not be blocked. More...
 
- Static Public Functions inherited from QObject
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 receiver object. More...
 
static bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection)
 
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. More...
 
static bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member)
 
static uint registerUserData ()
 
static QString tr (const char *sourceText, const char *comment=0, int n=-1)
 
static QString trUtf8 (const char *sourceText, const char *comment=0, int n=-1)
 
- Static Public Variables inherited from QObject
static const QMetaObject staticMetaObject
 This variable stores the meta-object for the class. More...
 
- Protected Functions inherited from QObject
virtual void childEvent (QChildEvent *)
 This event handler can be reimplemented in a subclass to receive child events. More...
 
virtual void connectNotify (const char *signal)
 This virtual function is called when something has been connected to signal in this object. More...
 
virtual void customEvent (QEvent *)
 This event handler can be reimplemented in a subclass to receive custom events. More...
 
virtual void disconnectNotify (const char *signal)
 This virtual function is called when something has been disconnected from signal in this object. More...
 
 QObject (QObjectPrivate &dd, QObject *parent=0)
 
int receivers (const char *signal) const
 Returns the number of receivers connected to the signal. More...
 
QObjectsender () const
 Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; otherwise it returns 0. More...
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *)
 This event handler can be reimplemented in a subclass to receive timer events for the object. More...
 
- Protected Variables inherited from QBearerEngine
QHash< QString, QNetworkConfigurationPrivatePointeraccessPointConfigurations
 
QMutex mutex
 
QHash< QString, QNetworkConfigurationPrivatePointersnapConfigurations
 
QHash< QString, QNetworkConfigurationPrivatePointeruserChoiceConfigurations
 
- Protected Variables inherited from QObject
QScopedPointer< QObjectDatad_ptr
 
- Static Protected Variables inherited from QObject
static const QMetaObject staticQtMetaObject
 

Detailed Description

Definition at line 75 of file qnlaengine.h.

Constructors and Destructors

◆ QNlaEngine()

QNlaEngine::QNlaEngine ( QObject parent = 0)

Definition at line 493 of file qnlaengine.cpp.

494 : QBearerEngineImpl(parent), nlaThread(0)
495 {
496  nlaThread = new QNlaThread(this);
498  this, SLOT(networksChanged()));
499  nlaThread->start();
500 
502 }
friend class QNlaThread
Definition: qnlaengine.h:79
QBearerEngineImpl(QObject *parent=0)
#define SLOT(a)
Definition: qobjectdefs.h:226
QNlaThread * nlaThread
Definition: qnlaengine.h:106
void networksChanged()
Definition: qnlaengine.cpp:509
#define SIGNAL(a)
Definition: qobjectdefs.h:227
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...
Definition: qobject.cpp:2580
#define qApp
void start(Priority=InheritPriority)
Begins execution of the thread by calling run().

◆ ~QNlaEngine()

QNlaEngine::~QNlaEngine ( )

Definition at line 504 of file qnlaengine.cpp.

505 {
506  delete nlaThread;
507 }
QNlaThread * nlaThread
Definition: qnlaengine.h:106

Functions

◆ capabilities()

QNetworkConfigurationManager::Capabilities QNlaEngine::capabilities ( ) const
virtual

◆ connectToId()

void QNlaEngine::connectToId ( const QString id)
virtual

Implements QBearerEngineImpl.

Definition at line 590 of file qnlaengine.cpp.

591 {
593 }
#define emit
Definition: qobjectdefs.h:76
void connectionError(const QString &id, QBearerEngineImpl::ConnectionError error)

◆ createSessionBackend()

QNetworkSessionPrivate * QNlaEngine::createSessionBackend ( )
virtual

Implements QBearerEngine.

Definition at line 638 of file qnlaengine.cpp.

◆ defaultConfiguration()

QNetworkConfigurationPrivatePointer QNlaEngine::defaultConfiguration ( )
virtual

Implements QBearerEngine.

Definition at line 643 of file qnlaengine.cpp.

644 {
646 }
QExplicitlySharedDataPointer< QNetworkConfigurationPrivate > QNetworkConfigurationPrivatePointer

◆ disconnectFromId()

void QNlaEngine::disconnectFromId ( const QString id)
virtual

Implements QBearerEngineImpl.

Definition at line 595 of file qnlaengine.cpp.

596 {
598 }
#define emit
Definition: qobjectdefs.h:76
void connectionError(const QString &id, QBearerEngineImpl::ConnectionError error)

◆ getInterfaceFromId()

QString QNlaEngine::getInterfaceFromId ( const QString id)
virtual

Implements QBearerEngineImpl.

Definition at line 576 of file qnlaengine.cpp.

577 {
578  QMutexLocker locker(&mutex);
579 
580  return configurationInterface.value(id.toUInt());
581 }
QMap< uint, QString > configurationInterface
Definition: qnlaengine.h:107
const T value(const Key &key) const
Returns the value associated with the key key.
Definition: qmap.h:499
The QMutexLocker class is a convenience class that simplifies locking and unlocking mutexes...
Definition: qmutex.h:101

◆ hasIdentifier()

bool QNlaEngine::hasIdentifier ( const QString id)
virtual

Implements QBearerEngine.

Definition at line 583 of file qnlaengine.cpp.

584 {
585  QMutexLocker locker(&mutex);
586 
587  return configurationInterface.contains(id.toUInt());
588 }
QMap< uint, QString > configurationInterface
Definition: qnlaengine.h:107
The QMutexLocker class is a convenience class that simplifies locking and unlocking mutexes...
Definition: qmutex.h:101
bool contains(const Key &key) const
Returns true if the map contains an item with key key; otherwise returns false.
Definition: qmap.h:553

◆ networksChanged

void QNlaEngine::networksChanged ( )
privateslot

Definition at line 509 of file qnlaengine.cpp.

Referenced by QNlaEngine().

510 {
511  QMutexLocker locker(&mutex);
512 
513  QStringList previous = accessPointConfigurations.keys();
514 
516  while (!foundConfigurations.isEmpty()) {
517  QNetworkConfigurationPrivate *cpPriv = foundConfigurations.takeFirst();
518 
519  previous.removeAll(cpPriv->id);
520 
521  if (accessPointConfigurations.contains(cpPriv->id)) {
523 
524  bool changed = false;
525 
526  ptr->mutex.lock();
527 
528  if (ptr->isValid != cpPriv->isValid) {
529  ptr->isValid = cpPriv->isValid;
530  changed = true;
531  }
532 
533  if (ptr->name != cpPriv->name) {
534  ptr->name = cpPriv->name;
535  changed = true;
536  }
537 
538  if (ptr->state != cpPriv->state) {
539  ptr->state = cpPriv->state;
540  changed = true;
541  }
542 
543  ptr->mutex.unlock();
544 
545  if (changed) {
546  locker.unlock();
548  locker.relock();
549  }
550 
551  delete cpPriv;
552  } else {
554 
555  accessPointConfigurations.insert(ptr->id, ptr);
556 
557  locker.unlock();
559  locker.relock();
560  }
561  }
562 
563  while (!previous.isEmpty()) {
565  accessPointConfigurations.take(previous.takeFirst());
566 
567  locker.unlock();
569  locker.relock();
570  }
571 
572  locker.unlock();
574 }
void lock()
Locks the mutex.
Definition: qmutex.cpp:151
QNetworkConfiguration::StateFlags state
void configurationChanged(QNetworkConfigurationPrivatePointer config)
QList< QNetworkConfigurationPrivate * > getConfigurations()
Definition: qnlaengine.cpp:242
void updateCompleted()
QNlaThread * nlaThread
Definition: qnlaengine.h:106
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
Definition: qlist.h:152
QHash< QString, QNetworkConfigurationPrivatePointer > accessPointConfigurations
T takeFirst()
Removes the first item in the list and returns it.
Definition: qlist.h:489
#define emit
Definition: qobjectdefs.h:76
The QStringList class provides a list of strings.
Definition: qstringlist.h:66
void configurationAdded(QNetworkConfigurationPrivatePointer config)
const T * ptr(const T &t)
void unlock()
Unlocks the mutex.
Definition: qmutex.cpp:296
The QMutexLocker class is a convenience class that simplifies locking and unlocking mutexes...
Definition: qmutex.h:101
void configurationRemoved(QNetworkConfigurationPrivatePointer config)
The QList class is a template class that provides lists.
Definition: qdatastream.h:62
int removeAll(const T &t)
Removes all occurrences of value in the list and returns the number of entries removed.
Definition: qlist.h:770

◆ requestUpdate()

void QNlaEngine::requestUpdate ( )

Definition at line 600 of file qnlaengine.cpp.

601 {
602  QMutexLocker locker(&mutex);
603 
605 }
QNlaThread * nlaThread
Definition: qnlaengine.h:106
void forceUpdate()
Definition: qnlaengine.cpp:252
The QMutexLocker class is a convenience class that simplifies locking and unlocking mutexes...
Definition: qmutex.h:101

◆ sessionStateForId()

QNetworkSession::State QNlaEngine::sessionStateForId ( const QString id)
virtual

Implements QBearerEngineImpl.

Definition at line 607 of file qnlaengine.cpp.

608 {
609  QMutexLocker locker(&mutex);
610 
612 
613  if (!ptr)
615 
616  if (!ptr->isValid) {
620  } else if ((ptr->state & QNetworkConfiguration::Discovered) ==
625  } else if ((ptr->state & QNetworkConfiguration::Undefined) ==
628  }
629 
631 }
QNetworkConfiguration::StateFlags state
QHash< QString, QNetworkConfigurationPrivatePointer > accessPointConfigurations
const T * ptr(const T &t)
The QMutexLocker class is a convenience class that simplifies locking and unlocking mutexes...
Definition: qmutex.h:101

Friends and Related Functions

◆ QNlaThread

friend class QNlaThread
friend

Definition at line 79 of file qnlaengine.h.

Referenced by QNlaEngine().

Properties

◆ configurationInterface

QMap<uint, QString> QNlaEngine::configurationInterface
private

Definition at line 107 of file qnlaengine.h.

Referenced by getInterfaceFromId(), and hasIdentifier().

◆ nlaThread

QNlaThread* QNlaEngine::nlaThread
private

Definition at line 106 of file qnlaengine.h.

Referenced by networksChanged(), QNlaEngine(), requestUpdate(), and ~QNlaEngine().

◆ winSock

QWindowsSockInit2 QNlaEngine::winSock
private

Definition at line 105 of file qnlaengine.h.


The documentation for this class was generated from the following files: