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

#include <qnetworksession_impl.h>

Inheritance diagram for QNetworkSessionPrivateImpl:
QNetworkSessionPrivate QNetworkSessionPrivate QObject QObject

Classes

struct  Statistics
 

Public Functions

void accept ()
 
void accept ()
 
quint64 activeTime () const
 
quint64 activeTime () const
 
quint64 bytesReceived () const
 
quint64 bytesReceived () const
 
quint64 bytesWritten () const
 
quint64 bytesWritten () const
 
void close ()
 
void close ()
 
QNetworkInterface currentInterface () const
 
QNetworkInterface currentInterface () const
 
QNetworkSession::SessionError error () const
 
QNetworkSession::SessionError error () const
 
QString errorString () const
 
QString errorString () const
 
void ignore ()
 
void ignore ()
 
void migrate ()
 
void migrate ()
 
void open ()
 
void open ()
 
 QNetworkSessionPrivateImpl ()
 
 QNetworkSessionPrivateImpl (QIcdEngine *engine)
 
void reject ()
 
void reject ()
 
QVariant sessionProperty (const QString &key) const
 
QVariant sessionProperty (const QString &key) const
 
void setSessionProperty (const QString &key, const QVariant &value)
 
void setSessionProperty (const QString &key, const QVariant &value)
 
void stop ()
 
void stop ()
 
void syncStateWithInterface ()
 
void syncStateWithInterface ()
 
 ~QNetworkSessionPrivateImpl ()
 
 ~QNetworkSessionPrivateImpl ()
 
- Public Functions inherited from QNetworkSessionPrivate
 QNetworkSessionPrivate ()
 
virtual void setALREnabled (bool)
 
virtual ~QNetworkSessionPrivate ()
 
- 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 configurationChanged (QNetworkConfigurationPrivatePointer config)
 
void connectionError (const QString &id, QBearerEngineImpl::ConnectionError error)
 
void connectTimeout ()
 
void decrementTimeout ()
 
void do_open ()
 
void finishStopBySendingClosedSignal ()
 
void forcedSessionClose (const QNetworkConfiguration &config)
 
void iapStateChanged (const QString &iapid, uint icd_connection_state)
 
void networkConfigurationsChanged ()
 
void networkConfigurationsChanged ()
 
void stateChange (const QDBusMessage &rep)
 
void updateProxies (QNetworkSession::State newState)
 

Private Functions

void cleanupSession (void)
 
void clearConfiguration (QNetworkConfiguration &config)
 
void clearProxyInformation ()
 
QNetworkConfigurationcopyConfig (QNetworkConfiguration &fromConfig, QNetworkConfiguration &toConfig, bool deepCopy=true)
 
Statistics getStatistics () const
 
void updateIdentifier (const QString &newId)
 
void updateProxyInformation ()
 
void updateState (QNetworkSession::State)
 
void updateStateFromActiveConfig ()
 
void updateStateFromActiveConfig ()
 
void updateStateFromServiceNetwork ()
 
void updateStateFromServiceNetwork ()
 

Properties

QNetworkConfiguration config
 
icd_connection_flags connectFlags
 
QString currentNetworkInterface
 
QNetworkSession::State currentState
 
QBearerEngineImplengine
 
QIcdEngineengine
 
QNetworkSession::SessionError lastError
 
bool m_asynchCallActive
 
QTimer m_connectRequestTimer
 
QDBusInterfacem_dbusInterface
 
QTimer m_stopTimer
 
QNetworkConfigurationManager manager
 
bool opened
 
int sessionTimeout
 
quint64 startTime
 
QDateTime startTime
 

Friends

class IcdListener
 

Additional Inherited Members

- Public Slots inherited from QObject
void deleteLater ()
 Schedules this object for deletion. More...
 
- Signals inherited from QNetworkSessionPrivate
void closed ()
 
void error (QNetworkSession::SessionError error)
 
void newConfigurationActivated ()
 
void preferredConfigurationChanged (const QNetworkConfiguration &config, bool isSeamless)
 
void quitPendingWaitsForOpened ()
 
void stateChanged (QNetworkSession::State state)
 
- 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 QNetworkSessionPrivate
QNetworkConfigurationPrivatePointer privateConfiguration (const QNetworkConfiguration &config) const
 
void setPrivateConfiguration (QNetworkConfiguration &config, QNetworkConfigurationPrivatePointer ptr) const
 
- 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 QNetworkSessionPrivate
QNetworkConfiguration activeConfig
 
bool isOpen
 
QMutex mutex
 
QNetworkConfiguration publicConfig
 
QNetworkSessionq
 
QNetworkConfiguration serviceConfig
 
QNetworkSession::State state
 
- Protected Variables inherited from QObject
QScopedPointer< QObjectDatad_ptr
 
- Static Protected Variables inherited from QObject
static const QMetaObject staticQtMetaObject
 

Detailed Description

Definition at line 88 of file qnetworksession_impl.h.

Constructors and Destructors

◆ QNetworkSessionPrivateImpl() [1/2]

QNetworkSessionPrivateImpl::QNetworkSessionPrivateImpl ( QIcdEngine engine)
inline

Definition at line 93 of file qnetworksession_impl.h.

94  : engine(engine),
95  connectFlags(ICD_CONNECTION_FLAG_USER_EVENT),
97  m_asynchCallActive(false)
98  {
101 
105 
106  m_dbusInterface = new QDBusInterface(ICD_DBUS_API_INTERFACE,
107  ICD_DBUS_API_PATH,
108  ICD_DBUS_API_INTERFACE,
109  systemBus,
110  this);
111 
112  systemBus.connect(ICD_DBUS_API_INTERFACE,
113  ICD_DBUS_API_PATH,
114  ICD_DBUS_API_INTERFACE,
115  ICD_DBUS_API_CONNECT_SIG,
116  this,
117  SLOT(stateChange(const QDBusMessage&)));
118 
119  qDBusRegisterMetaType<ICd2DetailsDBusStruct>();
120  qDBusRegisterMetaType<ICd2DetailsList>();
121 
123  connect(&m_connectRequestTimer, SIGNAL(timeout()), this, SLOT(connectTimeout()));
124  }
void setSingleShot(bool singleShot)
Definition: qtimer.h:108
QNetworkSession::State currentState
static QUuid createUuid()
On any platform other than Windows, this function returns a new UUID with variant QUuid::DCE and vers...
Definition: quuid.cpp:897
icd_connection_flags connectFlags
#define SLOT(a)
Definition: qobjectdefs.h:226
The QDBusInterface class is a proxy for interfaces on remote objects.
#define SIGNAL(a)
Definition: qobjectdefs.h:227
static QString toString(Register *reg, int type, bool *ok=0)
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
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...
The QDBusConnection class represents a connection to the D-Bus bus daemon.
static QDBusConnection connectToBus(BusType type, const QString &name)
Opens a connection of type type to one of the known busses and associate with it the connection name ...
The QDBusMessage class represents one message sent or received over the D-Bus bus.
Definition: qdbusmessage.h:59
void stateChange(const QDBusMessage &rep)

◆ ~QNetworkSessionPrivateImpl() [1/2]

QNetworkSessionPrivateImpl::~QNetworkSessionPrivateImpl ( )
inline

Definition at line 126 of file qnetworksession_impl.h.

127  {
128  cleanupSession();
129 
131  }
QDBusConnection connection() const
Returns the connection this interface is assocated with.
QString name() const
Returns the connection name for this connection, as given as the name parameter to connectToBus()...
static void disconnectFromBus(const QString &name)
Closes the bus connection of name name.

◆ QNetworkSessionPrivateImpl() [2/2]

QNetworkSessionPrivateImpl::QNetworkSessionPrivateImpl ( )
inline

