|
1 // Copyright (c) 2006-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 // This file provides the class implementation of the ECOM plug-in |
|
15 // interface for the LBS test Network Protocol Module. |
|
16 // |
|
17 // |
|
18 |
|
19 #include <ecom/implementationproxy.h> |
|
20 #include "lbsdevloggermacros.h" |
|
21 #include "cgatewayinterface.h" |
|
22 |
|
23 #ifdef ENABLE_LBS_DEV_LOGGER |
|
24 #include <lbs/lbsnetclasstypes.h> |
|
25 #endif |
|
26 |
|
27 |
|
28 /** The unique ID of this plug-in implementation. |
|
29 This corresponds to the implementation UID specified in the .rss file |
|
30 for this protocol module. |
|
31 */ |
|
32 const TInt KPluginUidValue = 0x10281D70; |
|
33 |
|
34 |
|
35 //============================================================================= |
|
36 // CGatewayInterface |
|
37 //============================================================================= |
|
38 |
|
39 /** Static public constructor. |
|
40 @param aObserver Plug-in parameters, which includes a reference |
|
41 to this protocol module's observer. |
|
42 @return A new instance of the CGatewayInterface class. |
|
43 */ |
|
44 CGatewayInterface* CGatewayInterface::NewL(TAny* aParam) |
|
45 { |
|
46 LBSLOG(ELogP2, "CGatewayInterface::NewL"); |
|
47 |
|
48 TLbsNetProtocolModuleParams* param = reinterpret_cast<TLbsNetProtocolModuleParams*>(aParam); |
|
49 CGatewayInterface* self = new (ELeave) CGatewayInterface(param->Observer()); |
|
50 CleanupStack::PushL(self); |
|
51 self->ConstructL(); |
|
52 CleanupStack::Pop(self); |
|
53 return self; |
|
54 } |
|
55 |
|
56 |
|
57 /** Standard destructor. |
|
58 */ |
|
59 CGatewayInterface::~CGatewayInterface() |
|
60 { |
|
61 LBSLOG(ELogP2, "CGatewayInterface::~CGatewayInterface"); |
|
62 delete iManager; |
|
63 } |
|
64 |
|
65 |
|
66 /** Default constructor |
|
67 @param aObserver Reference to this protocol module's observer. |
|
68 */ |
|
69 CGatewayInterface::CGatewayInterface(MLbsNetworkProtocolObserver& aObserver) |
|
70 : iObserver(aObserver) |
|
71 { |
|
72 LBSLOG(ELogP2, "CGatewayInterface::CGatewayInterface"); |
|
73 } |
|
74 |
|
75 |
|
76 /** Second stage private constructor. |
|
77 */ |
|
78 void CGatewayInterface::ConstructL() |
|
79 { |
|
80 LBSLOG(ELogP2, "CGatewayInterface::ConstructL"); |
|
81 iManager = CProtocolManager::NewL(*this); |
|
82 } |
|
83 |
|
84 |
|
85 /** Send a response to a privacy request to the network. |
|
86 @see CLbsNetworkProtocolBase::RespondPrivacyRequest() |
|
87 */ |
|
88 void CGatewayInterface::RespondPrivacyRequest(const TLbsNetSessionId& aSessionId, const TLbsPrivacyResponse& aResponse) |
|
89 { |
|
90 LBSLOG(ELogP2, "CGatewayInterface::RespondPrivacyRequest"); |
|
91 LBSLOG3(ELogP2, "SessionId : (0x%x, %d)\n", aSessionId.SessionOwner().iUid, |
|
92 aSessionId.SessionNum()); |
|
93 LBSLOG2(ELogP2, "PrivResp : %d\n", aResponse); |
|
94 iManager->PrivacyResp(aSessionId, aResponse); |
|
95 } |
|
96 |
|
97 |
|
98 /** Send a response to a location request to the network. |
|
99 @see CLbsNetworkProtocolBase::RespondLocationRequest() |
|
100 */ |
|
101 void CGatewayInterface::RespondLocationRequest(const TLbsNetSessionId& aSessionId, TInt aReason, |
|
102 const TPositionInfoBase& aPosInfo) |
|
103 { |
|
104 LBSLOG(ELogP2, "CGatewayInterface::RespondLocationRequest"); |
|
105 LBSLOG3(ELogP2, "SessionId : (0x%x, %d)\n", aSessionId.SessionOwner().iUid, |
|
106 aSessionId.SessionNum()); |
|
107 LBSLOG2(ELogP2, "Reason : %d\n", aReason); |
|
108 iManager->LocationResp(aSessionId, aReason, aPosInfo); |
|
109 } |
|
110 |
|
111 |
|
112 /** Send a request for GPS assistance data to the network. |
|
113 @see CLbsNetworkProtocolBase::RequestAssistanceData() |
|
114 */ |
|
115 void CGatewayInterface::RequestAssistanceData(TLbsAsistanceDataGroup aDataRequestMask) |
|
116 { |
|
117 LBSLOG(ELogP2, "CGatewayInterface::RequestAssistanceData"); |
|
118 LBSLOG2(ELogP2, "Data Mask : 0x%x", aDataRequestMask); |
|
119 iManager->AssistanceDataReq(aDataRequestMask); |
|
120 } |
|
121 |
|
122 /** Send a request for an approximate location based on the current network cell to the network. |
|
123 @see CLbsNetworkProtocolBase::RequestNetworkLocation() |
|
124 */ |
|
125 void CGatewayInterface::RequestNetworkLocation(const TLbsNetSessionId& aSessionId, |
|
126 const TLbsNetPosRequestOptionsBase& aOptions) |
|
127 { |
|
128 LBSLOG(ELogP2, "CGatewayInterface::RequestNetworkLocation"); |
|
129 LBSLOG3(ELogP2, "SessionId : (0x%x, %d)\n", aSessionId.SessionOwner().iUid, |
|
130 aSessionId.SessionNum()); |
|
131 iManager->NetworkBasedLocationReq(aSessionId, aOptions); |
|
132 } |
|
133 |
|
134 |
|
135 /** Tell the protocol module to finish the current network based location request. |
|
136 @see CLbsNetworkProtocolBase::CancelNetworkLocation() |
|
137 */ |
|
138 void CGatewayInterface::CancelNetworkLocation(const TLbsNetSessionId& aSessionId, |
|
139 TInt aReason) |
|
140 { |
|
141 LBSLOG(ELogP2, "CGatewayInterface::CancelNetworkLocation"); |
|
142 LBSLOG3(ELogP2, "SessionId : (0x%x, %d)\n", aSessionId.SessionOwner().iUid, |
|
143 aSessionId.SessionNum()); |
|
144 LBSLOG2(ELogP2, "Reason : %d\n", aReason); |
|
145 iManager->NetworkBasedLocationCompleteInd(aSessionId, aReason); |
|
146 } |
|
147 |
|
148 |
|
149 /** Request self locate. |
|
150 @see CLbsNetworkProtocolBase::RequestSelfLocation() |
|
151 */ |
|
152 void CGatewayInterface::RequestSelfLocation(const TLbsNetSessionId& aSessionId, |
|
153 const TLbsNetPosRequestOptionsBase& aOptions) |
|
154 { |
|
155 LBSLOG(ELogP2, "CGatewayInterface::RequestSelfLocation"); |
|
156 LBSLOG3(ELogP2, "SessionId : (0x%x, %d)\n", aSessionId.SessionOwner().iUid, |
|
157 aSessionId.SessionNum()); |
|
158 #ifdef ENABLE_LBS_DEV_LOGGER |
|
159 switch (aOptions.ClassType()) |
|
160 { |
|
161 case ELbsNetPosRequestOptionsClass: |
|
162 { |
|
163 const TLbsNetPosRequestOptions& options(static_cast<const TLbsNetPosRequestOptions&>(aOptions)); |
|
164 LBSLOG(ELogP2, "ELbsNetPosRequestOptionsClass params:"); |
|
165 LBSLOG2(ELogP2, "\tNewClientConnected() : %d", options.NewClientConnected()); |
|
166 (void) options; // avoid a compiler warning |
|
167 break; |
|
168 } |
|
169 case ELbsNetPosRequestOptionsAssistanceClass: |
|
170 { |
|
171 const TLbsNetPosRequestOptions& options(static_cast<const TLbsNetPosRequestOptions&>(aOptions)); |
|
172 LBSLOG(ELogP2, "ELbsNetPosRequestOptionsClass params:"); |
|
173 LBSLOG2(ELogP2, "\tNewClientConnected() : %d", options.NewClientConnected()); |
|
174 const TLbsNetPosRequestOptionsAssistance& optionsAssistance(static_cast<const TLbsNetPosRequestOptionsAssistance&>(aOptions)); |
|
175 LBSLOG(ELogP2, "ELbsNetPosRequestOptionsAssistanceClass params:"); |
|
176 LBSLOG2(ELogP2, "\tDataRequestMask() : 0x%x", optionsAssistance.DataRequestMask()); |
|
177 LBSLOG2(ELogP2, "\tPosMode() : 0x%x", optionsAssistance.PosMode()); |
|
178 (void) options; // avoid a compiler warning |
|
179 (void) optionsAssistance; // avoid a compiler warning |
|
180 break; |
|
181 } |
|
182 } |
|
183 #endif |
|
184 iManager->SelfLocationReq(aSessionId, aOptions); |
|
185 } |
|
186 |
|
187 |
|
188 /** Cancel request for self locate. |
|
189 @see CLbsNetworkProtocolBase::CancelSelfLocation() |
|
190 */ |
|
191 void CGatewayInterface::CancelSelfLocation(const TLbsNetSessionId& aSessionId, |
|
192 TInt aReason) |
|
193 { |
|
194 LBSLOG(ELogP2, "CGatewayInterface::CancelSelfLocation"); |
|
195 LBSLOG3(ELogP2, "SessionId : (0x%x, %d)\n", aSessionId.SessionOwner().iUid, |
|
196 aSessionId.SessionNum()); |
|
197 LBSLOG2(ELogP2, "Reason : %d\n", aReason); |
|
198 iManager->SelfLocationCompleteInd(aSessionId, aReason); |
|
199 } |
|
200 |
|
201 /** Lbs System Status information. |
|
202 @see CLbsNetworkProtocolBase::AdviceSystemStatus() |
|
203 */ |
|
204 void CGatewayInterface::AdviceSystemStatus(TLbsSystemStatus aStatus) |
|
205 { |
|
206 LBSLOG(ELogP2, "CGatewayInterface::AdviceSystemStatus"); |
|
207 LBSLOG2(ELogP2, "Status : %d\n", aStatus); |
|
208 iManager->SystemStatusInd(aStatus); |
|
209 } |
|
210 |
|
211 |
|
212 /** Send a request to send the handsets location to a third party to the network. |
|
213 @see CLbsNetworkProtocolBase::RequestTransmitLocation() |
|
214 */ |
|
215 void CGatewayInterface::RequestTransmitLocation(const TLbsNetSessionId& aSessionId, |
|
216 const TDesC& aDestination, TInt aPriority) |
|
217 { |
|
218 LBSLOG(ELogP2, "CGatewayInterface::RequestTransmitLocation"); |
|
219 LBSLOG3(ELogP2, "SessionId : (0x%x, %d)\n", aSessionId.SessionOwner().iUid, |
|
220 aSessionId.SessionNum()); |
|
221 LBSLOG2(ELogP2, "Priority : %d\n", aPriority); |
|
222 iManager->TransmitLocationReq(aSessionId, aDestination, aPriority); |
|
223 } |
|
224 |
|
225 |
|
226 /** Tell the protocol module to end the current send location to third party request. |
|
227 @see CLbsNetworkProtocolBase::CancelTransmitLocation() |
|
228 */ |
|
229 void CGatewayInterface::CancelTransmitLocation(const TLbsNetSessionId& aSessionId, TInt aReason) |
|
230 { |
|
231 LBSLOG(ELogP2, "CGatewayInterface::CancelTransmitLocation"); |
|
232 LBSLOG3(ELogP2, "SessionId : (0x%x, %d)\n", aSessionId.SessionOwner().iUid, |
|
233 aSessionId.SessionNum()); |
|
234 LBSLOG2(ELogP2, "Reason : %d\n", aReason); |
|
235 iManager->TransmitLocationCompleteInd(aSessionId, aReason); |
|
236 } |
|
237 |
|
238 |
|
239 /** Send privacy request to protocol module's observer. |
|
240 @param aSessionId The Id of the location session within the LBS sub-system. |
|
241 @param aEmergency ETrue if this is an emergency privacy request, EFalse otherwise. |
|
242 @param aPrivacy Type of privacy request specified by the network. |
|
243 @param aRequestInfo Data about the external requestor of this handsets location. |
|
244 |
|
245 @see MLbsNetworkProtocolObserver::ProcessPrivacyRequest() |
|
246 */ |
|
247 void CGatewayInterface::PrivacyReq(const TLbsNetSessionId& aSessionId, TBool aEmergency, |
|
248 const TLbsNetPosRequestPrivacy& aPrivacy, |
|
249 const TLbsExternalRequestInfo& aRequestInfo) |
|
250 { |
|
251 LBSLOG(ELogP2, "CGatewayInterface::PrivacyReq"); |
|
252 LBSLOG3(ELogP2, "SessionId : (0x%x, %d)\n", aSessionId.SessionOwner().iUid, |
|
253 aSessionId.SessionNum()); |
|
254 LBSLOG2(ELogP2, "Emergency : %d", aEmergency); |
|
255 LBSLOG3(ELogP2, "PrivacyReq : (%d, %d)\n", aPrivacy.RequestAdvice(), aPrivacy.RequestAction()); |
|
256 iObserver.ProcessPrivacyRequest(aSessionId, aEmergency, aPrivacy, aRequestInfo); |
|
257 } |
|
258 |
|
259 |
|
260 /** Send network-based location to protocol module's observer. |
|
261 @param aReferenceLocation The network-based reference location. |
|
262 |
|
263 @see MLbsNetworkProtocolObserver::ProcessNetworkBasedLocation() |
|
264 */ |
|
265 void CGatewayInterface::NetworkLocationInd(const TLbsNetSessionId& aSessionId, |
|
266 const TPositionInfoBase& aPosInfo) |
|
267 { |
|
268 LBSLOG(ELogP2, "CGatewayInterface::NetworkLocationInd"); |
|
269 LBSLOG3(ELogP2, "SessionId : (0x%x, %d)\n", aSessionId.SessionOwner().iUid, |
|
270 aSessionId.SessionNum()); |
|
271 iObserver.ProcessLocationUpdate(aSessionId, aPosInfo); |
|
272 } |
|
273 |
|
274 |
|
275 /** Send assistance data to protocol module's observer. |
|
276 @param aGroupMask This identifies the data group relevant for this indication. |
|
277 @param aData This holds GPS assistance data to be delivered to LBS. |
|
278 @param aReason A general error associated with assistance data retrieval. |
|
279 |
|
280 @see MLbsNetworkProtocolObserver::ProcessAssistanceData() |
|
281 */ |
|
282 void CGatewayInterface::AssistanceDataInd(const TLbsAsistanceDataGroup& aGroupMask, |
|
283 const RLbsAssistanceDataBuilderSet& aData, TInt aReason) |
|
284 { |
|
285 LBSLOG(ELogP2, "CGatewayInterface::AssistanceDataInd"); |
|
286 LBSLOG2(ELogP2, "Data Mask : 0x%x", aGroupMask); |
|
287 LBSLOG2(ELogP2, "Reason : %d\n", aReason); |
|
288 iObserver.ProcessAssistanceData(aGroupMask, aData, aReason); |
|
289 } |
|
290 |
|
291 |
|
292 /** Send location request to protocol module's observer. |
|
293 @param aSessionId The Id of the location session within the LBS sub-system. |
|
294 @param aEmergency ETrue if this is an emergency request, EFalse otherwise. |
|
295 @param aType The type of location request. The type is determined by preceding |
|
296 requests and other context information that only the network |
|
297 protocol module knows about. So it is the responsibility |
|
298 of the network protocol module to set the type of each request. |
|
299 @param aQuality The network-requested quality of service (QoS) of the |
|
300 location calculation. |
|
301 |
|
302 @see MLbsNetworkProtocolObserver::ProcessLocationRequest() |
|
303 */ |
|
304 void CGatewayInterface::LocationReq(const TLbsNetSessionId& aSessionId, TBool aEmergency, |
|
305 const MLbsNetworkProtocolObserver::TLbsNetProtocolService& aType, |
|
306 const TLbsNetPosRequestQuality& aQuality, |
|
307 const TLbsNetPosRequestMethod& aPosMethod) |
|
308 { |
|
309 LBSLOG(ELogP2, "CGatewayInterface::LocationReq"); |
|
310 LBSLOG3(ELogP2, "SessionId : (0x%x, %d)\n", aSessionId.SessionOwner().iUid, |
|
311 aSessionId.SessionNum()); |
|
312 LBSLOG2(ELogP2, "Emergency : %d", aEmergency); |
|
313 LBSLOG2(ELogP2, "Type : %d", aType); |
|
314 iObserver.ProcessLocationRequest(aSessionId, aEmergency, aType, aQuality, aPosMethod); |
|
315 } |
|
316 |
|
317 |
|
318 /** Send session complete indication to protocol module's observer. |
|
319 @param aSessionId The Id of the session completed. |
|
320 @param aReason Reason for the completion of the request. |
|
321 KErrNone if the request is successfully completed, otherwise |
|
322 it is one of a range of error codes. |
|
323 |
|
324 @see MLbsNetworkProtocolObserver::ProcessSessionComplete() |
|
325 */ |
|
326 void CGatewayInterface::SessionCompleteInd(const TLbsNetSessionId& aSessionId, TInt aReason) |
|
327 { |
|
328 LBSLOG(ELogP2, "CGatewayInterface::SessionCompleteInd"); |
|
329 LBSLOG3(ELogP2, "SessionId : (0x%x, %d)\n", aSessionId.SessionOwner().iUid, |
|
330 aSessionId.SessionNum()); |
|
331 LBSLOG2(ELogP2, "Reason : %d\n", aReason); |
|
332 iObserver.ProcessSessionComplete(aSessionId, aReason); |
|
333 } |
|
334 |
|
335 |
|
336 /** Network request for LBS capabilities |
|
337 @param aCapabilities The object to hold the returned capabilities from LBS. |
|
338 |
|
339 @see MLbsNetworkProtocolObserver::GetCapabilities() |
|
340 */ |
|
341 void CGatewayInterface::GetCapabilities(TLbsNetPosCapabilities& aCapabilities) |
|
342 { |
|
343 LBSLOG(ELogP2, "CGatewayInterface::GetCapabilities"); |
|
344 iObserver.GetCurrentCapabilities(aCapabilities); |
|
345 } |
|
346 |
|
347 |
|
348 /** Advise LBS of a change in active service status |
|
349 @param aActiveServiceMask A mask specifying the currently active services. |
|
350 |
|
351 @see MLbsNetworkProtocolObserver::StatusUpdate() |
|
352 */ |
|
353 void CGatewayInterface::StatusUpdate(MLbsNetworkProtocolObserver::TLbsNetProtocolServiceMask aActiveServiceMask) |
|
354 { |
|
355 LBSLOG(ELogP2, "CGatewayInterface::StatusUpdate"); |
|
356 LBSLOG2(ELogP2, "Status Mask : 0x%x", aActiveServiceMask); |
|
357 iObserver.ProcessStatusUpdate(aActiveServiceMask); |
|
358 } |
|
359 |
|
360 /** Asks LBS to reset the assistance data it holds |
|
361 @param aMask A mask specifying the assistance data to be reset. |
|
362 |
|
363 @see MLbsNetworkProtocolObserver::ProcessAssistanceData() |
|
364 */ |
|
365 void CGatewayInterface::ResetAssistanceData(TLbsAssistanceDataGroup aMask, const RLbsAssistanceDataBuilderSet& aData) |
|
366 { |
|
367 LBSLOG(ELogP2, "CGatewayInterface::ResetAssistanceData"); |
|
368 LBSLOG2(ELogP2, "Mask : 0x%x", aMask); |
|
369 iObserver.ProcessAssistanceData(aMask, aData, KPositionAssistanceDataReset); |
|
370 } |
|
371 |
|
372 /** Defines the plug-in interface implementation UIDs, required by ECOM. |
|
373 */ |
|
374 const TImplementationProxy ImplementationTable[] = |
|
375 { |
|
376 IMPLEMENTATION_PROXY_ENTRY(KPluginUidValue, CGatewayInterface::NewL) |
|
377 }; |
|
378 |
|
379 |
|
380 /** Exported function for ECOM to retrieve implementations table |
|
381 */ |
|
382 EXPORT_C |
|
383 const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) |
|
384 { |
|
385 aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); |
|
386 |
|
387 return ImplementationTable; |
|
388 } |
|
389 |