|
1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #include "lbsnetsim.h" |
|
17 #include "lbsnetsimtest.h" |
|
18 #include "lbsnetsimtestobserver.h" |
|
19 |
|
20 #include <lbs/lbsassistancedatabuilderset.h> |
|
21 #include <e32property.h> |
|
22 |
|
23 /** |
|
24 Constructor |
|
25 */ |
|
26 EXPORT_C RLbsNetSimTest::RLbsNetSimTest() : |
|
27 iObserver(NULL), iNotificationConnect(NULL), iNotificationDisconnect(NULL), |
|
28 iNotificationRegisterLcsMoLr(NULL), iNotificationReleaseLcsMoLr(NULL), |
|
29 iNotificationMeasurementReport(NULL), |
|
30 iNotificationMeasurementReportRequestMoreAssitanceData(NULL), iNotificationMeasurementReportControlFailure(NULL), |
|
31 iNotificationMeasurementControlLocation(NULL), iNotificationFacilityLcsMoLrResult(NULL), |
|
32 iMessageReleaseLcsLocationNotification(NULL), iMessageStartNetworkLocationRequest(NULL) |
|
33 { |
|
34 } |
|
35 |
|
36 |
|
37 /** |
|
38 Destructor |
|
39 */ |
|
40 EXPORT_C RLbsNetSimTest::~RLbsNetSimTest() |
|
41 { |
|
42 } |
|
43 |
|
44 /** |
|
45 Connect to the server |
|
46 |
|
47 @param aObserver observer to use for callbacks |
|
48 */ |
|
49 EXPORT_C TInt RLbsNetSimTest::ConnectL(MLbsNetSimTestObserver* aObserver) |
|
50 { |
|
51 TInt err = KErrNone; |
|
52 |
|
53 // Attempt to start the server and create a session |
|
54 for (TInt x = 0; ((x < 2) && (err == KErrNone)); x++) |
|
55 { |
|
56 err = CreateSession(KLbsNetSimServerName, TVersion(0,0,0)); |
|
57 if (err == KErrNone) |
|
58 { |
|
59 break; // We have a session |
|
60 } |
|
61 |
|
62 // Cant create a session |
|
63 if ((err == KErrNotFound) || (err == KErrServerTerminated)) |
|
64 { |
|
65 // We need to start the server |
|
66 err = StartServer(); |
|
67 } // if |
|
68 } // for |
|
69 |
|
70 // Leave if we have no session |
|
71 if (err == KErrNone) |
|
72 { |
|
73 TIpcArgs args(ETestHandler); |
|
74 err = SendReceive(EInitialise, args); |
|
75 |
|
76 // Again if we cant initialise then leave |
|
77 if (err == KErrNone) |
|
78 { |
|
79 iObserver = aObserver; |
|
80 if (iObserver != NULL) |
|
81 { |
|
82 // Create callback handlers |
|
83 iNotificationConnect = new(ELeave) CNotificationConnect(this, iObserver); |
|
84 iNotificationDisconnect = new(ELeave) CNotificationDisconnect(this, iObserver); |
|
85 iNotificationRegisterLcsMoLr = new(ELeave) CNotificationRegisterLcsMoLr(this, iObserver); |
|
86 iNotificationReleaseLcsMoLr = new(ELeave) CNotificationReleaseLcsMoLr(this, iObserver); |
|
87 iMessageReleaseLcsLocationNotification = new(ELeave) CMessageReleaseLcsLocationNotification(this, iObserver); |
|
88 iNotificationMeasurementReport = new(ELeave) CNotificationMeasurementReport(this, iObserver); |
|
89 iNotificationMeasurementReportRequestMoreAssitanceData = new(ELeave) CNotificationMeasurementReportRequestMoreAssitanceData(this, iObserver); |
|
90 iNotificationMeasurementReportControlFailure = new(ELeave) CNotificationMeasurementReportControlFailure(this, iObserver); |
|
91 iNotificationMeasurementControlLocation = CNotificationMeasurementControlLocation::NewL(this, iObserver); |
|
92 iNotificationFacilityLcsMoLrResult = new(ELeave) CNotificationFacilityLcsMoLrResult(this, iObserver); |
|
93 iMessageStartNetworkLocationRequest = new(ELeave) CMessageStartNetworkLocationRequest(this, iObserver); |
|
94 |
|
95 // Set-up property for step mode |
|
96 err = RProperty::Define(TUid::Uid(KLbsNetSimClient), KLbsStepModeKey, RProperty::EInt, |
|
97 ECapability_None, ECapability_None); |
|
98 |
|
99 if (err == KErrAlreadyExists) |
|
100 err = KErrNone; //we have already setup NetSim and property before |
|
101 } |
|
102 } |
|
103 } |
|
104 |
|
105 return err; |
|
106 } |
|
107 |
|
108 |
|
109 /** |
|
110 Close the connection to the server |
|
111 */ |
|
112 EXPORT_C void RLbsNetSimTest::Close() |
|
113 { |
|
114 // Cleanup here as they are created in the connect |
|
115 delete iNotificationConnect; |
|
116 delete iNotificationDisconnect; |
|
117 delete iNotificationRegisterLcsMoLr; |
|
118 delete iNotificationReleaseLcsMoLr; |
|
119 delete iMessageReleaseLcsLocationNotification; |
|
120 delete iNotificationMeasurementReport; |
|
121 delete iNotificationMeasurementReportRequestMoreAssitanceData; |
|
122 delete iNotificationMeasurementReportControlFailure; |
|
123 delete iNotificationMeasurementControlLocation; |
|
124 delete iNotificationFacilityLcsMoLrResult; |
|
125 delete iMessageStartNetworkLocationRequest; |
|
126 |
|
127 RSessionBase::Close(); |
|
128 } |
|
129 |
|
130 |
|
131 /** |
|
132 Set the reference location to use |
|
133 |
|
134 The reference location is passed to the assitance data supply module when |
|
135 retrieving assistance data. |
|
136 |
|
137 @param aLocation the reference location |
|
138 */ |
|
139 EXPORT_C TBool RLbsNetSimTest::SetReferenceLocation(TPosition& aPosition) |
|
140 { |
|
141 TPckg<TPosition> positionPkg(aPosition); |
|
142 |
|
143 TIpcArgs args(&positionPkg); |
|
144 return (SendReceive(ETSetReferenceLocation, args) == KErrNone); |
|
145 } |
|
146 |
|
147 |
|
148 /** |
|
149 Set the reference location to use |
|
150 |
|
151 The reference location is passed to the assitance data supply module when |
|
152 retrieving assistance data. |
|
153 |
|
154 @param aLocation the reference location |
|
155 */ |
|
156 EXPORT_C TBool RLbsNetSimTest::SetReferenceLocation(TDesC8& aLocation) |
|
157 { |
|
158 TIpcArgs args(&aLocation); |
|
159 return (SendReceive(ETSetReferenceLocationData, args) == KErrNone); |
|
160 } |
|
161 |
|
162 |
|
163 /** |
|
164 Set the time taken to respond to a request |
|
165 |
|
166 @param aTime the time in milliseconds to wait before responding |
|
167 @param aSticky continue using this delay until further notice |
|
168 */ |
|
169 EXPORT_C TBool RLbsNetSimTest::SetResponseTime(TInt32 aTime, TBool aSticky) |
|
170 { |
|
171 TIpcArgs args(aTime, aSticky); |
|
172 return (SendReceive(ETSetResponseTime, args) == KErrNone); |
|
173 } |
|
174 |
|
175 |
|
176 /** |
|
177 Set the error to respond to a request |
|
178 |
|
179 @param aError any error value |
|
180 @param aSticky continue using this delay until further notice |
|
181 */ |
|
182 EXPORT_C TBool RLbsNetSimTest::SetResponseError(TInt32 aError, TBool aSticky) |
|
183 { |
|
184 TIpcArgs args(aError, aSticky); |
|
185 return (SendReceive(ETSetResponseError, args) == KErrNone); |
|
186 } |
|
187 |
|
188 |
|
189 /** |
|
190 Set the default assitance data returned |
|
191 |
|
192 @param aFilter the filter |
|
193 */ |
|
194 EXPORT_C TBool RLbsNetSimTest::SetDefaultAssitanceDataFilter(TLbsAssistanceDataGroup& aFilter) |
|
195 { |
|
196 TPckg<TLbsAssistanceDataGroup> filterPkg(aFilter); |
|
197 TIpcArgs args(&filterPkg); |
|
198 return (SendReceive(ETSetDefaultAssitanceDataFilter, args) == KErrNone); |
|
199 } |
|
200 |
|
201 |
|
202 /** |
|
203 Set the default assitance data returned if more assitance data is required |
|
204 |
|
205 @param aFilter the filter |
|
206 */ |
|
207 EXPORT_C TBool RLbsNetSimTest::SetMoreAssitanceDataFilter(TLbsAssistanceDataGroup& aFilter) |
|
208 { |
|
209 TPckg<TLbsAssistanceDataGroup> filterPkg(aFilter); |
|
210 TIpcArgs args(&filterPkg); |
|
211 return (SendReceive(ETSetMoreDefaultAssitanceDataFilter, args) == KErrNone); |
|
212 } |
|
213 |
|
214 |
|
215 /** |
|
216 Clear the filters back to there default states |
|
217 */ |
|
218 EXPORT_C TBool RLbsNetSimTest::ClearAssistanceDataFilters() |
|
219 { |
|
220 return (SendReceive(ETClearAssitanceDataFilters) == KErrNone); |
|
221 } |
|
222 |
|
223 |
|
224 /** |
|
225 Select which assitance data provider to use |
|
226 |
|
227 @param aProvider the TUid of the provider to use |
|
228 */ |
|
229 EXPORT_C TBool RLbsNetSimTest::SetAssistanceDataProvider(TUid aProvider) |
|
230 { |
|
231 |
|
232 TIpcArgs args(aProvider.iUid); |
|
233 return (SendReceive(ETSetAssistanceDataProvider, args) == KErrNone); |
|
234 } |
|
235 |
|
236 |
|
237 /** |
|
238 Set the emergeny status of the phone |
|
239 |
|
240 @param aEmergency ETrue if the phone should be in emergeny status |
|
241 */ |
|
242 EXPORT_C TBool RLbsNetSimTest::SetEmergenyStatus(TBool aEmergency) |
|
243 { |
|
244 TIpcArgs args(aEmergency); |
|
245 return (SendReceive(ETSetEmergenyStatus, args) == KErrNone); |
|
246 } |
|
247 |
|
248 |
|
249 /** |
|
250 Set the roaming status of the phone |
|
251 |
|
252 @param aRoaming ETrue if the phone should be in roaming status |
|
253 */ |
|
254 EXPORT_C TBool RLbsNetSimTest::SetRoamingStatus(TBool aRoaming) |
|
255 { |
|
256 TIpcArgs args(aRoaming); |
|
257 return (SendReceive(ETSetRoamingStatus, args) == KErrNone); |
|
258 } |
|
259 |
|
260 |
|
261 /** |
|
262 Set the quality |
|
263 |
|
264 @param aQuality The quality of the data |
|
265 */ |
|
266 EXPORT_C TBool RLbsNetSimTest::SetQuality(TLbsNetPosRequestQuality& aQuality) |
|
267 { |
|
268 TPckg<TLbsNetPosRequestQuality> qualityPkg(aQuality); |
|
269 TIpcArgs args(&qualityPkg); |
|
270 return (SendReceive(ETSetRequestQuality, args) == KErrNone); |
|
271 } |
|
272 |
|
273 EXPORT_C TBool RLbsNetSimTest::SendResetAssistanceData(TLbsAssistanceDataGroup aMask) |
|
274 { |
|
275 TIpcArgs args(aMask); |
|
276 return (SendReceive(ETSendResetAssistanceData, args) == KErrNone); |
|
277 } |
|
278 |
|
279 |
|
280 |
|
281 /** |
|
282 Start a network privacy request |
|
283 |
|
284 @param aType |
|
285 @param aRequest |
|
286 */ |
|
287 EXPORT_C void RLbsNetSimTest::StartNetworkPrivacyRequest(TLbsNetPosRequestPrivacy aType, |
|
288 TLbsExternalRequestInfo& aRequest) |
|
289 { |
|
290 if (iObserver != NULL) |
|
291 { |
|
292 iMessageReleaseLcsLocationNotification->Send(aType, aRequest); |
|
293 } |
|
294 } |
|
295 |
|
296 |
|
297 /** |
|
298 Cancel an outstanding network privacy request |
|
299 |
|
300 |
|
301 */ |
|
302 EXPORT_C void RLbsNetSimTest::CancelNetworkPrivacyRequest() |
|
303 { |
|
304 if (iObserver != NULL) |
|
305 { |
|
306 iMessageReleaseLcsLocationNotification->Cancel(); |
|
307 } |
|
308 } |
|
309 |
|
310 |
|
311 /** |
|
312 Start a network location request |
|
313 */ |
|
314 EXPORT_C void RLbsNetSimTest::StartNetworkLocationRequest() |
|
315 { |
|
316 if (iObserver != NULL) |
|
317 { |
|
318 iMessageStartNetworkLocationRequest->Send(); |
|
319 } |
|
320 } |
|
321 |
|
322 |
|
323 /** |
|
324 Cancels an outstanding network location request |
|
325 |
|
326 */ |
|
327 EXPORT_C void RLbsNetSimTest::CancelNetworkLocationRequest() |
|
328 { |
|
329 if (iObserver != NULL) |
|
330 { |
|
331 iMessageStartNetworkLocationRequest->Cancel(); |
|
332 } |
|
333 } |
|
334 |
|
335 |
|
336 /** |
|
337 Enable the simulators step mode |
|
338 |
|
339 @param aStepMode ETrue to enter step mode |
|
340 */ |
|
341 EXPORT_C TBool RLbsNetSimTest::SetStepMode(TBool aStepMode) |
|
342 { |
|
343 if (iObserver != NULL) |
|
344 { |
|
345 TIpcArgs args(aStepMode); |
|
346 return (SendReceive(ETSetStepMode, args) == KErrNone); |
|
347 } |
|
348 else |
|
349 { |
|
350 return EFalse; |
|
351 } |
|
352 } |
|
353 |
|
354 |
|
355 /** |
|
356 Enable the simulator to peform the next step |
|
357 |
|
358 @param aError The error to use, KErrNone for normal behaviour |
|
359 |
|
360 */ |
|
361 EXPORT_C TBool RLbsNetSimTest::Next(TInt aError) |
|
362 { |
|
363 if (iObserver != NULL) |
|
364 { |
|
365 RProperty::Set(TUid::Uid(KLbsNetSimClient), KLbsStepModeKey, aError); |
|
366 |
|
367 return ETrue; |
|
368 } |
|
369 else |
|
370 { |
|
371 return EFalse; |
|
372 } |
|
373 } |
|
374 |
|
375 |
|
376 // |
|
377 // Private methods |
|
378 |
|
379 /** |
|
380 */ |
|
381 TInt RLbsNetSimTest::StartServer() |
|
382 { |
|
383 RProcess server; |
|
384 |
|
385 // Create the process/server |
|
386 TInt err = server.Create(KLBSNetSimServerBinary, KNullDesC); |
|
387 |
|
388 if (err == KErrNone) |
|
389 { |
|
390 TRequestStatus status; |
|
391 |
|
392 // Start the server |
|
393 server.Rendezvous(status); |
|
394 if (status != KRequestPending) |
|
395 { |
|
396 server.Kill(KErrNone); |
|
397 } // if |
|
398 else |
|
399 { |
|
400 server.Resume(); |
|
401 } // else |
|
402 |
|
403 // Wait for server to start |
|
404 User::WaitForRequest(status); |
|
405 |
|
406 // Result |
|
407 err = (server.ExitType() == EExitPanic) ? KErrGeneral : status.Int(); |
|
408 |
|
409 // Cleanup |
|
410 server.Close(); |
|
411 } // if |
|
412 |
|
413 return err; |
|
414 } |
|
415 |
|
416 // |
|
417 // CNotifications: CNotificationConnect |
|
418 RLbsNetSimTest::CNotificationConnect::CNotificationConnect(RLbsNetSimTest* aTest, MLbsNetSimTestObserver* aObserver) : |
|
419 CActive(EPriorityStandard), iTest(aTest), iObserver(aObserver) |
|
420 { |
|
421 CActiveScheduler::Add(this); |
|
422 |
|
423 TIpcArgs args(ENotificationConnect); |
|
424 iTest->SendReceive(ECallbacks, args, iStatus); |
|
425 SetActive(); |
|
426 } |
|
427 |
|
428 RLbsNetSimTest::CNotificationConnect::~CNotificationConnect() |
|
429 { |
|
430 Cancel(); |
|
431 } |
|
432 |
|
433 void RLbsNetSimTest::CNotificationConnect::RunL() |
|
434 { |
|
435 if (iStatus == KErrNone) |
|
436 { |
|
437 iObserver->Connected(); |
|
438 |
|
439 TIpcArgs args(ENotificationConnect); |
|
440 iTest->SendReceive(ECallbacks, args, iStatus); |
|
441 SetActive(); |
|
442 } // if |
|
443 } |
|
444 |
|
445 void RLbsNetSimTest::CNotificationConnect::DoCancel() |
|
446 { |
|
447 TIpcArgs args(ENotificationConnectCancel); |
|
448 iTest->Send(ECallbacks, args); |
|
449 } |
|
450 |
|
451 |
|
452 // |
|
453 // CNotifications: CNotificationDisconnect |
|
454 RLbsNetSimTest::CNotificationDisconnect::CNotificationDisconnect(RLbsNetSimTest* aTest, MLbsNetSimTestObserver* aObserver) : |
|
455 CActive(EPriorityStandard), iTest(aTest), iObserver(aObserver) |
|
456 { |
|
457 CActiveScheduler::Add(this); |
|
458 |
|
459 TIpcArgs args(ENotificationDisconnect); |
|
460 iTest->SendReceive(ECallbacks, args, iStatus); |
|
461 SetActive(); |
|
462 } |
|
463 |
|
464 RLbsNetSimTest::CNotificationDisconnect::~CNotificationDisconnect() |
|
465 { |
|
466 Cancel(); |
|
467 } |
|
468 |
|
469 |
|
470 void RLbsNetSimTest::CNotificationDisconnect::RunL() |
|
471 { |
|
472 if (iStatus == KErrNone) |
|
473 { |
|
474 iObserver->Disconnected(); |
|
475 |
|
476 TIpcArgs args(ENotificationDisconnect); |
|
477 iTest->SendReceive(ECallbacks, args, iStatus); |
|
478 SetActive(); |
|
479 } // if |
|
480 } |
|
481 |
|
482 void RLbsNetSimTest::CNotificationDisconnect::DoCancel() |
|
483 { |
|
484 TIpcArgs args(ENotificationDisconnectCancel); |
|
485 iTest->Send(ECallbacks, args); |
|
486 } |
|
487 |
|
488 |
|
489 // |
|
490 // CNotifications: CNotificationRegisterLcsMoLr |
|
491 RLbsNetSimTest::CNotificationRegisterLcsMoLr::CNotificationRegisterLcsMoLr(RLbsNetSimTest* aTest, MLbsNetSimTestObserver* aObserver) : |
|
492 CActive(EPriorityStandard), iTest(aTest), iObserver(aObserver) |
|
493 { |
|
494 CActiveScheduler::Add(this); |
|
495 |
|
496 TIpcArgs args(ENotificationRegisterLcsMoLr, &iData); |
|
497 iTest->SendReceive(ECallbacks, args, iStatus); |
|
498 SetActive(); |
|
499 } |
|
500 |
|
501 RLbsNetSimTest::CNotificationRegisterLcsMoLr::~CNotificationRegisterLcsMoLr() |
|
502 { |
|
503 Cancel(); |
|
504 } |
|
505 |
|
506 |
|
507 void RLbsNetSimTest::CNotificationRegisterLcsMoLr::RunL() |
|
508 { |
|
509 if (iStatus == KErrNone) |
|
510 { |
|
511 iObserver->NotifyRegisterLcsMoLr(iData); |
|
512 |
|
513 TIpcArgs args(ENotificationRegisterLcsMoLr, &iData); |
|
514 iTest->SendReceive(ECallbacks, args, iStatus); |
|
515 SetActive(); |
|
516 } // if |
|
517 } |
|
518 |
|
519 void RLbsNetSimTest::CNotificationRegisterLcsMoLr::DoCancel() |
|
520 { |
|
521 TIpcArgs args(ENotificationRegisterLcsMoLrCancel); |
|
522 iTest->Send(ECallbacks, args); |
|
523 } |
|
524 |
|
525 |
|
526 // |
|
527 // CNotifications: CNotificationReleaseLcsMoLr |
|
528 // |
|
529 // Priority of this object is low as it should be the last notification fired if more than |
|
530 // one notification is active at the same time |
|
531 RLbsNetSimTest::CNotificationReleaseLcsMoLr::CNotificationReleaseLcsMoLr(RLbsNetSimTest* aTest, MLbsNetSimTestObserver* aObserver) : |
|
532 CActive(EPriorityMuchLess), iTest(aTest), iObserver(aObserver), iReasonPkg(iReason) |
|
533 { |
|
534 CActiveScheduler::Add(this); |
|
535 |
|
536 TIpcArgs args(ENotificationReleaseLcsMoLr, &iReasonPkg); |
|
537 iTest->SendReceive(ECallbacks, args, iStatus); |
|
538 SetActive(); |
|
539 } |
|
540 |
|
541 RLbsNetSimTest::CNotificationReleaseLcsMoLr::~CNotificationReleaseLcsMoLr() |
|
542 { |
|
543 Cancel(); |
|
544 } |
|
545 |
|
546 |
|
547 void RLbsNetSimTest::CNotificationReleaseLcsMoLr::RunL() |
|
548 { |
|
549 if (iStatus == KErrNone) |
|
550 { |
|
551 iObserver->NotifyReleaseLcsMoLr(iReason); |
|
552 |
|
553 TIpcArgs args(ENotificationReleaseLcsMoLr, &iReasonPkg); |
|
554 iTest->SendReceive(ECallbacks, args, iStatus); |
|
555 SetActive(); |
|
556 } // if |
|
557 } |
|
558 |
|
559 void RLbsNetSimTest::CNotificationReleaseLcsMoLr::DoCancel() |
|
560 { |
|
561 TIpcArgs args(ENotificationReleaseLcsMoLrCancel); |
|
562 iTest->Send(ECallbacks, args); |
|
563 } |
|
564 // |
|
565 // CNotifications: CNotificationMeasurementReport |
|
566 RLbsNetSimTest::CNotificationMeasurementReport::CNotificationMeasurementReport(RLbsNetSimTest* aTest, MLbsNetSimTestObserver* aObserver) : |
|
567 CActive(EPriorityStandard), iTest(aTest), iObserver(aObserver), iPositionPkg(iPosition) |
|
568 { |
|
569 CActiveScheduler::Add(this); |
|
570 |
|
571 TIpcArgs args(ENotificationMeasurementReport, &iPositionPkg); |
|
572 iTest->SendReceive(ECallbacks, args, iStatus); |
|
573 SetActive(); |
|
574 } |
|
575 |
|
576 RLbsNetSimTest::CNotificationMeasurementReport::~CNotificationMeasurementReport() |
|
577 { |
|
578 Cancel(); |
|
579 } |
|
580 |
|
581 |
|
582 void RLbsNetSimTest::CNotificationMeasurementReport::RunL() |
|
583 { |
|
584 if (iStatus == KErrNone) |
|
585 { |
|
586 iObserver->NotifyMeasurementReportLocation(iPosition); |
|
587 |
|
588 TIpcArgs args(ENotificationMeasurementReport, &iPositionPkg); |
|
589 iTest->SendReceive(ECallbacks, args, iStatus); |
|
590 SetActive(); |
|
591 } // if |
|
592 } |
|
593 |
|
594 void RLbsNetSimTest::CNotificationMeasurementReport::DoCancel() |
|
595 { |
|
596 TIpcArgs args(ENotificationMeasurementReportCancel); |
|
597 iTest->Send(ECallbacks, args); |
|
598 } |
|
599 |
|
600 // |
|
601 // CNotifications: CNotificationMeasurementReportRequestMoreAssitanceData |
|
602 RLbsNetSimTest::CNotificationMeasurementReportRequestMoreAssitanceData::CNotificationMeasurementReportRequestMoreAssitanceData(RLbsNetSimTest* aTest, MLbsNetSimTestObserver* aObserver) : |
|
603 CActive(EPriorityStandard), iTest(aTest), iObserver(aObserver), iFilterPkg(iFilter) |
|
604 { |
|
605 CActiveScheduler::Add(this); |
|
606 |
|
607 TIpcArgs args(ENotificationMeasurementReportRequestMoreAssitanceData, &iFilterPkg); |
|
608 iTest->SendReceive(ECallbacks, args, iStatus); |
|
609 SetActive(); |
|
610 } |
|
611 |
|
612 RLbsNetSimTest::CNotificationMeasurementReportRequestMoreAssitanceData::~CNotificationMeasurementReportRequestMoreAssitanceData() |
|
613 { |
|
614 Cancel(); |
|
615 } |
|
616 |
|
617 |
|
618 void RLbsNetSimTest::CNotificationMeasurementReportRequestMoreAssitanceData::RunL() |
|
619 { |
|
620 if (iStatus == KErrNone) |
|
621 { |
|
622 iObserver->NotifyMeasurementReportRequestMoreAssistanceData(iFilter); |
|
623 |
|
624 TIpcArgs args(ENotificationMeasurementReportRequestMoreAssitanceData, &iFilterPkg); |
|
625 iTest->SendReceive(ECallbacks, args, iStatus); |
|
626 SetActive(); |
|
627 } // if |
|
628 } |
|
629 |
|
630 void RLbsNetSimTest::CNotificationMeasurementReportRequestMoreAssitanceData::DoCancel() |
|
631 { |
|
632 TIpcArgs args(ENotificationMeasurementReportRequestMoreAssitanceDataCancel); |
|
633 iTest->Send(ECallbacks, args); |
|
634 } |
|
635 |
|
636 // |
|
637 // CNotifications: CNotificationMeasurementReportControlFailure |
|
638 RLbsNetSimTest::CNotificationMeasurementReportControlFailure::CNotificationMeasurementReportControlFailure(RLbsNetSimTest* aTest, MLbsNetSimTestObserver* aObserver) : |
|
639 CActive(EPriorityStandard), iTest(aTest), iObserver(aObserver), iReasonPkg(iReason) |
|
640 { |
|
641 CActiveScheduler::Add(this); |
|
642 |
|
643 TIpcArgs args(ENotificationMeasurementReportControlFailure, &iReasonPkg); |
|
644 iTest->SendReceive(ECallbacks, args, iStatus); |
|
645 SetActive(); |
|
646 } |
|
647 |
|
648 RLbsNetSimTest::CNotificationMeasurementReportControlFailure::~CNotificationMeasurementReportControlFailure() |
|
649 { |
|
650 Cancel(); |
|
651 } |
|
652 |
|
653 |
|
654 void RLbsNetSimTest::CNotificationMeasurementReportControlFailure::RunL() |
|
655 { |
|
656 if (iStatus == KErrNone) |
|
657 { |
|
658 iObserver->NotifyMeasurementReportControlFailure(iReason); |
|
659 |
|
660 TIpcArgs args(ENotificationMeasurementReportControlFailure, &iReasonPkg); |
|
661 iTest->SendReceive(ECallbacks, args, iStatus); |
|
662 SetActive(); |
|
663 } // if |
|
664 } |
|
665 |
|
666 void RLbsNetSimTest::CNotificationMeasurementReportControlFailure::DoCancel() |
|
667 { |
|
668 TIpcArgs args(ENotificationMeasurementReportControlFailureCancel); |
|
669 iTest->Send(ECallbacks, args); |
|
670 } |
|
671 |
|
672 // |
|
673 // CNotifications: CNotificationMeasurementControlLocation |
|
674 RLbsNetSimTest::CNotificationMeasurementControlLocation* RLbsNetSimTest::CNotificationMeasurementControlLocation::NewL(RLbsNetSimTest* aTest, MLbsNetSimTestObserver* aObserver) |
|
675 { |
|
676 CNotificationMeasurementControlLocation* self = new (ELeave) CNotificationMeasurementControlLocation(aTest, aObserver); |
|
677 CleanupStack::PushL(self); |
|
678 self->ConstructL(); |
|
679 CleanupStack::Pop(); |
|
680 |
|
681 return self; |
|
682 } |
|
683 |
|
684 void RLbsNetSimTest::CNotificationMeasurementControlLocation::ConstructL() |
|
685 { |
|
686 iAssistanceData = HBufC8::NewL(RLbsAssistanceDataBuilderSet::MaxExternalizedBufferSize()); |
|
687 iPtr.Set(iAssistanceData->Des()); |
|
688 |
|
689 TIpcArgs args(ENotificationMeasurementControlLocation, &iPositionPkg, &iQualityPkg, &iPtr); |
|
690 iTest->SendReceive(ECallbacks, args, iStatus); |
|
691 SetActive(); |
|
692 } |
|
693 |
|
694 RLbsNetSimTest::CNotificationMeasurementControlLocation::CNotificationMeasurementControlLocation(RLbsNetSimTest* aTest, MLbsNetSimTestObserver* aObserver) : |
|
695 CActive(EPriorityStandard), iTest(aTest), iObserver(aObserver), |
|
696 iPositionPkg(iPosition), iQualityPkg(iQuality), iPtr(NULL, 0) |
|
697 { |
|
698 CActiveScheduler::Add(this); |
|
699 } |
|
700 |
|
701 RLbsNetSimTest::CNotificationMeasurementControlLocation::~CNotificationMeasurementControlLocation() |
|
702 { |
|
703 Cancel(); |
|
704 delete iAssistanceData; |
|
705 } |
|
706 |
|
707 |
|
708 void RLbsNetSimTest::CNotificationMeasurementControlLocation::RunL() |
|
709 { |
|
710 if (iStatus == KErrNone) |
|
711 { |
|
712 // Read the assistance data back out |
|
713 RLbsAssistanceDataBuilderSet assistanceData; |
|
714 CleanupClosePushL(assistanceData); |
|
715 assistanceData.OpenL(); |
|
716 RDesReadStream stream(iPtr); |
|
717 CleanupClosePushL(stream); |
|
718 assistanceData.InternalizeL(stream); |
|
719 |
|
720 iObserver->NotifyMeasurementControlLocation(iPosition, assistanceData, iQuality); |
|
721 |
|
722 |
|
723 TIpcArgs args(ENotificationMeasurementControlLocation, &iPositionPkg, &iQualityPkg, &iPtr); |
|
724 iTest->SendReceive(ECallbacks, args, iStatus); |
|
725 SetActive(); |
|
726 |
|
727 // Cleanup |
|
728 CleanupStack::PopAndDestroy(2); |
|
729 } // if |
|
730 } |
|
731 |
|
732 void RLbsNetSimTest::CNotificationMeasurementControlLocation::DoCancel() |
|
733 { |
|
734 TIpcArgs args(ENotificationMeasurementControlLocationCancel); |
|
735 iTest->Send(ECallbacks, args); |
|
736 } |
|
737 |
|
738 // |
|
739 // CNotifications: CNotificationFacilityLcsMoLrResult |
|
740 RLbsNetSimTest::CNotificationFacilityLcsMoLrResult::CNotificationFacilityLcsMoLrResult(RLbsNetSimTest* aTest, MLbsNetSimTestObserver* aObserver) : |
|
741 CActive(EPriorityStandard), iTest(aTest), iObserver(aObserver), iReasonPkg(iReason), iPositionPkg(iPosition) |
|
742 { |
|
743 CActiveScheduler::Add(this); |
|
744 |
|
745 TIpcArgs args(ENotificationFacilityLcsMoLrResult, &iReasonPkg, &iPositionPkg); |
|
746 iTest->SendReceive(ECallbacks, args, iStatus); |
|
747 SetActive(); |
|
748 } |
|
749 |
|
750 RLbsNetSimTest::CNotificationFacilityLcsMoLrResult::~CNotificationFacilityLcsMoLrResult() |
|
751 { |
|
752 Cancel(); |
|
753 } |
|
754 |
|
755 |
|
756 void RLbsNetSimTest::CNotificationFacilityLcsMoLrResult::RunL() |
|
757 { |
|
758 if (iStatus == KErrNone) |
|
759 { |
|
760 iObserver->NotifyFacilityLcsMoLrResult(iReason, iPosition); |
|
761 |
|
762 TIpcArgs args(ENotificationFacilityLcsMoLrResult, &iReasonPkg, &iPositionPkg); |
|
763 iTest->SendReceive(ECallbacks, args, iStatus); |
|
764 SetActive(); |
|
765 } // if |
|
766 } |
|
767 |
|
768 void RLbsNetSimTest::CNotificationFacilityLcsMoLrResult::DoCancel() |
|
769 { |
|
770 TIpcArgs args(ENotificationFacilityLcsMoLrResultCancel); |
|
771 iTest->Send(ECallbacks, args); |
|
772 } |
|
773 // |
|
774 // CNotifications: CMessageReleaseLcsLocationNotification |
|
775 RLbsNetSimTest::CMessageReleaseLcsLocationNotification::CMessageReleaseLcsLocationNotification(RLbsNetSimTest* aTest, MLbsNetSimTestObserver* aObserver) : |
|
776 CActive(EPriorityStandard), iTest(aTest), iObserver(aObserver), iTypePkg(iType), |
|
777 iRequestInfoPkg(iRequestInfo), iResponsePkg(iResponse) |
|
778 { |
|
779 CActiveScheduler::Add(this); |
|
780 } |
|
781 |
|
782 RLbsNetSimTest::CMessageReleaseLcsLocationNotification::~CMessageReleaseLcsLocationNotification() |
|
783 { |
|
784 Cancel(); |
|
785 } |
|
786 |
|
787 void RLbsNetSimTest::CMessageReleaseLcsLocationNotification::Send(TLbsNetPosRequestPrivacy& aType, TLbsExternalRequestInfo& aRequestInfo) |
|
788 { |
|
789 iType = aType; |
|
790 iRequestInfo = aRequestInfo; |
|
791 TIpcArgs args(&iTypePkg, &iRequestInfoPkg, &iResponsePkg); |
|
792 iTest->SendReceive(ETReleaseLcsLocationNotification, args, iStatus); |
|
793 SetActive(); |
|
794 } |
|
795 |
|
796 void RLbsNetSimTest::CMessageReleaseLcsLocationNotification::RunL() |
|
797 { |
|
798 if (iStatus == KErrNone) |
|
799 { |
|
800 iObserver->NotifyReleaseLcsLocationNotification(iResponse); |
|
801 } // if |
|
802 else |
|
803 { |
|
804 iObserver->NotifyError(MLbsNetSimTestObserver::EStartNetworkPrivacyRequest, iStatus.Int()); |
|
805 } |
|
806 } |
|
807 |
|
808 void RLbsNetSimTest::CMessageReleaseLcsLocationNotification::DoCancel() |
|
809 { |
|
810 iTest->Send(ETReleaseLcsLocationNotificationCancel); |
|
811 } |
|
812 // |
|
813 // CNotifications: CMessageReleaseLcsLocationNotification |
|
814 RLbsNetSimTest::CMessageStartNetworkLocationRequest::CMessageStartNetworkLocationRequest(RLbsNetSimTest* aTest, MLbsNetSimTestObserver* aObserver) : |
|
815 CActive(EPriorityStandard), iTest(aTest), iObserver(aObserver) |
|
816 { |
|
817 CActiveScheduler::Add(this); |
|
818 } |
|
819 |
|
820 RLbsNetSimTest::CMessageStartNetworkLocationRequest::~CMessageStartNetworkLocationRequest() |
|
821 { |
|
822 Cancel(); |
|
823 } |
|
824 |
|
825 void RLbsNetSimTest::CMessageStartNetworkLocationRequest::Send() |
|
826 { |
|
827 iTest->SendReceive(ETStartNetworkLocationRequest, iStatus); |
|
828 SetActive(); |
|
829 } |
|
830 |
|
831 void RLbsNetSimTest::CMessageStartNetworkLocationRequest::RunL() |
|
832 { |
|
833 if (iStatus != KErrNone) |
|
834 { |
|
835 iObserver->NotifyError(MLbsNetSimTestObserver::EStartNetworkLocationRequest, iStatus.Int()); |
|
836 } // if |
|
837 } |
|
838 |
|
839 void RLbsNetSimTest::CMessageStartNetworkLocationRequest::DoCancel() |
|
840 { |
|
841 iTest->Send(ETStartNetworkLocationRequestCancel); |
|
842 } |