|
1 // Copyright (c) 2007-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 // This contains the header file for Location Data Source Tests |
|
15 // |
|
16 // |
|
17 |
|
18 #ifndef __CT_LBS_MOLR_TRACKING_H__ |
|
19 #define __CT_LBS_MOLR_TRACKING_H__ |
|
20 |
|
21 // LBS includes. |
|
22 #include <lbs.h> |
|
23 #include <lbscommon.h> |
|
24 #include <lbs/lbsprivacycontroller.h> |
|
25 #include <lbs/lbsadmin.h> |
|
26 |
|
27 // LBS test includes. |
|
28 #include "ctlbshybridmolrstep.h" |
|
29 #include <lbs/test/lbsnetprotocolproxy.h> |
|
30 #include <lbs/test/posserverwatch.h> |
|
31 #include "ctlbstestactivemanager.h" |
|
32 #include "ctlbsnetprotocol.h" |
|
33 #include "lbs/lbspositioningstatus.h" |
|
34 |
|
35 // Literals used |
|
36 _LIT(KLbsMolrTracking, "LbsMolrTracking"); |
|
37 |
|
38 class CT_LbsMolrTracking : public CT_LbsHybridMOLRStep, public MTestFlowObserver, public MLbsPositioningStatusObserver |
|
39 { |
|
40 private: |
|
41 class CT_ClientData : public CBase |
|
42 { |
|
43 public: |
|
44 CT_ClientData(TInt aSessionIdDelay, TInt aSessionStepDelay, TBool aCancelRequest,TInt aSessionIdCancel, TInt aSessionStepCancel, TInt aTrackingLoops, TPositionUpdateOptions aUpdateOptions, TInt aPsyUid, TInt aExpectedError) |
|
45 : iSessionIdDelay(aSessionIdDelay), iSessionStepDelay(aSessionStepDelay), |
|
46 iCancelRequest(aCancelRequest), iSessionIdCancel(aSessionIdCancel), iSessionStepCancel(aSessionStepCancel), iPsyUid(aPsyUid), iExpectedError(aExpectedError), |
|
47 iInitialStep(ETrue), iNumberOfNPUDs(aTrackingLoops), iPositionsReceived(0), |
|
48 iUpdateOptions(aUpdateOptions),iRequestCancelled(EFalse) |
|
49 {} |
|
50 ~CT_ClientData() |
|
51 { |
|
52 delete iWatcher; |
|
53 iWatcher = NULL; |
|
54 iPositioner.Close(); |
|
55 iServer.Close(); |
|
56 } |
|
57 public: |
|
58 // After what session should this client start |
|
59 TInt iSessionIdDelay; |
|
60 // After which step in the session should this client start |
|
61 TInt iSessionStepDelay; |
|
62 // whether an NPUD should be cancelled |
|
63 TBool iCancelRequest; |
|
64 // After what session should this client's last NPUD be cancelled |
|
65 TInt iSessionIdCancel; |
|
66 // After which step in the session should this client's last NPUD be cancelled |
|
67 TInt iSessionStepCancel; |
|
68 // Specifies if the initial NPUD has been sent out or not |
|
69 TBool iInitialStep; |
|
70 RPositionServer iServer; |
|
71 RPositioner iPositioner; |
|
72 // The number of NPUDs it needs to send out |
|
73 TInt iNumberOfNPUDs; |
|
74 // The number of positions received so far |
|
75 TInt iPositionsReceived; |
|
76 CPosServerWatcher* iWatcher; |
|
77 |
|
78 TTime iTimeOfInitialPosition; |
|
79 TPositionUpdateOptions iUpdateOptions; |
|
80 // whether the clients last NPUD was cancelled |
|
81 TBool iRequestCancelled; |
|
82 // The time when the last calculated position was received (for MaxAge checking) |
|
83 TTime iTimeOfLastPosition; |
|
84 // The time when the previous position was received (for calculating the right window for variant2 behaviour) |
|
85 TTime iTimeOfPreviousPosition; |
|
86 // Uid of the positioner to be used |
|
87 TInt iPsyUid; |
|
88 TBool iAutonomousPsy; // whether the client has opened a session to the (autonomous) gps psy |
|
89 |
|
90 TInt iExpectedError; // error code that the client expects when it issues an NPUD |
|
91 }; |
|
92 public: |
|
93 ~CT_LbsMolrTracking(); |
|
94 |
|
95 static CT_LbsMolrTracking* New(CT_LbsHybridMOLRServer& aParent); |
|
96 virtual TVerdict doTestStepPreambleL(); |
|
97 virtual TVerdict doTestStepPostambleL(); |
|
98 virtual TVerdict doTestStepL(); |
|
99 |
|
100 // MTestFlowObserver |
|
101 void OnReadyL(TInt aObjectId); |
|
102 void OnTimedOutL(TInt aObjectId); |
|
103 void OnGetLastKnownPositionL(TInt aObjectId, TInt32 aErr, const TPositionInfoBase& aPosInfo); |
|
104 void OnNotifyPositionUpdateL(TInt aObjectId, TInt32 aErr, const TPositionInfoBase& aPosInfo); |
|
105 void StopTest(); |
|
106 void OnSignalNetworkStep(TInt aSessionId, TInt aSessionStep); |
|
107 |
|
108 //MLbsPositioningStatusObserver |
|
109 void OnPositioningStatusUpdate(const CLbsPositioningStatus::TLbsPositioningStatus& aPositioningStatus); |
|
110 |
|
111 protected: |
|
112 CT_LbsMolrTracking(CT_LbsHybridMOLRServer& aParent); |
|
113 void ConstructL(); |
|
114 |
|
115 private: |
|
116 void DoClientStepL(TInt aIndex); |
|
117 void EnablePsy(TInt aPsyUid); |
|
118 private: |
|
119 |
|
120 /** Used so the test checks the right request is sent to the network */ |
|
121 CLbsAdmin::TGpsMode iAdminGpsMode; |
|
122 |
|
123 /** Used so the network proxy knows what to expect*/ |
|
124 TBool iGPSModeNotSupported; |
|
125 |
|
126 CT_LbsNetProtocol* iNetworkProtocol; |
|
127 RPointerArray<CT_LbsTestActiveManager> iClientTestManagers; |
|
128 |
|
129 /** The information of the clients of LBS */ |
|
130 RPointerArray<CT_ClientData> iClients; |
|
131 |
|
132 // used for "one off" tests |
|
133 // =1 - LastKnownPosition test |
|
134 // =2 - MaxAge test |
|
135 // =3 - EarlyComplete test |
|
136 TInt iSpecialTestMode; |
|
137 TInt iPositioningIndicatorCount; |
|
138 TInt iPosStatusCount; |
|
139 CLbsPositioningStatus* iLbsPositioningStatus; |
|
140 CLbsPositioningStatus::TLbsPositioningStatus iPositioningStatus; |
|
141 }; |
|
142 |
|
143 #endif //__CT_LBS_MOLR_TRACKING_H__ |
|
144 |