Go to the
documentation of this file.
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 #ifndef QNETWORKSESSION_H
00043 #define QNETWORKSESSION_H
00044
00045 #include <QtCore/qobject.h>
00046 #include <QtCore/qstring.h>
00047 #include <QtNetwork/qnetworkinterface.h>
00048 #include <QtCore/qvariant.h>
00049 #include <QtNetwork/qnetworkconfiguration.h>
00050
00051 #ifndef QT_NO_BEARERMANAGEMENT
00052
00053 #if defined(Q_OS_WIN) && defined(interface)
00054 #undef interface
00055 #endif
00056
00057 QT_BEGIN_HEADER
00058
00059 #ifndef QT_MOBILITY_BEARER
00060 #include <QtCore/qshareddata.h>
00061 QT_BEGIN_NAMESPACE
00062 QT_MODULE(Network)
00063 #define QNetworkSessionExport Q_NETWORK_EXPORT
00064 #else
00065 #include "qmobilityglobal.h"
00066 QTM_BEGIN_NAMESPACE
00067 #define QNetworkSessionExport Q_BEARER_EXPORT
00068 #endif
00069
00070 class QNetworkSessionPrivate;
00071 class QNetworkSessionExport QNetworkSession : public QObject
00072 {
00073 Q_OBJECT
00074 public:
00075 enum State {
00076 Invalid = 0,
00077 NotAvailable,
00078 Connecting,
00079 Connected,
00080 Closing,
00081 Disconnected,
00082 Roaming
00083 };
00084
00085 enum SessionError {
00086 UnknownSessionError = 0,
00087 SessionAbortedError,
00088 RoamingError,
00089 OperationNotSupportedError,
00090 InvalidConfigurationError
00091 };
00092 explicit QNetworkSession(const QNetworkConfiguration& connConfig, QObject* parent =0);
00093 virtual ~QNetworkSession();
00094
00095 bool isOpen() const;
00096 QNetworkConfiguration configuration() const;
00097 #ifndef QT_NO_NETWORKINTERFACE
00098 QNetworkInterface interface() const;
00099 #endif
00100
00101 State state() const;
00102 SessionError error() const;
00103 QString errorString() const;
00104 QVariant sessionProperty(const QString& key) const;
00105 void setSessionProperty(const QString& key, const QVariant& value);
00106
00107 quint64 bytesWritten() const;
00108 quint64 bytesReceived() const;
00109 quint64 activeTime() const;
00110
00111 bool waitForOpened(int msecs = 30000);
00112
00113 public Q_SLOTS:
00114 void open();
00115 void close();
00116 void stop();
00117
00118
00119 void migrate();
00120 void ignore();
00121 void accept();
00122 void reject();
00123
00124
00125 Q_SIGNALS:
00126 void stateChanged(QNetworkSession::State);
00127 void opened();
00128 void closed();
00129 void error(QNetworkSession::SessionError);
00130 void preferredConfigurationChanged(const QNetworkConfiguration& config, bool isSeamless);
00131 void newConfigurationActivated();
00132
00133 protected:
00134 virtual void connectNotify(const char *signal);
00135 virtual void disconnectNotify(const char *signal);
00136
00137 private:
00138 QNetworkSessionPrivate* d;
00139 friend class QNetworkSessionPrivate;
00140 };
00141
00142 #ifndef QT_MOBILITY_BEARER
00143 QT_END_NAMESPACE
00144 #else
00145 QTM_END_NAMESPACE
00146 #endif
00147
00148 QT_END_HEADER
00149
00150 #endif // QT_NO_BEARERMANAGEMENT
00151
00152 #endif //QNETWORKSESSION_H