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