1 /* |
|
2 * Copyright (c) 2009 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: |
|
15 * This is a source file for connmon library stub functions |
|
16 */ |
|
17 |
|
18 #include <QString> |
|
19 #include <QObject> |
|
20 #include <rconnmon.h> |
|
21 #include <nifvar.h> |
|
22 #include "wlanqtutilswlanap.h" |
|
23 |
|
24 #ifdef __WINS__ |
|
25 |
|
26 // TODO: This function is copied from ConnMonWLANNetworksArrayPckg_v2.cpp because this |
|
27 // function, although being in rconnmon.h, is not in the interface because IMPORT_C/EXPORT_C |
|
28 // declarations are not used for this particular constructor. The only change that was made to |
|
29 // this version was to remove traces and some empty lines. This function is needed when |
|
30 // creating output in RConnectionMonitor::GetPckgAttribute() for WLAN scan results. |
|
31 // This is needed for both UT and emulator compilation. |
|
32 CConnMonWlanNetworksPtrArrayPckg::CConnMonWlanNetworksPtrArrayPckg( |
|
33 const RPointerArray<CConnMonWlanNetwork>& aRef, |
|
34 TUint aBufLen ) |
|
35 { |
|
36 RPointerArray<HBufC> items; |
|
37 TUint len( 0 ); |
|
38 |
|
39 for ( TUint i( 0 ); i < aRef.Count(); ++i ) |
|
40 { |
|
41 const HBufC* item( aRef[i]->ToBuf() ); |
|
42 if ( item ) |
|
43 { |
|
44 // Is there room in buffer |
|
45 TUint countFields( 3 ); // aRef.Count(); items->Count(); item->Length() |
|
46 if ( (countFields + len + item->Length()) > aBufLen ) |
|
47 { |
|
48 delete item; |
|
49 item = NULL; |
|
50 break; |
|
51 } |
|
52 items.Append( item ); |
|
53 ++( len += item->Length() ); // ++ is for item's size |
|
54 } |
|
55 else |
|
56 { |
|
57 ; // There was a trace. |
|
58 } |
|
59 } |
|
60 // Check that given buflen (aBufLen) is not smaller than one |
|
61 // item (TConnMonWLANNetwork) + aRef count + items count |
|
62 // + item length |
|
63 if ( items.Count() == 0 && aRef.Count() > 0 ) |
|
64 { |
|
65 aBufLen = 2; // aRef.Count(), items.Count() |
|
66 } |
|
67 |
|
68 iBuf = HBufC::New( aBufLen ); // Set size exactly to a buffer length |
|
69 if ( !iBuf ) |
|
70 { |
|
71 items.ResetAndDestroy(); |
|
72 items.Close(); |
|
73 return; |
|
74 } |
|
75 iBuf->Des().Append( aRef.Count() ); // Total amount of data |
|
76 iBuf->Des().Append( items.Count() ); // Amount of transferring data |
|
77 for ( TUint i(0); i<items.Count(); ++i ) |
|
78 { |
|
79 iBuf->Des().Append( items[i]->Length() ); |
|
80 iBuf->Des().Append( *items[i] ); |
|
81 } |
|
82 items.ResetAndDestroy(); |
|
83 items.Close(); |
|
84 } |
|
85 |
|
86 // ----------------------------------------------------------------------------- |
|
87 // CConnMonEventBase::CConnMonEventBase |
|
88 // ----------------------------------------------------------------------------- |
|
89 // |
|
90 CConnMonEventBase::CConnMonEventBase( const TInt aEventType, const TUint aConnectionId ) |
|
91 { |
|
92 iEventType = aEventType; |
|
93 iConnectionId = aConnectionId; |
|
94 } |
|
95 |
|
96 // Destructor |
|
97 CConnMonEventBase::~CConnMonEventBase() |
|
98 { |
|
99 } |
|
100 |
|
101 // ----------------------------------------------------------------------------- |
|
102 // CConnMonEventBase::EventType |
|
103 // ----------------------------------------------------------------------------- |
|
104 // |
|
105 TInt CConnMonEventBase::EventType() const |
|
106 { |
|
107 return iEventType; |
|
108 } |
|
109 |
|
110 // ----------------------------------------------------------------------------- |
|
111 // CConnMonConnectionStatusChange::CConnMonConnectionStatusChange |
|
112 // ----------------------------------------------------------------------------- |
|
113 // |
|
114 CConnMonConnectionStatusChange::CConnMonConnectionStatusChange( |
|
115 const TUint aConnectionId, |
|
116 const TUint aSubConnectionId, |
|
117 const TInt aConnectionStatus ) : |
|
118 CConnMonEventBase(EConnMonConnectionStatusChange, aConnectionId) |
|
119 { |
|
120 iSubConnectionId = aSubConnectionId; |
|
121 iConnectionStatus = aConnectionStatus; |
|
122 } |
|
123 |
|
124 // Destructor |
|
125 CConnMonConnectionStatusChange::~CConnMonConnectionStatusChange() |
|
126 { |
|
127 } |
|
128 |
|
129 #ifdef WLANQTUTILS_T_WLANQTUTILS_UT_FLAG |
|
130 |
|
131 // ---------------------------------------------- |
|
132 // Stub functions for connmon library, used in UT |
|
133 // ---------------------------------------------- |
|
134 |
|
135 #include "wlanqtutilstestcontext.h" |
|
136 |
|
137 extern WlanQtUtilsTestContext testContext; |
|
138 |
|
139 EXPORT_C void RConnectionMonitor::GetConnectionCount( |
|
140 TUint& aConnectionCount, |
|
141 TRequestStatus& aStatus) |
|
142 { |
|
143 aConnectionCount = testContext.connMon_.activeConnections_.activeConnList_.count(); |
|
144 User::RequestComplete(&aStatus, KErrNone); |
|
145 } |
|
146 |
|
147 EXPORT_C TInt RConnectionMonitor::GetConnectionInfo( |
|
148 const TUint aIndex, |
|
149 TUint& aConnectionId, |
|
150 TUint& aSubConnectionCount ) const |
|
151 { |
|
152 aConnectionId = testContext.connMon_.activeConnections_.activeConnList_[aIndex - 1]->connectionId(); |
|
153 aSubConnectionCount = 0; |
|
154 return KErrNone; // TODO: put return value into context. |
|
155 } |
|
156 |
|
157 EXPORT_C void RConnectionMonitor::GetIntAttribute( |
|
158 const TUint aConnectionId, |
|
159 const TUint /* aSubConnectionId */, |
|
160 const TUint aAttribute, |
|
161 TInt& aValue, |
|
162 TRequestStatus& aStatus ) |
|
163 { |
|
164 WlanQtUtilsCtxActiveConn *activeConn = testContext.connMon_.activeConnections_.findActiveConn(aConnectionId); |
|
165 if (aAttribute == KBearer) { |
|
166 aValue = activeConn->connMonBearerType_; |
|
167 } else if (aAttribute == KConnectionStatus) { |
|
168 aValue = activeConn->connMonConnectionStatus_; |
|
169 } else { |
|
170 Q_ASSERT(false); |
|
171 } |
|
172 User::RequestComplete(&aStatus, KErrNone); // TODO: Take return value from the context. |
|
173 } |
|
174 |
|
175 EXPORT_C void RConnectionMonitor::GetUintAttribute( |
|
176 const TUint aConnectionId, |
|
177 const TUint /* aSubConnectionId */, |
|
178 const TUint aAttribute, |
|
179 TUint& aValue, |
|
180 TRequestStatus& aStatus ) |
|
181 { |
|
182 WlanQtUtilsCtxActiveConn *activeConn = testContext.connMon_.activeConnections_.findActiveConn(aConnectionId); |
|
183 if (aAttribute == KIAPId) { |
|
184 aValue = activeConn->iapId(); |
|
185 } else { |
|
186 Q_ASSERT(false); |
|
187 } |
|
188 |
|
189 User::RequestComplete(&aStatus, KErrNone); // TODO: Take return value from the context. |
|
190 } |
|
191 |
|
192 EXPORT_C void RConnectionMonitor::GetPckgAttribute( |
|
193 const TUint aConnectionId, |
|
194 const TUint aSubConnectionId, |
|
195 const TUint aAttribute, |
|
196 TDes8& aValue, |
|
197 TRequestStatus& aStatus ) const |
|
198 { |
|
199 // This is copy-paste from real implementation and we'll use that for other requests. |
|
200 TIpcArgs args(aConnectionId, aSubConnectionId, aAttribute, &aValue); |
|
201 SendReceive(EReqGetPckgAttribute, args, aStatus); |
|
202 } |
|
203 |
|
204 // --------------------------------------------------------- |
|
205 // connUtils2ConnMonSecModeMap() |
|
206 // Local function to map WlanQtUtilsWlanSecMode into Connection |
|
207 // monitor's security mode. Currently for UT use only. |
|
208 // --------------------------------------------------------- |
|
209 // |
|
210 static TUint connUtils2ConnMonSecModeMap(WlanQtUtilsWlanSecMode connUtilsWlanSecMode) |
|
211 { |
|
212 TUint ret; |
|
213 switch (connUtilsWlanSecMode) { |
|
214 case WlanQtUtilsWlanSecModeWep: |
|
215 ret = EConnMonSecurityWep; |
|
216 break; |
|
217 case WlanQtUtilsWlanSecMode802_1x: |
|
218 ret = EConnMonSecurity802d1x; |
|
219 break; |
|
220 case WlanQtUtilsWlanSecModeWpa: |
|
221 ret = EConnMonSecurityWpa; |
|
222 break; |
|
223 case WlanQtUtilsWlanSecModeWpa2: |
|
224 ret = EConnMonSecurityWpaPsk; |
|
225 break; |
|
226 default: |
|
227 ret = EConnMonSecurityOpen; |
|
228 break; |
|
229 } |
|
230 return ret; |
|
231 } |
|
232 |
|
233 |
|
234 |
|
235 EXPORT_C void RConnectionMonitor::GetPckgAttribute( |
|
236 const TUint /* aConnectionId */, |
|
237 const TUint /* aSubConnectionId */, |
|
238 const TUint /* aAttribute */, |
|
239 TDes16& aValue, |
|
240 TRequestStatus& aStatus ) const |
|
241 { |
|
242 // TODO: verify input parameters, i.e., first three params... |
|
243 |
|
244 RConnMonWlanNetworksPtrArray wlanPtrArray; |
|
245 RBuf vendorData; |
|
246 |
|
247 for (int i = 0; i < testContext.connMon_.wlanScanResult_.wlanScanResultList_.count(); i++) { |
|
248 WlanQtUtilsWlanAp* ap = testContext.connMon_.wlanScanResult_.wlanScanResultList_[i]; |
|
249 TBufC<CConnMonWlanNetwork::KMaxNameLength> name(ap->ssid().utf16()); |
|
250 |
|
251 TBufC<CConnMonWlanNetwork::KWlanBssId> bssid16(QString("addMAC").utf16()); |
|
252 TBuf8<CConnMonWlanNetwork::KWlanBssId> bssid; |
|
253 bssid.Copy(bssid16); |
|
254 |
|
255 CConnMonWlanNetwork* wlanAp = CConnMonWlanNetwork::NewL( |
|
256 name, |
|
257 ap->connectionMode(), |
|
258 ap->signalStrength(), |
|
259 connUtils2ConnMonSecModeMap(ap->securityMode()), |
|
260 bssid, |
|
261 vendorData ); |
|
262 wlanPtrArray.Append(wlanAp); |
|
263 } |
|
264 |
|
265 CConnMonWlanNetworksPtrArrayPckg wlanBuf(wlanPtrArray, 2560); |
|
266 aValue.Copy(wlanBuf.Buf()->Des()); |
|
267 |
|
268 User::RequestComplete(&aStatus, KErrNone); // TODO: enable return value modification. |
|
269 } |
|
270 |
|
271 #else // WLANQTUTILS_T_WLANQTUTILS_UT_FLAG |
|
272 |
|
273 // ---------------------------------------------------- |
|
274 // Stub functions for connmon library, used in emulator |
|
275 // ---------------------------------------------------- |
|
276 |
|
277 #if 0 |
|
278 // In emulator, there are always two active connections. |
|
279 // The following functions return different properties of these active connection |
|
280 // so that it's easy to test in emulator. |
|
281 |
|
282 EXPORT_C void RConnectionMonitor::GetConnectionCount( |
|
283 TUint& aConnectionCount, |
|
284 TRequestStatus& aStatus) |
|
285 { |
|
286 aConnectionCount = 2; |
|
287 User::RequestComplete(&aStatus, KErrNone); |
|
288 } |
|
289 |
|
290 EXPORT_C TInt RConnectionMonitor::GetConnectionInfo( |
|
291 const TUint aIndex, |
|
292 TUint& aConnectionId, |
|
293 TUint& aSubConnectionCount ) const |
|
294 { |
|
295 if (aIndex == 1) { |
|
296 aConnectionId = 10; |
|
297 } else if (aIndex == 2) { |
|
298 aConnectionId = 20; |
|
299 } else { |
|
300 Q_ASSERT(false); |
|
301 } |
|
302 |
|
303 aSubConnectionCount = 0; |
|
304 return KErrNone; |
|
305 } |
|
306 |
|
307 EXPORT_C void RConnectionMonitor::GetIntAttribute( |
|
308 const TUint aConnectionId, |
|
309 const TUint /* aSubConnectionId */, |
|
310 const TUint aAttribute, |
|
311 TInt& aValue, |
|
312 TRequestStatus& aStatus ) |
|
313 { |
|
314 if (aAttribute == KBearer) { |
|
315 if (aConnectionId == 10) { |
|
316 aValue = EBearerGPRS; |
|
317 } else if (aConnectionId == 20) { |
|
318 aValue = EBearerWLAN; |
|
319 } else { |
|
320 Q_ASSERT(false); |
|
321 } |
|
322 } else if (aAttribute == KConnectionStatus) { |
|
323 if (aConnectionId == 10) { |
|
324 aValue = KConnectionOpen; |
|
325 } else if (aConnectionId == 20) { |
|
326 aValue = KStartingConnection; |
|
327 } else { |
|
328 Q_ASSERT(false); |
|
329 } |
|
330 } else if (aAttribute == KSignalStrength) { |
|
331 if (aConnectionId == 10) { |
|
332 Q_ASSERT(false); |
|
333 } else if (aConnectionId == 20) { |
|
334 aValue = 78; |
|
335 } else { |
|
336 Q_ASSERT(false); |
|
337 } |
|
338 } else if (aAttribute == KNetworkMode) { |
|
339 if (aConnectionId == 10) { |
|
340 Q_ASSERT(false); |
|
341 } else if (aConnectionId == 20) { |
|
342 aValue = EConnMonInfraStructure; |
|
343 } else { |
|
344 Q_ASSERT(false); |
|
345 } |
|
346 } else if (aAttribute == KSecurityMode) { |
|
347 if (aConnectionId == 10) { |
|
348 Q_ASSERT(false); |
|
349 } else if (aConnectionId == 20) { |
|
350 aValue = EConnMonSecurityWpaPsk; |
|
351 } else { |
|
352 Q_ASSERT(false); |
|
353 } |
|
354 } else { |
|
355 Q_ASSERT(false); |
|
356 } |
|
357 User::RequestComplete(&aStatus, KErrNone); |
|
358 } |
|
359 |
|
360 EXPORT_C void RConnectionMonitor::GetUintAttribute( |
|
361 const TUint aConnectionId, |
|
362 const TUint /* aSubConnectionId */, |
|
363 const TUint aAttribute, |
|
364 TUint& aValue, |
|
365 TRequestStatus& aStatus ) |
|
366 { |
|
367 if (aAttribute == KIAPId) { |
|
368 if (aConnectionId == 10) { |
|
369 aValue = 1; |
|
370 } else if (aConnectionId == 20) { |
|
371 aValue = 10; |
|
372 } else { |
|
373 Q_ASSERT(false); |
|
374 } |
|
375 } else if (aAttribute == KDownlinkData) { |
|
376 if (aConnectionId == 10) { |
|
377 aValue = 123; |
|
378 } else if (aConnectionId == 20) { |
|
379 aValue = 12345; |
|
380 } else { |
|
381 Q_ASSERT(false); |
|
382 } |
|
383 } else if (aAttribute == KUplinkData) { |
|
384 if (aConnectionId == 10) { |
|
385 aValue = 987654321; |
|
386 } else if (aConnectionId == 20) { |
|
387 aValue = 1234567890; |
|
388 } else { |
|
389 Q_ASSERT(false); |
|
390 } |
|
391 } else if (aAttribute == KTransmitPower) { |
|
392 if (aConnectionId == 10) { |
|
393 Q_ASSERT(false); |
|
394 } else if (aConnectionId == 20) { |
|
395 aValue = 50; |
|
396 } else { |
|
397 Q_ASSERT(false); |
|
398 } |
|
399 } else { |
|
400 Q_ASSERT(false); |
|
401 } |
|
402 |
|
403 User::RequestComplete(&aStatus, KErrNone); |
|
404 } |
|
405 |
|
406 EXPORT_C void RConnectionMonitor::GetBoolAttribute( |
|
407 const TUint aConnectionId, |
|
408 const TUint /* aSubConnectionId */, |
|
409 const TUint aAttribute, |
|
410 TBool& aValue, |
|
411 TRequestStatus& aStatus ) |
|
412 { |
|
413 if (aAttribute == KConnectionActive) { |
|
414 if (aConnectionId == 10) { |
|
415 aValue = EFalse; |
|
416 } else if (aConnectionId == 20) { |
|
417 aValue = ETrue; |
|
418 } else { |
|
419 Q_ASSERT(false); |
|
420 } |
|
421 } else { |
|
422 Q_ASSERT(false); |
|
423 } |
|
424 |
|
425 User::RequestComplete(&aStatus, KErrNone); |
|
426 } |
|
427 |
|
428 EXPORT_C void RConnectionMonitor::GetStringAttribute( |
|
429 const TUint aConnectionId, |
|
430 const TUint /* aSubConnectionId */, |
|
431 const TUint aAttribute, |
|
432 TDes& aValue, |
|
433 TRequestStatus& aStatus ) const |
|
434 { |
|
435 if (aAttribute == KIAPName) { |
|
436 if (aConnectionId == 10) { |
|
437 _LIT(iapNameLit, "PACKET DATA 1"); |
|
438 TBufC<KConnMonMaxStringAttributeLength> iapName(iapNameLit); |
|
439 aValue = iapName.Des(); |
|
440 } else if (aConnectionId == 20) { |
|
441 _LIT(iapNameLit, "WLAN IAP 3"); |
|
442 TBufC<KConnMonMaxStringAttributeLength> iapName(iapNameLit); |
|
443 aValue = iapName.Des(); |
|
444 } else { |
|
445 Q_ASSERT(false); |
|
446 } |
|
447 } else if (aAttribute == KNetworkName) { |
|
448 if (aConnectionId == 10) { |
|
449 Q_ASSERT(false); |
|
450 } else if (aConnectionId == 20) { |
|
451 _LIT(ssidLit, "WLAN SSID 3"); |
|
452 TBufC<KConnMonMaxStringAttributeLength> ssid(ssidLit); |
|
453 aValue = ssid.Des(); |
|
454 } else { |
|
455 Q_ASSERT(false); |
|
456 } |
|
457 } else if (aAttribute == KAccessPointName) { |
|
458 if (aConnectionId == 10) { |
|
459 _LIT(iapNameLit, "PACKET DATA 1"); |
|
460 TBufC<KConnMonMaxStringAttributeLength> iapName(iapNameLit); |
|
461 aValue = iapName.Des(); |
|
462 } else if (aConnectionId == 20) { |
|
463 Q_ASSERT(false); |
|
464 } else { |
|
465 Q_ASSERT(false); |
|
466 } |
|
467 } else { |
|
468 Q_ASSERT(false); |
|
469 } |
|
470 |
|
471 User::RequestComplete(&aStatus, KErrNone); |
|
472 } |
|
473 |
|
474 EXPORT_C void RConnectionMonitor::GetPckgAttribute( |
|
475 const TUint aConnectionId, |
|
476 const TUint aSubConnectionId, |
|
477 const TUint aAttribute, |
|
478 TDes8& aValue, |
|
479 TRequestStatus& aStatus ) const |
|
480 { |
|
481 if (aAttribute == KStartTime) { |
|
482 if (aConnectionId == 10) { |
|
483 TDateTime dateTime(2009, EMarch, 31-1, 15, 15, 15, 0); |
|
484 TTime time(dateTime); |
|
485 TConnMonTimeBuf timePckg(time); |
|
486 aValue.Copy(timePckg); |
|
487 } else if (aConnectionId == 20) { |
|
488 TTime time; |
|
489 time.UniversalTime(); |
|
490 TConnMonTimeBuf timePckg(time); |
|
491 aValue.Copy(timePckg); |
|
492 } else { |
|
493 Q_ASSERT(false); |
|
494 } |
|
495 User::RequestComplete(&aStatus, KErrNone); |
|
496 } else if (aAttribute == KClientInfo) { |
|
497 TConnMonClientEnum applications; |
|
498 if (aConnectionId == 10) { |
|
499 applications.iCount = 1; |
|
500 applications.iUid[0].iUid = 0x10008D39; // Web |
|
501 applications.iUid[1].iUid = 0; |
|
502 applications.iUid[2].iUid = 0; |
|
503 applications.iUid[3].iUid = 0; |
|
504 applications.iUid[4].iUid = 0; |
|
505 applications.iUid[5].iUid = 0; |
|
506 applications.iUid[6].iUid = 0; |
|
507 applications.iUid[7].iUid = 0; |
|
508 applications.iUid[8].iUid = 0; |
|
509 applications.iUid[9].iUid = 0; |
|
510 } else if (aConnectionId == 20) { |
|
511 applications.iCount = 7; |
|
512 applications.iUid[0].iUid = 0x101fd9c5; // KBannedServerUID |
|
513 applications.iUid[1].iUid = 0x1020728E; // KFeedsServerUid |
|
514 applications.iUid[2].iUid = 0x10008D60; // KDownloadMgrServerUid |
|
515 applications.iUid[3].iUid = 0x1000484b; // KMessagingServerUid |
|
516 applications.iUid[4].iUid = 0x102033E6; // KJavaVMUid |
|
517 applications.iUid[5].iUid = 0x102073CA; // KSUPLServerUid |
|
518 applications.iUid[6].iUid = 0x200212F3; // Connect Screen |
|
519 applications.iUid[7].iUid = 0; |
|
520 applications.iUid[8].iUid = 0; |
|
521 applications.iUid[9].iUid = 0; |
|
522 } else { |
|
523 Q_ASSERT(false); |
|
524 } |
|
525 TPckgBuf< TConnMonClientEnum > applicationsPckg( applications ); |
|
526 aValue.Copy(applicationsPckg); |
|
527 User::RequestComplete(&aStatus, KErrNone); |
|
528 } else { |
|
529 // This is copy-paste from real implementation and we'll use that for other requests. |
|
530 TIpcArgs args( aConnectionId, aSubConnectionId, aAttribute, &aValue ); |
|
531 SendReceive( EReqGetPckgAttribute, args, aStatus ); |
|
532 } |
|
533 } |
|
534 #endif |
|
535 |
|
536 // This function returns WLAN scan results. |
|
537 // Six results in every second scan and the others have two. |
|
538 EXPORT_C void RConnectionMonitor::GetPckgAttribute( |
|
539 const TUint /* aConnectionId */, |
|
540 const TUint /* aSubConnectionId */, |
|
541 const TUint aAttribute, |
|
542 TDes16& aValue, |
|
543 TRequestStatus& aStatus ) const { |
|
544 |
|
545 if (aAttribute == KWlanNetworks) { |
|
546 RConnMonWlanNetworksPtrArray wlanPtrArray; |
|
547 RBuf vendorData; |
|
548 |
|
549 TBufC<CConnMonWlanNetwork::KWlanBssId> bssid16(QString("addMAC").utf16()); |
|
550 TBuf8<CConnMonWlanNetwork::KWlanBssId> bssid; |
|
551 bssid.Copy(bssid16); |
|
552 |
|
553 _LIT(wlanAp1Name, "Test AP 1"); |
|
554 TBufC<CConnMonWlanNetwork::KMaxNameLength> name1(wlanAp1Name); |
|
555 CConnMonWlanNetwork* wlanAp1 = CConnMonWlanNetwork::NewL( |
|
556 name1, |
|
557 EConnMonInfraStructure, |
|
558 20, |
|
559 EConnMonSecurityOpen, |
|
560 bssid, |
|
561 vendorData ); |
|
562 wlanPtrArray.Append(wlanAp1); |
|
563 |
|
564 _LIT(wlanAp2Name, "Test AP 2"); |
|
565 TBufC<CConnMonWlanNetwork::KMaxNameLength> name2(wlanAp2Name); |
|
566 CConnMonWlanNetwork* wlanAp2 = CConnMonWlanNetwork::NewL( |
|
567 name2, |
|
568 EConnMonAdHoc, |
|
569 20, |
|
570 EConnMonSecurityOpen, |
|
571 bssid, |
|
572 vendorData ); |
|
573 wlanPtrArray.Append(wlanAp2); |
|
574 |
|
575 static bool refresh = true; |
|
576 |
|
577 if (refresh) { |
|
578 _LIT(wlanAp3Name, "Test AP 3"); |
|
579 TBufC<CConnMonWlanNetwork::KMaxNameLength> name3(wlanAp3Name); |
|
580 CConnMonWlanNetwork* wlanAp3 = CConnMonWlanNetwork::NewL( |
|
581 name3, |
|
582 EConnMonInfraStructure, |
|
583 20, |
|
584 EConnMonSecurityWep, |
|
585 bssid, |
|
586 vendorData ); |
|
587 wlanPtrArray.Append(wlanAp3); |
|
588 |
|
589 _LIT(wlanAp4Name, "Test AP 4"); |
|
590 TBufC<CConnMonWlanNetwork::KMaxNameLength> name4(wlanAp4Name); |
|
591 CConnMonWlanNetwork* wlanAp4 = CConnMonWlanNetwork::NewL( |
|
592 name4, |
|
593 EConnMonInfraStructure, |
|
594 20, |
|
595 EConnMonSecurityOpen, |
|
596 bssid, |
|
597 vendorData ); |
|
598 wlanPtrArray.Append(wlanAp4); |
|
599 |
|
600 _LIT(wlanAp5Name, "Test AP 5"); |
|
601 TBufC<CConnMonWlanNetwork::KMaxNameLength> name5(wlanAp5Name); |
|
602 CConnMonWlanNetwork* wlanAp5 = CConnMonWlanNetwork::NewL( |
|
603 name5, |
|
604 EConnMonInfraStructure, |
|
605 20, |
|
606 EConnMonSecurityWpa, |
|
607 bssid, |
|
608 vendorData ); |
|
609 wlanPtrArray.Append(wlanAp5); |
|
610 |
|
611 _LIT(wlanAp6Name, "Test AP 6"); |
|
612 TBufC<CConnMonWlanNetwork::KMaxNameLength> name6(wlanAp6Name); |
|
613 CConnMonWlanNetwork* wlanAp6 = CConnMonWlanNetwork::NewL( |
|
614 name6, |
|
615 EConnMonInfraStructure, |
|
616 20, |
|
617 EConnMonSecurityWpaPsk, |
|
618 bssid, |
|
619 vendorData ); |
|
620 wlanPtrArray.Append(wlanAp6); |
|
621 |
|
622 refresh = false; |
|
623 } else { |
|
624 refresh = true; |
|
625 } |
|
626 |
|
627 CConnMonWlanNetworksPtrArrayPckg wlanBuf(wlanPtrArray, 2560); // TODO: buffer size to more dynamic or use constant |
|
628 aValue.Copy(wlanBuf.Buf()->Des()); |
|
629 } else { |
|
630 Q_ASSERT(false); |
|
631 } |
|
632 |
|
633 User::RequestComplete(&aStatus, KErrNone); |
|
634 } |
|
635 |
|
636 #endif // WLANQTUTILS_T_WLANQTUTILS_UT_FLAG |
|
637 #endif // __WINS__ |
|