|
1 /* |
|
2 * Copyright (c) 2009 NTT DOCOMO, INC. 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 * NTT DOCOMO, INC. - initial contribution. |
|
10 * Nokia Corporation - additional changes. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 /** |
|
19 @file |
|
20 @publishedPartner |
|
21 @released |
|
22 */ |
|
23 |
|
24 #ifndef LBS_PRIVACY_CONTROLLER_H |
|
25 #define LBS_PRIVACY_CONTROLLER_H |
|
26 |
|
27 #include <e32std.h> |
|
28 |
|
29 class TLbsExternalRequestInfo; |
|
30 class TPositionInfo; |
|
31 class CLbsPrivacyControllerImpl; |
|
32 |
|
33 |
|
34 /** |
|
35 The mixin class that defines the interface for the LBS privacy |
|
36 controller observer. |
|
37 |
|
38 @publishedPartner |
|
39 @released |
|
40 |
|
41 The callbacks defined in this class are called by the LBS system |
|
42 when needed, e.g. when a network location request is received, |
|
43 when the reference position is received, when the final position |
|
44 is calculated and when the request has completed. |
|
45 */ |
|
46 class MLbsPrivacyObserver |
|
47 { |
|
48 public: |
|
49 /** Contains the user notification action defined by the |
|
50 network location request (MT-LR). This setting may be |
|
51 overridden by the setting(s) in the LBS Admin Settings API. |
|
52 |
|
53 @see CLbsAdmin::TExternalLocateService |
|
54 @see CLbsAdmin::TPrivacyTimeoutAction |
|
55 */ |
|
56 enum TNotificationType |
|
57 { |
|
58 /** Unused/Unknown notification. */ |
|
59 ENotifyUnknown = 0, |
|
60 /** Accept and notify user.*/ |
|
61 ENotifyLocationAccepted, |
|
62 /** Verify (query user). Accept if no response.*/ |
|
63 ENotifyAndVerifyLocationAcceptedIfNoReponse, |
|
64 /** Verify (query user). Reject if no response.*/ |
|
65 ENotifyAndVerifyLocationRejectedIfNoReponse, |
|
66 /** Reject and notify user.*/ |
|
67 ENotifyLocationRejected, |
|
68 }; |
|
69 |
|
70 public: |
|
71 IMPORT_C virtual TVersion Version(); |
|
72 |
|
73 /** |
|
74 Called when a network location request is received by the LBS system. |
|
75 The implementer of this function must decide whether the location request |
|
76 is allowed and give the result to the LBS system. The result is passed |
|
77 by calling CPrivacyController::SendRequestVerificationResult(). |
|
78 |
|
79 @param aRequestId Identifies the request within the LBS system. |
|
80 @param aRequestInfo Information about the external client making the request. |
|
81 Note that the actual type may be of one the derived classes |
|
82 e.g. TLbsExternalRequestInfo2. |
|
83 The type may be determined by calling ClassType(). |
|
84 If the class is of the TLbsExternalRequestInfo2 type, this parameter may be |
|
85 casted to access the extended information. |
|
86 @param aNotificationType The value set by the network for the user notification. |
|
87 |
|
88 @see TLbsExternalRequestInfo2 |
|
89 @see TLbsLocClassTypeBase::ClassType() |
|
90 */ |
|
91 virtual void ProcessNetworkLocationRequest(TUint aRequestId, const TLbsExternalRequestInfo& aRequestInfo, const TNotificationType& aNotificationType) = 0; |
|
92 |
|
93 /** |
|
94 Called whenever a position update is ready while processing a network |
|
95 location request. Typically, it will be called twice: |
|
96 1) As soon as the network reference position is available. |
|
97 2) As soon as the final calculated position is available. |
|
98 |
|
99 @param aRequestId Identifies the request within the LBS system. |
|
100 @param aPosInfo The latest position data. |
|
101 */ |
|
102 virtual void ProcessNetworkPositionUpdate(TUint aRequestId, const TPositionInfo& aPosInfo) = 0; |
|
103 |
|
104 /** |
|
105 Called when a network location request (e.g. MT-LR) has been completed. |
|
106 |
|
107 @param aRequestId Identifies the request within the LBS system. |
|
108 @param aReason Contains the reason for the completion of the request. |
|
109 Usually KErrNone, or a standard Symbian error code. |
|
110 KErrNotFound if aRequestId is not a currently |
|
111 active external location request. |
|
112 */ |
|
113 virtual void ProcessRequestComplete(TUint aRequestId, TInt aReason) = 0; |
|
114 }; |
|
115 |
|
116 |
|
117 /** |
|
118 The mixin class that defines an extended interface for the LBS privacy |
|
119 controller observer. |
|
120 |
|
121 It should be used only if the start up of a Privacy Controller process |
|
122 (platform specific, not a part of LBS) is controlled by the LBS sub-system |
|
123 by adding the name of the Privacy Controller process to the LBS Root Process |
|
124 configuration file. |
|
125 |
|
126 @see MLbsPrivacyObserver |
|
127 @see CLbsPrivacyController |
|
128 |
|
129 @publishedPartner |
|
130 @released |
|
131 */ |
|
132 class MLbsPrivacyObserver2 : public MLbsPrivacyObserver |
|
133 { |
|
134 public: |
|
135 IMPORT_C virtual TVersion Version(); |
|
136 |
|
137 /** |
|
138 Called whenever the LBS sub-system is closing down. |
|
139 After receiving the call the current process MUST close itself down. |
|
140 |
|
141 @param aReservedParam Reserved for future extensions. |
|
142 */ |
|
143 virtual void ProcessCloseDownNotification(TInt32 aReservedParam) = 0; |
|
144 }; |
|
145 |
|
146 |
|
147 /** |
|
148 An application can use this class to register itself as the user |
|
149 privacy controller for the LBS system. |
|
150 |
|
151 The application must supply an implementation of the MLbsPrivacyObserver |
|
152 interface so that it can be notified of important events. |
|
153 |
|
154 When it receives the MLbsPrivacyObserver::ProcessNetworkLocationRequest() |
|
155 notification it must reply by calling |
|
156 CLbsPrivacyController::RespondNetworkLocationRequest() to tell the |
|
157 LBS system the user response to the network location request. |
|
158 |
|
159 If the request was accepted then the application will recieve more |
|
160 notifications: |
|
161 1) MLbsPrivacyObserver::ProcessNetworkPositionUpdate() with the reference |
|
162 position when the assistance data is received from the network. |
|
163 2) MLbsPrivacyObserver::ProcessNetworkPositionUpdate() with the calculated |
|
164 position when it is sent back to the network. |
|
165 3) MLbsPrivacyObserver::ProcessRequestCompleted() when the application |
|
166 no longer needs to listen to notifications for that request. |
|
167 |
|
168 Each notification contains aRequestId, which identifies each network |
|
169 location request within the LBS system. It is meant to be used so that |
|
170 each of the different notifications can be matched to the request they |
|
171 came from. |
|
172 */ |
|
173 NONSHARABLE_CLASS(CLbsPrivacyController) : public CBase |
|
174 { |
|
175 public: |
|
176 /** The user response to the network location request dialog. */ |
|
177 enum TRequestVerificationResult |
|
178 { |
|
179 /** Unused request. */ |
|
180 ERequestUnknown = 0, |
|
181 /** Request accepted (permission granted). */ |
|
182 ERequestAccepted, |
|
183 /** Request rejected (permission denied). */ |
|
184 ERequestRejected, |
|
185 /** Tell the Lbs system to ignore the request. Currently not implemented. */ |
|
186 ERequestIgnore |
|
187 }; |
|
188 |
|
189 public: |
|
190 IMPORT_C static CLbsPrivacyController* NewL(MLbsPrivacyObserver& aObserver); |
|
191 ~CLbsPrivacyController(); |
|
192 |
|
193 IMPORT_C void RespondNetworkLocationRequest(TUint aRequestId, TRequestVerificationResult aResult); |
|
194 |
|
195 IMPORT_C void CancelNetworkLocationRequest(TUint aRequestId); |
|
196 |
|
197 private: |
|
198 CLbsPrivacyController(); |
|
199 void ConstructL(MLbsPrivacyObserver& aObserver); |
|
200 |
|
201 private: |
|
202 /** CLbsPrivacyControllerImp* Impl is the internal handle to the Implementation */ |
|
203 CLbsPrivacyControllerImpl* iImpl; |
|
204 }; |
|
205 |
|
206 |
|
207 #endif // LBS_PRIVACY_CONTROLLER_H |