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