|
1 // Copyright (c) 2008-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 // |
|
15 |
|
16 /** |
|
17 @file |
|
18 @InternalComponent |
|
19 */ |
|
20 |
|
21 #ifndef __LBSREQUESTHANDLER_H__ |
|
22 #define __LBSREQUESTHANDLER_H__ |
|
23 |
|
24 #include <e32base.h> |
|
25 #include <lbssatellite.h> |
|
26 #include <lbsposition.h> |
|
27 #include <lbscriteria.h> |
|
28 #include "lbstimer.h" // for MLbsCallbackTimerObserver & CLbsCallbackTimer |
|
29 #include "LbsInternalInterface.h" |
|
30 |
|
31 class CPositionerQ; |
|
32 class TRequestParameters; |
|
33 class MPositioner; |
|
34 |
|
35 class CRequestHandler : public CBase, public MLbsCallbackTimerObserver |
|
36 |
|
37 { |
|
38 public: |
|
39 virtual ~CRequestHandler(); |
|
40 virtual void ReMergeWithCancelRequestL(TInt aError); |
|
41 virtual void CancelRequestL(); |
|
42 virtual void SubmitNewRequestL(MPositioner* aNewRequest); |
|
43 virtual void WarmDownTimerExpired(); |
|
44 |
|
45 void NotifyRequestComplete(); |
|
46 |
|
47 // from MLbsCallbackTimerObserver |
|
48 void OnTimerEventL(TInt aTimerId); |
|
49 TInt OnTimerError(TInt aError, TInt aTimerId); |
|
50 |
|
51 enum TEventId // timer event ID at request queue level |
|
52 { |
|
53 EPowerStandByTimerEvent = 0 |
|
54 }; |
|
55 |
|
56 enum TRequestHandlerPanic |
|
57 { |
|
58 KUnknownTimerEventId |
|
59 }; |
|
60 |
|
61 protected: |
|
62 CRequestHandler(); |
|
63 void ConstructL(); |
|
64 |
|
65 virtual void IssueStatus(TBool aTracking, TLbsPositionUpdateRequestBase::TPowerAdvice aPower = TLbsPositionUpdateRequestBase::ENoPowerAdvice) = 0; |
|
66 virtual void IssueCancel(TBool aTracking, TLbsPositionUpdateRequestBase::TPowerAdvice aPower = TLbsPositionUpdateRequestBase::EPowerAdviceStandby) = 0; |
|
67 virtual void IssueMergedRequestL() = 0; |
|
68 void BuildUpdateRequest(TLbsLocRequestQuality& aRequest, const TTimeIntervalMicroSeconds& aTimeForFix, const TPositionQuality& aQuality); |
|
69 virtual TInt MergeRequest(const TRequestParameters* aRequestParameters, |
|
70 const TBool aTracking, |
|
71 TLbsPositionUpdateRequestBase::TPowerAdvice aPower = TLbsPositionUpdateRequestBase::ENoPowerAdvice) = 0; |
|
72 |
|
73 virtual void ResetMergedRequest() = 0; |
|
74 |
|
75 protected: |
|
76 TLbsPositionUpdateRequest iMergedRequest; // next potential position update request |
|
77 TLbsPositionUpdateRequest iCurrentRequest; // current update request that's on the bus |
|
78 CPositionerQ* iPositionerQ; |
|
79 |
|
80 private: |
|
81 void SubmitRequestL(); |
|
82 TBool MergedDifferent(); |
|
83 |
|
84 void MergeAllRequests(); |
|
85 TInt MergeNewRequest(TInt aNewRequest); |
|
86 void TimeOutTimerEvent(); |
|
87 TInt TimeOutTimerError(TInt /*aError*/); |
|
88 |
|
89 TUint iTrackingCount; |
|
90 CLbsCallbackTimer* iPowerStandByTimer; // sends a standby if no requests in the queue |
|
91 }; |
|
92 |
|
93 #endif // __LBSREQUESTHANDLER_H__ |