◆ ~QNetworkSessionPrivateImpl() [2/2]

QNetworkSessionPrivateImpl::~QNetworkSessionPrivateImpl ( )
inline

Definition at line 75 of file qnetworksession_impl.h.

76  {}

Functions

◆ accept() [1/2]

void QNetworkSessionPrivateImpl::accept ( )
virtual

◆ accept() [2/2]

void QNetworkSessionPrivateImpl::accept ( )
virtual

◆ activeTime() [1/2]

quint64 QNetworkSessionPrivateImpl::activeTime ( ) const
virtual

◆ activeTime() [2/2]

quint64 QNetworkSessionPrivateImpl::activeTime ( ) const
virtual

◆ bytesReceived() [1/2]

quint64 QNetworkSessionPrivateImpl::bytesReceived ( ) const
virtual

◆ bytesReceived() [2/2]

quint64 QNetworkSessionPrivateImpl::bytesReceived ( ) const
virtual

◆ bytesWritten() [1/2]

quint64 QNetworkSessionPrivateImpl::bytesWritten ( ) const
virtual

◆ bytesWritten() [2/2]

quint64 QNetworkSessionPrivateImpl::bytesWritten ( ) const
virtual

◆ cleanupSession()

void QNetworkSessionPrivateImpl::cleanupSession ( void  )
private

Definition at line 154 of file qnetworksession_impl.cpp.

155 {
158 }
#define SLOT(a)
Definition: qobjectdefs.h:226
State
This enum describes the connectivity state of the session.
#define SIGNAL(a)
Definition: qobjectdefs.h:227
void updateProxies(QNetworkSession::State newState)
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.
Definition: qobject.cpp:2895
void stateChanged(QNetworkSession::State state)

◆ clearConfiguration()

void QNetworkSessionPrivateImpl::clearConfiguration ( QNetworkConfiguration config)
private

Definition at line 555 of file qnetworksession_impl.cpp.

Referenced by updateStateFromActiveConfig().

556 {
558 
559  QMutexLocker locker(&icdConfig->mutex);
560 
561  icdConfig->network_id.clear();
562  icdConfig->iap_type.clear();
563  icdConfig->network_attrs = 0;
564  icdConfig->service_type.clear();
565  icdConfig->service_id.clear();
566  icdConfig->service_attrs = 0;
567 }
QNetworkConfigurationPrivatePointer privateConfiguration(const QNetworkConfiguration &config) const
The QMutexLocker class is a convenience class that simplifies locking and unlocking mutexes...
Definition: qmutex.h:101
IcdNetworkConfigurationPrivate * toIcdConfig(QNetworkConfigurationPrivatePointer ptr)
Definition: qicdengine.h:92
void clear()
Clears the contents of the string and makes it empty.
Definition: qstring.h:723
void clear()
Clears the contents of the byte array and makes it empty.

◆ clearProxyInformation()

void QNetworkSessionPrivateImpl::clearProxyInformation ( )
private

Definition at line 1071 of file qnetworksession_impl.cpp.

Referenced by updateProxies().

1072 {
1074 }
static void clear(void)
Definition: proxyconf.cpp:410

◆ close() [1/2]

void QNetworkSessionPrivateImpl::close ( )
virtual

◆ close() [2/2]

void QNetworkSessionPrivateImpl::close ( )
virtual

Implements QNetworkSessionPrivate.

Definition at line 889 of file qnetworksession_impl.cpp.

Referenced by QNetworkSessionManagerPrivate::forceSessionClose(), and ~QNetworkSessionPrivateImpl().

890 {
893 
894  if (serviceConfig.isValid()) {
897  } else if (isOpen) {
899  // We will not wait any disconnect from icd as it might never come
900 #ifdef BEARER_MANAGEMENT_DEBUG
901  qDebug() << "closing session" << publicConfig.identifier();
902 #endif
905 
906  // we fake a disconnection, session error is sent
908 
909  opened = false;
910  isOpen = false;
911 
912  m_dbusInterface->call(ICD_DBUS_API_DISCONNECT_REQ, ICD_CONNECTION_FLAG_APPLICATION_EVENT);
913  startTime = QDateTime();
914  } else {
915  opened = false;
916  isOpen = false;
917  emit closed();
918  }
919  }
920 }
QNetworkSession::SessionError lastError
QNetworkConfiguration serviceConfig
QNetworkConfiguration activeConfig
Q_CORE_EXPORT void qDebug(const char *,...)
bool isValid() const
Returns true if this QNetworkConfiguration object is valid.
virtual QNetworkSession::SessionError error() const =0
#define emit
Definition: qobjectdefs.h:76
QNetworkSession::State state
bool isActive() const
Returns true if the timer is running (pending); otherwise returns false.
Definition: qtimer.h:69
QNetworkConfiguration publicConfig
QString identifier() const
Returns the unique and platform specific identifier for this network configuration; otherwise an empt...
void stateChanged(QNetworkSession::State state)
The QDateTime class provides date and time functions.
Definition: qdatetime.h:216
StateFlags state() const
Returns the current state of the configuration.
void updateState(QNetworkSession::State)
void stop()
Stops the timer.
Definition: qtimer.cpp:284
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...

◆ configurationChanged

void QNetworkSessionPrivateImpl::configurationChanged ( QNetworkConfigurationPrivatePointer  config)
privateslot

Definition at line 367 of file qnetworksession_impl.cpp.

Referenced by ~QNetworkSessionPrivateImpl().

368 {
369  if (serviceConfig.isValid() &&
370  (config->id == serviceConfig.identifier() || config->id == activeConfig.identifier())) {
372  } else if (config->id == activeConfig.identifier()) {
374  }
375 }
QNetworkConfiguration serviceConfig
QNetworkConfiguration activeConfig
bool isValid() const
Returns true if this QNetworkConfiguration object is valid.
QString identifier() const
Returns the unique and platform specific identifier for this network configuration; otherwise an empt...

◆ connectionError

void QNetworkSessionPrivateImpl::connectionError ( const QString id,
QBearerEngineImpl::ConnectionError  error 
)
privateslot

Definition at line 390 of file qnetworksession_impl.cpp.

Referenced by ~QNetworkSessionPrivateImpl().

391 {
392  if (activeConfig.identifier() == id) {
394  switch (error) {
397  opened = false;
398  break;
402  default:
404  }
405 
407  }
408 }
QNetworkSession::SessionError lastError
QNetworkConfiguration activeConfig
virtual QNetworkSession::SessionError error() const =0
#define emit
Definition: qobjectdefs.h:76
QString identifier() const
Returns the unique and platform specific identifier for this network configuration; otherwise an empt...
QNetworkSession::SessionError error() const

◆ connectTimeout

void QNetworkSessionPrivateImpl::connectTimeout ( )
privateslot

Definition at line 881 of file qnetworksession_impl.cpp.

882 {
887 }
QNetworkConfiguration activeConfig
QNetworkConfiguration & copyConfig(QNetworkConfiguration &fromConfig, QNetworkConfiguration &toConfig, bool deepCopy=true)
virtual QNetworkSession::SessionError error() const =0
#define emit
Definition: qobjectdefs.h:76
QNetworkConfiguration publicConfig
void updateState(QNetworkSession::State)
Type type() const
Returns the type of the configuration.

◆ copyConfig()

QNetworkConfiguration & QNetworkSessionPrivateImpl::copyConfig ( QNetworkConfiguration fromConfig,
QNetworkConfiguration toConfig,
bool  deepCopy = true 
)
private

Definition at line 310 of file qnetworksession_impl.cpp.

Referenced by connectTimeout(), stateChange(), syncStateWithInterface(), and updateState().

