|
1 /* |
|
2 * Copyright (c) 2005-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 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CPOSITIONREQUEST_H |
|
21 #define CPOSITIONREQUEST_H |
|
22 |
|
23 // INCLUDE FILES |
|
24 #include <e32base.h> |
|
25 #include "epos_proxypositionerconstructparams.h" |
|
26 |
|
27 // CONSTANT DECLARATIONS |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 class CPositioner; |
|
31 class CPosPositionLog; |
|
32 class CPosModuleSettings; |
|
33 struct TPosModulesEvent; |
|
34 class CPosCallbackTimer; |
|
35 class CPosLocMonitorReqHandlerHub; |
|
36 |
|
37 // CLASS DECLARATION |
|
38 |
|
39 /** |
|
40 * Active object implementing a position request cycle. Handles |
|
41 * activities such as controlling logging and verifying privacy. |
|
42 * |
|
43 */ |
|
44 class CPositionRequest : public CActive |
|
45 { |
|
46 public: // Constructors and destructor |
|
47 static CPositionRequest* NewL(CPosModuleSettings& aModuleSettings, |
|
48 CPosLocMonitorReqHandlerHub& aLastPositionHandler, |
|
49 TProxyPositionerConstructParams& aPositionerParams, |
|
50 TBool aIsProxy); |
|
51 virtual ~CPositionRequest(); |
|
52 |
|
53 public: // New functions |
|
54 void MakeRequestL(const RMessage2& aMessage); |
|
55 void SetUpdateOptions(const TPositionUpdateOptionsBase& aOptions); |
|
56 void GetUpdateOptions(TPositionUpdateOptionsBase& aOptions) const; |
|
57 void NewTrackingSessionIfTracking(); |
|
58 void HandleSettingsChangeL(TPosModulesEvent aEvent); |
|
59 void NotifyServerShutdown(); |
|
60 void ExtendUpdateTimeOut(const TTimeIntervalMicroSeconds& aAdditionalTime); |
|
61 |
|
62 protected: // From CActive |
|
63 |
|
64 void RunL(); |
|
65 TInt RunError(TInt aError); |
|
66 void DoCancel(); |
|
67 |
|
68 private: |
|
69 CPositionRequest(CPosModuleSettings& aModuleSettings, |
|
70 CPosLocMonitorReqHandlerHub& aLastPositionHandler, |
|
71 TProxyPositionerConstructParams& aPositionerParams, |
|
72 TBool aIsProxy); |
|
73 |
|
74 void ConstructL(); |
|
75 CPositionRequest( const CPositionRequest& ); |
|
76 CPositionRequest& operator= ( const CPositionRequest& ); |
|
77 |
|
78 void CompleteRequest(TInt aReason); |
|
79 void CompleteClient(TInt aReason); |
|
80 void CompleteSelf(TInt aReason); |
|
81 |
|
82 void StartPositionDataRequestPhase(); |
|
83 void StartTrackingTimerWaitPhase(); |
|
84 |
|
85 TInt PackPositionData(); |
|
86 void SaveAsLastKnownPosition(); |
|
87 |
|
88 static TInt HandleTimeOut(TAny* aPositionRequest); |
|
89 static TInt TrackingCallback(TAny* aPositionRequest); |
|
90 |
|
91 void HandleTrackingStateL(); |
|
92 void RestartTrackingL(); |
|
93 void StopTracking(); |
|
94 void ContinueTrackingTimer(); |
|
95 |
|
96 void StartPsyTrackingL(); |
|
97 void StopPsyTracking(); |
|
98 |
|
99 void LoadPositionerL(); |
|
100 |
|
101 private: // Data |
|
102 |
|
103 enum TPosRequestStage |
|
104 { |
|
105 EPosReqInactive = 0, |
|
106 EPosReqPositionRequest, |
|
107 EPosWaitForTracking |
|
108 }; |
|
109 |
|
110 enum TPosTrackingState |
|
111 { |
|
112 EPosNoTracking = 0, /** No tracking is ongoing */ |
|
113 EPosFirstTrackingRequest, /** This request completes immediately |
|
114 Next will be delayed by interval */ |
|
115 EPosTracking, /** Internal and PSYs timers started */ |
|
116 EPosStopTracking /** Tracking marked to stop */ |
|
117 }; |
|
118 |
|
119 RMessage2 iMessage; |
|
120 HBufC8* iPositionBuffer; |
|
121 TPosRequestStage iRequestPhase; |
|
122 TInt iRequestId; |
|
123 CPositioner* iPositioner; |
|
124 TPositionModuleInfo iModuleInfo; |
|
125 TProxyPositionerConstructParams iPositionerParams; |
|
126 TBool iHasProxyPositioner; |
|
127 |
|
128 TTime iReqStartTime; |
|
129 CPosCallbackTimer* iTimeoutTimer; |
|
130 TTimeIntervalMicroSeconds iTimeOut; |
|
131 TBool iRequestTimedOut; |
|
132 |
|
133 TBool iPositionerTrackingStarted; |
|
134 TPosTrackingState iTrackingState; |
|
135 CPosCallbackTimer* iTrackingTimer; |
|
136 TTimeIntervalMicroSeconds iTrackingUpdateInterval; |
|
137 TBool iTrackingOverridden; |
|
138 const RRequestorStack* iTrackingRequestorStackPtr; |
|
139 TBool iNewTrackingInterval; |
|
140 |
|
141 // CPosLocMonitorReqHandlerHub& iLastPositionHandler; |
|
142 CPosLocMonitorReqHandlerHub& iLocMonitorReqHandler; |
|
143 CPosModuleSettings& iModuleSettings; |
|
144 }; |
|
145 |
|
146 #endif // CPOSITIONREQUEST_H |
|
147 |
|
148 // End of File |