58 { |
58 { |
59 iIsCommandElement = ETrue; |
59 iIsCommandElement = ETrue; |
60 } |
60 } |
61 |
61 |
62 #if(!defined __SERIES60_30__ && !defined __SERIES60_31__) |
62 #if(!defined __SERIES60_30__ && !defined __SERIES60_31__) |
63 void CCreatorConnectionMethodElement::AsyncExecuteCommandL() |
|
64 { |
|
65 const CCreatorScriptAttribute* amountAttr = FindAttributeByName(KAmount); |
|
66 TInt cmAmount = 1; |
|
67 if( amountAttr ) |
|
68 { |
|
69 cmAmount = ConvertStrToIntL(amountAttr->Value()); |
|
70 } |
|
71 // Get 'fields' element |
|
72 CCreatorScriptElement* fieldsElement = FindSubElement(KFields); |
|
73 if( fieldsElement && fieldsElement->SubElements().Count() > 0 ) |
|
74 { |
|
75 // Get sub-elements |
|
76 const RPointerArray<CCreatorScriptElement>& fields = fieldsElement->SubElements(); |
|
77 // Create connection method entries, the amount of entries is defined by cmAmount: |
|
78 if( iLoopIndex < cmAmount ) |
|
79 { |
|
80 CConnectionSettingsParameters* param = new (ELeave) CConnectionSettingsParameters; |
|
81 CleanupStack::PushL(param); |
|
82 |
|
83 for( TInt i = 0; i < fields.Count(); ++i ) |
|
84 { |
|
85 CCreatorScriptElement* field = fields[i]; |
|
86 TPtrC elemName = field->Name(); |
|
87 TPtrC elemContent = field->Content(); |
|
88 const CCreatorScriptAttribute* randomAttr = fields[i]->FindAttributeByName(KRandomLength); |
|
89 TBool useRandom = EFalse; |
|
90 if( randomAttr || elemContent.Length() == 0 ) |
|
91 { |
|
92 useRandom = ETrue; |
|
93 } |
|
94 |
|
95 if( elemName == Kconnectionname ) |
|
96 { |
|
97 if( useRandom ) |
|
98 { |
|
99 param->SetRandomCMNameL(*iEngine); |
|
100 } |
|
101 else |
|
102 { |
|
103 SetContentToTextParamL(param->iConnectionName, elemContent); |
|
104 // reserve extra space for possible renaming |
|
105 TInt newLen = param->iConnectionName->Length() + KExtraSpace; |
|
106 param->iConnectionName = param->iConnectionName->ReAllocL(newLen); |
|
107 } |
|
108 } |
|
109 else if( elemName == Kstartpage ) |
|
110 { |
|
111 if( useRandom ) |
|
112 { |
|
113 param->SetRandomStartPageL(*iEngine); |
|
114 } |
|
115 else |
|
116 { |
|
117 SetContentToTextParamL(param->iStartPage, elemContent); |
|
118 } |
|
119 } |
|
120 else if( elemName == Kwapwspoption ) |
|
121 { |
|
122 if( useRandom ) |
|
123 { |
|
124 param->SetRandomWapWspOptionL(*iEngine); |
|
125 } |
|
126 else |
|
127 { |
|
128 if( CompareIgnoreCase(elemContent, Kconnectionless) == 0 ) |
|
129 { |
|
130 param->iWapWspOption = ECmWapWspOptionConnectionless; |
|
131 } |
|
132 else if( CompareIgnoreCase(elemContent, Kconnectionoriented) == 0 ) |
|
133 { |
|
134 param->iWapWspOption = ECmWapWspOptionConnectionOriented; |
|
135 } |
|
136 } |
|
137 } |
|
138 else if( elemName == Kprotocoltype ) |
|
139 { |
|
140 if( useRandom ) |
|
141 { |
|
142 param->SetRandomProtocolTypeL(*iEngine); |
|
143 } |
|
144 else |
|
145 { |
|
146 if( CompareIgnoreCase(elemContent, Kipv4) == 0 ) |
|
147 { |
|
148 param->iProtocolType = RPacketContext::EPdpTypeIPv4; |
|
149 } |
|
150 else if( CompareIgnoreCase(elemContent, Kipv6) == 0 ) |
|
151 { |
|
152 param->iProtocolType = RPacketContext::EPdpTypeIPv6; |
|
153 } |
|
154 } |
|
155 } |
|
156 else if( elemName == Kloginname ) |
|
157 { |
|
158 if( useRandom ) |
|
159 { |
|
160 param->SetRandomLoginNameL(*iEngine); |
|
161 } |
|
162 else |
|
163 { |
|
164 SetContentToTextParamL(param->iLoginName, elemContent); |
|
165 } |
|
166 } |
|
167 else if( elemName == Ksecureauthentication ) |
|
168 { |
|
169 if( useRandom ) |
|
170 { |
|
171 param->SetRandomSecureAuthenticationL(*iEngine); |
|
172 } |
|
173 else |
|
174 { |
|
175 param->iSecureAuthentication = ConvertStrToBooleanL(elemContent); |
|
176 } |
|
177 } |
|
178 else if( elemName == Kloginpass ) |
|
179 { |
|
180 if( useRandom ) |
|
181 { |
|
182 param->SetRandomLoginPassL(*iEngine); |
|
183 } |
|
184 else |
|
185 { |
|
186 SetContentToTextParamL(param->iLoginPass, elemContent); |
|
187 } |
|
188 } |
|
189 else if( elemName == Kpromptpassword ) |
|
190 { |
|
191 if( useRandom ) |
|
192 { |
|
193 param->SetRandomPromptPasswordL(*iEngine); |
|
194 } |
|
195 else |
|
196 { |
|
197 param->iPromptPassword = ConvertStrToBooleanL(elemContent); |
|
198 } |
|
199 } |
|
200 else if( elemName == Kgatewayaddress ) |
|
201 { |
|
202 if( useRandom ) |
|
203 { |
|
204 param->SetRandomGatewayAddressL(*iEngine); |
|
205 } |
|
206 else |
|
207 { |
|
208 SetContentToTextParamL(param->iGatewayAddress, elemContent); |
|
209 } |
|
210 } |
|
211 else if( elemName == Ksubnetmask ) |
|
212 { |
|
213 if( useRandom ) |
|
214 { |
|
215 param->SetRandomSubnetMaskL(*iEngine); |
|
216 } |
|
217 else |
|
218 { |
|
219 SetContentToTextParamL(param->iSubnetMask, elemContent); |
|
220 } |
|
221 } |
|
222 else if( elemName == Kdeviceipaddr ) |
|
223 { |
|
224 if( useRandom ) |
|
225 { |
|
226 param->SetRandomIPAddressL(*iEngine); |
|
227 } |
|
228 else |
|
229 { |
|
230 SetContentToTextParamL(param->iIPAddr, elemContent); |
|
231 } |
|
232 } |
|
233 else if( elemName == Kip4nameserver1 ) |
|
234 { |
|
235 if( useRandom ) |
|
236 { |
|
237 param->SetRandomIP4NameServer1L(*iEngine); |
|
238 } |
|
239 else |
|
240 { |
|
241 SetContentToTextParamL(param->iIP4NameServer1, elemContent); |
|
242 } |
|
243 } |
|
244 else if( elemName == Kip4nameserver2 ) |
|
245 { |
|
246 if( useRandom ) |
|
247 { |
|
248 param->SetRandomIP4NameServer2L(*iEngine); |
|
249 } |
|
250 else |
|
251 { |
|
252 SetContentToTextParamL(param->iIP4NameServer2, elemContent); |
|
253 } |
|
254 } |
|
255 else if( elemName == Kdatacalltelnumber ) |
|
256 { |
|
257 if( useRandom ) |
|
258 { |
|
259 param->SetRandomTelephoneNumberL(*iEngine); |
|
260 } |
|
261 else |
|
262 { |
|
263 SetContentToTextParamL(param->iDefaultTelNumber, elemContent); |
|
264 } |
|
265 } |
|
266 else if( elemName == Kdatacalltypeisdn ) |
|
267 { |
|
268 if( useRandom ) |
|
269 { |
|
270 param->SetRandomBearerTypeIsdnL(*iEngine); |
|
271 } |
|
272 else |
|
273 { |
|
274 if( CompareIgnoreCase(elemContent, Kanalogue) == 0 ) |
|
275 param->iBearerCallTypeIsdn = CMManager::ECmCallTypeAnalogue; |
|
276 else if( CompareIgnoreCase( elemContent, Kisdnv110) == 0 ) |
|
277 param->iBearerCallTypeIsdn = CMManager::ECmCallTypeISDNv110; |
|
278 else if( CompareIgnoreCase( elemContent, Kisdnv120) == 0 ) |
|
279 param->iBearerCallTypeIsdn = CMManager::ECmCallTypeISDNv120; |
|
280 } |
|
281 } |
|
282 else if( elemName == Kbearertype ) |
|
283 { |
|
284 if( useRandom ) |
|
285 { |
|
286 param->iBearerType = KRandomBearerType; |
|
287 } |
|
288 else |
|
289 { |
|
290 if( CompareIgnoreCase(elemContent, Kwlan) == 0 ) |
|
291 { |
|
292 param->iBearerType = KUidWlanBearerType; |
|
293 } |
|
294 else if( CompareIgnoreCase(elemContent, Kgprs) == 0 ) |
|
295 { |
|
296 param->iBearerType = KUidPacketDataBearerType; |
|
297 } |
|
298 else if( CompareIgnoreCase(elemContent, Kdatacall) == 0 ) |
|
299 { |
|
300 param->iBearerType = KUidCSDBearerType; |
|
301 } |
|
302 else if( CompareIgnoreCase(elemContent, Khsgsm) == 0 ) |
|
303 { |
|
304 param->iBearerType = KUidHSCSDBearerType; |
|
305 } |
|
306 else if( CompareIgnoreCase(elemContent, Kembedded) == 0 ) |
|
307 { |
|
308 param->iBearerType = KUidEmbeddedDestination; |
|
309 } |
|
310 else if( CompareIgnoreCase(elemContent, Kvpn) == 0 ) |
|
311 { |
|
312 param->iBearerType = KPluginVPNBearerTypeUid; |
|
313 } |
|
314 else if( CompareIgnoreCase(elemContent, Klan) == 0 ) |
|
315 { |
|
316 param->iBearerType = KUidLanBearerType; |
|
317 } |
|
318 } |
|
319 } |
|
320 else if( elemName == Kdatacalllinespeed ) |
|
321 { |
|
322 if( useRandom ) |
|
323 { |
|
324 param->SetRandomBearerSpeedL(*iEngine); |
|
325 } |
|
326 else |
|
327 { |
|
328 if( CompareIgnoreCase(elemContent, Kautomatic) == 0 ) |
|
329 { |
|
330 param->iBearerSpeed = CMManager::ECmSpeedAutobaud; |
|
331 } |
|
332 else |
|
333 { |
|
334 TUint lineSpeed = ConvertStrToUintL(elemContent); |
|
335 if( lineSpeed == 9600 ) |
|
336 param->iBearerSpeed = CMManager::ECmSpeed9600; |
|
337 else if( lineSpeed == 14400 ) |
|
338 param->iBearerSpeed = CMManager::ECmSpeed14400; |
|
339 else if( lineSpeed == 19200 ) |
|
340 param->iBearerSpeed = CMManager::ECmSpeed19200; |
|
341 else if( lineSpeed == 28800 ) |
|
342 param->iBearerSpeed = CMManager::ECmSpeed28800; |
|
343 else if( lineSpeed == 38400 ) |
|
344 param->iBearerSpeed = CMManager::ECmSpeed38400; |
|
345 else if( lineSpeed == 43200 ) |
|
346 param->iBearerSpeed = CMManager::ECmSpeed43200; |
|
347 else if( lineSpeed == 56000 ) |
|
348 param->iBearerSpeed = CMManager::ECmSpeed56000; |
|
349 } |
|
350 } |
|
351 } |
|
352 else if( elemName == Kuseproxy ) |
|
353 { |
|
354 if( useRandom ) |
|
355 { |
|
356 param->SetRandomUseProxyL(*iEngine); |
|
357 } |
|
358 else |
|
359 { |
|
360 param->iUseProxy = ConvertStrToBooleanL(elemContent); |
|
361 } |
|
362 } |
|
363 else if( elemName == Kproxyserveraddress ) |
|
364 { |
|
365 if( useRandom ) |
|
366 { |
|
367 param->SetRandomProxyAddressL(*iEngine); |
|
368 } |
|
369 else |
|
370 { |
|
371 SetContentToTextParamL(param->iProxyServerAddress, elemContent); |
|
372 } |
|
373 } |
|
374 else if( elemName == Kproxyportnumber ) |
|
375 { |
|
376 if( useRandom ) |
|
377 { |
|
378 param->SetRandomProxyPortL(*iEngine); |
|
379 } |
|
380 else |
|
381 { |
|
382 param->iProxyPortNumber = ConvertStrToUintL(elemContent); |
|
383 } |
|
384 } |
|
385 else if( elemName == Kip6nameserver1 ) |
|
386 { |
|
387 if( useRandom ) |
|
388 { |
|
389 param->SetRandomIPv6NameServer1L(*iEngine); |
|
390 } |
|
391 else |
|
392 { |
|
393 SetContentToTextParamL(param->iIP6NameServer1, elemContent); |
|
394 } |
|
395 } |
|
396 else if( elemName == Kip6nameserver2 ) |
|
397 { |
|
398 if( useRandom ) |
|
399 { |
|
400 param->SetRandomIPv6NameServer2L(*iEngine); |
|
401 } |
|
402 else |
|
403 { |
|
404 SetContentToTextParamL(param->iIP6NameServer2, elemContent); |
|
405 } |
|
406 } |
|
407 else if( elemName == Kdisabletextauth ) |
|
408 { |
|
409 if( useRandom ) |
|
410 { |
|
411 param->SetRandomDisableTextAuthL(*iEngine); |
|
412 } |
|
413 else |
|
414 { |
|
415 param->iDisableTextAuth = ConvertStrToBooleanL(elemContent); |
|
416 } |
|
417 } |
|
418 else if( elemName == Kwlanname ) |
|
419 { |
|
420 if( useRandom ) |
|
421 { |
|
422 param->SetRandomWLANNameL(*iEngine); |
|
423 } |
|
424 else |
|
425 { |
|
426 SetContentToTextParamL(param->iWLANName, elemContent); |
|
427 } |
|
428 } |
|
429 else if( elemName == Kwlanipaddr ) |
|
430 { |
|
431 if( useRandom ) |
|
432 { |
|
433 param->SetRandomWlanIpAddrL(*iEngine); |
|
434 } |
|
435 else |
|
436 { |
|
437 SetContentToTextParamL(param->iWlanIpAddr, elemContent); |
|
438 } |
|
439 } |
|
440 else if( elemName == Kwlansecmode ) |
|
441 { |
|
442 if( useRandom ) |
|
443 { |
|
444 param->SetRandomWLANSecurityModeL(*iEngine); |
|
445 } |
|
446 else |
|
447 { |
|
448 if( CompareIgnoreCase(elemContent, Kopen) == 0) |
|
449 param->iWLanSecMode = CMManager::EWlanSecModeOpen; |
|
450 else if( CompareIgnoreCase(elemContent, Kwep) == 0 ) |
|
451 param->iWLanSecMode = CMManager::EWlanSecModeWep; |
|
452 else if( CompareIgnoreCase(elemContent, Ke802_1x) == 0 ) |
|
453 param->iWLanSecMode = CMManager::EWlanSecMode802_1x; |
|
454 else if( CompareIgnoreCase(elemContent, Kwpa) == 0 ) |
|
455 param->iWLanSecMode = CMManager::EWlanSecModeWpa; |
|
456 else if( CompareIgnoreCase(elemContent, Kwpa2) == 0 ) |
|
457 param->iWLanSecMode = CMManager::EWlanSecModeWpa2; |
|
458 } |
|
459 } |
|
460 } |
|
461 iEngine->AppendToCommandArrayL(ECmdCreateMiscEntryAccessPoints, param); |
|
462 CleanupStack::Pop(); // param |
|
463 StartNextLoop(); |
|
464 } |
|
465 else |
|
466 { |
|
467 // stop loop and signal end of the executing command |
|
468 AsyncCommandFinished(); |
|
469 } |
|
470 } |
|
471 else |
|
472 { |
|
473 // No fields defined so add random entries: |
|
474 iEngine->AppendToCommandArrayL(ECmdCreateMiscEntryAccessPoints, 0, cmAmount); |
|
475 // signal end of the executing command |
|
476 AsyncCommandFinished(); |
|
477 } |
|
478 } |
|
479 |
|
480 void CCreatorConnectionMethodElement::ExecuteCommandL() |
63 void CCreatorConnectionMethodElement::ExecuteCommandL() |
481 { |
64 { |
482 const CCreatorScriptAttribute* amountAttr = FindAttributeByName(KAmount); |
65 const CCreatorScriptAttribute* amountAttr = FindAttributeByName(KAmount); |
483 TInt cmAmount = 1; |
66 TInt cmAmount = 1; |
484 if( amountAttr ) |
67 if( amountAttr ) |