313 {
315  if (deepCopy) {
316  cpPriv = new IcdNetworkConfigurationPrivate;
318  } else {
319  cpPriv = toIcdConfig(privateConfiguration(toConfig));
320  }
321 
323 
324  QMutexLocker toLocker(&cpPriv->mutex);
325  QMutexLocker fromLocker(&fromPriv->mutex);
326 
327  cpPriv->name = fromPriv->name;
328  cpPriv->isValid = fromPriv->isValid;
329  // Note that we do not copy id field here as the publicConfig does
330  // not contain a valid IAP id.
331  cpPriv->state = fromPriv->state;
332  cpPriv->type = fromPriv->type;
333  cpPriv->roamingSupported = fromPriv->roamingSupported;
334  cpPriv->purpose = fromPriv->purpose;
335  cpPriv->network_id = fromPriv->network_id;
336  cpPriv->iap_type = fromPriv->iap_type;
337  cpPriv->bearerType = fromPriv->bearerType;
338  cpPriv->network_attrs = fromPriv->network_attrs;
339  cpPriv->service_type = fromPriv->service_type;
340  cpPriv->service_id = fromPriv->service_id;
341  cpPriv->service_attrs = fromPriv->service_attrs;
342 
343  return toConfig;
344 }
QNetworkConfigurationPrivatePointer privateConfiguration(const QNetworkConfiguration &config) const
QNetworkConfiguration::StateFlags state
QNetworkConfiguration::BearerType bearerType
void setPrivateConfiguration(QNetworkConfiguration &config, QNetworkConfigurationPrivatePointer ptr) const
The QMutexLocker class is a convenience class that simplifies locking and unlocking mutexes...
Definition: qmutex.h:101
QNetworkConfiguration::Purpose purpose
IcdNetworkConfigurationPrivate * toIcdConfig(QNetworkConfigurationPrivatePointer ptr)
Definition: qicdengine.h:92
QExplicitlySharedDataPointer< QNetworkConfigurationPrivate > QNetworkConfigurationPrivatePointer
QNetworkConfiguration::Type type

◆ currentInterface() [1/2]

QNetworkInterface QNetworkSessionPrivateImpl::currentInterface ( ) const
virtual

◆ currentInterface() [2/2]

QNetworkInterface QNetworkSessionPrivateImpl::currentInterface ( ) const
virtual

Implements QNetworkSessionPrivate.

Definition at line 985 of file qnetworksession_impl.cpp.

Referenced by QNetworkSessionManagerPrivate::forceSessionClose(), and ~QNetworkSessionPrivateImpl().

986 {
988  return QNetworkInterface();
989 
991  return QNetworkInterface();
992 
994 }
static QNetworkInterface interfaceFromName(const QString &name)
Returns a QNetworkInterface object for the interface named name.
bool isValid() const
Returns true if this QNetworkConfiguration object is valid.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
QNetworkSession::State state
QNetworkConfiguration publicConfig
The QNetworkInterface class provides a listing of the host&#39;s IP addresses and network interfaces...

◆ decrementTimeout

void QNetworkSessionPrivateImpl::decrementTimeout ( )
privateslot

Definition at line 410 of file qnetworksession_impl.cpp.

Referenced by ~QNetworkSessionPrivateImpl().

411 {
412  if (--sessionTimeout <= 0) {
413  disconnect(engine, SIGNAL(updateCompleted()), this, SLOT(decrementTimeout()));
414  sessionTimeout = -1;
415  close();
416  }
417 }
#define SLOT(a)
Definition: qobjectdefs.h:226
#define SIGNAL(a)
Definition: qobjectdefs.h:227
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.
Definition: qobject.cpp:2895

◆ do_open

void QNetworkSessionPrivateImpl::do_open ( )
privateslot

Definition at line 728 of file qnetworksession_impl.cpp.

Referenced by open().

729 {
730  icd_connection_flags flags = connectFlags;
732 
734 #ifdef BEARER_MANAGEMENT_DEBUG
735  qDebug() << "Already connected to" << activeConfig.identifier();
736 #endif
739  return;
740  }
741 
744  else
746 
747  if (iap == OSSO_IAP_ANY) {
748 #ifdef BEARER_MANAGEMENT_DEBUG
749  qDebug() << "connecting to default IAP" << iap;
750 #endif
752  m_dbusInterface->asyncCall(ICD_DBUS_API_CONNECT_REQ, (uint)flags); // Return value ignored
753  m_asynchCallActive = true;
754  } else {
756 
757  icdConfig->mutex.lock();
759  icd2.serviceType = icdConfig->service_type;
760  icd2.serviceAttributes = icdConfig->service_attrs;
761  icd2.setviceId = icdConfig->service_id;
762  icd2.networkType = icdConfig->iap_type;
763  icd2.networkAttributes = icdConfig->network_attrs;
764  if (icdConfig->network_attrs & ICD_NW_ATTR_IAPNAME) {
765  icd2.networkId = QByteArray(iap.toLatin1());
766  } else {
767  icd2.networkId = icdConfig->network_id;
768  }
769  icdConfig->mutex.unlock();
770 
771 #ifdef BEARER_MANAGEMENT_DEBUG
772  qDebug("connecting to %s/%s/0x%x/%s/0x%x/%s",
773  icd2.networkId.data(),
774  icd2.networkType.toAscii().constData(),
775  icd2.networkAttributes,
776  icd2.serviceType.toAscii().constData(),
777  icd2.serviceAttributes,
778  icd2.setviceId.toAscii().constData());
779 #endif
780 
781  ICd2DetailsList paramArray;
782  paramArray.append(icd2);
784  m_dbusInterface->asyncCall(ICD_DBUS_API_CONNECT_REQ, (uint)flags, QVariant::fromValue(paramArray)); // Return value ignored
785  m_asynchCallActive = true;
786  }
787 }
QNetworkConfiguration config
void lock()
Locks the mutex.
Definition: qmutex.cpp:151
QNetworkConfigurationPrivatePointer privateConfiguration(const QNetworkConfiguration &config) const
char * data()
Returns a pointer to the data stored in the byte array.
Definition: qbytearray.h:429
icd_connection_flags connectFlags
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
QDBusPendingCall asyncCall(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...
The QString class provides a Unicode character string.
Definition: qstring.h:83
QNetworkConfiguration activeConfig
#define ICD_LONG_CONNECT_TIMEOUT
Definition: maemo_icd.h:62
Q_CORE_EXPORT void qDebug(const char *,...)
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
#define emit
Definition: qobjectdefs.h:76
QNetworkSession::State state
unsigned int uint
Definition: qglobal.h:996
QByteArray toLatin1() const Q_REQUIRED_RESULT
Returns a Latin-1 representation of the string as a QByteArray.
Definition: qstring.cpp:3993
static QVariant fromValue(const T &value)
Returns a QVariant containing a copy of value.
Definition: qvariant.h:336
void unlock()
Unlocks the mutex.
Definition: qmutex.cpp:296
QNetworkConfiguration publicConfig
const char * constData() const
Returns a pointer to the data stored in the byte array.
Definition: qbytearray.h:433
QString identifier() const
Returns the unique and platform specific identifier for this network configuration; otherwise an empt...
void stateChanged(QNetworkSession::State state)
IcdNetworkConfigurationPrivate * toIcdConfig(QNetworkConfigurationPrivatePointer ptr)
Definition: qicdengine.h:92
QByteArray toAscii() const Q_REQUIRED_RESULT
Returns an 8-bit representation of the string as a QByteArray.
Definition: qstring.cpp:4014
void start(int msec)
Starts or restarts the timer with a timeout interval of msec milliseconds.
Definition: qtimer.cpp:249
The QList class is a template class that provides lists.
Definition: qdatastream.h:62
Type type() const
Returns the type of the configuration.

◆ error() [1/2]

QNetworkSession::SessionError QNetworkSessionPrivateImpl::error ( ) const
virtual

◆ error() [2/2]

QNetworkSession::SessionError QNetworkSessionPrivateImpl::error ( ) const
virtual

◆ errorString() [1/2]

QString QNetworkSessionPrivateImpl::errorString ( ) const
virtual

◆ errorString() [2/2]

QString QNetworkSessionPrivateImpl::errorString ( ) const
virtual

Implements QNetworkSessionPrivate.

Definition at line 1025 of file qnetworksession_impl.cpp.

Referenced by QNetworkSessionManagerPrivate::forceSessionClose(), and ~QNetworkSessionPrivateImpl().

1026 {
1027  QString errorStr;
1028  switch(q->error()) {
1030  errorStr = QNetworkSessionPrivateImpl::tr("Roaming error");
1031  break;
1033  errorStr = QNetworkSessionPrivateImpl::tr("Session aborted by user or system");
1034  break;
1036  errorStr = QNetworkSessionPrivateImpl::tr("The specified configuration cannot be used.");
1037  break;
1038  default:
1040  errorStr = QNetworkSessionPrivateImpl::tr("Unidentified Error");
1041  break;
1042  }
1043  return errorStr;
1044 }
static QString tr(const char *sourceText, const char *comment=0, int n=-1)
SessionError error() const
Returns the type of error that last occurred.
The QString class provides a Unicode character string.
Definition: qstring.h:83

◆ finishStopBySendingClosedSignal

void QNetworkSessionPrivateImpl::finishStopBySendingClosedSignal ( )
privateslot

Definition at line 955 of file qnetworksession_impl.cpp.

956 {
960  }
961 
962  emit closed();
963 }
QNetworkConfiguration activeConfig
#define emit
Definition: qobjectdefs.h:76
QNetworkSession::State state
void stateChanged(QNetworkSession::State state)
StateFlags state() const
Returns the current state of the configuration.

