|
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: The base class that provides the common functionalities of |
|
15 * all the requests to the Location Monitor. Specific request handlers |
|
16 * derive from this class. |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 #ifndef CPOSLOCMONITORREQHANDLERBASE_H_ |
|
22 #define CPOSLOCMONITORREQHANDLERBASE_H_ |
|
23 |
|
24 //-------------------------------------------------------------------------------------- |
|
25 // INCLUDES |
|
26 #include <e32property.h> |
|
27 #include <e32base.h> |
|
28 #include <e32err.h> |
|
29 #include <lbspositioninfo.h> |
|
30 #include <lbserrors.h> |
|
31 |
|
32 |
|
33 |
|
34 //-------------------------------------------------------------------------------------- |
|
35 // CLASS DECLARATION |
|
36 /** |
|
37 The active object that that provides the common functionalities of |
|
38 all the requests to the Location Monitor such as maintaining a queue of requests |
|
39 and completing all the requests on the queue when an update from location monitor arrives. |
|
40 */ |
|
41 class CPosLocMonitorReqHandlerBase : public CActive |
|
42 { |
|
43 public: |
|
44 void NotifySessionClosed(const CSession2* aSessionPtr); |
|
45 void NotifyServerShutDown(); |
|
46 void NotifySubSessionClosed(const RMessage2& aMessage); |
|
47 |
|
48 virtual ~CPosLocMonitorReqHandlerBase(); |
|
49 |
|
50 public: |
|
51 enum TLocMonitorRequestType |
|
52 { |
|
53 EReqOnSession, |
|
54 EReqOnSubSession, |
|
55 }; |
|
56 |
|
57 protected: |
|
58 CPosLocMonitorReqHandlerBase(); |
|
59 // Destructors |
|
60 void RequestComplete(const RMessage2& aMessage, TInt aCompleteCode); |
|
61 void QRequestsComplete(TInt aCompleteCode); |
|
62 |
|
63 void CheckAndAddReqToQueueL(TLocMonitorRequestType aRequestType, const RMessage2& aMessage); |
|
64 void CancelRequest(TLocMonitorRequestType aRequestType, const RMessage2& aMessage); |
|
65 |
|
66 private: |
|
67 static TBool MatchSessionAndSubsession(const RMessage2& qClient, const RMessage2& newClient); |
|
68 static TBool MatchSession(const RMessage2& qClient, const RMessage2& newClient); |
|
69 |
|
70 TInt MatchRequestInQueue (TLocMonitorRequestType aRequestType, const RMessage2& aMessage); |
|
71 void FindRequestAndCancel(TLocMonitorRequestType aRequestType, const RMessage2& aMessage); |
|
72 |
|
73 protected: |
|
74 // The queue of requests |
|
75 RArray<RMessage2> iLocMonitorReqQ; |
|
76 |
|
77 |
|
78 private: |
|
79 // A pointer to the function that compares two RMessage2 entries |
|
80 // Utilised in the call to the "Find" method of RArray |
|
81 TIdentityRelation<RMessage2> iSubsessionIdentity; |
|
82 TIdentityRelation<RMessage2> iSessionIdentity; |
|
83 }; |
|
84 |
|
85 |
|
86 |
|
87 #endif /*CPOSLOCMONITORREQHANDLERBASE_H_*/ |