1 /****************************************************************************
3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: Nokia Corporation (qt-info@nokia.com)
7 ** This file is part of the QtNetwork module of the Qt Toolkit.
9 ** $QT_BEGIN_LICENSE:LGPL$
10 ** No Commercial Usage
11 ** This file contains pre-release code and may not be distributed.
12 ** You may use this file in accordance with the terms and conditions
13 ** contained in the Technology Preview License Agreement accompanying
16 ** GNU Lesser General Public License Usage
17 ** Alternatively, this file may be used under the terms of the GNU Lesser
18 ** General Public License version 2.1 as published by the Free Software
19 ** Foundation and appearing in the file LICENSE.LGPL included in the
20 ** packaging of this file. Please review the following information to
21 ** ensure the GNU Lesser General Public License version 2.1 requirements
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 ** In addition, as a special exception, Nokia gives you certain additional
25 ** rights. These rights are described in the Nokia Qt LGPL Exception
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
40 ****************************************************************************/
42 #ifndef QNETWORKSESSION_H
43 #define QNETWORKSESSION_H
45 #include <QtCore/qobject.h>
46 #include <QtCore/qstring.h>
47 #include <QtNetwork/qnetworkinterface.h>
48 #include <QtCore/qvariant.h>
49 #include <QtNetwork/qnetworkconfiguration.h>
51 #ifndef QT_NO_BEARERMANAGEMENT
53 #if defined(Q_OS_WIN) && defined(interface)
59 #ifndef QT_MOBILITY_BEARER
60 #include <QtCore/qshareddata.h>
63 #define QNetworkSessionExport Q_NETWORK_EXPORT
65 #include "qmobilityglobal.h"
67 #define QNetworkSessionExport Q_BEARER_EXPORT
70 class QNetworkSessionPrivate;
71 class QNetworkSessionExport QNetworkSession : public QObject
86 UnknownSessionError = 0,
89 OperationNotSupportedError,
90 InvalidConfigurationError
92 explicit QNetworkSession(const QNetworkConfiguration& connConfig, QObject* parent =0);
93 virtual ~QNetworkSession();
96 QNetworkConfiguration configuration() const;
97 #ifndef QT_NO_NETWORKINTERFACE
98 QNetworkInterface interface() const;
102 SessionError error() const;
103 QString errorString() const;
104 QVariant sessionProperty(const QString& key) const;
105 void setSessionProperty(const QString& key, const QVariant& value);
107 quint64 bytesWritten() const;
108 quint64 bytesReceived() const;
109 quint64 activeTime() const;
111 bool waitForOpened(int msecs = 30000);
118 //roaming related slots
126 void stateChanged(QNetworkSession::State);
129 void error(QNetworkSession::SessionError);
130 void preferredConfigurationChanged(const QNetworkConfiguration& config, bool isSeamless);
131 void newConfigurationActivated();
134 virtual void connectNotify(const char *signal);
135 virtual void disconnectNotify(const char *signal);
138 QNetworkSessionPrivate* d;
139 friend class QNetworkSessionPrivate;
142 #ifndef QT_MOBILITY_BEARER
148 Q_DECLARE_METATYPE(QNetworkSession::State)
149 Q_DECLARE_METATYPE(QNetworkSession::SessionError)
153 #endif // QT_NO_BEARERMANAGEMENT
155 #endif //QNETWORKSESSION_H