◆ forcedSessionClose

void QNetworkSessionPrivateImpl::forcedSessionClose ( const QNetworkConfiguration config)
privateslot

Definition at line 377 of file qnetworksession_impl.cpp.

Referenced by ~QNetworkSessionPrivateImpl().

378 {
379  if (activeConfig == config) {
380  opened = false;
381  isOpen = false;
382 
383  emit closed();
384 
387  }
388 }
QNetworkSession::SessionError lastError
QNetworkConfiguration activeConfig
virtual QNetworkSession::SessionError error() const =0
#define emit
Definition: qobjectdefs.h:76

◆ getStatistics()

QNetworkSessionPrivateImpl::Statistics QNetworkSessionPrivateImpl::getStatistics ( ) const
private

Definition at line 254 of file qnetworksession_impl.cpp.

Referenced by activeTime(), bytesReceived(), and bytesWritten().

255 {
256  /* This could be also implemented by using the Maemo::Icd::statistics()
257  * that gets the statistics data for a specific IAP. Change if
258  * necessary.
259  */
260  Maemo::Icd icd;
261  QList<Maemo::IcdStatisticsResult> stats_results;
262  Statistics stats = { 0, 0, 0};
263 
264  if (!icd.statistics(stats_results))
265  return stats;
266 
267  foreach (const Maemo::IcdStatisticsResult &res, stats_results) {
268  if (res.params.network_attrs & ICD_NW_ATTR_IAPNAME) {
269  /* network_id is the IAP UUID */
271  stats.txData = res.bytes_sent;
272  stats.rxData = res.bytes_received;
273  stats.activeTime = res.time_active;
274  }
275  } else {
276  /* We probably will never get to this branch */
277  IcdNetworkConfigurationPrivate *icdConfig =
279 
280  icdConfig->mutex.lock();
281  if (res.params.network_id == icdConfig->network_id) {
282  stats.txData = res.bytes_sent;
283  stats.rxData = res.bytes_received;
284  stats.activeTime = res.time_active;
285  }
286  icdConfig->mutex.unlock();
287  }
288  }
289 
290  return stats;
291 }
void lock()
Locks the mutex.
Definition: qmutex.cpp:151
QNetworkConfigurationPrivatePointer privateConfiguration(const QNetworkConfiguration &config) const
char * data()
Returns a pointer to the data stored in the byte array.
Definition: qbytearray.h:429
QByteArray network_id
Definition: maemo_icd.h:72
The QString class provides a Unicode character string.
Definition: qstring.h:83
QNetworkConfiguration activeConfig
struct CommonParams params
Definition: maemo_icd.h:101
void unlock()
Unlocks the mutex.
Definition: qmutex.cpp:296
QString identifier() const
Returns the unique and platform specific identifier for this network configuration; otherwise an empt...
IcdNetworkConfigurationPrivate * toIcdConfig(QNetworkConfigurationPrivatePointer ptr)
Definition: qicdengine.h:92
uint statistics(QList< IcdStatisticsResult > &stats_results)
Definition: maemo_icd.cpp:826
The QList class is a template class that provides lists.
Definition: qdatastream.h:62

◆ iapStateChanged

void QNetworkSessionPrivateImpl::iapStateChanged ( const QString iapid,
uint  icd_connection_state 
)
privateslot

Definition at line 126 of file qnetworksession_impl.cpp.

Referenced by syncStateWithInterface().

127 {
128 
130  (activeConfig.identifier() == iapid)) ||
131  (publicConfig.identifier() == iapid)) {
132  switch (icd_connection_state) {
133  case ICD_STATE_CONNECTING:
135  break;
136  case ICD_STATE_CONNECTED:
138  break;
139  case ICD_STATE_DISCONNECTING:
141  break;
142  case ICD_STATE_DISCONNECTED:
144  break;
145  default:
146  break;
147  }
148  }
150  updateIdentifier(iapid);
151  }
152 }
QNetworkConfiguration activeConfig
QNetworkConfiguration publicConfig
QString identifier() const
Returns the unique and platform specific identifier for this network configuration; otherwise an empt...
void updateIdentifier(const QString &newId)
void updateState(QNetworkSession::State)
Type type() const
Returns the type of the configuration.

◆ ignore() [1/2]

void QNetworkSessionPrivateImpl::ignore ( )
virtual

◆ ignore() [2/2]

void QNetworkSessionPrivateImpl::ignore ( )
virtual

◆ migrate() [1/2]

void QNetworkSessionPrivateImpl::migrate ( )
virtual

◆ migrate() [2/2]

void QNetworkSessionPrivateImpl::migrate ( )
virtual

◆ networkConfigurationsChanged [1/2]

void QNetworkSessionPrivateImpl::networkConfigurationsChanged ( )
privateslot

◆ networkConfigurationsChanged [2/2]

void QNetworkSessionPrivateImpl::networkConfigurationsChanged ( )
privateslot

Definition at line 516 of file qnetworksession_impl.cpp.

Referenced by QNetworkSessionManagerPrivate::forceSessionClose(), syncStateWithInterface(), and ~QNetworkSessionPrivateImpl().

517 {
518  if (serviceConfig.isValid())
520  else
522 }
QNetworkConfiguration serviceConfig
bool isValid() const
Returns true if this QNetworkConfiguration object is valid.

◆ open() [1/2]

void QNetworkSessionPrivateImpl::open ( )
virtual

◆ open() [2/2]

void QNetworkSessionPrivateImpl::open ( )
virtual

Implements QNetworkSessionPrivate.

Definition at line 675 of file qnetworksession_impl.cpp.

Referenced by QNetworkSessionManagerPrivate::forceSessionClose(), and ~QNetworkSessionPrivateImpl().

