|
1 /* |
|
2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Global WLAN settings adapter |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef __GLOBALWLANADAPTER_H__ |
|
21 #define __GLOBALWLANADAPTER_H__ |
|
22 |
|
23 |
|
24 // ----------------------------------------------------------------------------------------------- |
|
25 // Includes |
|
26 // ----------------------------------------------------------------------------------------------- |
|
27 #include <utf.h> |
|
28 #include <commdb.h> |
|
29 #include <EapSettings.h> |
|
30 #include <internetconnectivitycrkeys.h> |
|
31 #include <smldmadapter.h> |
|
32 |
|
33 |
|
34 // ----------------------------------------------------------------------------------------------- |
|
35 // Constants |
|
36 // ----------------------------------------------------------------------------------------------- |
|
37 |
|
38 // The nodes of the DDF structure |
|
39 _LIT8( KNSmlWLan, "WLAN" ); |
|
40 _LIT8( KNSmlWLanInternetConnectivityTest, "InternetConnectivityTest" ); |
|
41 _LIT8( KNSmlWLanUseDefaultSettings, "UseDefaultSettings" ); |
|
42 _LIT8( KNSmlWLanLongRetryLimit, "LongRetryLimit" ); |
|
43 _LIT8( KNSmlWLanShortRetryLimit, "ShortRetryLimit" ); |
|
44 _LIT8( KNSmlWLanRTSThreshold, "RTSThreshold" ); |
|
45 _LIT8( KNSmlWLanTXPowerLevel, "TXPowerLevel" ); |
|
46 _LIT8( KNSmlWLanPowerSaving, "PowerSaving" ); |
|
47 _LIT8( KNSmlWLanBackgroundScanInterval, "BackgroundScanInterval" ); |
|
48 _LIT8( KNSmlWLanScanRate, "ScanRate" ); |
|
49 _LIT8( KNSmlWLanRCPITrigger, "RCPITrigger" ); |
|
50 _LIT8( KNSmlWLanMinActiveChannelTime, "MinActiveChannelTime" ); |
|
51 _LIT8( KNSmlWLanMaxActiveChannelTime, "MaxActiveChannelTime" ); |
|
52 _LIT8( KNSmlWLanMaxTxMSDULifeTime, "MaxTxMSDULifeTime" ); |
|
53 _LIT8( KNSmlWLanScanExpirationTimer, "ScanExpirationTimer" ); |
|
54 _LIT8( KNSmlWLanUnloadDriverTimer, "UnloadDriverTimer" ); |
|
55 _LIT8( KNSmlWLanRoamTimer, "RoamTimer" ); |
|
56 _LIT8( KNSmlWLanRCPIDifference, "RCPIDifference" ); |
|
57 _LIT8( KNSmlWLanConnRegainTimer, "ConnRegainTimer" ); |
|
58 _LIT8( KNSmlWLanMaxTriesToFindNw, "MaxTriesToFindNw" ); |
|
59 _LIT8( KNSmlWLanDelayBetweenFindNw, "DelayBetweenFindNw" ); |
|
60 _LIT8( KNSmlWLanAllowRadioMeasurements, "AllowRadioMeasurements" ); |
|
61 _LIT8( KNSmlWLanMinPassiveChannelTime, "MinPassiveChannelTime" ); |
|
62 _LIT8( KNSmlWLanMaxPassiveChannelTime, "MaxPassiveChannelTime" ); |
|
63 _LIT8( KNSmlWLanMaxApFailureCount, "MaxApFailureCount" ); |
|
64 _LIT8( KNSmlWLanLongBeaconFindCount, "LongBeaconFindCount" ); |
|
65 _LIT8( KNSmlWLanQosNullFrameInterval, "QosNullFrameInterval" ); |
|
66 _LIT8( KNSmlWLanQosNullFrameTimeout, "QosNullFrameTimeout" ); |
|
67 _LIT8( KNSmlWLanMTU, "MTU" ); |
|
68 _LIT8( KNSmlWLanNode, "InternetConnectivityTest/UseDefaultSettings/LongRetryLimit/ShortRetryLimit/RTSThreshold/TXPowerLevel/PowerSaving/BackgroundScanInterval/ScanRate/RCPITrigger/MinActiveChannelTime/MaxActiveChannelTime/MaxTxMSDULifeTime/ScanExpirationTimer/UnloadDriverTimer/RoamTimer/RCPIDifference/ConnRegainTimer/MaxTriesToFindNw/DelayBetweenFindNw/AllowRadioMeasurements/MinPassiveChannelTime/MaxApFailureCount/LongBeaconFindCount/QosNullFrameInterval/QosNullFrameTimeout" ); |
|
69 |
|
70 //DDF version number |
|
71 _LIT8( KNSmGlobalWlanAdapterDDFversion, "1.0"); |
|
72 _LIT8( KNSmlMimeType, "text/plain" ); |
|
73 _LIT8( KNSmlEmpty, ""); |
|
74 |
|
75 |
|
76 const TInt KUriSegListLength = 128; |
|
77 // Maximum input size for nodes |
|
78 const TInt KInputMaxLength = 50; |
|
79 // Max lenght of the DDF type |
|
80 const TInt KTypeMaxLength = 40; |
|
81 // Repository id |
|
82 const TUid KCRUidWlanDeviceSettingsRegistryId = {0x101f8e44}; |
|
83 |
|
84 |
|
85 // WLan engine central repository parameters |
|
86 const TUint32 KWlanScanRate = 0x00000004; |
|
87 const TUint32 KWlanRcpiTrigger = 0x00000005; |
|
88 const TUint32 KWlanMinActiveChannelTime = 0x00000006; |
|
89 const TUint32 KWlanMaxActiveChannelTime = 0x00000007; |
|
90 const TUint32 KWlanMaxTxMSDULifeTime = 0x00000008; |
|
91 const TUint32 KWlanScanExpirationTimer = 0x00000009; |
|
92 const TUint32 KWlanUnloadDriverTimer = 0x0000000A; |
|
93 const TUint32 KWlanRoamTimer = 0x0000000B; |
|
94 const TUint32 KWlanRcpiDifference = 0x0000000C; |
|
95 const TUint32 KWlanConnRegainTimer = 0x0000000D; |
|
96 const TUint32 KWlanMaxTriesToFindNw = 0x0000000E; |
|
97 const TUint32 KWlanDelayBetweenFindNw = 0x0000000F; |
|
98 const TUint32 KWlanMTU = 0x00000010; |
|
99 const TUint32 KWlanMinPassiveChannelTime = 0x00000011; |
|
100 const TUint32 KWlanMaxPassiveChannelTime = 0x00000012; |
|
101 const TUint32 KWlanMaxApFailureCount = 0x00000013; |
|
102 const TUint32 KWlanLongBeaconFindCount = 0x00000014; |
|
103 const TUint32 KWlanQosNullFrameInterval = 0x00000015; |
|
104 const TUint32 KWlanQosNullFrameTimeout = 0x00000016; |
|
105 |
|
106 // ----------------------------------------------------------------------------------------------- |
|
107 // Structures |
|
108 // ----------------------------------------------------------------------------------------------- |
|
109 |
|
110 // Structure for storing the settings to be stored into cenrep and commsdb |
|
111 struct TGlobalSettings |
|
112 { |
|
113 TUint32 internetConnectivityTest; |
|
114 TBool internetConnectivityTestPresent; |
|
115 TBool useDefaultSettings; |
|
116 TBool useDefaultSettingsPresent; |
|
117 TUint32 longRetryLimit; |
|
118 TBool longRetryLimitPresent; |
|
119 TUint32 shortRetryLimit; |
|
120 TBool shortRetryLimitPresent; |
|
121 TUint32 RTSThreshold; |
|
122 TBool RTSThresholdPresent; |
|
123 TUint32 TXPowerLevel; |
|
124 TBool TXPowerLevelPresent; |
|
125 TBool powerSaving; |
|
126 TBool powerSavingPresent; |
|
127 TUint32 backgroundScanInterval; |
|
128 TBool backgroundScanIntervalPresent; |
|
129 TUint32 scanRate; |
|
130 TBool scanRatePresent; |
|
131 TUint32 RCPITrigger; |
|
132 TBool RCPITriggerPresent; |
|
133 TUint32 minActiveChannelTime; |
|
134 TBool minActiveChannelTimePresent; |
|
135 TUint32 maxActiveChannelTime; |
|
136 TBool maxActiveChannelTimePresent; |
|
137 TUint32 maxTxMSDULifeTime; |
|
138 TBool maxTxMSDULifeTimePresent; |
|
139 TUint32 scanExpirationTimer; |
|
140 TBool scanExpirationTimerPresent; |
|
141 TUint32 unloadDriverTimer; |
|
142 TBool unloadDriverTimerPresent; |
|
143 TUint32 roamTimer; |
|
144 TBool roamTimerPresent; |
|
145 TUint32 RCPIDifference; |
|
146 TBool RCPIDifferencePresent; |
|
147 TUint32 connRegainTimer; |
|
148 TBool connRegainTimerPresent; |
|
149 TUint32 maxTriesToFindNw; |
|
150 TBool maxTriesToFindNwPresent; |
|
151 TUint32 delayBetweenFindNw; |
|
152 TBool delayBetweenFindNwPresent; |
|
153 TBool allowRadioMeasurements; |
|
154 TBool allowRadioMeasurementsPresent; |
|
155 TUint32 minPassiveChannelTime; |
|
156 TBool minPassiveChannelTimePresent; |
|
157 TUint32 maxPassiveChannelTime; |
|
158 TBool maxPassiveChannelTimePresent; |
|
159 TUint32 maxApFailureCount; |
|
160 TBool maxApFailureCountPresent; |
|
161 TUint32 longBeaconFindCount; |
|
162 TBool longBeaconFindCountPresent; |
|
163 TUint32 qosNullFrameInterval; |
|
164 TBool qosNullFrameIntervalPresent; |
|
165 TUint32 qosNullFrameTimeout; |
|
166 TBool qosNullFrameTimeoutPresent; |
|
167 TUint32 MTU; |
|
168 TBool MTUPresent; |
|
169 }; |
|
170 |
|
171 // Structure for storing the result and status variables from every addition/fetch command |
|
172 struct TStatusResult |
|
173 { |
|
174 TInt internetConnectivityTestStatus; |
|
175 TInt internetConnectivityTestResult; |
|
176 TInt useDefaultSettingsStatus; |
|
177 TInt useDefaultSettingsResult; |
|
178 TInt longRetryLimitStatus; |
|
179 TInt longRetryLimitResult; |
|
180 TInt shortRetryLimitStatus; |
|
181 TInt shortRetryLimitResult; |
|
182 TInt RTSThresholdStatus; |
|
183 TInt RTSThresholdResult; |
|
184 TInt TXPowerLevelStatus; |
|
185 TInt TXPowerLevelResult; |
|
186 TInt powerSavingStatus; |
|
187 TInt powerSavingResult; |
|
188 TInt backgroundScanIntervalStatus; |
|
189 TInt backgroundScanIntervalResult; |
|
190 TInt scanRateStatus; |
|
191 TInt scanRateResult; |
|
192 TInt RCPITriggerStatus; |
|
193 TInt RCPITriggerResult; |
|
194 TInt minActiveChannelTimeStatus; |
|
195 TInt minActiveChannelTimeResult; |
|
196 TInt maxActiveChannelTimeStatus; |
|
197 TInt maxActiveChannelTimeResult; |
|
198 TInt maxTxMSDULifeTimeStatus; |
|
199 TInt maxTxMSDULifeTimeResult; |
|
200 TInt scanExpirationTimerStatus; |
|
201 TInt scanExpirationTimerResult; |
|
202 TInt unloadDriverTimerStatus; |
|
203 TInt unloadDriverTimerResult; |
|
204 TInt roamTimerStatus; |
|
205 TInt roamTimerResult; |
|
206 TInt RCPIDifferenceStatus; |
|
207 TInt RCPIDifferenceResult; |
|
208 TInt connRegainTimerStatus; |
|
209 TInt connRegainTimerResult; |
|
210 TInt maxTriesToFindNwStatus; |
|
211 TInt maxTriesToFindNwResult; |
|
212 TInt delayBetweenFindNwStatus; |
|
213 TInt delayBetweenFindNwResult; |
|
214 TInt allowRadioMeasurementsStatus; |
|
215 TInt allowRadioMeasurementsResult; |
|
216 TInt minPassiveChannelTimeStatus; |
|
217 TInt minPassiveChannelTimeResult; |
|
218 TInt maxPassiveChannelTimeStatus; |
|
219 TInt maxPassiveChannelTimeResult; |
|
220 TInt maxApFailureCountStatus; |
|
221 TInt maxApFailureCountResult; |
|
222 TInt longBeaconFindCountStatus; |
|
223 TInt longBeaconFindCountResult; |
|
224 TInt qosNullFrameIntervalStatus; |
|
225 TInt qosNullFrameIntervalResult; |
|
226 TInt qosNullFrameTimeoutStatus; |
|
227 TInt qosNullFrameTimeoutResult; |
|
228 TInt MTUStatus; |
|
229 TInt MTUResult; |
|
230 }; |
|
231 |
|
232 |
|
233 // ----------------------------------------------------------------------------------------------- |
|
234 // Enumerations |
|
235 // ----------------------------------------------------------------------------------------------- |
|
236 |
|
237 |
|
238 // ------------------------------------------------------------------------------------------------ |
|
239 // CGlobalWLanAdapter |
|
240 // ------------------------------------------------------------------------------------------------ |
|
241 class CGlobalWLANAdapter : public CSmlDmAdapter |
|
242 { |
|
243 public: |
|
244 static CGlobalWLANAdapter* NewL( MSmlDmCallback* aDmCallback ); |
|
245 static CGlobalWLANAdapter* NewLC( MSmlDmCallback* aDmCallback ); |
|
246 void ConstructL( ); |
|
247 virtual ~CGlobalWLANAdapter(); |
|
248 |
|
249 // Adapter interface |
|
250 void DDFVersionL( CBufBase& aDDFVersion ); |
|
251 void DDFStructureL( MSmlDmDDFObject& aDDF ); |
|
252 void AddLeafObjectL( const TDesC8& aURI, |
|
253 const TDesC8& aParentLUID, |
|
254 const TDesC8& aObject, |
|
255 const TDesC8& aType, |
|
256 const TInt aStatusRef ); |
|
257 void UpdateLeafObjectL( const TDesC8& aURI, |
|
258 const TDesC8& aLUID, |
|
259 const TDesC8& aObject, |
|
260 const TDesC8& aType, |
|
261 const TInt aStatusRef ); |
|
262 void UpdateLeafObjectL( const TDesC8& aURI, |
|
263 const TDesC8& aLUID, |
|
264 RWriteStream*& aStream, |
|
265 const TDesC8& aType, |
|
266 TInt aStatusRef ); |
|
267 void DeleteObjectL( const TDesC8& aURI, |
|
268 const TDesC8& aLUID, |
|
269 const TInt aStatusRef ); |
|
270 void FetchLeafObjectL( const TDesC8& aURI, |
|
271 const TDesC8& aLUID, |
|
272 const TDesC8& aType, |
|
273 const TInt aResultsRef, |
|
274 const TInt aStatusRef ); |
|
275 void FetchLeafObjectSizeL( const TDesC8& aURI, |
|
276 const TDesC8& aLUID, |
|
277 const TDesC8& aType, |
|
278 TInt aResultsRef, |
|
279 TInt aStatusRef ); |
|
280 void ChildURIListL( const TDesC8& aURI, |
|
281 const TDesC8& aLUID, |
|
282 const CArrayFix<TSmlDmMappingInfo>& aPreviousURISegmentList, |
|
283 const TInt aResultsRef, |
|
284 const TInt aStatusRef ); |
|
285 void AddNodeObjectL( const TDesC8& aURI, |
|
286 const TDesC8& aParentLUID, |
|
287 const TInt aStatusRef ); |
|
288 void ExecuteCommandL( const TDesC8& aURI, |
|
289 const TDesC8& aLUID, |
|
290 const TDesC8& aArgument, |
|
291 const TDesC8& aType, |
|
292 TInt aStatusRef ); |
|
293 void ExecuteCommandL( const TDesC8& aURI, |
|
294 const TDesC8& aLUID, |
|
295 RWriteStream*& aStream, |
|
296 const TDesC8& aType, |
|
297 TInt aStatusRef ); |
|
298 void CopyCommandL( const TDesC8& aTargetURI, |
|
299 const TDesC8& aTargetLUID, |
|
300 const TDesC8& aSourceURI, |
|
301 const TDesC8& aSourceLUID, |
|
302 const TDesC8& aType, |
|
303 TInt aStatusRef ); |
|
304 void StartAtomicL(); |
|
305 void CommitAtomicL(); |
|
306 void RollbackAtomicL(); |
|
307 TBool StreamingSupport( TInt& aItemSize ); |
|
308 void StreamCommittedL(); |
|
309 void CompleteOutstandingCmdsL(); |
|
310 |
|
311 |
|
312 private: |
|
313 CGlobalWLANAdapter(TAny* aEcomArguments); |
|
314 void FillNodeInfoL( MSmlDmDDFObject& aNode, |
|
315 TSmlDmAccessTypes aAccTypes, |
|
316 MSmlDmDDFObject::TOccurence aOccurrence, |
|
317 MSmlDmDDFObject::TScope aScope, |
|
318 MSmlDmDDFObject::TDFFormat aFormat, |
|
319 const TDesC8& aDescription ); |
|
320 void ExecuteBufferL( TBool aFinal = EFalse ); |
|
321 |
|
322 /** |
|
323 * Stores the central repository parameters |
|
324 * |
|
325 * @return |
|
326 */ |
|
327 void StoreCenRepParamsL(); |
|
328 |
|
329 /** |
|
330 * Stores the CommsDB parameters |
|
331 * |
|
332 * @return |
|
333 */ |
|
334 void StoreCommsDBParamsL(); |
|
335 |
|
336 /** |
|
337 * Reads the central repository parameters |
|
338 * |
|
339 * @return |
|
340 */ |
|
341 void ReadCenRepParamsL(); |
|
342 |
|
343 /** |
|
344 * Returns the central repository parameters and updates statuses |
|
345 * |
|
346 * @return |
|
347 */ |
|
348 void UpdateStatusAndResultL( TInt aResult, TInt aStatus, TDesC8& aValue, TDesC8& aType, TInt aStoreErr ); |
|
349 |
|
350 /** |
|
351 * Reads the CommsDB parameters |
|
352 * |
|
353 * @return |
|
354 */ |
|
355 void ReadCommsDBParamsL(); |
|
356 |
|
357 /** |
|
358 * Gets the number of uri segments in the URI |
|
359 * |
|
360 * @since S60 ?S60_version |
|
361 * @param aUri The URI whose segments are counted |
|
362 * @return The amount of segments |
|
363 */ |
|
364 TInt NumOfUriSegs( const TDesC8& aUri ); |
|
365 |
|
366 /** |
|
367 * Gets the last uri segment |
|
368 * |
|
369 * @since S60 ?S60_version |
|
370 * @param aUri The URI whose segments are counted |
|
371 * @return The last segment |
|
372 */ |
|
373 TPtrC8 GetLastUriSeg(const TDesC8& aURI); |
|
374 |
|
375 TInt DesToInt( const TDesC8& aLuid ); |
|
376 void InitMemberVariables(); |
|
377 |
|
378 MSmlDmCallback* iCallBack; |
|
379 |
|
380 // Variable to store the received parameters |
|
381 TGlobalSettings* iWriteSettings; |
|
382 // Variable to store whick parameters are to be fetched |
|
383 TGlobalSettings* iReadSettings; |
|
384 // Status and result information related to fetches and additions |
|
385 TStatusResult* iReadStatuses; |
|
386 TStatusResult* iWriteStatuses; |
|
387 |
|
388 TBool iWlanSupported; |
|
389 |
|
390 }; |
|
391 |
|
392 #endif __GLOBALWLANADAPTER_H__ |