|
1 // Copyright (c) 2008-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 // Protocol Module gateway observer class definition |
|
15 // |
|
16 // |
|
17 |
|
18 #ifndef __CSUPLGATEWAYOBSERVER_H__ |
|
19 #define __CSUPLGATEWAYOBSERVER_H__ |
|
20 |
|
21 #include <e32cmn.h> |
|
22 #include <ecom/ecom.h> |
|
23 #include <lbs/lbslocdatasourcegpsbase.h> |
|
24 #include <lbs/lbsnetcommon.h> |
|
25 #include <lbs/lbsnetprotocolbase.h> |
|
26 #include <lbs/lbsassistancedatabuilderset.h> |
|
27 #include "lbstimer.h" |
|
28 |
|
29 |
|
30 /** Gateway observer class definition. |
|
31 |
|
32 This class is used to capture calls made from the Protocol Module |
|
33 to the Network Gateway. The callback methods are all defined by the |
|
34 MLbsNetworkProtocolObserver interface. |
|
35 */ |
|
36 class CSuplGatewayObserver : public CBase , public MLbsNetworkProtocolObserver2, |
|
37 public MLbsCallbackTimerObserver |
|
38 { |
|
39 public: |
|
40 |
|
41 /** Callback method result enumeration. |
|
42 This is used to show which observer method was called. |
|
43 */ |
|
44 enum TCallBackResult |
|
45 { |
|
46 ENone, |
|
47 EProcessLocationRequest, |
|
48 EProcessAssistanceData, |
|
49 EProcessLocationUpdate, |
|
50 EProcessPrivacyRequest, |
|
51 EProcessSessionComplete, |
|
52 ETimeout, |
|
53 ETimerError |
|
54 }; |
|
55 |
|
56 public: |
|
57 |
|
58 /** Static constructor |
|
59 */ |
|
60 static CSuplGatewayObserver* NewL(); |
|
61 |
|
62 /** Destructor |
|
63 */ |
|
64 ~CSuplGatewayObserver(); |
|
65 |
|
66 /** Reset the observer's called status |
|
67 */ |
|
68 void ResetWasObserverCalled(); |
|
69 |
|
70 /** Wait for an observer callback |
|
71 */ |
|
72 void WaitForCallBack(); |
|
73 |
|
74 /** Check if the observer was called |
|
75 */ |
|
76 TBool WasObserverCalled() const; |
|
77 |
|
78 /** Retrieve callback result |
|
79 */ |
|
80 TInt CallBackResult() const; |
|
81 |
|
82 /** Retrieve assistance data error |
|
83 */ |
|
84 TInt AssistanceDataError() const; |
|
85 |
|
86 /** Session ID |
|
87 */ |
|
88 const TLbsNetSessionId& SessionIdValue() const; |
|
89 |
|
90 /** Retrieve assistance data set mask |
|
91 */ |
|
92 TLbsAsistanceDataGroup AssistanceDataSetMask() const; |
|
93 |
|
94 /** Retrieve assistance data error mask |
|
95 */ |
|
96 TLbsAsistanceDataGroup AssistanceDataErrorMask() const; |
|
97 |
|
98 /** Retrieve provided data group mask |
|
99 */ |
|
100 TLbsAsistanceDataGroup ProvidedDataSetMask() const; |
|
101 |
|
102 /** Session close reason |
|
103 */ |
|
104 TInt SessionCloseReason() const; |
|
105 |
|
106 /** Is location request emergency related |
|
107 */ |
|
108 TBool IsLocEmergency() const; |
|
109 |
|
110 /** Location requestor type |
|
111 */ |
|
112 const MLbsNetworkProtocolObserver::TLbsNetProtocolService& LocType() const; |
|
113 |
|
114 /** Location request quality |
|
115 */ |
|
116 const TLbsNetPosRequestQuality& LocQuality() const; |
|
117 |
|
118 /** Reference location position |
|
119 */ |
|
120 const TPosition& ReferencePos() const; |
|
121 |
|
122 /** Has Reference Location been |
|
123 reported? |
|
124 */ |
|
125 TBool IsRefLocNotified(); |
|
126 |
|
127 /** Privacy notification type |
|
128 */ |
|
129 const TLbsNetPosRequestPrivacy& PrivacyNotifType() const; |
|
130 |
|
131 /** Retrieve privacy requestor info ID |
|
132 */ |
|
133 void RequesterId(TDes8& aId) const; |
|
134 |
|
135 /** Is privacy request emergency related |
|
136 */ |
|
137 TBool IsPrivReqReceived(); |
|
138 |
|
139 /** Check if more observer activity takes place |
|
140 */ |
|
141 TBool IsMoreObserverActivity(); |
|
142 |
|
143 /** Set the default set of positioning capabilities, as returned by |
|
144 GetCurrentCapabilities() |
|
145 */ |
|
146 void SetDefaultCapabilities(); |
|
147 |
|
148 /** Modify the set of positioning capabilities, as returned by |
|
149 GetCurrentCapabilities() |
|
150 */ |
|
151 void SetCurrentCapabilities(const TLbsNetPosCapabilities& aCapabilities); |
|
152 |
|
153 // MLbsNetworkProtocolObserver methods |
|
154 |
|
155 /** Get LBS capabilities |
|
156 */ |
|
157 void GetCurrentCapabilities(TLbsNetPosCapabilities& aCapabilities) const; |
|
158 |
|
159 /** Advise LBS of status update |
|
160 */ |
|
161 void ProcessStatusUpdate(TLbsNetProtocolServiceMask aActiveServiceMask); |
|
162 |
|
163 /** Ask the gateway to process a location request arriving from the network. |
|
164 |
|
165 @param aSessionId The Id of the location session within the LBS sub-system. |
|
166 @param aEmergency ETrue if this is an emergency request, EFalse otherwise. |
|
167 @param aType The type of location request. The type is determined by preceding |
|
168 requests and other context information that only the network |
|
169 protocol module knows about. So it is the responsibility |
|
170 of the network protocol module to set the type of each request. |
|
171 @param aQuality The network-requested quality of service (QoS) of the |
|
172 location calculation. |
|
173 @param aMethod Location request means and method to be employed. |
|
174 */ |
|
175 void ProcessLocationRequest(const TLbsNetSessionId& aSessionId, TBool aEmergency, |
|
176 TLbsNetProtocolService aType, |
|
177 const TLbsNetPosRequestQuality& aQuality, |
|
178 const TLbsNetPosRequestMethod& aMethod); |
|
179 |
|
180 /** Tell the gateway that the network has finished a location session. |
|
181 |
|
182 @param aSessionId The Id of the session. |
|
183 @param aReason Reason for the completion. KErrNone if the request is successfully |
|
184 completed, or one of a range of error codes otherwise. |
|
185 */ |
|
186 void ProcessSessionComplete(const TLbsNetSessionId& aSessionId, TInt aReason); |
|
187 |
|
188 /** Inform the gateway of the arrival of new assistance data. |
|
189 |
|
190 @param aDataMask The data group mask relevant for the delivered data. |
|
191 @param aData A container that holds all of the GPS assistance data to be delivered. |
|
192 @param aReason The nature of any error related to this assistance data. |
|
193 */ |
|
194 void ProcessAssistanceData(TLbsAsistanceDataGroup aDataMask, |
|
195 const RLbsAssistanceDataBuilderSet& aData, TInt aReason, const TLbsNetSessionIdArray& aSessionIdArray); |
|
196 |
|
197 /** Inform the gateway of the arrival of the network-based location. |
|
198 |
|
199 @param aSessionId The Id of the location session. |
|
200 @param aLocation The network-based location, including any |
|
201 relevant accuracy data. |
|
202 */ |
|
203 void ProcessLocationUpdate(const TLbsNetSessionId& aSessionId, |
|
204 const TPositionInfoBase& aLocation); |
|
205 |
|
206 /** Tell the gateway to process a privacy request from the network. |
|
207 |
|
208 @param aSessionId The Id of the location session within the LBS sub-system. |
|
209 @param aEmergency ETrue if this is an emergency privacy request, EFalse |
|
210 otherwise. |
|
211 @param aNotification Type of user notification specified by the network. |
|
212 @param aRequestInfo Data about the external requestor of this handsets location. |
|
213 */ |
|
214 void ProcessPrivacyRequest(const TLbsNetSessionId& aSessionId, TBool aEmergency, |
|
215 const TLbsNetPosRequestPrivacy& aPrivacy, |
|
216 const TLbsExternalRequestInfo& aRequestInfo); |
|
217 |
|
218 |
|
219 // MTestTimerObserver methods |
|
220 void OnTimerEventL(TInt aTimerId); |
|
221 TInt OnTimerError(TInt aTimerId, TInt aError); |
|
222 |
|
223 private: |
|
224 |
|
225 /** Constructor |
|
226 */ |
|
227 CSuplGatewayObserver(); |
|
228 |
|
229 /** Second phase Constructor |
|
230 */ |
|
231 void ConstructL(); |
|
232 |
|
233 /** Signal that observer has received a callback |
|
234 @param aResult Enumeration showing which observer method was called. |
|
235 */ |
|
236 void SignalObserverCallBack(const TCallBackResult aResult); |
|
237 |
|
238 private: |
|
239 |
|
240 /** Flag to show if observer has received a callback |
|
241 */ |
|
242 TBool iWasObserverCalled; |
|
243 |
|
244 /** Value relating to the observer method that was called. |
|
245 */ |
|
246 TCallBackResult iCallBackResult; |
|
247 |
|
248 /** Local (nested) active scheduler used to wait for callbacks |
|
249 */ |
|
250 CActiveSchedulerWait* iScheduler; |
|
251 |
|
252 /** Assistance data error |
|
253 */ |
|
254 TInt iAssistanceDataError; |
|
255 |
|
256 /** Assistance data set mask |
|
257 This is the mask reported by the module when |
|
258 the error is KErrNone (available assistance data) |
|
259 */ |
|
260 TLbsAsistanceDataGroup iAssistanceDataSetMask; |
|
261 |
|
262 /** Provided data set mask |
|
263 This mask is derived from the actual provided data content |
|
264 */ |
|
265 TLbsAsistanceDataGroup iProvidedDataSetMask; |
|
266 |
|
267 /** Assistance Data Error Mask |
|
268 This is the mask reported by the module to signal |
|
269 that some requested assistance data types couldn't be |
|
270 obtained from the network. |
|
271 */ |
|
272 TLbsAsistanceDataGroup iAssistanceDataErrorMask; |
|
273 |
|
274 /** Session ID |
|
275 */ |
|
276 TLbsNetSessionId iSessionIdValue; |
|
277 |
|
278 /** Session close reason |
|
279 */ |
|
280 TInt iSessionCloseReason; |
|
281 |
|
282 /** Flag to show if location request is emergency related |
|
283 */ |
|
284 TBool iLocEmergency; |
|
285 |
|
286 /** Location requestor type |
|
287 */ |
|
288 TLbsNetProtocolService iLocReqType; |
|
289 |
|
290 /** Location requestor quality |
|
291 */ |
|
292 TLbsNetPosRequestQuality iLocQuality; |
|
293 |
|
294 /** Reference Location position |
|
295 */ |
|
296 TPosition iReferencePos; |
|
297 |
|
298 /** True when reference position |
|
299 has been notified from SUPL |
|
300 */ |
|
301 TBool iRefLocNotified; |
|
302 |
|
303 /** Privacy Notification Type |
|
304 */ |
|
305 TLbsNetPosRequestPrivacy iPrivacyNotifType; |
|
306 |
|
307 /** Location Request Method |
|
308 */ |
|
309 TLbsNetPosRequestMethod iMethod; |
|
310 |
|
311 /** Privacy Requestor Information |
|
312 */ |
|
313 TLbsExternalRequestInfo iRequestInfo; |
|
314 |
|
315 /** Flag to show if privacy request has been received |
|
316 */ |
|
317 TBool iPrivReqReceived; |
|
318 |
|
319 /** Positioning Capabilities |
|
320 */ |
|
321 TLbsNetPosCapabilities iCapabilities; |
|
322 |
|
323 /** Test timer |
|
324 */ |
|
325 CLbsCallbackTimer* iTimer; |
|
326 |
|
327 }; |
|
328 |
|
329 |
|
330 #endif // __CSUPLGATEWAYOBSERVER_H__ |
|
331 |