676 {
677  if (m_stopTimer.isActive()) {
678  m_stopTimer.stop();
679  }
680  if (!publicConfig.isValid()) {
683  return;
684  }
685  if (serviceConfig.isValid()) {
688  } else if (!opened) {
690  /* Caller is trying to connect to default IAP.
691  * At this time we will not know the IAP details so we just
692  * connect and update the active config when the IAP is
693  * connected.
694  */
695  opened = true;
698  QTimer::singleShot(0, this, SLOT(do_open()));
699  return;
700  }
701 
702  /* User is connecting to one specific IAP. If that IAP is not
703  * in discovered state we cannot continue.
704  */
709  return;
710  }
711  opened = true;
712 
716  QTimer::singleShot(0, this, SLOT(do_open()));
717  return;
718  }
720  if (isOpen)
722  } else {
723  /* We seem to be active so inform caller */
725  }
726 }
QNetworkSession::SessionError lastError
#define SLOT(a)
Definition: qobjectdefs.h:226
QNetworkConfiguration serviceConfig
QNetworkConfiguration activeConfig
bool isValid() const
Returns true if this QNetworkConfiguration object is valid.
virtual QNetworkSession::SessionError error() const =0
#define emit
Definition: qobjectdefs.h:76
QNetworkSession::State state
bool isActive() const
Returns true if the timer is running (pending); otherwise returns false.
Definition: qtimer.h:69
QNetworkConfiguration publicConfig
void stateChanged(QNetworkSession::State state)
bool singleShot
This static function calls a slot after a given time interval.
Definition: qtimer.h:59
StateFlags state() const
Returns the current state of the configuration.
void stop()
Stops the timer.
Definition: qtimer.cpp:284
Type type() const
Returns the type of the configuration.

◆ reject() [1/2]

void QNetworkSessionPrivateImpl::reject ( )
virtual

◆ reject() [2/2]

void QNetworkSessionPrivateImpl::reject ( )
virtual

◆ sessionProperty() [1/2]

QVariant QNetworkSessionPrivateImpl::sessionProperty ( const QString key) const
virtual

◆ sessionProperty() [2/2]

QVariant QNetworkSessionPrivateImpl::sessionProperty ( const QString key) const
virtual

Implements QNetworkSessionPrivate.

Definition at line 1019 of file qnetworksession_impl.cpp.

Referenced by QNetworkSessionManagerPrivate::forceSessionClose(), and ~QNetworkSessionPrivateImpl().

1020 {
1021  return properties.value(key);
1022 }
const T value(const Key &key) const
Returns the value associated with the key.
Definition: qhash.h:606
static QHash< QString, QVariant > properties

◆ setSessionProperty() [1/2]

void QNetworkSessionPrivateImpl::setSessionProperty ( const QString key,
const QVariant value 
)
virtual

◆ setSessionProperty() [2/2]

void QNetworkSessionPrivateImpl::setSessionProperty ( const QString key,
const QVariant value 
)
virtual

Implements QNetworkSessionPrivate.

Definition at line 997 of file qnetworksession_impl.cpp.

Referenced by QNetworkSessionManagerPrivate::forceSessionClose(), and ~QNetworkSessionPrivateImpl().

998 {
999  if (value.isValid()) {
1000  properties.insert(key, value);
1001 
1002  if (key == "ConnectInBackground") {
1003  bool v = value.toBool();
1004  if (v)
1005  connectFlags = ICD_CONNECTION_FLAG_APPLICATION_EVENT;
1006  else
1007  connectFlags = ICD_CONNECTION_FLAG_USER_EVENT;
1008  }
1009  } else {
1010  properties.remove(key);
1011 
1012  /* Set default value when property is removed */
1013  if (key == "ConnectInBackground")
1014  connectFlags = ICD_CONNECTION_FLAG_USER_EVENT;
1015  }
1016 }
int remove(const Key &key)
Removes all the items that have the key from the hash.
Definition: qhash.h:784
icd_connection_flags connectFlags
bool toBool() const
Returns the variant as a bool if the variant has type() Bool.
Definition: qvariant.cpp:2691
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
Definition: qhash.h:753
bool isValid() const
Returns true if the storage type of this variant is not QVariant::Invalid; otherwise returns false...
Definition: qvariant.h:485
static QHash< QString, QVariant > properties

◆ stateChange

void QNetworkSessionPrivateImpl::stateChange ( const QDBusMessage rep)
privateslot

Definition at line 789 of file qnetworksession_impl.cpp.

790 {
791  if (m_asynchCallActive == true) {
794  m_asynchCallActive = false;
795 
796  QString result = rep.arguments().at(5).toString(); // network id or empty string
797  QString connected_iap = result;
798  if (connected_iap.isEmpty()) {
799 #ifdef BEARER_MANAGEMENT_DEBUG
800  qDebug() << "connect to"<< publicConfig.identifier() << "failed, result is empty";
801 #endif
806  return;
807  }
808 
809  /* If the user tried to connect to some specific connection (foo)
810  * and we were already connected to some other connection (bar),
811  * then we cannot activate this session although icd has a valid
812  * connection to somewhere.
813  */
815  (connected_iap != config.identifier())) {
818  return;
819  }
820 
822 
823  /* Did we connect to non saved IAP? */
824  icdConfig->mutex.lock();
825  if (!(icdConfig->network_attrs & ICD_NW_ATTR_IAPNAME)) {
826  /* Because the connection succeeded, the IAP is now known.
827  */
828  icdConfig->network_attrs |= ICD_NW_ATTR_IAPNAME;
829  icdConfig->id = connected_iap;
830  }
831 
832  /* User might have changed the IAP name when a new IAP was saved */
833  Maemo::IAPConf iap_name(icdConfig->id);
834  QString name = iap_name.value("name").toString();
835  if (!name.isEmpty())
836  icdConfig->name = name;
837 
838  icdConfig->iap_type = rep.arguments().at(3).toString(); // connect_result.connect.network_type;
839  icdConfig->bearerType = bearerTypeFromIapType(icdConfig->iap_type);
840  icdConfig->isValid = true;
843 
844  icdConfig->mutex.unlock();
845 
848  //currentNetworkInterface = get_network_interface();
849 #ifdef BEARER_MANAGEMENT_DEBUG
850  //qDebug() << "connected to" << result << config.name() << "at" << currentNetworkInterface;
851 #endif
852 
853  /* We first check if the configuration already exists in the manager
854  * and if it is not found there, we then insert it. Note that this
855  * is only done for user choice config only because it can be missing
856  * from config manager list.
857  */
859  if (!engine->hasIdentifier(result)) {
861  } else {
863  QNetworkConfiguration reference;
864  setPrivateConfiguration(reference, priv);
865  copyConfig(config, reference, false);
866  privateConfiguration(reference)->id = result; // Note: Id was not copied in copyConfig() function
867  config = reference;
868  activeConfig = reference;
870 
871 #ifdef BEARER_MANAGEMENT_DEBUG
872  qDebug()<<"Existing configuration"<<result<<"updated in manager in open";
873 #endif
874  }
875  }
876 
878  }
879 }
QNetworkConfiguration config
void lock()
Locks the mutex.
Definition: qmutex.cpp:151
QNetworkConfigurationPrivatePointer privateConfiguration(const QNetworkConfiguration &config) const
QNetworkConfiguration::StateFlags state
QString toString() const
Returns the variant as a QString if the variant has type() String , Bool , ByteArray ...
Definition: qvariant.cpp:2270
The QString class provides a Unicode character string.
Definition: qstring.h:83
QNetworkConfiguration activeConfig
QNetworkConfiguration::BearerType bearerType
QNetworkConfiguration & copyConfig(QNetworkConfiguration &fromConfig, QNetworkConfiguration &toConfig, bool deepCopy=true)
void addSessionConfiguration(QNetworkConfigurationPrivatePointer ptr)
Definition: qicdengine.h:125
Q_CORE_EXPORT void qDebug(const char *,...)
The QNetworkConfiguration class provides an abstraction of one or more access point configurations...
QList< QVariant > arguments() const
Returns the list of arguments that are going to be sent or were received from D-Bus.
virtual QNetworkSession::SessionError error() const =0
void setPrivateConfiguration(QNetworkConfiguration &config, QNetworkConfigurationPrivatePointer ptr) const
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
const char * name
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
#define emit
Definition: qobjectdefs.h:76
void changedSessionConfiguration(QNetworkConfigurationPrivatePointer ptr)
Definition: qicdengine.h:135
bool isActive() const
Returns true if the timer is running (pending); otherwise returns false.
Definition: qtimer.h:69
void unlock()
Unlocks the mutex.
Definition: qmutex.cpp:296
QNetworkConfiguration publicConfig
QString identifier() const
Returns the unique and platform specific identifier for this network configuration; otherwise an empt...
IcdNetworkConfigurationPrivate * toIcdConfig(QNetworkConfigurationPrivatePointer ptr)
Definition: qicdengine.h:92
bool hasIdentifier(const QString &id)
QNetworkConfiguration::Type type
static const QMetaObjectPrivate * priv(const uint *data)
static QDateTime currentDateTime()
Returns the current datetime, as reported by the system clock, in the local time zone.
Definition: qdatetime.cpp:3138
void updateState(QNetworkSession::State)
void stop()
Stops the timer.
Definition: qtimer.cpp:284
QNetworkConfiguration::BearerType bearerTypeFromIapType(const QString &iapType)
Definition: qicdengine.h:58
QNetworkConfigurationPrivatePointer configuration(const QString &id)
Definition: qicdengine.h:118
Type type() const
Returns the type of the configuration.

