|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** All rights reserved. |
|
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 ** |
|
7 ** This file is part of the Qt Mobility Components. |
|
8 ** |
|
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 |
|
14 ** this package. |
|
15 ** |
|
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. |
|
23 ** |
|
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. |
|
27 ** |
|
28 ** If you have questions regarding the use of this file, please contact |
|
29 ** Nokia at qt-info@nokia.com. |
|
30 ** |
|
31 ** |
|
32 ** |
|
33 ** |
|
34 ** |
|
35 ** |
|
36 ** |
|
37 ** |
|
38 ** $QT_END_LICENSE$ |
|
39 ** |
|
40 ****************************************************************************/ |
|
41 |
|
42 #ifndef QNMWIFIENGINE_P_H |
|
43 #define QNMWIFIENGINE_P_H |
|
44 |
|
45 // |
|
46 // W A R N I N G |
|
47 // ------------- |
|
48 // |
|
49 // This file is not part of the Qt API. It exists purely as an |
|
50 // implementation detail. This header file may change from version to |
|
51 // version without notice, or even be removed. |
|
52 // |
|
53 // We mean it. |
|
54 // |
|
55 |
|
56 //#include <QtCore/qtimer.h> |
|
57 |
|
58 #include <QHash> |
|
59 #include <QDBusPendingCallWatcher> |
|
60 #include <QExplicitlySharedDataPointer> |
|
61 #include <qnetworkmanagerservice_p.h> |
|
62 |
|
63 #include "qnetworksessionengine_p.h" |
|
64 #include <qnetworksession.h> |
|
65 #include <qnetworkconfiguration.h> |
|
66 #include <qnetworkconfigmanager_p.h> |
|
67 |
|
68 |
|
69 QTM_BEGIN_NAMESPACE |
|
70 |
|
71 class QNetworkConfigurationPrivate; |
|
72 |
|
73 class QNmWifiEngine : public QNetworkSessionEngine |
|
74 { |
|
75 Q_OBJECT |
|
76 |
|
77 public: |
|
78 QNmWifiEngine(QObject *parent = 0); |
|
79 ~QNmWifiEngine(); |
|
80 |
|
81 QList<QNetworkConfigurationPrivate *> getConfigurations(bool *ok = 0); |
|
82 QString getInterfaceFromId(const QString &id); |
|
83 bool hasIdentifier(const QString &id); |
|
84 |
|
85 QString bearerName(const QString &id); |
|
86 |
|
87 void connectToId(const QString &id); |
|
88 void disconnectFromId(const QString &id); |
|
89 |
|
90 void requestUpdate(); |
|
91 |
|
92 static QNmWifiEngine *instance(); |
|
93 |
|
94 QStringList knownSsids; |
|
95 inline void emitConfigurationsChanged() { emit configurationsChanged(); } |
|
96 QNetworkConfigurationPrivate * addAccessPoint(const QString &, QDBusObjectPath ); |
|
97 |
|
98 QStringList getConnectionPathForId(const QString &uuid); |
|
99 //QString getConnectionPathForId(const QString &name = QString()); |
|
100 quint64 sentDataForId(const QString &id) const; |
|
101 quint64 receivedDataForId(const QString &id) const; |
|
102 |
|
103 private: |
|
104 bool updated; |
|
105 QString activatingConnectionPath; |
|
106 QStringList activeConnectionPaths; |
|
107 |
|
108 |
|
109 QMap<QString,QDBusObjectPath> availableAccessPoints; |
|
110 void scanForAccessPoints(); |
|
111 |
|
112 QStringList devicePaths; |
|
113 |
|
114 void updateActiveConnectionsPaths(); |
|
115 void updateKnownSsids(); |
|
116 void accessPointConnections(); |
|
117 void knownConnections(); |
|
118 QString deviceConnectionPath(const QString &mac); |
|
119 |
|
120 QList<QNetworkConfigurationPrivate *> foundConfigurations; |
|
121 // QHash<QString, QExplicitlySharedDataPointer<QNetworkConfigurationPrivate> > allConfigurations; |
|
122 |
|
123 QNetworkManagerInterface *iface; |
|
124 |
|
125 QNetworkConfiguration::StateFlags getAPState(qint32 vState, bool isKnown); |
|
126 QNetworkConfiguration::StateFlags getStateFlag(quint32 nmstate); |
|
127 |
|
128 QString getActiveConnectionPath(const QString &identifier); |
|
129 QString getNameForConfiguration(QNetworkManagerInterfaceDevice *devIface); |
|
130 |
|
131 QNetworkConfiguration::StateFlags getStateForId(const QString &id); |
|
132 |
|
133 QNetworkInterface getBestInterface(quint32 type, const QString &conPath); |
|
134 |
|
135 QMap<QString, QString> configurationInterface; |
|
136 |
|
137 bool isAddressOfConnection(const QString &conPath, quint32 ipaddress); |
|
138 |
|
139 private slots: |
|
140 void updateDeviceInterfaceState(const QString &, quint32); |
|
141 void addDevice(QDBusObjectPath path); |
|
142 |
|
143 Q_SIGNALS: |
|
144 void configurationChanged(const QNetworkConfiguration& config); |
|
145 |
|
146 private slots: |
|
147 void accessPointAdded( const QString &aPath, QDBusObjectPath oPath); |
|
148 void accessPointRemoved( const QString &aPath, QDBusObjectPath oPath); |
|
149 void cmpPropertiesChanged(const QString &, QMap<QString,QVariant> map); |
|
150 void newConnection(QDBusObjectPath); |
|
151 void settingsConnectionRemoved(const QString &); |
|
152 void slotActivationFinished(QDBusPendingCallWatcher*); |
|
153 }; |
|
154 |
|
155 QTM_END_NAMESPACE |
|
156 |
|
157 #endif |
|
158 |
|
159 |