|
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 // Source file for the 'stub' network protocol module used in |
|
15 // the Network Gateway unit tests. |
|
16 // |
|
17 // |
|
18 |
|
19 /** |
|
20 @file |
|
21 @internalTechnology |
|
22 @released |
|
23 */ |
|
24 |
|
25 #include <e32base.h> |
|
26 #include <e32debug.h> |
|
27 #include <ecom/implementationproxy.h> |
|
28 #include <lbs.h> |
|
29 #include "lbsdevloggermacros.h" |
|
30 #include "lbsnetgatewayprotocoltest.h" |
|
31 |
|
32 |
|
33 _LIT(KLbsTestNetworkProtocol,"LbsTestNetworkProtocol"); |
|
34 |
|
35 |
|
36 |
|
37 // |
|
38 // ECom instantiation functions |
|
39 // |
|
40 |
|
41 const TImplementationProxy KImplementationTable[] = |
|
42 { |
|
43 IMPLEMENTATION_PROXY_ENTRY(0x10282250, CTestLbsNetworkProtocol::New0L), |
|
44 IMPLEMENTATION_PROXY_ENTRY(0x10285AB9, CTestLbsNetworkProtocol::New1L), |
|
45 // Entry points for multiple PM test |
|
46 IMPLEMENTATION_PROXY_ENTRY(0x102871C8, CTestLbsNetworkProtocol::New2L), |
|
47 IMPLEMENTATION_PROXY_ENTRY(0x102871C9, CTestLbsNetworkProtocol::New3L), |
|
48 IMPLEMENTATION_PROXY_ENTRY(0x102871CA, CTestLbsNetworkProtocol::New4L), |
|
49 IMPLEMENTATION_PROXY_ENTRY(0x102871CB, CTestLbsNetworkProtocol::New5L), |
|
50 IMPLEMENTATION_PROXY_ENTRY(0x102871CC, CTestLbsNetworkProtocol::New6L), |
|
51 IMPLEMENTATION_PROXY_ENTRY(0x102871CD, CTestLbsNetworkProtocol::New7L), |
|
52 IMPLEMENTATION_PROXY_ENTRY(0x102871CE, CTestLbsNetworkProtocol::New8L), |
|
53 IMPLEMENTATION_PROXY_ENTRY(0x102871CF, CTestLbsNetworkProtocol::New9L), |
|
54 |
|
55 // Another 10 entry points for the roaming PMs |
|
56 IMPLEMENTATION_PROXY_ENTRY(0x102871D0, CTestLbsNetworkProtocol::New10L), |
|
57 IMPLEMENTATION_PROXY_ENTRY(0x102871D1, CTestLbsNetworkProtocol::New11L), |
|
58 IMPLEMENTATION_PROXY_ENTRY(0x102871D2, CTestLbsNetworkProtocol::New12L), |
|
59 IMPLEMENTATION_PROXY_ENTRY(0x102871D3, CTestLbsNetworkProtocol::New13L), |
|
60 IMPLEMENTATION_PROXY_ENTRY(0x102871D4, CTestLbsNetworkProtocol::New14L), |
|
61 IMPLEMENTATION_PROXY_ENTRY(0x102871D5, CTestLbsNetworkProtocol::New15L), |
|
62 IMPLEMENTATION_PROXY_ENTRY(0x102871D6, CTestLbsNetworkProtocol::New16L), |
|
63 IMPLEMENTATION_PROXY_ENTRY(0x102871D7, CTestLbsNetworkProtocol::New17L), |
|
64 IMPLEMENTATION_PROXY_ENTRY(0x102871D8, CTestLbsNetworkProtocol::New18L), |
|
65 IMPLEMENTATION_PROXY_ENTRY(0x102871D9, CTestLbsNetworkProtocol::New19L), |
|
66 }; |
|
67 |
|
68 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) |
|
69 { |
|
70 aTableCount = (sizeof(KImplementationTable) / sizeof(TImplementationProxy)); |
|
71 return KImplementationTable; |
|
72 } |
|
73 |
|
74 // |
|
75 // CTestLbsNetworkProtocol Implementation |
|
76 // |
|
77 |
|
78 CTestLbsNetworkProtocol::CTestLbsNetworkProtocol(TUint aModuleIndex, |
|
79 TLbsNetProtocolModuleParams& aParams) : iObserver(aParams.Observer()), |
|
80 iTestChannel(aModuleIndex), |
|
81 iModuleIndex(aModuleIndex) |
|
82 { |
|
83 LBSLOG(ELogP1, "CTestLbsNetworkProtocol::CTestLbsNetworkProtocol:"); |
|
84 } |
|
85 |
|
86 CTestLbsNetworkProtocol::~CTestLbsNetworkProtocol() |
|
87 { |
|
88 LBSLOG(ELogP1, "CTestLbsNetworkProtocol::~CTestLbsNetworkProtocol:"); |
|
89 iTestChannel.Close(); |
|
90 RNetGatewayProtocolTestChannel::Shutdown(iModuleIndex); |
|
91 } |
|
92 |
|
93 CTestLbsNetworkProtocol* CTestLbsNetworkProtocol::New0L(TAny* aData) |
|
94 { |
|
95 return NewL(KTe_LbsNetGatewayTestProtocolIndex, aData); |
|
96 } |
|
97 |
|
98 CTestLbsNetworkProtocol* CTestLbsNetworkProtocol::New1L(TAny* aData) |
|
99 { |
|
100 return NewL(KTe_LbsNetGatewayTestProtocolIndex2, aData); |
|
101 } |
|
102 |
|
103 CTestLbsNetworkProtocol* CTestLbsNetworkProtocol::New2L(TAny* aData) |
|
104 { |
|
105 return NewL(KTe_LbsNetGatewayTestProtocolIndex3, aData); |
|
106 } |
|
107 |
|
108 CTestLbsNetworkProtocol* CTestLbsNetworkProtocol::New3L(TAny* aData) |
|
109 { |
|
110 return NewL(KTe_LbsNetGatewayTestProtocolIndex4, aData); |
|
111 } |
|
112 |
|
113 CTestLbsNetworkProtocol* CTestLbsNetworkProtocol::New4L(TAny* aData) |
|
114 { |
|
115 return NewL(KTe_LbsNetGatewayTestProtocolIndex5, aData); |
|
116 } |
|
117 |
|
118 CTestLbsNetworkProtocol* CTestLbsNetworkProtocol::New5L(TAny* aData) |
|
119 { |
|
120 return NewL(KTe_LbsNetGatewayTestProtocolIndex6, aData); |
|
121 } |
|
122 |
|
123 CTestLbsNetworkProtocol* CTestLbsNetworkProtocol::New6L(TAny* aData) |
|
124 { |
|
125 return NewL(KTe_LbsNetGatewayTestProtocolIndex7, aData); |
|
126 } |
|
127 |
|
128 CTestLbsNetworkProtocol* CTestLbsNetworkProtocol::New7L(TAny* aData) |
|
129 { |
|
130 return NewL(KTe_LbsNetGatewayTestProtocolIndex8, aData); |
|
131 } |
|
132 |
|
133 CTestLbsNetworkProtocol* CTestLbsNetworkProtocol::New8L(TAny* aData) |
|
134 { |
|
135 return NewL(KTe_LbsNetGatewayTestProtocolIndex9, aData); |
|
136 } |
|
137 |
|
138 CTestLbsNetworkProtocol* CTestLbsNetworkProtocol::New9L(TAny* aData) |
|
139 { |
|
140 return NewL(KTe_LbsNetGatewayTestProtocolIndex10, aData); |
|
141 } |
|
142 |
|
143 CTestLbsNetworkProtocol* CTestLbsNetworkProtocol::New10L(TAny* aData) |
|
144 { |
|
145 return NewL(KTe_LbsNetGatewayTestProtocolIndex11, aData); |
|
146 } |
|
147 |
|
148 // 10 entry points for roaming modules |
|
149 CTestLbsNetworkProtocol* CTestLbsNetworkProtocol::New11L(TAny* aData) |
|
150 { |
|
151 return NewL(KTe_LbsNetGatewayTestProtocolIndex12, aData); |
|
152 } |
|
153 CTestLbsNetworkProtocol* CTestLbsNetworkProtocol::New12L(TAny* aData) |
|
154 { |
|
155 return NewL(KTe_LbsNetGatewayTestProtocolIndex13, aData); |
|
156 } |
|
157 CTestLbsNetworkProtocol* CTestLbsNetworkProtocol::New13L(TAny* aData) |
|
158 { |
|
159 return NewL(KTe_LbsNetGatewayTestProtocolIndex14, aData); |
|
160 } |
|
161 CTestLbsNetworkProtocol* CTestLbsNetworkProtocol::New14L(TAny* aData) |
|
162 { |
|
163 return NewL(KTe_LbsNetGatewayTestProtocolIndex15, aData); |
|
164 } |
|
165 CTestLbsNetworkProtocol* CTestLbsNetworkProtocol::New15L(TAny* aData) |
|
166 { |
|
167 return NewL(KTe_LbsNetGatewayTestProtocolIndex16, aData); |
|
168 } |
|
169 CTestLbsNetworkProtocol* CTestLbsNetworkProtocol::New16L(TAny* aData) |
|
170 { |
|
171 return NewL(KTe_LbsNetGatewayTestProtocolIndex17, aData); |
|
172 } |
|
173 CTestLbsNetworkProtocol* CTestLbsNetworkProtocol::New17L(TAny* aData) |
|
174 { |
|
175 return NewL(KTe_LbsNetGatewayTestProtocolIndex18, aData); |
|
176 } |
|
177 CTestLbsNetworkProtocol* CTestLbsNetworkProtocol::New18L(TAny* aData) |
|
178 { |
|
179 return NewL(KTe_LbsNetGatewayTestProtocolIndex19, aData); |
|
180 } |
|
181 CTestLbsNetworkProtocol* CTestLbsNetworkProtocol::New19L(TAny* aData) |
|
182 { |
|
183 return NewL(KTe_LbsNetGatewayTestProtocolIndex20, aData); |
|
184 } |
|
185 |
|
186 |
|
187 |
|
188 CTestLbsNetworkProtocol* CTestLbsNetworkProtocol::NewL(TUint aModuleIndex, TAny* aData) |
|
189 { |
|
190 LBSLOG(ELogP1, "CTestLbsNetworkProtocol::NewL:"); |
|
191 TLbsNetProtocolModuleParams* params = reinterpret_cast<TLbsNetProtocolModuleParams*>(aData); |
|
192 CTestLbsNetworkProtocol* self = new (ELeave) CTestLbsNetworkProtocol(aModuleIndex, *params); |
|
193 CleanupStack::PushL(self); |
|
194 self->ConstructL(); |
|
195 CleanupStack::Pop(); |
|
196 return self; |
|
197 } |
|
198 |
|
199 void CTestLbsNetworkProtocol::ConstructL() |
|
200 { |
|
201 LBSLOG(ELogP1, "CTestLbsNetworkProtocol::ConstructL:"); |
|
202 RNetGatewayProtocolTestChannel::InitialiseL(iModuleIndex); |
|
203 iTestChannel.OpenL(KTestAppChannelKey, KNetProtocolChannelKey, *this); |
|
204 } |
|
205 |
|
206 void CTestLbsNetworkProtocol::RespondPrivacyRequest(const TLbsNetSessionId& aSessionId, |
|
207 const TLbsPrivacyResponse& aResponse, |
|
208 TInt /* aReason */) |
|
209 { |
|
210 LBSLOG(ELogP2, "CTestLbsNetworkProtocol::RespondPrivacyRequest:"); |
|
211 LBSLOG3(ELogP2, "SessionId : (%d, %d)\n", aSessionId.SessionOwner().iUid, |
|
212 aSessionId.SessionNum()); |
|
213 LBSLOG2(ELogP2, "Response : %d", aResponse); |
|
214 |
|
215 TNetGatewayMsg msg; |
|
216 SNetMsgRespondPrivacyRequest* response; |
|
217 response = reinterpret_cast<SNetMsgRespondPrivacyRequest*>(msg.Data()); |
|
218 msg.iType = ENetMsgRespondPrivacyRequest; |
|
219 response->iSessionId = aSessionId; |
|
220 response->iResponse = aResponse; |
|
221 |
|
222 TInt err = KErrNone; |
|
223 TRAP(err, iTestChannel.SendNetProtocolMessageL(msg);) |
|
224 if(err) |
|
225 User::Panic(KLbsTestNetworkProtocol, err); |
|
226 } |
|
227 |
|
228 void CTestLbsNetworkProtocol::RespondLocationRequest(const TLbsNetSessionId& aSessionId, |
|
229 TInt aReason, |
|
230 const TPositionInfoBase& aPosInfo) |
|
231 { |
|
232 const TPositionInfo& posInfo = static_cast<const TPositionInfo&>(aPosInfo); |
|
233 TPosition position; |
|
234 posInfo.GetPosition(position); |
|
235 |
|
236 LBSLOG(ELogP2, "CTestLbsNetworkProtocol::RespondLocationRequest:"); |
|
237 LBSLOG3(ELogP2, "SessionId : (%d, %d)\n", aSessionId.SessionOwner().iUid, |
|
238 aSessionId.SessionNum()); |
|
239 LBSLOG2(ELogP2, "Reason : %d", aReason); |
|
240 LBSLOG3(ELogP2, "Position : %LF lat, %LF long", position.Latitude(), |
|
241 position.Longitude()); |
|
242 |
|
243 SNetMsgRespondLocationRequest* response; |
|
244 TNetGatewayMsg msg; |
|
245 response = reinterpret_cast<SNetMsgRespondLocationRequest*>(msg.Data()); |
|
246 new (response) SNetMsgRespondLocationRequest; |
|
247 msg.iType = ENetMsgRespondLocationRequest; |
|
248 response->iSessionId = aSessionId; |
|
249 response->iReason = aReason; |
|
250 // This assumes that aPosInfo is really a reference to |
|
251 // a TPositionSatelliteInfo. If this isn't true then |
|
252 // the last part will be junk. |
|
253 Mem::Copy(&response->iPositionInfo, &aPosInfo, response->iPositionInfo.PositionClassSize()); |
|
254 |
|
255 TInt err = KErrNone; |
|
256 TRAP(err, iTestChannel.SendNetProtocolMessageL(msg);) |
|
257 if(err) |
|
258 User::Panic(KLbsTestNetworkProtocol, err); |
|
259 |
|
260 } |
|
261 |
|
262 void CTestLbsNetworkProtocol::RequestAssistanceData(TLbsAssistanceDataGroup aDataRequestMask, const TLbsNetSessionIdArray& /*aSessionIdArray*/) |
|
263 { |
|
264 LBSLOG(ELogP2, "CTestLbsNetworkProtocol::RequestAssistanceData:"); |
|
265 LBSLOG2(ELogP2, "Data Mask : 0x%x", aDataRequestMask); |
|
266 |
|
267 TNetGatewayMsg msg; |
|
268 SNetMsgRequestAssistanceData* request; |
|
269 request = reinterpret_cast<SNetMsgRequestAssistanceData*>(msg.Data()); |
|
270 msg.iType = ENetMsgRequestAssistanceData; |
|
271 request->iDataRequestMask = aDataRequestMask; |
|
272 |
|
273 TInt err = KErrNone; |
|
274 TRAP(err, iTestChannel.SendNetProtocolMessageL(msg);) |
|
275 if(err) |
|
276 User::Panic(KLbsTestNetworkProtocol, err); |
|
277 } |
|
278 |
|
279 void CTestLbsNetworkProtocol::RequestSelfLocation(const TLbsNetSessionId& aSessionId, |
|
280 const TLbsNetPosRequestOptionsBase& aOptions) |
|
281 { |
|
282 LBSLOG(ELogP2, "CTestLbsNetworkProtocol::RequestNetworkBasedLocation:"); |
|
283 LBSLOG3(ELogP2, "SessionId : (%d, %d)\n", aSessionId.SessionOwner().iUid, |
|
284 aSessionId.SessionNum()); |
|
285 |
|
286 TNetGatewayMsg msg; |
|
287 SNetMsgRequestSelfLocation* request; |
|
288 request = reinterpret_cast<SNetMsgRequestSelfLocation*>(msg.Data()); |
|
289 msg.iType = ENetMsgRequestSelfLocation; |
|
290 const TLbsNetPosRequestOptionsAssistance assistOptions = reinterpret_cast<const TLbsNetPosRequestOptionsAssistance&>(aOptions); |
|
291 request->iSessionId = aSessionId; |
|
292 request->iNewClient = assistOptions.NewClientConnected(); |
|
293 request->iDataRequestMask = assistOptions.DataRequestMask(); |
|
294 TInt err = KErrNone; |
|
295 TRAP(err, iTestChannel.SendNetProtocolMessageL(msg);) |
|
296 if(err) |
|
297 User::Panic(KLbsTestNetworkProtocol, err); |
|
298 } |
|
299 |
|
300 void CTestLbsNetworkProtocol::CancelSelfLocation(const TLbsNetSessionId& aSessionId, |
|
301 TInt aReason) |
|
302 { |
|
303 LBSLOG(ELogP2, "CTestLbsNetworkProtocol::CancelSelfLocation:"); |
|
304 LBSLOG3(ELogP2, "SessionId : (%d, %d)\n", aSessionId.SessionOwner().iUid, |
|
305 aSessionId.SessionNum()); |
|
306 LBSLOG2(ELogP2, "Reason : %d", aReason); |
|
307 |
|
308 TNetGatewayMsg msg; |
|
309 SNetMsgCancelSelfLocation* cancel; |
|
310 cancel = reinterpret_cast<SNetMsgCancelSelfLocation*>(msg.Data()); |
|
311 msg.iType = ENetMsgCancelSelfLocation; |
|
312 cancel->iSessionId = aSessionId; |
|
313 cancel->iReason = aReason; |
|
314 |
|
315 TInt err = KErrNone; |
|
316 TRAP(err, iTestChannel.SendNetProtocolMessageL(msg);) |
|
317 if(err) |
|
318 User::Panic(KLbsTestNetworkProtocol, err); |
|
319 } |
|
320 |
|
321 void CTestLbsNetworkProtocol::RequestNetworkLocation(const TLbsNetSessionId& aSessionId, |
|
322 const TLbsNetPosRequestOptionsBase& aOptions) |
|
323 { |
|
324 LBSLOG(ELogP2, "CTestLbsNetworkProtocol::RequestNetworkLocation:"); |
|
325 LBSLOG3(ELogP2, "SessionId : (%d, %d)\n", aSessionId.SessionOwner().iUid, |
|
326 aSessionId.SessionNum()); |
|
327 |
|
328 TNetGatewayMsg msg; |
|
329 SNetMsgRequestNetworkLocation* request; |
|
330 request = reinterpret_cast<SNetMsgRequestNetworkLocation*>(msg.Data()); |
|
331 msg.iType = ENetMsgRequestNetworkLocation; |
|
332 const TLbsNetPosRequestOptions netOptions = reinterpret_cast<const TLbsNetPosRequestOptions&>(aOptions); |
|
333 netOptions.GetRequestQuality(request->iQuality); |
|
334 request->iSessionId = aSessionId; |
|
335 |
|
336 TInt err = KErrNone; |
|
337 TRAP(err, iTestChannel.SendNetProtocolMessageL(msg);) |
|
338 if(err) |
|
339 User::Panic(KLbsTestNetworkProtocol, err); |
|
340 } |
|
341 |
|
342 void CTestLbsNetworkProtocol::CancelNetworkLocation(const TLbsNetSessionId& aSessionId, |
|
343 TInt aReason) |
|
344 { |
|
345 LBSLOG(ELogP2, "CTestLbsNetworkProtocol::CancelNetworkLocation:"); |
|
346 LBSLOG3(ELogP2, "SessionId : (%d, %d)\n", aSessionId.SessionOwner().iUid, |
|
347 aSessionId.SessionNum()); |
|
348 LBSLOG2(ELogP2, "Reason : %d", aReason); |
|
349 |
|
350 TNetGatewayMsg msg; |
|
351 SNetMsgCancelNetworkLocation* cancel; |
|
352 cancel = reinterpret_cast<SNetMsgCancelNetworkLocation*>(msg.Data()); |
|
353 msg.iType = ENetMsgCancelNetworkLocation; |
|
354 cancel->iSessionId = aSessionId; |
|
355 cancel->iReason = aReason; |
|
356 |
|
357 TInt err = KErrNone; |
|
358 TRAP(err, iTestChannel.SendNetProtocolMessageL(msg);) |
|
359 if(err) |
|
360 User::Panic(KLbsTestNetworkProtocol, err); |
|
361 } |
|
362 |
|
363 void CTestLbsNetworkProtocol::RequestTransmitLocation(const TLbsNetSessionId& aSessionId, |
|
364 const TDesC& aDestination, |
|
365 TInt aPriority, |
|
366 const TLbsNetPosRequestOptionsBase& aOptions) |
|
367 { |
|
368 LBSLOG(ELogP2, "CTestLbsNetworkProtocol::RequestTransmitLocation:"); |
|
369 LBSLOG3(ELogP2, "SessionId : (%d, %d)\n", aSessionId.SessionOwner().iUid, |
|
370 aSessionId.SessionNum()); |
|
371 LBSLOG2(ELogP2, "Destination : %S", &aDestination); |
|
372 LBSLOG2(ELogP2, "Priority : %d", aPriority); |
|
373 |
|
374 TNetGatewayMsg msg; |
|
375 SNetMsgRequestTransmitLocation* request; |
|
376 request = reinterpret_cast<SNetMsgRequestTransmitLocation*>(msg.Data()); |
|
377 new (request) SNetMsgRequestTransmitLocation; // in-place construction is needed to construct the descriptors (iDestination) |
|
378 msg.iType = ENetMsgRequestTransmitLocation; |
|
379 request->iSessionId = aSessionId; |
|
380 request->iPriority = aPriority; |
|
381 request->iDestination = aDestination; |
|
382 request->iOptions = reinterpret_cast<const TLbsNetPosRequestOptionsTechnology&>(aOptions); |
|
383 |
|
384 TInt err = KErrNone; |
|
385 TRAP(err, iTestChannel.SendNetProtocolMessageL(msg);) |
|
386 if(err) |
|
387 User::Panic(KLbsTestNetworkProtocol, err); |
|
388 } |
|
389 |
|
390 void CTestLbsNetworkProtocol::CancelTransmitLocation(const TLbsNetSessionId& aSessionId, |
|
391 TInt aReason) |
|
392 { |
|
393 LBSLOG(ELogP2, "CTestLbsNetworkProtocol::CancelTransmitLocation:"); |
|
394 LBSLOG3(ELogP2, "SessionId : (%d, %d)\n", aSessionId.SessionOwner().iUid, |
|
395 aSessionId.SessionNum()); |
|
396 LBSLOG2(ELogP2, "Reason : %d", aReason); |
|
397 |
|
398 TNetGatewayMsg msg; |
|
399 SNetMsgCancelTransmitLocation* cancel; |
|
400 cancel = reinterpret_cast<SNetMsgCancelTransmitLocation*>(msg.Data()); |
|
401 msg.iType = ENetMsgCancelTransmitLocation; |
|
402 cancel->iSessionId = aSessionId; |
|
403 cancel->iReason = aReason; |
|
404 |
|
405 TInt err = KErrNone; |
|
406 TRAP(err, iTestChannel.SendNetProtocolMessageL(msg);) |
|
407 if(err) |
|
408 User::Panic(KLbsTestNetworkProtocol, err); |
|
409 } |
|
410 |
|
411 void CTestLbsNetworkProtocol::CancelExternalLocation( |
|
412 const TLbsNetSessionId& aSessionId, |
|
413 TInt aReason) |
|
414 { |
|
415 LBSLOG(ELogP2, "CTestLbsNetworkProtocol::CancelExternalLocation:"); |
|
416 LBSLOG3(ELogP2, "SessionId : (%d, %d)\n", aSessionId.SessionOwner().iUid, |
|
417 aSessionId.SessionNum()); |
|
418 LBSLOG2(ELogP2, "Reason : %d", aReason); |
|
419 |
|
420 TNetGatewayMsg msg; |
|
421 SNetMsgCancelExternalLocation* cancel; |
|
422 cancel = reinterpret_cast<SNetMsgCancelExternalLocation*>(msg.Data()); |
|
423 msg.iType = ENetMsgCancelExternalLocation; |
|
424 cancel->iSessionId = aSessionId; |
|
425 cancel->iReason = aReason; |
|
426 |
|
427 TInt err = KErrNone; |
|
428 TRAP(err, iTestChannel.SendNetProtocolMessageL(msg);) |
|
429 if(err) |
|
430 User::Panic(KLbsTestNetworkProtocol, err); |
|
431 } |
|
432 |
|
433 |
|
434 void CTestLbsNetworkProtocol::AdviceSystemStatus(TLbsSystemStatus /*aStatus*/) |
|
435 { |
|
436 #pragma message("NOTE: CTestLbsNetworkProtocol::AdviceSystemStatus method not yet implemented. TBD") |
|
437 } |
|
438 |
|
439 void CTestLbsNetworkProtocol::ProcessNetProtocolMessage(const TNetGatewayMsg& aMessage) |
|
440 { |
|
441 LBSLOG(ELogP1, "CTestLbsNetworkProtocol::ProcessNetProtocolMessage:"); |
|
442 |
|
443 switch (aMessage.iType) |
|
444 { |
|
445 case ENetMsgProcessPrivacyRequest: |
|
446 { |
|
447 const SNetMsgProcessPrivacyRequest* request; |
|
448 request = reinterpret_cast<const SNetMsgProcessPrivacyRequest*>(aMessage.Data()); |
|
449 iObserver.ProcessPrivacyRequest(request->iSessionId, |
|
450 request->iEmergency, |
|
451 request->iPrivacy, |
|
452 request->iRequestInfo); |
|
453 break; |
|
454 } |
|
455 case ENetMsgProcessLocationRequest: |
|
456 { |
|
457 const SNetMsgProcessLocationRequest* request; |
|
458 request = reinterpret_cast<const SNetMsgProcessLocationRequest*>(aMessage.Data()); |
|
459 iObserver.ProcessLocationRequest(request->iSessionId, |
|
460 request->iEmergency, |
|
461 request->iService, |
|
462 request->iQuality, |
|
463 request->iMethod); |
|
464 break; |
|
465 } |
|
466 case ENetMsgProcessSessionComplete: |
|
467 { |
|
468 const SNetMsgProcessSessionComplete* complete; |
|
469 complete = reinterpret_cast<const SNetMsgProcessSessionComplete*>(aMessage.Data()); |
|
470 iObserver.ProcessSessionComplete(complete->iSessionId, |
|
471 complete->iReason); |
|
472 break; |
|
473 } |
|
474 case ENetMsgProcessAssistanceData: |
|
475 { |
|
476 const SNetMsgProcessAssistanceData* data; |
|
477 data = reinterpret_cast<const SNetMsgProcessAssistanceData*>(aMessage.Data()); |
|
478 iObserver.ProcessAssistanceData(data->iDataMask, |
|
479 data->iData, |
|
480 data->iReason); |
|
481 break; |
|
482 } |
|
483 case ENetMsgProcessLocationUpdate: |
|
484 { |
|
485 const SNetMsgProcessLocationUpdate* location; |
|
486 location = reinterpret_cast<const SNetMsgProcessLocationUpdate*>(aMessage.Data()); |
|
487 iObserver.ProcessLocationUpdate(location->iSessionId, location->iReferenceLocation); |
|
488 break; |
|
489 } |
|
490 case ENetMsgGetCurrentCapabilitiesRequest: |
|
491 { |
|
492 TNetGatewayMsg msg; |
|
493 msg.iType = ENetMsgGetCurrentCapabilitiesResponse; |
|
494 SNetMsgGetCurrentCapabilitiesResponse* response; |
|
495 response = reinterpret_cast<SNetMsgGetCurrentCapabilitiesResponse*>(msg.Data()); |
|
496 iObserver.GetCurrentCapabilities(response->iCapabilities); |
|
497 |
|
498 TInt err = KErrNone; |
|
499 TRAP(err, iTestChannel.SendNetProtocolMessageL(msg);) |
|
500 if(err) |
|
501 User::Panic(KLbsTestNetworkProtocol, err); |
|
502 break; |
|
503 } |
|
504 case ENetMsgProcessStatusUpdate: |
|
505 { |
|
506 const SNetMsgProcessStatusUpdate* status; |
|
507 status = reinterpret_cast<const SNetMsgProcessStatusUpdate*>(aMessage.Data()); |
|
508 iObserver.ProcessStatusUpdate(status->iActiveServiceMask); |
|
509 break; |
|
510 } |
|
511 case ENetMsgRespondPrivacyRequest: |
|
512 case ENetMsgRespondLocationRequest: |
|
513 case ENetMsgRequestTransmitLocation: |
|
514 case ENetMsgCancelTransmitLocation: |
|
515 case ENetMsgCancelExternalLocation: |
|
516 case ENetMsgRequestAssistanceData: |
|
517 case ENetMsgRequestSelfLocation: |
|
518 case ENetMsgCancelSelfLocation: |
|
519 case ENetMsgRequestNetworkLocation: |
|
520 case ENetMsgCancelNetworkLocation: |
|
521 case ENetMsgGetCurrentCapabilitiesResponse: |
|
522 { |
|
523 // The message go from the the plugin to the test code, |
|
524 // so they should never be received here. |
|
525 break; |
|
526 } |
|
527 case ENetMsgShutdownNetGateway: |
|
528 { |
|
529 CActiveScheduler::Stop(); |
|
530 break; |
|
531 } |
|
532 default: |
|
533 { |
|
534 LBSLOG_ERR2(ELogP3, "Unhandled message type ; %d\n", aMessage.iType); |
|
535 break; |
|
536 } |
|
537 } |
|
538 } |
|
539 |
|
540 |