◆ stop() [1/2]

void QNetworkSessionPrivateImpl::stop ( )
virtual

◆ stop() [2/2]

void QNetworkSessionPrivateImpl::stop ( )
virtual

Implements QNetworkSessionPrivate.

Definition at line 923 of file qnetworksession_impl.cpp.

Referenced by QNetworkSessionManagerPrivate::forceSessionClose(), and ~QNetworkSessionPrivateImpl().

924 {
927 
928  if (serviceConfig.isValid()) {
931  } else {
933 #ifdef BEARER_MANAGEMENT_DEBUG
934  qDebug() << "stopping session" << publicConfig.identifier();
935 #endif
938 
939  // we fake a disconnection, a session error is sent also
941 
942  opened = false;
943  isOpen = false;
944 
945  m_dbusInterface->call(ICD_DBUS_API_DISCONNECT_REQ, ICD_CONNECTION_FLAG_APPLICATION_EVENT);
946  startTime = QDateTime();
947  } else {
948  opened = false;
949  isOpen = false;
950  emit closed();
951  }
952  }
953 }
QNetworkSession::SessionError lastError
QNetworkConfiguration serviceConfig
QNetworkConfiguration activeConfig
Q_CORE_EXPORT void qDebug(const char *,...)
bool isValid() const
Returns true if this QNetworkConfiguration object is valid.
virtual QNetworkSession::SessionError error() const =0
#define emit
Definition: qobjectdefs.h:76
QNetworkSession::State state
bool isActive() const
Returns true if the timer is running (pending); otherwise returns false.
Definition: qtimer.h:69
QNetworkConfiguration publicConfig
QString identifier() const
Returns the unique and platform specific identifier for this network configuration; otherwise an empt...
void stateChanged(QNetworkSession::State state)
The QDateTime class provides date and time functions.
Definition: qdatetime.h:216
StateFlags state() const
Returns the current state of the configuration.
void updateState(QNetworkSession::State)
void stop()
Stops the timer.
Definition: qtimer.cpp:284
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...

◆ syncStateWithInterface() [1/2]

void QNetworkSessionPrivateImpl::syncStateWithInterface ( )
virtual

◆ syncStateWithInterface() [2/2]

void QNetworkSessionPrivateImpl::syncStateWithInterface ( )
virtual

Implements QNetworkSessionPrivate.

Definition at line 350 of file qnetworksession_impl.cpp.

Referenced by QNetworkSessionManagerPrivate::forceSessionClose(), and ~QNetworkSessionPrivateImpl().

