author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Fri, 17 Sep 2010 08:37:32 +0300 | |
changeset 60 | 9a7e3d5f461a |
parent 51 | 95c570bf4a05 |
permissions | -rw-r--r-- |
36 | 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(); |
|
60
9a7e3d5f461a
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
51
diff
changeset
|
100 |
|
9a7e3d5f461a
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
51
diff
changeset
|
101 |
void ActivatePositioningStatusIfNeeded(); |
9a7e3d5f461a
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
51
diff
changeset
|
102 |
|
9a7e3d5f461a
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
51
diff
changeset
|
103 |
void DeActivatePositioningStatusIfNeeded(); |
36 | 104 |
|
105 |
private: // Data |
|
106 |
||
107 |
enum TPosRequestStage |
|
108 |
{ |
|
109 |
EPosReqInactive = 0, |
|
110 |
EPosReqPositionRequest, |
|
111 |
EPosWaitForTracking |
|
112 |
}; |
|
113 |
||
114 |
enum TPosTrackingState |
|
115 |
{ |
|
116 |
EPosNoTracking = 0, /** No tracking is ongoing */ |
|
117 |
EPosFirstTrackingRequest, /** This request completes immediately |
|
118 |
Next will be delayed by interval */ |
|
119 |
EPosTracking, /** Internal and PSYs timers started */ |
|
120 |
EPosStopTracking /** Tracking marked to stop */ |
|
121 |
}; |
|
122 |
||
123 |
RMessage2 iMessage; |
|
124 |
HBufC8* iPositionBuffer; |
|
125 |
TPosRequestStage iRequestPhase; |
|
126 |
TInt iRequestId; |
|
127 |
CPositioner* iPositioner; |
|
128 |
TPositionModuleInfo iModuleInfo; |
|
129 |
TProxyPositionerConstructParams iPositionerParams; |
|
130 |
TBool iHasProxyPositioner; |
|
131 |
||
132 |
TTime iReqStartTime; |
|
133 |
CPosCallbackTimer* iTimeoutTimer; |
|
134 |
TTimeIntervalMicroSeconds iTimeOut; |
|
135 |
TBool iRequestTimedOut; |
|
136 |
||
137 |
TBool iPositionerTrackingStarted; |
|
138 |
TPosTrackingState iTrackingState; |
|
139 |
CPosCallbackTimer* iTrackingTimer; |
|
140 |
TTimeIntervalMicroSeconds iTrackingUpdateInterval; |
|
141 |
TBool iTrackingOverridden; |
|
142 |
const RRequestorStack* iTrackingRequestorStackPtr; |
|
143 |
TBool iNewTrackingInterval; |
|
144 |
||
145 |
// CPosLocMonitorReqHandlerHub& iLastPositionHandler; |
|
146 |
CPosLocMonitorReqHandlerHub& iLocMonitorReqHandler; |
|
147 |
CPosModuleSettings& iModuleSettings; |
|
60
9a7e3d5f461a
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
51
diff
changeset
|
148 |
|
9a7e3d5f461a
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
51
diff
changeset
|
149 |
TUid iPosStatusCategory; |
9a7e3d5f461a
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
51
diff
changeset
|
150 |
|
9a7e3d5f461a
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
51
diff
changeset
|
151 |
/** |
9a7e3d5f461a
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
51
diff
changeset
|
152 |
* Positioning state flag |
9a7e3d5f461a
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
51
diff
changeset
|
153 |
*/ |
9a7e3d5f461a
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
51
diff
changeset
|
154 |
TBool iPositioningActive; |
9a7e3d5f461a
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
51
diff
changeset
|
155 |
|
9a7e3d5f461a
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
51
diff
changeset
|
156 |
|
36 | 157 |
}; |
158 |
||
159 |
#endif // CPOSITIONREQUEST_H |
|
160 |
||
161 |
// End of File |