|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2010 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 QNETWORKCONFIGURATIONMANAGERPRIVATE_H |
|
43 #define QNETWORKCONFIGURATIONMANAGERPRIVATE_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 for the convenience |
|
50 // of the QLibrary class. This header file may change from |
|
51 // version to version without notice, or even be removed. |
|
52 // |
|
53 // We mean it. |
|
54 // |
|
55 |
|
56 #include <QHash> |
|
57 #include <QStringList> |
|
58 #include <QDBusInterface> |
|
59 #include <maemo_icd.h> |
|
60 |
|
61 #include "qnetworkconfigmanager.h" |
|
62 #include "qnetworkconfiguration_maemo_p.h" |
|
63 |
|
64 QTM_BEGIN_NAMESPACE |
|
65 |
|
66 class QNetworkConfigurationPrivate; |
|
67 |
|
68 class QNetworkConfigurationManagerPrivate : public QObject |
|
69 { |
|
70 Q_OBJECT |
|
71 public: |
|
72 QNetworkConfigurationManagerPrivate() |
|
73 : QObject(0), capFlags(0), firstUpdate(true), onlineConfigurations(0), m_scanGoingOn(false) |
|
74 { |
|
75 registerPlatformCapabilities(); |
|
76 updateConfigurations(); |
|
77 init(); |
|
78 } |
|
79 |
|
80 virtual ~QNetworkConfigurationManagerPrivate() |
|
81 { |
|
82 QList<QString> configIdents = snapConfigurations.keys(); |
|
83 foreach(const QString oldIface, configIdents) { |
|
84 QExplicitlySharedDataPointer<QNetworkConfigurationPrivate> priv = snapConfigurations.take(oldIface); |
|
85 priv->isValid = false; |
|
86 priv->id.clear(); |
|
87 } |
|
88 |
|
89 configIdents = accessPointConfigurations.keys(); |
|
90 foreach(const QString oldIface, configIdents) { |
|
91 QExplicitlySharedDataPointer<QNetworkConfigurationPrivate> priv = accessPointConfigurations.take(oldIface); |
|
92 priv->isValid = false; |
|
93 priv->id.clear(); |
|
94 } |
|
95 |
|
96 configIdents = userChoiceConfigurations.keys(); |
|
97 foreach(const QString oldIface, configIdents) { |
|
98 QExplicitlySharedDataPointer<QNetworkConfigurationPrivate> priv = userChoiceConfigurations.take(oldIface); |
|
99 priv->isValid = false; |
|
100 priv->id.clear(); |
|
101 } |
|
102 |
|
103 cleanup(); |
|
104 } |
|
105 |
|
106 QNetworkConfiguration defaultConfiguration(); |
|
107 |
|
108 void init(); |
|
109 |
|
110 QNetworkConfigurationManager::Capabilities capFlags; |
|
111 void registerPlatformCapabilities(); |
|
112 |
|
113 void performAsyncConfigurationUpdate(); |
|
114 void doUpdateConfigurations(QList<Maemo::IcdScanResult> scanned = QList<Maemo::IcdScanResult>()); |
|
115 void startListeningStateSignalsForAllConnections(); |
|
116 |
|
117 //this table contains an up to date list of all configs at any time. |
|
118 //it must be updated if configurations change, are added/removed or |
|
119 //the members of ServiceNetworks change |
|
120 QHash<QString, QExplicitlySharedDataPointer<QNetworkConfigurationPrivate> > accessPointConfigurations; |
|
121 QHash<QString, QExplicitlySharedDataPointer<QNetworkConfigurationPrivate> > snapConfigurations; |
|
122 QHash<QString, QExplicitlySharedDataPointer<QNetworkConfigurationPrivate> > userChoiceConfigurations; |
|
123 bool firstUpdate; |
|
124 int onlineConfigurations; |
|
125 friend class IapMonitor; |
|
126 void cleanup(); |
|
127 void deleteConfiguration(QString &iap_id); |
|
128 void addConfiguration(QString &iap_id); |
|
129 void configurationChanged(QNetworkConfigurationPrivate *ptr); |
|
130 uint32_t getNetworkAttrs(bool is_iap_id, const QString& iap_id, |
|
131 const QString& iap_type, QString security_method); |
|
132 |
|
133 QDBusInterface *m_dbusInterface; |
|
134 QTimer m_scanTimer; |
|
135 bool m_gettingInitialConnectionState; |
|
136 bool m_scanGoingOn; |
|
137 QStringList m_typesToBeScanned; |
|
138 QList<Maemo::IcdScanResult> m_scanResult; |
|
139 QString m_onlineIapId; |
|
140 |
|
141 friend class QNetworkSessionPrivate; |
|
142 |
|
143 public slots: |
|
144 void updateConfigurations(); |
|
145 |
|
146 private slots: |
|
147 void cancelAsyncConfigurationUpdate(); |
|
148 void finishAsyncConfigurationUpdate(); |
|
149 void asyncUpdateConfigurationsSlot(QDBusMessage msg); |
|
150 void connectionStateSignalsSlot(QDBusMessage msg); |
|
151 |
|
152 Q_SIGNALS: |
|
153 void configurationAdded(const QNetworkConfiguration& config); |
|
154 void configurationRemoved(const QNetworkConfiguration& config); |
|
155 void configurationUpdateComplete(); |
|
156 void configurationChanged(const QNetworkConfiguration& config); |
|
157 void onlineStateChanged(bool isOnline); |
|
158 |
|
159 void iapStateChanged(const QString& iapid, uint icd_connection_state); |
|
160 }; |
|
161 |
|
162 QTM_END_NAMESPACE |
|
163 |
|
164 #endif //QNETWORKCONFIGURATIONMANAGERPRIVATE_H |