351 {
352  /* Initially we are not active although the configuration might be in
353  * connected state.
354  */
355  isOpen = false;
356  opened = false;
357 
359  this, SLOT(iapStateChanged(const QString&, uint)));
360 
362 
365 
366  switch (publicConfig.type()) {
369  break;
372  break;
374  // active config will contain correct data after open() has succeeded
376 
377  /* We create new configuration that holds the actual configuration
378  * returned by icd. This way publicConfig still contains the
379  * original user specified configuration.
380  *
381  * Note that the new activeConfig configuration is not inserted
382  * to configurationManager as manager class will get the newly
383  * connected configuration from gconf when the IAP is saved.
384  * This configuration manager update is done by IapMonitor class.
385  * If the ANY connection fails in open(), then the configuration
386  * data is not saved to gconf and will not be added to
387  * configuration manager IAP list.
388  */
389 #ifdef BEARER_MANAGEMENT_DEBUG
390  qDebug()<<"New configuration created for" << publicConfig.identifier();
391 #endif
392  break;
393  default:
394  /* Invalid configuration, no point continuing */
395  return;
396  }
397 
398  if (!activeConfig.isValid())
399  return;
400 
401  /* Get the initial state from icd */
402  Maemo::Icd icd;
403  QList<Maemo::IcdStateResult> state_results;
404 
405  /* Update the active config from first connection, this is ok as icd
406  * supports only one connection anyway.
407  */
408  if (icd.state(state_results) && !state_results.isEmpty()) {
409  /* If we did not get full state back, then we are not
410  * connected and can skip the next part.
411  */
412  if (!(state_results.first().params.network_attrs == 0 &&
413  state_results.first().params.network_id.isEmpty())) {
414 
415  /* If we try to connect to specific IAP and we get results back
416  * that tell the icd is actually connected to another IAP,
417  * then do not update current state etc.
418  */
420  publicConfig.identifier() == state_results.first().params.network_id) {
421  switch (state_results.first().state) {
422  case ICD_STATE_DISCONNECTED:
425  ptr->mutex.lock();
426  ptr->isValid = true;
427  ptr->mutex.unlock();
428  }
429  break;
430  case ICD_STATE_CONNECTING:
433  ptr->mutex.lock();
434  ptr->isValid = true;
435  ptr->mutex.unlock();
436  }
437  break;
438  case ICD_STATE_CONNECTED:
439  {
440  if (!state_results.first().error.isEmpty())
441  break;
442 
443  const QString id = state_results.first().params.network_id;
444 
446  if (config.isValid()) {
447  //we don't want the copied data if the config is already known by the manager
448  //just reuse it so that existing references to the old data get the same update
450  }
451 
453 
454  QMutexLocker configLocker(&ptr->mutex);
455 
457  toIcdConfig(ptr)->network_id = state_results.first().params.network_id;
458  ptr->id = toIcdConfig(ptr)->network_id;
459  toIcdConfig(ptr)->network_attrs = state_results.first().params.network_attrs;
460  toIcdConfig(ptr)->iap_type = state_results.first().params.network_type;
461  ptr->bearerType = bearerTypeFromIapType(toIcdConfig(ptr)->iap_type);
462  toIcdConfig(ptr)->service_type = state_results.first().params.service_type;
463  toIcdConfig(ptr)->service_id = state_results.first().params.service_id;
464  toIcdConfig(ptr)->service_attrs = state_results.first().params.service_attrs;
467  ptr->isValid = true;
469 
470  Maemo::IAPConf iap_name(ptr->id);
471  QString name_value = iap_name.value("name").toString();
472  if (!name_value.isEmpty())
473  ptr->name = name_value;
474  else
475  ptr->name = ptr->id;
476 
477  const QString identifier = ptr->id;
478 
479  configLocker.unlock();
480 
481  // Add the new active configuration to manager or update the old config
482  if (!engine->hasIdentifier(identifier))
484  else
486  }
487  break;
488 
489  case ICD_STATE_DISCONNECTING:
492  ptr->mutex.lock();
493  ptr->isValid = true;
494  ptr->mutex.unlock();
495  }
496  break;
497  default:
498  break;
499  }
500  }
501  } else {
502 #ifdef BEARER_MANAGEMENT_DEBUG
503  qDebug() << "status_req tells icd is not connected";
504 #endif
505  }
506  } else {
507 #ifdef BEARER_MANAGEMENT_DEBUG
508  qDebug() << "status_req did not return any results from icd";
509 #endif
510  }
511 
513 }
QNetworkConfiguration config
void lock()
Locks the mutex.
Definition: qmutex.cpp:151
QNetworkConfigurationPrivatePointer privateConfiguration(const QNetworkConfiguration &config) const
QNetworkConfiguration::StateFlags state
QString service_id
Definition: maemo_icd.h:69
QNetworkSession::SessionError lastError
#define SLOT(a)
Definition: qobjectdefs.h:226
QByteArray network_id
Definition: maemo_icd.h:72
State
This enum describes the connectivity state of the session.
QNetworkConfiguration serviceConfig
The QString class provides a Unicode character string.
Definition: qstring.h:83
QNetworkConfiguration activeConfig
QNetworkConfiguration::BearerType bearerType
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
Definition: qlist.h:152
QNetworkConfiguration & copyConfig(QNetworkConfiguration &fromConfig, QNetworkConfiguration &toConfig, bool deepCopy=true)
void addSessionConfiguration(QNetworkConfigurationPrivatePointer ptr)
Definition: qicdengine.h:125
Q_CORE_EXPORT void qDebug(const char *,...)
#define SIGNAL(a)
Definition: qobjectdefs.h:227
bool isValid() const
Returns true if this QNetworkConfiguration object is valid.
The QNetworkConfiguration class provides an abstraction of one or more access point configurations...
void setPrivateConfiguration(QNetworkConfiguration &config, QNetworkConfigurationPrivatePointer ptr) const
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
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
void updateProxies(QNetworkSession::State newState)
QNetworkSession::State state
QNetworkConfigurationManager manager
unsigned int uint
Definition: qglobal.h:996
void changedSessionConfiguration(QNetworkConfigurationPrivatePointer ptr)
Definition: qicdengine.h:135
const T * ptr(const T &t)
struct CommonParams params
Definition: maemo_icd.h:95
void unlock()
Unlocks the mutex.
Definition: qmutex.cpp:296
void iapStateChanged(const QString &iapid, uint icd_connection_state)
QNetworkConfiguration publicConfig
T & first()
Returns a reference to the first item in the list.
Definition: qlist.h:282
uint state(QString &service_type, uint service_attrs, QString &service_id, QString &network_type, uint network_attrs, QByteArray &network_id, IcdStateResult &state_result)
Definition: maemo_icd.cpp:798
The QMutexLocker class is a convenience class that simplifies locking and unlocking mutexes...
Definition: qmutex.h:101
QString identifier() const
Returns the unique and platform specific identifier for this network configuration; otherwise an empt...
void stateChanged(QNetworkSession::State state)
IcdNetworkConfigurationPrivate * toIcdConfig(QNetworkConfigurationPrivatePointer ptr)
Definition: qicdengine.h:92
bool hasIdentifier(const QString &id)
QNetworkConfiguration::Type type
QNetworkConfiguration configurationFromIdentifier(const QString &identifier) const
Returns the QNetworkConfiguration for identifier; otherwise returns an invalid QNetworkConfiguration...
bool isEmpty() const
Returns true if the byte array has size 0; otherwise returns false.
Definition: qbytearray.h:421
QString service_type
Definition: maemo_icd.h:67
static QString get_network_interface()
QNetworkConfiguration::BearerType bearerTypeFromIapType(const QString &iapType)
Definition: qicdengine.h:58
The QList class is a template class that provides lists.
Definition: qdatastream.h:62
Type type() const
Returns the type of the configuration.
QString network_type
Definition: maemo_icd.h:70

◆ updateIdentifier()

void QNetworkSessionPrivateImpl::updateIdentifier ( const QString newId)
private

Definition at line 231 of file qnetworksession_impl.cpp.

Referenced by iapStateChanged().

232 {
234  IcdNetworkConfigurationPrivate *icdConfig =
236 
237  icdConfig->mutex.lock();
238  icdConfig->network_attrs |= ICD_NW_ATTR_IAPNAME;
239  icdConfig->id = newId;
240  icdConfig->mutex.unlock();
241  } else {
242  IcdNetworkConfigurationPrivate *icdConfig =
244 
245  icdConfig->mutex.lock();
246  icdConfig->network_attrs |= ICD_NW_ATTR_IAPNAME;
247  if (icdConfig->id != newId)
248  icdConfig->id = newId;
249  icdConfig->mutex.unlock();
250  }
251 }
void lock()
Locks the mutex.
Definition: qmutex.cpp:151
QNetworkConfigurationPrivatePointer privateConfiguration(const QNetworkConfiguration &config) const
QNetworkConfiguration activeConfig
void unlock()
Unlocks the mutex.
Definition: qmutex.cpp:296
QNetworkConfiguration publicConfig
IcdNetworkConfigurationPrivate * toIcdConfig(QNetworkConfigurationPrivatePointer ptr)
Definition: qicdengine.h:92
Type type() const
Returns the type of the configuration.

◆ updateProxies

void QNetworkSessionPrivateImpl::updateProxies ( QNetworkSession::State  newState)
privateslot

◆ updateProxyInformation()

void QNetworkSessionPrivateImpl::updateProxyInformation ( )
private

Definition at line 1065 of file qnetworksession_impl.cpp.

Referenced by updateProxies().

1066 {
1068 }
static void update(void)
Definition: proxyconf.cpp:401

◆ updateState()

void QNetworkSessionPrivateImpl::updateState ( QNetworkSession::State  newState)
private

Definition at line 161 of file qnetworksession_impl.cpp.

Referenced by close(), connectTimeout(), iapStateChanged(), stateChange(), and stop().

162 {
163  if (newState != state) {
164  if (newState == QNetworkSession::Disconnected) {
165  if (isOpen) {
166  // The Session was aborted by the user or system
169  emit closed();
170  }
171  if (m_stopTimer.isActive()) {
172  // Session was closed by calling stop()
173  m_stopTimer.stop();
174  }
175  isOpen = false;
176  opened = false;
180  IcdNetworkConfigurationPrivate *icdConfig =
182 
183  icdConfig->mutex.lock();
185  icdConfig->mutex.unlock();
186 
187  // Reset the state of the default configuration to Discovered
189  icdConfig->mutex.lock();
191  icdConfig->mutex.unlock();
192  } else {
193  if (!activeConfig.isValid()) {
194  // Active configuration (IAP) was removed from system
195  // => Connection was disconnected and configuration became
196  // invalid
197  // => Also Session state must be changed to invalid
198  newState = QNetworkSession::Invalid;
199  }
200  }
201  } else if (newState == QNetworkSession::Connected) {
202  if (opened) {
203  isOpen = true;
204  }
206  IcdNetworkConfigurationPrivate *icdConfig =
208 
209  icdConfig->mutex.lock();
212  icdConfig->mutex.unlock();
213  }
214 
215  IcdNetworkConfigurationPrivate *icdConfig =
217 
218  icdConfig->mutex.lock();
220  icdConfig->mutex.unlock();
221  }
222 
223  if (newState != state) {
224  state = newState;
225  emit stateChanged(newState);
226  }
227  }
228 }
void lock()
Locks the mutex.
Definition: qmutex.cpp:151
QNetworkConfigurationPrivatePointer privateConfiguration(const QNetworkConfiguration &config) const
QNetworkConfiguration::StateFlags state
QNetworkSession::SessionError lastError
QNetworkConfiguration activeConfig
QNetworkConfiguration & copyConfig(QNetworkConfiguration &fromConfig, QNetworkConfiguration &toConfig, bool deepCopy=true)
bool isValid() const
Returns true if this QNetworkConfiguration object is valid.
virtual QNetworkSession::SessionError error() const =0
#define emit
Definition: qobjectdefs.h:76
QNetworkSession::State state
bool isActive() const
Returns true if the timer is running (pending); otherwise returns false.
Definition: qtimer.h:69
void unlock()
Unlocks the mutex.
Definition: qmutex.cpp:296
QNetworkConfiguration publicConfig
void stateChanged(QNetworkSession::State state)
IcdNetworkConfigurationPrivate * toIcdConfig(QNetworkConfigurationPrivatePointer ptr)
Definition: qicdengine.h:92
void clear()
Clears the contents of the string and makes it empty.
Definition: qstring.h:723
QNetworkConfiguration::Type type
void stop()
Stops the timer.
Definition: qtimer.cpp:284
Type type() const
Returns the type of the configuration.

