|
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // 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 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 /** |
|
17 @file |
|
18 @publishedPartner |
|
19 @prototype |
|
20 */ |
|
21 |
|
22 #ifndef LBSPRIVACYREQUEST_H_ |
|
23 #define LBSPRIVACYREQUEST_H_ |
|
24 |
|
25 #include <e32base.h> |
|
26 #include <lbs/lbsloccommon.h> |
|
27 #include <lbs/lbsprivacyrequestcommon.h> |
|
28 |
|
29 class CLbsPrivacyRequestImpl; |
|
30 |
|
31 /** A type for the unique privacy request identifier. |
|
32 @publishedPartner |
|
33 @prototype |
|
34 */ |
|
35 typedef TUint32 TLbsPrivacyRequestId; |
|
36 |
|
37 |
|
38 /** |
|
39 The MLbsPrivacyRequestObserver is an abstract interface to an external application |
|
40 and is used to pass privacy responses. |
|
41 |
|
42 The MLbsPrivacyRequestObserver class is used in partnership with the CLbsPrivacyRequest |
|
43 interface class. |
|
44 |
|
45 A concrete class must derive from MLbsPrivacyRequestObserver to provide the specific |
|
46 implementation of the interface methods. |
|
47 |
|
48 @see CLbsPrivacyRequest |
|
49 |
|
50 @publishedPartner |
|
51 @prototype |
|
52 */ |
|
53 class MLbsPrivacyRequestObserver |
|
54 { |
|
55 public: |
|
56 /** Defined type for TLbsPrivacyResponse */ |
|
57 typedef TUint32 TLbsPrivacyResponse; |
|
58 |
|
59 /** The response to a privacy request. |
|
60 Note that the TLbsPrivacyResponse enum may be extended in the future by adding |
|
61 more enumerated values. To maintain compatibility any unrecognized values |
|
62 must be handled as EPrivacyResponseUnknown. */ |
|
63 enum _TLbsPrivacyResponse |
|
64 { |
|
65 /** Not Used */ |
|
66 EPrivacyResponseUnknown = 0, |
|
67 /** Inform the requestor the terminal will accept its location request */ |
|
68 EPrivacyResponseAccepted, |
|
69 /** Inform the requestor the terminal will reject its location request */ |
|
70 EPrivacyResponseRejected, |
|
71 /** Inform the application it should not respond to the location request. |
|
72 This option is currently not supported */ |
|
73 EPrivacyResponseIgnored |
|
74 }; |
|
75 |
|
76 |
|
77 public: |
|
78 IMPORT_C virtual TVersion Version() const; |
|
79 |
|
80 /** |
|
81 OnPrivacyResponse() is called by the LBS subsystem in response to an application |
|
82 issuing a privacy request on behalf of a local client or a network. |
|
83 |
|
84 The method indicates to the application whether the terminal is willing to accept or has |
|
85 rejected the privacy request. This method is called for privacy verification and privacy |
|
86 notification requests and the request ID parameter indicates which request is being |
|
87 responded to by the LBS subsystem. |
|
88 |
|
89 If a request is of the notification type, the response is usually identical to the |
|
90 default action passed as a parameter of a privacy request. |
|
91 |
|
92 The privacy response is set to the value defined by CLbsAdmin::TPrivacyTimeoutAction |
|
93 if the privacy request times out and no default action was specified as part of the |
|
94 privacy request (@see CLbsAdmin::TPrivacyTimeoutAction. |
|
95 |
|
96 @param aRequestId [In] The Id of the privacy request associated with this privacy response |
|
97 @param aResponse [In] The result of the privacy check. |
|
98 @param aError [In] KErrNone a request has been processed successfully, |
|
99 KErrArgument if the request parameters are incorrect, |
|
100 KErrServerBusy if calling CLbsPrivacyRequest::NewPrivacyRequest() causes |
|
101 the number of privacy requests to exceed the maximum number of privacy requests |
|
102 that can be handled simultaneously (as defined by KLbsSettingMaximumExternalLocateRequests), |
|
103 or any other system wide error code. |
|
104 |
|
105 @see TLbsPrivacyResponse |
|
106 @see CLbsPrivacyRequest |
|
107 @see CLbsAdmin::TPrivacyTimeoutAction |
|
108 @see KLbsSettingMaximumExternalLocateRequests |
|
109 |
|
110 |
|
111 */ |
|
112 virtual void OnPrivacyResponse(TLbsPrivacyRequestId aRequestId, |
|
113 const TLbsPrivacyResponse& aResponse, |
|
114 TInt aError) = 0; |
|
115 |
|
116 |
|
117 protected: |
|
118 /** |
|
119 @prototype |
|
120 Should not be used. Provides for future expansion of the observer interface. |
|
121 Currently not implemented. |
|
122 */ |
|
123 IMPORT_C virtual TAny* ExtendedInterface(TInt aFunctionNumber, TAny* aPtr1, TAny* aPtr2); |
|
124 }; |
|
125 |
|
126 |
|
127 /** |
|
128 The CLbsPrivacyRequest interface class provides a simple alternative to the Protocol Module API |
|
129 (@see CLbsNetworkProtocolBase) and allows an application to perform privacy verification or |
|
130 notification procedures without the need of actually implementing a full Protocol Module. |
|
131 |
|
132 The interface is to be used in Standalone Privacy Mode only. In this mode, the LBS sub-system is used |
|
133 to process privacy requests only, not location requests. It is the responsibility of the application using |
|
134 this interface to act on the user's privacy response to decide whether to send the user's position. |
|
135 |
|
136 The interface consists of two main methods, NewPrivacyRequest() (used send a new privacy request to LBS) |
|
137 and CompleteRequest() (used complete a privacy request). RepeatPrivacyRequest() may be used to |
|
138 notify a user about a difference between the action that was specified in the privacy response and the action |
|
139 taken by the network. |
|
140 |
|
141 A unique request ID couples the privacy requests and responses. |
|
142 |
|
143 This interface supports requests originating from local applications as well as from the network. |
|
144 |
|
145 @publishedPartner |
|
146 @prototype |
|
147 @see MLbsPrivacyRequestObserver |
|
148 */ |
|
149 NONSHARABLE_CLASS(CLbsPrivacyRequest) : public CBase |
|
150 { |
|
151 public: |
|
152 IMPORT_C static CLbsPrivacyRequest* NewL(MLbsPrivacyRequestObserver& aObserver /*in*/); |
|
153 virtual ~CLbsPrivacyRequest(); |
|
154 |
|
155 public: |
|
156 IMPORT_C TInt NewPrivacyRequest(TLbsPrivacyRequestId& aRequestId, /*out*/ |
|
157 const TLbsPrivacyRequest& aPrivacy,/*in*/ |
|
158 const TLbsExternalRequestInfo& aRequestInfo/*in*/); |
|
159 |
|
160 IMPORT_C TInt RepeatPrivacyRequest(const TLbsPrivacyRequestId aRequestId, /*in*/ |
|
161 const TLbsPrivacyRequest& aPrivacy,/*in*/ |
|
162 const TLbsExternalRequestInfo& aRequestInfo/*in*/); |
|
163 |
|
164 IMPORT_C TInt CompleteRequest(TLbsPrivacyRequestId aRequestId/*in*/, |
|
165 TInt aReason/*in*/); |
|
166 |
|
167 private: |
|
168 CLbsPrivacyRequest(); |
|
169 void ConstructL(MLbsPrivacyRequestObserver& aObserver); |
|
170 |
|
171 //** Prohibit copy constructor */ |
|
172 CLbsPrivacyRequest(const CLbsPrivacyRequest&); |
|
173 //** Prohibit assigment operator */ |
|
174 CLbsPrivacyRequest& operator= (const CLbsPrivacyRequest&); |
|
175 |
|
176 private: |
|
177 CLbsPrivacyRequestImpl* iImpl; |
|
178 }; |
|
179 |
|
180 |
|
181 #endif //LBSPRIVACYREQUEST_H_ |