|
1 /* |
|
2 * Copyright (c) 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: This class inherits the common functionalities for requests to the |
|
15 * Location Monitor from EPos_CPosLocMonitorReqHandlerBase.h and also |
|
16 * implements the functions specific to Last Known Position request. |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 |
|
22 #ifndef CPOSLASTKNOWNPOSHANDLER_H_ |
|
23 #define CPOSLASTKNOWNPOSHANDLER_H_ |
|
24 |
|
25 //-------------------------------------------------------------------------------------- |
|
26 // INCLUDES |
|
27 #include <e32base.h> |
|
28 #include <e32std.h> |
|
29 #include <e32def.h> |
|
30 #include <e32cmn.h> |
|
31 #include "LbsErrors.h" |
|
32 #include "EPos_CPosLocMonitorReqHandlerBase.h" |
|
33 #include "EPos_Global.h" // For DEBUG_TRACE |
|
34 #include "EPos_ServerPanic.h" // For EPosServerPanicPositionerNotInitialized |
|
35 #include "rlbslocmonitorsession.h" |
|
36 #include "rlbslocmonitorareapositioner.h" |
|
37 |
|
38 //-------------------------------------------------------------------------------------- |
|
39 // FORWARD DECLARATIONS |
|
40 class CPosCallbackTimer; // Used for timeout |
|
41 |
|
42 //-------------------------------------------------------------------------------------- |
|
43 // CONSTANT DEFINITIONS |
|
44 // The timeout value for get last known position request is 10seconds |
|
45 const TTimeIntervalMicroSeconds KLastKnownPosTimeOut(10000000); |
|
46 |
|
47 //-------------------------------------------------------------------------------------- |
|
48 // CLASS DECLARATION |
|
49 /** |
|
50 The active object that handles requests for last known position from clients. |
|
51 Owns subsession with the location monitor and uses the sub-session handle to |
|
52 forward the above requests to the location monitor. Inherits the basic functionalities |
|
53 from CPosLocMonitorReqHandlerBase. |
|
54 */ |
|
55 class CPosLastKnownPosHandler : public CPosLocMonitorReqHandlerBase |
|
56 { |
|
57 public: |
|
58 // Two-phased Constructors |
|
59 static CPosLastKnownPosHandler* NewL(); |
|
60 // Destructors |
|
61 ~CPosLastKnownPosHandler(); |
|
62 // Function to request last known position info from the Location Monitor |
|
63 void GetLastKnownPosL(RLbsLocMonitorSession& aLocMonSession, const RMessage2& aMessage); |
|
64 void CancelGetLastKnownPosL(const RMessage2& aMessage); |
|
65 void NotifyOnEmptyLastKnownPosStoreReq(); |
|
66 |
|
67 private: |
|
68 // C++ Default constructor |
|
69 CPosLastKnownPosHandler(); |
|
70 void ConstructL(); |
|
71 static TInt HandleTimeOut(TAny* aRequestHandler); |
|
72 |
|
73 protected: |
|
74 // From CActive |
|
75 void RunL(); |
|
76 TInt RunError(TInt aError); |
|
77 void DoCancel(); |
|
78 |
|
79 private: |
|
80 RMessage2 iMessage; |
|
81 // Subsession with the location monitor |
|
82 RLbsLocMonitorAreaPositioner iLocMonPositioner; |
|
83 |
|
84 TPositionInfo iPositionInfo; |
|
85 CPosCallbackTimer* iTimeoutTimer; // The timeout value is hardcoded in the constant KLastKnownPosTimeOut |
|
86 }; |
|
87 |
|
88 |
|
89 |
|
90 #endif /*CPOSLASTKNOWNPOSHANDLER_H_*/ |