|
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: |
|
15 * |
|
16 */ |
|
17 /* |
|
18 */ |
|
19 |
|
20 #ifndef PRIVACYADVANCEDNOTIFIERHANDLER_H__ |
|
21 #define PRIVACYADVANCEDNOTIFIERHANDLER_H__ |
|
22 |
|
23 |
|
24 #include <lbs/lbsloccommon.h> // For TLbsExternalRequestInfo |
|
25 #include <lbs/lbsprivacycontroller.h> // For MLbsSessionObserver |
|
26 #include <lbs/epos_privacy.h> |
|
27 #include <lbs/epos_cposrequestor.h> |
|
28 #include "EPos_PrivacyInternal.h" |
|
29 #include "privacyhandlerobserver.h" |
|
30 #include "privacyhandler.h" |
|
31 |
|
32 |
|
33 class CPosDialogCtrl; |
|
34 class CPosPrivManager; |
|
35 class RPosRequestorStack; |
|
36 |
|
37 /** Extended data class with extra members for the Q&N notififer. |
|
38 */ |
|
39 class CPrivacyAdvancedRequest : public CPrivacyRequest |
|
40 { |
|
41 public: |
|
42 static CPrivacyAdvancedRequest* NewL(); |
|
43 ~CPrivacyAdvancedRequest() {} |
|
44 |
|
45 const TPosRequestData RequestData() const { return iRequestData; } |
|
46 void SetRequestData(const TPosRequestData& aRequestData) { iRequestData = aRequestData; } |
|
47 |
|
48 static TBool IsSessionIdEqual( |
|
49 const TLbsNetSessionIdInt* aSessionId, |
|
50 const CPrivacyAdvancedRequest& aRequest) |
|
51 { |
|
52 return (*aSessionId == aRequest.SessionId()); |
|
53 } |
|
54 |
|
55 protected: |
|
56 CPrivacyAdvancedRequest() {}; |
|
57 CPrivacyAdvancedRequest(const CPrivacyAdvancedRequest&); |
|
58 |
|
59 private: |
|
60 TPosRequestData iRequestData; |
|
61 }; |
|
62 |
|
63 /** Privacy handler for the Q&N API. |
|
64 */ |
|
65 class CPrivacyAdvancedNotifierHandler : public CPrivacyHandler |
|
66 { |
|
67 public: |
|
68 static CPrivacyAdvancedNotifierHandler* NewL(CLbsAdmin& aLbsAdmin, |
|
69 RLbsNetworkRegistrationStatus& aNetRegStatus); |
|
70 ~CPrivacyAdvancedNotifierHandler(); |
|
71 |
|
72 public: |
|
73 // From MLbsSessionObserver |
|
74 void ProcessNetworkLocationRequest(TLbsNetSessionIdInt aRequestId, |
|
75 const TLbsNetworkEnumInt::TLbsNetProtocolServiceInt aSessionType, |
|
76 const TLbsExternalRequestInfo& aRequestInfo, |
|
77 const TLbsNetPosRequestPrivacyInt& aNetPosRequestPrivacy, |
|
78 TBool aIsEmergency); |
|
79 |
|
80 void ProcessNetworkPositionUpdate(TLbsNetSessionIdInt aRequestId, |
|
81 const TPositionInfo& aPosInfo); |
|
82 void ProcessRequestComplete(TLbsNetSessionIdInt aRequestId, |
|
83 TInt aReason); |
|
84 |
|
85 public: |
|
86 // From MPrivacyHandlerObserver |
|
87 void SetServerObserver(MLbsSessionObserver* aNrhPrivacyServer); |
|
88 void OnRespondNetworkLocationRequest(const TLbsNetSessionIdInt& aRequestId, |
|
89 TLbsNetworkEnumInt::TLbsPrivacyResponseInt aRequestResult, |
|
90 TInt aResponseReason); |
|
91 void OnCancelNetworkLocationRequest(const TLbsNetSessionIdInt& aRequestId); |
|
92 |
|
93 protected: |
|
94 // From CActive |
|
95 void RunL(); |
|
96 void DoCancel(); |
|
97 |
|
98 protected: |
|
99 CPrivacyAdvancedNotifierHandler(CLbsAdmin& aLbsAdmin, |
|
100 RLbsNetworkRegistrationStatus& aNetRegStatus); |
|
101 void RegisterObserver(MPrivacyHandlerObserver* aObserver); |
|
102 void ConstructL(); |
|
103 |
|
104 TBool IsPrivacyRequestActive(); |
|
105 void SendNextPrivacyRequest(); |
|
106 void SendPrivacyResponse(); |
|
107 |
|
108 void SendNotificationRequest(CPrivacyAdvancedRequest& aActiveRequest); |
|
109 void SendVerificationRequest(CPrivacyAdvancedRequest& aActiveRequest); |
|
110 |
|
111 TInt BufferPrivacyRequest( |
|
112 const TLbsNetSessionIdInt& aSessionId, |
|
113 const TLbsExternalRequestInfo& aRequestInfo, |
|
114 const TLbsNetPosRequestPrivacyInt& aRequestPrivacy, |
|
115 TBool aIsEmergency); |
|
116 void RemovePrivacyRequestFromBuffer(const TLbsNetSessionIdInt& aSessionId); |
|
117 |
|
118 void ResetRequestData(TPosRequestData& aRequestData); |
|
119 |
|
120 void ConvertActionToTPosRequestDecision(TLbsNetPosRequestPrivacyInt::TLbsRequestActionInt aAction, |
|
121 TPosRequestDecision& aDecision); |
|
122 TInt InsertVerification(CPrivacyAdvancedRequest* aRequest); |
|
123 TInt DeferNotification(TInt aIndex); |
|
124 private: |
|
125 CPosDialogCtrl* iPrivacyDialogController; |
|
126 CPosPrivManager* iPrivacyManager; |
|
127 |
|
128 TLbsNetSessionIdInt iHighestSessionId; |
|
129 |
|
130 RPointerArray<CPrivacyAdvancedRequest> iRequestBuffer; |
|
131 }; |
|
132 |
|
133 |
|
134 #endif // PRIVACYADVANCEDNOTIFIERHANDLER_H__ |