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".
8 * Initial Contributors:
9 * NTT DOCOMO, INC. - initial contribution.
10 * Nokia Corporation - additional changes.
24 #ifndef LBS_PRIVACY_CONTROLLER_H
25 #define LBS_PRIVACY_CONTROLLER_H
29 class TLbsExternalRequestInfo;
31 class CLbsPrivacyControllerImpl;
35 The mixin class that defines the interface for the LBS privacy
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.
46 class MLbsPrivacyObserver
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.
53 @see CLbsAdmin::TExternalLocateService
54 @see CLbsAdmin::TPrivacyTimeoutAction
56 enum TNotificationType
58 /** Unused/Unknown notification. */
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,
71 IMPORT_C virtual TVersion Version();
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().
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.
88 @see TLbsExternalRequestInfo2
89 @see TLbsLocClassTypeBase::ClassType()
91 virtual void ProcessNetworkLocationRequest(TUint aRequestId, const TLbsExternalRequestInfo& aRequestInfo, const TNotificationType& aNotificationType) = 0;
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.
99 @param aRequestId Identifies the request within the LBS system.
100 @param aPosInfo The latest position data.
102 virtual void ProcessNetworkPositionUpdate(TUint aRequestId, const TPositionInfo& aPosInfo) = 0;
105 Called when a network location request (e.g. MT-LR) has been completed.
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.
113 virtual void ProcessRequestComplete(TUint aRequestId, TInt aReason) = 0;
118 The mixin class that defines an extended interface for the LBS privacy
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
126 @see MLbsPrivacyObserver
127 @see CLbsPrivacyController
132 class MLbsPrivacyObserver2 : public MLbsPrivacyObserver
135 IMPORT_C virtual TVersion Version();
138 Called whenever the LBS sub-system is closing down.
139 After receiving the call the current process MUST close itself down.
141 @param aReservedParam Reserved for future extensions.
143 virtual void ProcessCloseDownNotification(TInt32 aReservedParam) = 0;
148 An application can use this class to register itself as the user
149 privacy controller for the LBS system.
151 The application must supply an implementation of the MLbsPrivacyObserver
152 interface so that it can be notified of important events.
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.
159 If the request was accepted then the application will recieve more
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.
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
173 NONSHARABLE_CLASS(CLbsPrivacyController) : public CBase
176 /** The user response to the network location request dialog. */
177 enum TRequestVerificationResult
179 /** Unused request. */
181 /** Request accepted (permission granted). */
183 /** Request rejected (permission denied). */
185 /** Tell the Lbs system to ignore the request. Currently not implemented. */
190 IMPORT_C static CLbsPrivacyController* NewL(MLbsPrivacyObserver& aObserver);
191 ~CLbsPrivacyController();
193 IMPORT_C void RespondNetworkLocationRequest(TUint aRequestId, TRequestVerificationResult aResult);
195 IMPORT_C void CancelNetworkLocationRequest(TUint aRequestId);
198 CLbsPrivacyController();
199 void ConstructL(MLbsPrivacyObserver& aObserver);
202 /** CLbsPrivacyControllerImp* Impl is the internal handle to the Implementation */
203 CLbsPrivacyControllerImpl* iImpl;
207 #endif // LBS_PRIVACY_CONTROLLER_H