|
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 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 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 <qnetworkconfigmanager.h> |
|
57 #include <qnetworkconfiguration_s60_p.h> |
|
58 |
|
59 #include <QHash> |
|
60 #include <rconnmon.h> |
|
61 #ifdef SNAP_FUNCTIONALITY_AVAILABLE |
|
62 #include <cmmanager.h> |
|
63 #endif |
|
64 |
|
65 class CCommsDatabase; |
|
66 |
|
67 QT_BEGIN_NAMESPACE |
|
68 class QTimer; |
|
69 QT_END_NAMESPACE |
|
70 |
|
71 QTM_BEGIN_NAMESPACE |
|
72 |
|
73 class QNetworkSessionPrivate; |
|
74 class AccessPointsAvailabilityScanner; |
|
75 |
|
76 class QNetworkConfigurationManagerPrivate : public QObject, public CActive, public MConnectionMonitorObserver |
|
77 { |
|
78 Q_OBJECT |
|
79 |
|
80 public: |
|
81 QNetworkConfigurationManagerPrivate(); |
|
82 virtual ~QNetworkConfigurationManagerPrivate(); |
|
83 |
|
84 QNetworkConfiguration defaultConfiguration(); |
|
85 void performAsyncConfigurationUpdate(); |
|
86 |
|
87 Q_SIGNALS: |
|
88 void configurationAdded(const QNetworkConfiguration& config); |
|
89 void configurationRemoved(const QNetworkConfiguration& config); |
|
90 void configurationUpdateComplete(); |
|
91 void configurationChanged(const QNetworkConfiguration& config); |
|
92 void onlineStateChanged(bool isOnline); |
|
93 |
|
94 public Q_SLOTS: |
|
95 void updateConfigurations(); |
|
96 |
|
97 private: |
|
98 void registerPlatformCapabilities(); |
|
99 void updateStatesToSnaps(); |
|
100 bool changeConfigurationStateTo(QExplicitlySharedDataPointer<QNetworkConfigurationPrivate>& sharedData, |
|
101 QNetworkConfiguration::StateFlags newState); |
|
102 bool changeConfigurationStateAtMinTo(QExplicitlySharedDataPointer<QNetworkConfigurationPrivate>& sharedData, |
|
103 QNetworkConfiguration::StateFlags newState); |
|
104 bool changeConfigurationStateAtMaxTo(QExplicitlySharedDataPointer<QNetworkConfigurationPrivate>& sharedData, |
|
105 QNetworkConfiguration::StateFlags newState); |
|
106 #ifdef SNAP_FUNCTIONALITY_AVAILABLE |
|
107 QNetworkConfigurationPrivate* configFromConnectionMethodL(RCmConnectionMethod& connectionMethod); |
|
108 #else |
|
109 bool readNetworkConfigurationValuesFromCommsDb( |
|
110 TUint32 aApId, QNetworkConfigurationPrivate* apNetworkConfiguration); |
|
111 void readNetworkConfigurationValuesFromCommsDbL( |
|
112 TUint32 aApId, QNetworkConfigurationPrivate* apNetworkConfiguration); |
|
113 #endif |
|
114 |
|
115 void updateConfigurationsL(); |
|
116 void updateActiveAccessPoints(); |
|
117 void updateAvailableAccessPoints(); |
|
118 void accessPointScanningReady(TBool scanSuccessful, TConnMonIapInfo iapInfo); |
|
119 void startCommsDatabaseNotifications(); |
|
120 void stopCommsDatabaseNotifications(); |
|
121 |
|
122 QNetworkConfiguration defaultConfigurationL(); |
|
123 TBool GetS60PlatformVersion(TUint& aMajor, TUint& aMinor) const; |
|
124 void startMonitoringIAPData(TUint32 aIapId); |
|
125 QExplicitlySharedDataPointer<QNetworkConfigurationPrivate> dataByConnectionId(TUint aConnectionId); |
|
126 |
|
127 protected: // From CActive |
|
128 void RunL(); |
|
129 void DoCancel(); |
|
130 |
|
131 private: // MConnectionMonitorObserver |
|
132 void EventL(const CConnMonEventBase& aEvent); |
|
133 |
|
134 public: // Data |
|
135 //this table contains an up to date list of all configs at any time. |
|
136 //it must be updated if configurations change, are added/removed or |
|
137 //the members of ServiceNetworks change |
|
138 QHash<QString, QExplicitlySharedDataPointer<QNetworkConfigurationPrivate> > accessPointConfigurations; |
|
139 QHash<QString, QExplicitlySharedDataPointer<QNetworkConfigurationPrivate> > snapConfigurations; |
|
140 QHash<QString, QExplicitlySharedDataPointer<QNetworkConfigurationPrivate> > userChoiceConfigurations; |
|
141 QNetworkConfigurationManager::Capabilities capFlags; |
|
142 |
|
143 private: // Data |
|
144 bool iFirstUpdate; |
|
145 CCommsDatabase* ipCommsDB; |
|
146 RConnectionMonitor iConnectionMonitor; |
|
147 |
|
148 TBool iWaitingCommsDatabaseNotifications; |
|
149 TBool iOnline; |
|
150 TBool iInitOk; |
|
151 TBool iUpdateGoingOn; |
|
152 |
|
153 |
|
154 AccessPointsAvailabilityScanner* ipAccessPointsAvailabilityScanner; |
|
155 |
|
156 friend class QNetworkSessionPrivate; |
|
157 friend class AccessPointsAvailabilityScanner; |
|
158 |
|
159 #ifdef SNAP_FUNCTIONALITY_AVAILABLE |
|
160 RCmManager iCmManager; |
|
161 #endif |
|
162 }; |
|
163 |
|
164 class AccessPointsAvailabilityScanner : public CActive |
|
165 { |
|
166 public: |
|
167 AccessPointsAvailabilityScanner(QNetworkConfigurationManagerPrivate& owner, |
|
168 RConnectionMonitor& connectionMonitor); |
|
169 ~AccessPointsAvailabilityScanner(); |
|
170 |
|
171 void StartScanning(); |
|
172 |
|
173 protected: // From CActive |
|
174 void RunL(); |
|
175 void DoCancel(); |
|
176 |
|
177 private: // Data |
|
178 QNetworkConfigurationManagerPrivate& iOwner; |
|
179 RConnectionMonitor& iConnectionMonitor; |
|
180 TConnMonIapInfoBuf iIapBuf; |
|
181 }; |
|
182 |
|
183 QTM_END_NAMESPACE |
|
184 |
|
185 #endif //QNETWORKCONFIGURATIONMANAGERPRIVATE_H |