◆ updateStateFromActiveConfig() [1/2]

void QNetworkSessionPrivateImpl::updateStateFromActiveConfig ( )
private

◆ updateStateFromActiveConfig() [2/2]

void QNetworkSessionPrivateImpl::updateStateFromActiveConfig ( )
private

Definition at line 570 of file qnetworksession_impl.cpp.

Referenced by QNetworkSessionManagerPrivate::forceSessionClose(), networkConfigurationsChanged(), and ~QNetworkSessionPrivateImpl().

571 {
572  QNetworkSession::State oldState = state;
573 
574  bool newActive = false;
575 
576  if (!activeConfig.isValid())
577  return;
578 
579  if (!activeConfig.isValid()) {
584  newActive = opened;
591  }
592 
593  bool oldActive = isOpen;
594  isOpen = newActive;
595 
596  if (!oldActive && isOpen)
598 
599  if (oldActive && !isOpen)
600  emit closed();
601 
602  if (oldState != state) {
604 
605  if (state == QNetworkSession::Disconnected && oldActive) {
606 #ifdef BEARER_MANAGEMENT_DEBUG
607  //qDebug()<<"session aborted error emitted for"<<activeConfig.identifier();
608 #endif
611  }
612  }
613 
614 #ifdef BEARER_MANAGEMENT_DEBUG
615  //qDebug()<<"oldState ="<<oldState<<" state ="<<state<<" oldActive ="<<oldActive<<" newActive ="<<newActive<<" opened ="<<opened;
616 #endif
617 }
QNetworkSession::SessionError lastError
State
This enum describes the connectivity state of the session.
QNetworkConfiguration activeConfig
bool isValid() const
Returns true if this QNetworkConfiguration object is valid.
virtual QNetworkSession::SessionError error() const =0
#define emit
Definition: qobjectdefs.h:76
QNetworkSession::State state
void clearConfiguration(QNetworkConfiguration &config)
void stateChanged(QNetworkSession::State state)
StateFlags state() const
Returns the current state of the configuration.

◆ updateStateFromServiceNetwork() [1/2]

void QNetworkSessionPrivateImpl::updateStateFromServiceNetwork ( )
private

◆ updateStateFromServiceNetwork() [2/2]

void QNetworkSessionPrivateImpl::updateStateFromServiceNetwork ( )
private

Definition at line 525 of file qnetworksession_impl.cpp.

Referenced by QNetworkSessionManagerPrivate::forceSessionClose(), networkConfigurationsChanged(), and ~QNetworkSessionPrivateImpl().

526 {
527  QNetworkSession::State oldState = state;
528 
529  foreach (const QNetworkConfiguration &config, serviceConfig.children()) {
531  continue;
532 
533  if (activeConfig != config) {
536  }
537 
539  if (state != oldState)
541 
542  return;
543  }
544 
545  if (serviceConfig.children().isEmpty())
547  else
549 
550  if (state != oldState)
552 }
QNetworkConfiguration config
State
This enum describes the connectivity state of the session.
QNetworkConfiguration serviceConfig
QList< QNetworkConfiguration > children() const
Returns all sub configurations of this network configuration in priority order.
QNetworkConfiguration activeConfig
The QNetworkConfiguration class provides an abstraction of one or more access point configurations...
#define emit
Definition: qobjectdefs.h:76
QNetworkSession::State state
void stateChanged(QNetworkSession::State state)
StateFlags state() const
Returns the current state of the configuration.

Friends and Related Functions

◆ IcdListener

friend class IcdListener
friend

Definition at line 197 of file qnetworksession_impl.h.

Properties

◆ config

QNetworkConfiguration QNetworkSessionPrivateImpl::config
private

◆ connectFlags

icd_connection_flags QNetworkSessionPrivateImpl::connectFlags
private

Definition at line 191 of file qnetworksession_impl.h.

Referenced by do_open(), and setSessionProperty().

◆ currentNetworkInterface

QString QNetworkSessionPrivateImpl::currentNetworkInterface
private

Definition at line 196 of file qnetworksession_impl.h.

Referenced by currentInterface(), syncStateWithInterface(), and updateState().

◆ currentState

QNetworkSession::State QNetworkSessionPrivateImpl::currentState
private

Definition at line 205 of file qnetworksession_impl.h.

Referenced by updateProxies().

◆ engine [1/2]

QBearerEngineImpl* QNetworkSessionPrivateImpl::engine
private

Definition at line 117 of file qnetworksession_impl.h.

◆ engine [2/2]

QIcdEngine* QNetworkSessionPrivateImpl::engine
private

Definition at line 176 of file qnetworksession_impl.h.

Referenced by stateChange(), and syncStateWithInterface().

◆ lastError

QNetworkSession::SessionError QNetworkSessionPrivateImpl::lastError
private

◆ m_asynchCallActive

bool QNetworkSessionPrivateImpl::m_asynchCallActive
private

Definition at line 211 of file qnetworksession_impl.h.

Referenced by do_open(), and stateChange().

◆ m_connectRequestTimer

QTimer QNetworkSessionPrivateImpl::m_connectRequestTimer
private

Definition at line 212 of file qnetworksession_impl.h.

Referenced by close(), do_open(), stateChange(), and stop().

◆ m_dbusInterface

QDBusInterface* QNetworkSessionPrivateImpl::m_dbusInterface
private

Definition at line 207 of file qnetworksession_impl.h.

Referenced by close(), do_open(), and stop().

◆ m_stopTimer

QTimer QNetworkSessionPrivateImpl::m_stopTimer
private

Definition at line 209 of file qnetworksession_impl.h.

Referenced by open(), and updateState().

◆ manager

QNetworkConfigurationManager QNetworkSessionPrivateImpl::manager
private

Definition at line 175 of file qnetworksession_impl.h.

Referenced by syncStateWithInterface().

◆ opened

bool QNetworkSessionPrivateImpl::opened
private

◆ sessionTimeout

int QNetworkSessionPrivateImpl::sessionTimeout
private

Definition at line 123 of file qnetworksession_impl.h.

◆ startTime [1/2]

quint64 QNetworkSessionPrivateImpl::startTime
private

Definition at line 119 of file qnetworksession_impl.h.

◆ startTime [2/2]

QDateTime QNetworkSessionPrivateImpl::startTime
private

Definition at line 195 of file qnetworksession_impl.h.

Referenced by close(), stateChange(), and stop().


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