1 #include <e32debug.h> |
|
2 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 // All rights reserved. |
|
4 // This component and the accompanying materials are made available |
|
5 // under the terms of "Eclipse Public License v1.0" |
|
6 // which accompanies this distribution, and is available |
|
7 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 // |
|
9 // Initial Contributors: |
|
10 // Nokia Corporation - initial contribution. |
|
11 // |
|
12 // Contributors: |
|
13 // |
|
14 // Description: |
|
15 // |
|
16 |
|
17 /** |
|
18 @file |
|
19 @internalTechnology |
|
20 |
|
21 */ |
|
22 |
|
23 |
|
24 #include "rrlpassistancedata.h" |
|
25 #include "rrlpassistancedataack.h" |
|
26 #include "rrlpmeasureposrequest.h" |
|
27 #include "rrlpmeasureposresponse.h" |
|
28 #include "supldevloggermacros.h" |
|
29 #include "suplrrlpstatemachine.h" |
|
30 #include "suplpositioningprotocolfsm.inl" |
|
31 |
|
32 // statics |
|
33 const TInt CSuplRrlpFsm::KAssistanceDataChunkTimeout = 10; // Seconds |
|
34 const TInt CSuplRrlpFsm::KRequestTimeout = 60; // Seconds |
|
35 const TInt CSuplRrlpFsm::KResponseDelayAddition = 1000; // Micro-Seconds |
|
36 const TInt CSuplRrlpFsm::KResponseDelayTimeout = 60; // Seconds |
|
37 const TInt CSuplRrlpFsm::KMeasureRequestWithAssistanceDataDelay = 10000; // Micro-Seconds |
|
38 |
|
39 |
|
40 // Construction |
|
41 EXPORT_C CSuplRrlpFsm* CSuplRrlpFsm::NewL(MSuplPositioningProtocolFsmObserver& aObserver, RLbsAssistanceDataBuilderSet& aDataBuilder) |
|
42 { |
|
43 SUPLLOG(ELogP1, "CSuplRrlpFsm::NewL() Begin\n"); |
|
44 CSuplRrlpFsm* self = new(ELeave)CSuplRrlpFsm(aObserver,aDataBuilder); |
|
45 CleanupStack::PushL(self); |
|
46 self->ConstructL(); |
|
47 CleanupStack::Pop(self); |
|
48 |
|
49 SUPLLOG(ELogP1, "CSuplRrlpFsm::NewL() End\n"); |
|
50 return self; |
|
51 } |
|
52 |
|
53 CSuplRrlpFsm::CSuplRrlpFsm(MSuplPositioningProtocolFsmObserver& aObserver, RLbsAssistanceDataBuilderSet& aDataBuilder) : |
|
54 CSuplPositioningProtocolFsm(aObserver), iCurrentState(EStateNull), iAssistanceData(aDataBuilder) |
|
55 { |
|
56 SUPLLOG(ELogP1, "CSuplRrlpFsm::CSuplRrlpFsm() Begin\n"); |
|
57 SUPLLOG(ELogP1, "CSuplRrlpFsm::CSuplRrlpFsm() End\n"); |
|
58 } |
|
59 |
|
60 void CSuplRrlpFsm::ConstructL() |
|
61 { |
|
62 SUPLLOG(ELogP1, "CSuplRrlpFsm::ConstructL() Begin\n"); |
|
63 iAssistanceDataChunkTimer = CLbsCallbackTimer::NewL(*this); |
|
64 iRequestTimer = CLbsCallbackTimer::NewL(*this); |
|
65 iResponseDelayTimer = CLbsCallbackTimer::NewL(*this); |
|
66 iMeasureRequestWithAssitanceDataDelayTimer = CLbsCallbackTimer::NewL(*this); |
|
67 SUPLLOG(ELogP1, "CSuplRrlpFsm::ConstructL() End\n"); |
|
68 } |
|
69 |
|
70 CSuplRrlpFsm::~CSuplRrlpFsm() |
|
71 { |
|
72 SUPLLOG(ELogP1, "CSuplRrlpFsm::~CSuplRrlpFsm() Begin\n"); |
|
73 delete iAssistanceDataChunkTimer; |
|
74 delete iRequestTimer; |
|
75 delete iResponseDelayTimer; |
|
76 delete iMeasureRequestWithAssitanceDataDelayTimer; |
|
77 SUPLLOG(ELogP1, "CSuplRrlpFsm::~CSuplRrlpFsm() End\n"); |
|
78 } |
|
79 |
|
80 // Base class functions |
|
81 EXPORT_C void CSuplRrlpFsm::ProcessPositioningMessage(CSuplPosPayload* aMessage) |
|
82 { |
|
83 TInt message = aMessage->MessageType(); |
|
84 SUPLLOG2(ELogP1, "CSuplRrlpFsm::ProcessPositioningMessage() Begin. Message: %d\n", message); |
|
85 |
|
86 // Set the reference number |
|
87 CRrlpMessageBase* base = static_cast<CRrlpMessageBase*>(aMessage); |
|
88 base->GetReference(iLastReferenceNumber); |
|
89 |
|
90 switch (message) |
|
91 { |
|
92 case CSuplPosPayload::ERrlpAssistanceData: |
|
93 { |
|
94 CRrlpAssistanceData* pAssData = static_cast<CRrlpAssistanceData*>(aMessage); |
|
95 |
|
96 HandleAssistanceDataMessage(pAssData); |
|
97 break; |
|
98 } |
|
99 case CSuplPosPayload::ERrlpMeasurePositionReq: |
|
100 { |
|
101 CRrlpMeasurePositionRequest* pReq = static_cast<CRrlpMeasurePositionRequest*>(aMessage); |
|
102 HandleMeasurementPositionRequest(pReq); |
|
103 break; |
|
104 } |
|
105 case CSuplPosPayload::ERrlpProtocolError: |
|
106 { |
|
107 CRrlpProtocolError* pErr = static_cast<CRrlpProtocolError*>(aMessage); |
|
108 HandleProtocolError(pErr); |
|
109 break; |
|
110 } |
|
111 default: |
|
112 { |
|
113 iObserver.PositioningProtocolError(KErrNotFound); |
|
114 } |
|
115 } // switch |
|
116 |
|
117 delete aMessage; |
|
118 SUPLLOG(ELogP1, "CSuplRrlpFsm::ProcessPositioningMessage() End\n"); |
|
119 } |
|
120 |
|
121 EXPORT_C void CSuplRrlpFsm::CancelMachine(const TCancelSource& /*aCancelSource*/, TInt /*aReason*/) |
|
122 { |
|
123 SUPLLOG(ELogP1, "CSuplRrlpFsm::CancelMachine() Begin\n"); |
|
124 iResponseDelayTimer->Cancel(); |
|
125 iAssistanceDataChunkTimer->Cancel(); |
|
126 iRequestTimer->Cancel(); |
|
127 iMeasureRequestWithAssitanceDataDelayTimer->Cancel(); |
|
128 |
|
129 TransistionTo(EStateNull); |
|
130 SUPLLOG(ELogP1, "CSuplRrlpFsm::CancelMachine() End\n"); |
|
131 } |
|
132 |
|
133 EXPORT_C void CSuplRrlpFsm::AssistanceDataRequest(const TLbsAssistanceDataGroup& aData) |
|
134 { |
|
135 SUPLLOG(ELogP1, "CSuplRrlpFsm::AssistanceDataRequest() Begin\n"); |
|
136 if (TransistionTo(EStateMoreAssistDataRequested)) |
|
137 { |
|
138 iResponseDelayTimer->Cancel(); |
|
139 CRrlpMeasurePositionResponse* pResp = NULL; |
|
140 TRAPD(err, pResp = CRrlpMeasurePositionResponse::NewL()); |
|
141 if (err == KErrNone) |
|
142 { |
|
143 AddReference(*pResp); |
|
144 pResp->SetLocationError(ERrlpLocErrorGpsAssDataMissing, aData); |
|
145 |
|
146 iObserver.PositioningPayloadToNetwork(pResp); |
|
147 pResp = NULL; |
|
148 } // if |
|
149 |
|
150 if (err != KErrNone) |
|
151 { |
|
152 TransistionToError(err); |
|
153 } // if |
|
154 } // if |
|
155 SUPLLOG(ELogP1, "CSuplRrlpFsm::AssistanceDataRequest() End\n"); |
|
156 } |
|
157 |
|
158 EXPORT_C void CSuplRrlpFsm::LocationResp(TInt aReason, const TPositionInfoBase& aPosInfo) |
|
159 { |
|
160 SUPLLOG(ELogP1, "CSuplRrlpFsm::LocationResp() Begin\n"); |
|
161 // No call to TrnasistionTo as we to ignore if we are not in the correct state |
|
162 if (iCurrentState == EStateRequestHandled) |
|
163 { |
|
164 SUPLLOG(ELogP1, "iCurrentState == EStateRequestHandled\n"); |
|
165 if(aReason != KErrNone) |
|
166 { |
|
167 SUPLLOG2(ELogP1, "Location error %d\n", aReason); |
|
168 TransistionToError(aReason); |
|
169 } |
|
170 else |
|
171 { |
|
172 iCurrentState = EStateMeasureRespSent; |
|
173 |
|
174 // Cancel the timeout timer |
|
175 iResponseDelayTimer->Cancel(); |
|
176 |
|
177 CRrlpMeasurePositionResponse* pResp = NULL; |
|
178 TRAPD(err, pResp = CRrlpMeasurePositionResponse::NewL()); |
|
179 if (err == KErrNone) |
|
180 { |
|
181 AddReference(*pResp); |
|
182 |
|
183 // Is aPosInfo measurements or position? |
|
184 TPositionInfoBase* pBase = const_cast<TPositionInfoBase*>(&aPosInfo); |
|
185 |
|
186 if ((aPosInfo.PositionClassType() & EPositionGpsMeasurementInfoClass)) |
|
187 { |
|
188 err = pResp->SetMeasurementInformation(*pBase); |
|
189 } |
|
190 else |
|
191 { |
|
192 err = pResp->SetLocationInformation(*pBase); |
|
193 } |
|
194 |
|
195 if (err == KErrNone) |
|
196 { |
|
197 iObserver.PositioningSessionEnded(); |
|
198 iObserver.PositioningPayloadToNetwork(pResp); |
|
199 pResp = NULL; |
|
200 TransistionTo(EStateNull); |
|
201 } |
|
202 else |
|
203 { |
|
204 delete pResp; |
|
205 } |
|
206 } // if |
|
207 if (err != KErrNone) |
|
208 { |
|
209 TransistionToError(err); |
|
210 } // if |
|
211 } // else |
|
212 } // if |
|
213 SUPLLOG(ELogP1, "CSuplRrlpFsm::LocationResp() End\n"); |
|
214 } |
|
215 |
|
216 EXPORT_C bool CSuplRrlpFsm::IsAssistDataRequestAllowed() |
|
217 { |
|
218 SUPLLOG(ELogP1, "CSuplRrlpFsm::IsAssistDataRequestAllowed() Begin\n"); |
|
219 SUPLLOG(ELogP1, "CSuplRrlpFsm::IsAssistDataRequestAllowed() End\n"); |
|
220 return ((iCurrentState == EStateNull) || (iCurrentState == EStateRequestHandled)); |
|
221 } |
|
222 |
|
223 |
|
224 // Handler functions |
|
225 void CSuplRrlpFsm::HandleAssistanceDataMessage(CRrlpAssistanceData* aData) |
|
226 { |
|
227 SUPLLOG(ELogP1, "CSuplRrlpFsm::HandleAssistanceDataMessage() Begin\n"); |
|
228 TLbsAsistanceDataGroup dataMask = 0; |
|
229 if (TransistionTo(EStateAssitDataChunkRecvd)) |
|
230 { |
|
231 // Kick off the timer |
|
232 StartAssitanceDataChunkTimer(); |
|
233 |
|
234 TInt err = KErrNone; |
|
235 |
|
236 if ((err == KErrNone) && (aData->AssistanceDataPresent())) // It is possible for an empty assistance data message |
|
237 // we just ignore it |
|
238 { |
|
239 err = aData->BuildAssistanceData(dataMask, iAssistanceData); |
|
240 } // if |
|
241 |
|
242 if (err == KErrNone) |
|
243 { |
|
244 iAssistanceDataMask |= dataMask; |
|
245 // Ack the assistance data |
|
246 CRrlpAssistanceDataAck* pAck = NULL; |
|
247 TRAP(err, pAck = CRrlpAssistanceDataAck::NewL()); |
|
248 if (err == KErrNone) |
|
249 { |
|
250 if(!aData->MoreAssDataToBeSent()) |
|
251 { |
|
252 // Inform observer that these could be the last |
|
253 // RRLP messages sent. |
|
254 iObserver.PositioningSessionEnded(); |
|
255 } |
|
256 AddReference(*pAck); |
|
257 iObserver.PositioningPayloadToNetwork(pAck); |
|
258 pAck = NULL; |
|
259 } |
|
260 } |
|
261 |
|
262 if ((err == KErrNone) && (!aData->MoreAssDataToBeSent())) |
|
263 { |
|
264 TransistionTo(EStateAssitDataAcknowledged); |
|
265 |
|
266 // Pass the assistance data to LBS |
|
267 iObserver.ProcessAssistanceData(iAssistanceDataMask,KErrNone); |
|
268 iAssistanceDataMask = 0; |
|
269 |
|
270 // Start the request timer |
|
271 iAssistanceDataChunkTimer->Cancel(); |
|
272 StartRequestTimer(); |
|
273 |
|
274 } // if |
|
275 |
|
276 if (err != KErrNone) |
|
277 { |
|
278 TransistionToError(err); |
|
279 } |
|
280 } // if |
|
281 SUPLLOG(ELogP1, "CSuplRrlpFsm::HandleAssistanceDataMessage() End\n"); |
|
282 } |
|
283 |
|
284 void CSuplRrlpFsm::HandleMeasurementPositionRequest(CRrlpMeasurePositionRequest* aReq) |
|
285 { |
|
286 SUPLLOG(ELogP1, "CSuplRrlpFsm::HandleMeasurementPositionRequest() Begin\n"); |
|
287 TLbsAsistanceDataGroup dataMask = 0; |
|
288 if (TransistionTo(EStateMeasureReqRecvd)) |
|
289 { |
|
290 // Cancel any outstanding timers |
|
291 iAssistanceDataChunkTimer->Cancel(); // We could be expecting an assistance data chunk |
|
292 // Is there assistance data |
|
293 TInt delay = 0; |
|
294 TInt err = KErrNone; |
|
295 if (aReq->AssistanceDataPresent()) |
|
296 { |
|
297 err = aReq->BuildAssistanceData(dataMask, iAssistanceData); |
|
298 iAssistanceDataMask |= dataMask; |
|
299 if (err == KErrNone) |
|
300 { |
|
301 // Pass the assistance data to LBS |
|
302 iObserver.ProcessAssistanceData(iAssistanceDataMask,KErrNone); |
|
303 iAssistanceDataMask = 0; |
|
304 delay = KMeasureRequestWithAssistanceDataDelay; |
|
305 } // if |
|
306 } // if |
|
307 |
|
308 if (err == KErrNone) |
|
309 { |
|
310 // Store quality and method for later request |
|
311 aReq->GetPositionInstruct(iLocReqQuality, iPosMethod); |
|
312 |
|
313 // Start a timer to give LBS a chance to handle the assistance data(this could be 0) |
|
314 StartMeasureRequestWithAssitanceDataTimer(delay); |
|
315 } |
|
316 |
|
317 if (err != KErrNone) |
|
318 { |
|
319 TransistionToError(err); |
|
320 } |
|
321 } // if |
|
322 SUPLLOG(ELogP1, "CSuplRrlpFsm::HandleMeasurementPositionRequest() End\n"); |
|
323 } |
|
324 |
|
325 void CSuplRrlpFsm::HandleProtocolError(CRrlpProtocolError* aError) |
|
326 { |
|
327 SUPLLOG(ELogP1, "CSuplRrlpFsm::HandleProtocolError() Begin\n"); |
|
328 if (TransistionTo(EStateNull)) |
|
329 { |
|
330 TRrlpErrorCode error; |
|
331 aError->GetProtocolError(error); |
|
332 iObserver.PositioningProtocolError(error); |
|
333 } |
|
334 SUPLLOG(ELogP1, "CSuplRrlpFsm::HandleProtocolError() End\n"); |
|
335 } |
|
336 |
|
337 // Timers |
|
338 // MLbsCallbackTimerObserver methods |
|
339 void CSuplRrlpFsm::OnTimerEventL(TInt aTimerId) |
|
340 { |
|
341 SUPLLOG2(ELogP1, "CSuplRrlpFsm::OnTimerEventL() Begin, aTimerId: %d\n", aTimerId); |
|
342 switch (aTimerId) |
|
343 { |
|
344 case EAssitanceDataChunk: |
|
345 ReceivedAssistanceDataChunkTimer(); |
|
346 break; |
|
347 case ERequest: |
|
348 ReceivedRequestTimer(); |
|
349 break; |
|
350 case EResponseDelay: |
|
351 ReceivedPosResultTimer(); |
|
352 break; |
|
353 case EMeasureRequestWithAssistanceDataDelay: |
|
354 ReceivedMeasureRequestWithAssitanceDataTimer(); |
|
355 break; |
|
356 default: |
|
357 ASSERT(EFalse); |
|
358 } // switch |
|
359 SUPLLOG(ELogP1, "CSuplRrlpFsm::OnTimerEventL() End\n"); |
|
360 } |
|
361 |
|
362 TInt CSuplRrlpFsm::OnTimerError(TInt /*aTimerId*/, TInt aError) |
|
363 { |
|
364 SUPLLOG(ELogP1, "CSuplRrlpFsm::OnTimerEventL() Begin\n"); |
|
365 return aError; |
|
366 SUPLLOG(ELogP1, "CSuplRrlpFsm::OnTimerEventL() End\n"); |
|
367 } |
|
368 |
|
369 void CSuplRrlpFsm::StartAssitanceDataChunkTimer() |
|
370 { |
|
371 SUPLLOG(ELogP1, "CSuplRrlpFsm::StartAssitanceDataChunkTimer() Begin\n"); |
|
372 // Cancel current one if running |
|
373 iAssistanceDataChunkTimer->Cancel(); |
|
374 |
|
375 // Start again |
|
376 TTimeIntervalSeconds time(KAssistanceDataChunkTimeout); |
|
377 iAssistanceDataChunkTimer->EventAfter(time, EAssitanceDataChunk); |
|
378 SUPLLOG(ELogP1, "CSuplRrlpFsm::StartAssitanceDataChunkTimer() End\n"); |
|
379 } |
|
380 |
|
381 void CSuplRrlpFsm::ReceivedAssistanceDataChunkTimer() |
|
382 { |
|
383 SUPLLOG(ELogP1, "CSuplRrlpFsm::ReceivedAssistanceDataChunkTimer() Begin\n"); |
|
384 // If we receive this then there has been a timeout in receiving the assistance data chunks |
|
385 // this is an error |
|
386 iObserver.PositioningProtocolError(KErrTimedOut); |
|
387 TransistionTo(EStateNull); |
|
388 SUPLLOG(ELogP1, "CSuplRrlpFsm::ReceivedAssistanceDataChunkTimer() End\n"); |
|
389 } |
|
390 |
|
391 void CSuplRrlpFsm::StartRequestTimer() |
|
392 { |
|
393 SUPLLOG(ELogP1, "CSuplRrlpFsm::StartRequestTimer() Begin\n"); |
|
394 // Cancel this it its running |
|
395 iRequestTimer->Cancel(); |
|
396 |
|
397 // Start timer |
|
398 TTimeIntervalSeconds time(KRequestTimeout); |
|
399 iRequestTimer->EventAfter(time, ERequest); |
|
400 SUPLLOG(ELogP1, "CSuplRrlpFsm::StartRequestTimer() End\n"); |
|
401 } |
|
402 |
|
403 void CSuplRrlpFsm::ReceivedRequestTimer() |
|
404 { |
|
405 SUPLLOG(ELogP1, "CSuplRrlpFsm::ReceivedRequestTimer() Begin\n"); |
|
406 // If we receive this then there has been a timeout in receiving a measurement request |
|
407 // after receiving assistance data |
|
408 iObserver.PositioningProtocolError(KErrTimedOut); |
|
409 TransistionTo(EStateNull); |
|
410 SUPLLOG(ELogP1, "CSuplRrlpFsm::ReceivedRequestTimer() End\n"); |
|
411 } |
|
412 |
|
413 void CSuplRrlpFsm::StartPosResultTimer(TTimeIntervalMicroSeconds aTime) |
|
414 { |
|
415 SUPLLOG(ELogP1, "CSuplRrlpFsm::StartPosResultTimer() Begin\n"); |
|
416 // Add on the extra time to allow it to filter through from LBS |
|
417 aTime = aTime.Int64() + KResponseDelayAddition; |
|
418 |
|
419 iResponseDelayTimer->EventAfter(aTime, EResponseDelay); |
|
420 SUPLLOG(ELogP1, "CSuplRrlpFsm::StartPosResultTimer() End\n"); |
|
421 } |
|
422 |
|
423 void CSuplRrlpFsm::ReceivedPosResultTimer() |
|
424 { |
|
425 SUPLLOG(ELogP1, "CSuplRrlpFsm::ReceivedPosResultTimer() Begin\n"); |
|
426 // If we recieve this then LBS has timed out |
|
427 iObserver.PositioningProtocolError(KErrTimedOut); |
|
428 TransistionTo(EStateNull); |
|
429 SUPLLOG(ELogP1, "CSuplRrlpFsm::ReceivedPosResultTimer() End\n"); |
|
430 } |
|
431 |
|
432 void CSuplRrlpFsm::StartMeasureRequestWithAssitanceDataTimer(TInt aTimer) |
|
433 { |
|
434 SUPLLOG(ELogP1, "CSuplRrlpFsm::StartMeasureRequestWithAssitanceDataTimer() Begin\n"); |
|
435 TTimeIntervalMicroSeconds time(aTimer); |
|
436 iAssistanceDataChunkTimer->EventAfter(time, EMeasureRequestWithAssistanceDataDelay); |
|
437 SUPLLOG(ELogP1, "CSuplRrlpFsm::StartMeasureRequestWithAssitanceDataTimer() End\n"); |
|
438 } |
|
439 void CSuplRrlpFsm::ReceivedMeasureRequestWithAssitanceDataTimer() |
|
440 { |
|
441 SUPLLOG(ELogP1, "CSuplRrlpFsm::ReceivedMeasureRequestWithAssitanceDataTimer() Begin\n"); |
|
442 if (TransistionTo(EStateRequestHandled)) |
|
443 { |
|
444 iObserver.ProcessPositioningRequest(iLocReqQuality, iPosMethod); |
|
445 |
|
446 // Expect results from LBS before the MaxFixTime elapses (allow an |
|
447 // additional second for the results to propagate through LBS) |
|
448 StartPosResultTimer(iLocReqQuality.MaxFixTime().Int64() + (1000*KResponseDelayAddition)); |
|
449 } |
|
450 SUPLLOG(ELogP1, "CSuplRrlpFsm::ReceivedMeasureRequestWithAssitanceDataTimer() End\n"); |
|
451 } |
|
452 |
|
453 |
|
454 // Others |
|
455 TBool CSuplRrlpFsm::TransistionTo(TRrlpState aNewState) |
|
456 { |
|
457 SUPLLOG3(ELogP1, "CSuplRrlpFsm::TransistionTo() Begin, iCurrentState %d, aNewState %d\n", iCurrentState, aNewState); |
|
458 |
|
459 TBool ret = EFalse; |
|
460 |
|
461 if (aNewState != EStateNull) |
|
462 { |
|
463 switch (iCurrentState) |
|
464 { |
|
465 case EStateNull: |
|
466 case EStateAssitDataChunkRecvd: |
|
467 { |
|
468 ret = (aNewState == EStateAssitDataChunkRecvd) || |
|
469 (aNewState == EStateAssitDataAcknowledged) || |
|
470 (aNewState == EStateMeasureReqRecvd); |
|
471 break; |
|
472 } |
|
473 case EStateAssitDataAcknowledged: |
|
474 { |
|
475 ret = (aNewState == EStateMeasureReqRecvd); |
|
476 break; |
|
477 } |
|
478 case EStateMeasureReqRecvd: |
|
479 { |
|
480 ret = (aNewState == EStateRequestHandled); |
|
481 break; |
|
482 } |
|
483 case EStateRequestHandled: |
|
484 { |
|
485 ret = (aNewState == EStateMoreAssistDataRequested) || |
|
486 (aNewState == EStateMeasureRespSent); |
|
487 break; |
|
488 } |
|
489 case EStateMeasureRespSent: |
|
490 { |
|
491 ret = (aNewState == EStateNull); |
|
492 break; |
|
493 } |
|
494 case EStateMoreAssistDataRequested: |
|
495 { |
|
496 ret = (aNewState == EStateMeasureReqRecvd); |
|
497 break; |
|
498 } |
|
499 } |
|
500 } |
|
501 else |
|
502 { |
|
503 ret = ETrue; |
|
504 } |
|
505 |
|
506 if (ret) |
|
507 { |
|
508 iCurrentState = aNewState; |
|
509 } |
|
510 else |
|
511 { |
|
512 TransistionToError(KErrGeneral); |
|
513 } |
|
514 |
|
515 SUPLLOG(ELogP1, "CSuplRrlpFsm::TransistionTo() End\n"); |
|
516 return ret; |
|
517 } |
|
518 |
|
519 void CSuplRrlpFsm::TransistionToError(TInt aError) |
|
520 { |
|
521 SUPLLOG(ELogP1, "CSuplRrlpFsm::TransistionToError() Begin\n"); |
|
522 |
|
523 iObserver.PositioningProtocolError(aError); |
|
524 |
|
525 // Prevent delayed actions from happening |
|
526 iResponseDelayTimer->Cancel(); |
|
527 iAssistanceDataChunkTimer->Cancel(); |
|
528 iRequestTimer->Cancel(); |
|
529 iMeasureRequestWithAssitanceDataDelayTimer->Cancel(); |
|
530 |
|
531 // Go back to null state |
|
532 TransistionTo(EStateNull); |
|
533 SUPLLOG(ELogP1, "CSuplRrlpFsm::TransistionToError() End\n"); |
|
534 } |
|
535 |
|
536 void CSuplRrlpFsm::AddReference(CRrlpMessageBase& aMessage) |
|
537 { |
|
538 SUPLLOG(ELogP1, "CSuplRrlpFsm::AddReference() Begin\n"); |
|
539 aMessage.SetReference(iLastReferenceNumber); |
|
540 SUPLLOG(ELogP1, "CSuplRrlpFsm::AddReference() End\n"); |
|
541 } |
|
542 |
|
543 |
|
544 // Unused functions from base class |
|
545 void CSuplRrlpFsm::RunL() |
|
546 { |
|
547 SUPLLOG(ELogP1, "CSuplRrlpFsm::RunL() Begin\n"); |
|
548 ASSERT(EFalse); |
|
549 SUPLLOG(ELogP1, "CSuplRrlpFsm::RunL() End\n"); |
|
550 } |
|
551 void CSuplRrlpFsm::DoCancel() |
|
552 { |
|
553 SUPLLOG(ELogP1, "CSuplRrlpFsm::DoCancel() Begin\n"); |
|
554 ASSERT(EFalse); |
|
555 SUPLLOG(ELogP1, "CSuplRrlpFsm::DoCancel() End\n"); |
|
556 } |
|
557 |
|