|
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 // |
|
15 |
|
16 /** |
|
17 @file |
|
18 @InternalComponent |
|
19 */ |
|
20 |
|
21 #include <e32base.h> |
|
22 #include <lbs/epos_mpositionerstatus.h> |
|
23 #include <ecom/implementationproxy.h> |
|
24 #include <lbssatellite.h> |
|
25 #include "utilfunctions.h" |
|
26 |
|
27 #include "crequesthandler.h" |
|
28 #include "cresponsehandler.h" |
|
29 #include "cadaptationpositioner.h" |
|
30 #include "psypanic.h" |
|
31 #include "psylogging.h" |
|
32 #include "lbsprocessuiddefs.h" |
|
33 #include "lbsdevloggermacros.h" |
|
34 |
|
35 const TUint KWarmDownTimeout = 10000000;//10s |
|
36 |
|
37 CAdaptationPositioner::CAdaptationPositioner() |
|
38 { |
|
39 LBSLOG(ELogP1, "CAdaptationPositioner::CAdaptationPositioner()"); |
|
40 iState = ERequestStateInitial; |
|
41 } |
|
42 |
|
43 /** |
|
44 * Destructor |
|
45 */ |
|
46 CAdaptationPositioner::~CAdaptationPositioner() |
|
47 { |
|
48 LBSLOG(ELogP1, "CAdaptationPositioner::~CAdaptationPositioner()"); |
|
49 |
|
50 StopMaxFixTimer(); |
|
51 delete iMaxFixTimer; |
|
52 iMaxFixTimer = NULL; |
|
53 StopWarmDownTimer(); |
|
54 delete iWarmDownTimer; |
|
55 iWarmDownTimer = NULL; |
|
56 |
|
57 CancelNotifyPositionUpdate(); |
|
58 |
|
59 if(iEnvironment) |
|
60 { |
|
61 iEnvironment->CloseInstance(); |
|
62 } |
|
63 } |
|
64 |
|
65 /** |
|
66 * CancelNotifyPositionUpdate implements CAdaptationPositioner::CancelNotifyPositionUpdate |
|
67 * Cancels position info request. |
|
68 */ |
|
69 void CAdaptationPositioner::CancelNotifyPositionUpdate() |
|
70 { |
|
71 LBSLOG(ELogP1, "CAdaptationPositioner::CancelNotifyPositionUpdate()"); |
|
72 // Stop timers |
|
73 StopMaxFixTimer(); |
|
74 StopWarmDownTimer(); |
|
75 CancelNotifyPositionUpdate(KErrCancel); |
|
76 } |
|
77 |
|
78 /** |
|
79 * CancelNotifyPositionUpdate implements CAdaptationPositioner::CancelNotifyPositionUpdate(TInt) |
|
80 * Cancels position info request with reason. This reason allows the S60 Loc Server to distinguish between a real user cancel |
|
81 * and a timeout - in the case of the latter the LS calls CancelNotifyPositionUpdate(KErrTimedOut), |
|
82 * in the former he passes no error. |
|
83 */ |
|
84 void CAdaptationPositioner::CancelNotifyPositionUpdate(TInt aError) |
|
85 { |
|
86 LBSLOG2(ELogP1, "CAdaptationPositioner::CancelNotifyPositionUpdate(aError) %d", aError); |
|
87 |
|
88 if( iActive ) |
|
89 { |
|
90 LBSLOG2(ELogP1, "CAdaptationPositioner::Complete request error = %d", aError); |
|
91 |
|
92 UpdateFailed(KErrCancel); |
|
93 TRAP_IGNORE(iRequestHandler->ReMergeWithCancelRequestL(aError)); // Nothing we can do about a leave here |
|
94 if(aError == KErrTimedOut && IsTracking()) |
|
95 { |
|
96 // The last tracking request timedout so we need to schedule one for the next interval |
|
97 TTime timeNow; |
|
98 timeNow.UniversalTime(); |
|
99 iActive = ETrue; |
|
100 UpdateTrackingTime(timeNow); |
|
101 TRAPD(error, iRequestHandler->SubmitNewRequestL(this)); // Nothing we can do about a leave here |
|
102 if(!error) |
|
103 { |
|
104 TRAP_IGNORE(StartMaxFixTimerL());// (re)start maxfix timer so that we know when the module has stopped trying |
|
105 } |
|
106 } |
|
107 } |
|
108 } |
|
109 |
|
110 |
|
111 /** |
|
112 * Indicate if the PSY has overridden tracking. The default |
|
113 * implementation returns EFalse. |
|
114 * @return ETrue if PSY has own timer, otherwise EFalse. |
|
115 */ |
|
116 TBool CAdaptationPositioner::TrackingOverridden() const |
|
117 { |
|
118 return ETrue; |
|
119 } |
|
120 |
|
121 |
|
122 /** |
|
123 * Initiate a tracking session. |
|
124 * |
|
125 * @param aInterval Interval for position requests. |
|
126 */ |
|
127 void CAdaptationPositioner::StartTrackingL(const TTimeIntervalMicroSeconds& aInterval) |
|
128 { |
|
129 LBSLOG2(ELogP1, "CAdaptationPositioner::StartTrackingL, interval = %d", aInterval); |
|
130 |
|
131 TTime timeNow; |
|
132 |
|
133 TTime trackingTime = LbsTimerUtils::AddUpInt64TimersWithOverflowCheck(iTargetTime, aInterval); |
|
134 timeNow.UniversalTime(); |
|
135 |
|
136 iTrackingInterval = aInterval; |
|
137 |
|
138 if(! (trackingTime < timeNow)) // if this is not a default proxy call to StartTracking |
|
139 { |
|
140 LBSLOG(ELogP1, "Non-DefProxy Start"); |
|
141 SetupTrackingRequestL(); |
|
142 iRequestHandler->SubmitNewRequestL(this); |
|
143 } |
|
144 } |
|
145 |
|
146 /** |
|
147 * Stop a periodic update session. |
|
148 */ |
|
149 void CAdaptationPositioner::StopTracking() |
|
150 { |
|
151 LBSLOG(ELogP1, "CAdaptationPositioner::StopTracking"); |
|
152 |
|
153 iTrackingInterval = 0; |
|
154 } |
|
155 |
|
156 /** |
|
157 * Restart tracking after a missed update |
|
158 */ |
|
159 void CAdaptationPositioner::UpdateTrackingTime(TTime& aTimeNow) |
|
160 { |
|
161 LBSLOG(ELogP1, "CAdaptationPositioner::UpdateTrackingTime restarting tracking"); |
|
162 |
|
163 TUint multiplier = ( (aTimeNow.Int64() - iTargetTime.Int64()) / iTrackingInterval.Int64() ); |
|
164 TTimeIntervalMicroSeconds timeToAdd = ( (multiplier + 1) * iTrackingInterval.Int64() ); |
|
165 |
|
166 if (timeToAdd < 0) |
|
167 { |
|
168 iTargetTime = Time::MaxTTime(); |
|
169 } |
|
170 else |
|
171 { |
|
172 iTargetTime = LbsTimerUtils::AddUpInt64TimersWithOverflowCheck(iTargetTime, timeToAdd); |
|
173 } |
|
174 } |
|
175 |
|
176 /** |
|
177 * Submit a request with the target time in the future. |
|
178 * The positionerQ will deal with issuing a merged request from |
|
179 * all active positioners. |
|
180 */ |
|
181 void CAdaptationPositioner::SetupTrackingRequestL() |
|
182 { |
|
183 if(IsTracking()) |
|
184 { |
|
185 LBSLOG(ELogP1, "CAdaptationPositioner::SetupTrackingRequestL"); |
|
186 |
|
187 iPosInfo = NULL; // This will be filled in by the NPUD when it arrives |
|
188 iActive = ETrue; |
|
189 |
|
190 iTargetTime.UniversalTime(); |
|
191 |
|
192 #ifdef _DEBUG |
|
193 TDateTime timeNow = iTargetTime.DateTime(); |
|
194 LBSLOG3(ELogP1, "Time Now = %d.%d", timeNow.Second(), timeNow.MicroSecond()); |
|
195 #endif |
|
196 |
|
197 iTargetTime = LbsTimerUtils::AddUpInt64TimersWithOverflowCheck(iTargetTime, iTrackingInterval); |
|
198 |
|
199 #ifdef _DEBUG |
|
200 timeNow = iTargetTime.DateTime(); |
|
201 LBSLOG3(ELogP1, "Target Time = %d.%d", timeNow.Second(), timeNow.MicroSecond()); |
|
202 #endif |
|
203 |
|
204 StartMaxFixTimerL(); |
|
205 } |
|
206 } |
|
207 |
|
208 /** |
|
209 * Check if we're tracking. |
|
210 * |
|
211 * @return ETrue if we are tracking |
|
212 */ |
|
213 TBool CAdaptationPositioner::IsTracking() |
|
214 { |
|
215 return (iTrackingInterval != 0); |
|
216 } |
|
217 |
|
218 /** |
|
219 * Attempt to use an old position |
|
220 * |
|
221 * @param aPosInfo The clients position info |
|
222 * @return ETrue if the old position was used |
|
223 */ |
|
224 TBool CAdaptationPositioner::UseLastLocation(TPositionInfoBase& aPosInfo) |
|
225 { |
|
226 TTime maxAge; |
|
227 TBool result = EFalse; |
|
228 |
|
229 GetMaxAge(maxAge); |
|
230 |
|
231 if(maxAge > 0) |
|
232 { |
|
233 CResponseHandler* responseHandler = iEnvironment->GetResponseHandler(); |
|
234 |
|
235 result = responseHandler->GetLastPosition(aPosInfo, maxAge, IsPartialUpdateAllowed()); |
|
236 |
|
237 if( result ) // Use last location |
|
238 { |
|
239 TInt err = KErrNone; |
|
240 TPosition pos; |
|
241 static_cast<TPositionInfo&>(aPosInfo).GetPosition(pos); |
|
242 if(Partial(pos)) |
|
243 { |
|
244 err = KPositionPartialUpdate; |
|
245 } |
|
246 LBSLOG(ELogP1, "CAdaptationPositioner::NotifyPositionUpdate returning old position"); |
|
247 // nb: this will deal with tracking requests properly: |
|
248 if(CompleteRequest(static_cast<TPositionInfo&>(aPosInfo), err)) |
|
249 { |
|
250 TRAP_IGNORE(SetupTrackingRequestL()); |
|
251 } |
|
252 } |
|
253 } |
|
254 |
|
255 return result; |
|
256 } |
|
257 |
|
258 /** |
|
259 * Attempt to complete an outstanding request if there is one |
|
260 * |
|
261 * @param aPositionInfo The retrieved fix. |
|
262 * @param aError The error code if the request is failed. |
|
263 * @param aActualTime time of the location update |
|
264 */ |
|
265 void CAdaptationPositioner::RequestCompleteNotify(const TPositionInfo& aPositionInfo, TInt aError, TTime& aActualTime) |
|
266 { |
|
267 LBSLOG(ELogP1, "CAdaptationPositioner::RequestCompleteNotify start..."); |
|
268 |
|
269 TBool startWarmDown = EFalse; |
|
270 TBool completed = EFalse; |
|
271 |
|
272 if(iActive) |
|
273 { |
|
274 TPositionModuleInfo::TTechnologyType mode = aPositionInfo.PositionMode(); |
|
275 |
|
276 if( (aActualTime >= iTargetTime) || (aError == KPositionCalculationFutile) ) |
|
277 { |
|
278 // Check if the update is partial and if partial updates are allowed |
|
279 TPosition pos; |
|
280 aPositionInfo.GetPosition(pos); |
|
281 |
|
282 TBool partial = Partial(pos); |
|
283 |
|
284 TBool isFNP = (aPositionInfo.PositionMode() == (TPositionModuleInfo::ETechnologyNetwork | TPositionModuleInfo::ETechnologyAssisted)); |
|
285 |
|
286 if(isFNP) |
|
287 { |
|
288 LBSLOG(ELogP1, "Complete with FNP"); |
|
289 /* removing this for now until we decide how to deal with the qualityloss issue on s60 |
|
290 * since on s60 qualityloss means no position was generated |
|
291 if(partial) |
|
292 { |
|
293 CompleteRequest(aPositionInfo, KPositionQualityLoss); |
|
294 } |
|
295 |
|
296 else |
|
297 */ |
|
298 { |
|
299 completed = CompleteRequest(aPositionInfo, KErrNone); |
|
300 |
|
301 // Stop the AGPS Manager if there are no other outstanding requests |
|
302 TRAP_IGNORE(iRequestHandler->CancelRequestL()); |
|
303 } |
|
304 } |
|
305 else if(partial && IsPartialUpdateAllowed()) |
|
306 { |
|
307 LBSLOG(ELogP1, "Complete with partial"); |
|
308 completed = CompleteRequest(aPositionInfo, KPositionPartialUpdate); |
|
309 startWarmDown = ETrue; |
|
310 } |
|
311 else if(!partial) |
|
312 { |
|
313 LBSLOG(ELogP1, "Complete with non-partial"); |
|
314 completed = CompleteRequest(aPositionInfo, KErrNone); |
|
315 |
|
316 // did the module produce an accurate update or is it still trying? |
|
317 if(!IsAccurate(aPositionInfo)) |
|
318 { |
|
319 startWarmDown = ETrue; |
|
320 } |
|
321 else // it might be an accurate reference position |
|
322 { |
|
323 TBool isRefPos = (aPositionInfo.ModuleId() == KLbsGpsLocManagerUid) && |
|
324 (aPositionInfo.PositionMode() == TPositionModuleInfo::ETechnologyNetwork); |
|
325 if(isRefPos) |
|
326 { |
|
327 startWarmDown = ETrue; |
|
328 } |
|
329 } |
|
330 } |
|
331 else if(aError == KPositionCalculationFutile) |
|
332 { |
|
333 // if autonomous return immediately otherwise wait for FNP |
|
334 if(mode & TPositionModuleInfo::ETechnologyTerminal) |
|
335 { |
|
336 LBSLOG(ELogP1, "Complete with futile"); |
|
337 completed = CompleteRequest(aPositionInfo, KPositionQualityLoss); |
|
338 } |
|
339 } |
|
340 else |
|
341 { |
|
342 // position is not futile and is partial but partials are not |
|
343 // allowed. In this case do nothing and wait for further updates |
|
344 } |
|
345 } |
|
346 else |
|
347 { |
|
348 LBSLOG(ELogP1, "CAdaptationPositioner::RequestCompleteNotify Ignoring early response"); |
|
349 } |
|
350 } |
|
351 |
|
352 if (completed) |
|
353 { |
|
354 TRAP_IGNORE(SetupTrackingRequestL()); |
|
355 } |
|
356 |
|
357 if(startWarmDown) // we need to start a warmdown timer |
|
358 { |
|
359 TRAP_IGNORE(StartWarmDownTimerL()); // not much we can do here if warmdown timer not started |
|
360 } |
|
361 LBSLOG(ELogP1, "CAdaptationPositioner::RequestCompleteNotify end"); |
|
362 } |
|
363 |
|
364 /** |
|
365 * Attempt to complete an outstanding request if there is one with an error |
|
366 * |
|
367 * @param aError The error code if the request is failed. |
|
368 */ |
|
369 void CAdaptationPositioner::UpdateFailed(TInt aError) |
|
370 { |
|
371 LBSLOG(ELogP1, "CAdaptationPositioner::UpdateFailed()"); |
|
372 if(iActive) |
|
373 { |
|
374 LBSLOG2(ELogP1, "CAdaptationPositioner::Complete request error = %d", aError); |
|
375 |
|
376 iActive = EFalse; |
|
377 ClearPositionInfo(*iPosInfo); |
|
378 |
|
379 if(iClientStatus) |
|
380 { |
|
381 User::RequestComplete(iClientStatus, aError); |
|
382 iClientStatus = NULL; |
|
383 } |
|
384 LBSLOG2(ELogP1, "iState -> ERequestStatePostInitial from %d", iState); |
|
385 iState = ERequestStatePostInitial; |
|
386 } |
|
387 } |
|
388 |
|
389 /** |
|
390 * Complete the outstanding request and reset internal state |
|
391 * |
|
392 * @param aPositionInfo The retrieved fix. |
|
393 * @param aError The error code if the request is failed. |
|
394 */ |
|
395 TBool CAdaptationPositioner::CompleteRequest(const TPositionInfo& aPositionInfo, TInt aError) |
|
396 { |
|
397 LBSLOG2(ELogP1, "CAdaptationPositioner::CompleteRequest() with error %d", aError); |
|
398 TBool completed = EFalse; |
|
399 iActive = EFalse; // Stop another request being sent for this instance of the PSY |
|
400 |
|
401 if(iPosInfo) |
|
402 { |
|
403 TInt error = CopyPositionTypes(*iPosInfo, aPositionInfo); |
|
404 __ASSERT_DEBUG(error == KErrNone, |
|
405 User::Panic(KAdaptationPanicCategory, EPanicPositionCopyFailed)); |
|
406 error = error; // this is to stop arm build warnings |
|
407 |
|
408 SetModuleId(iPosInfo); // Delegate to the derived class |
|
409 User::RequestComplete(iClientStatus, aError); |
|
410 iClientStatus = NULL; |
|
411 LBSLOG2(ELogP1, "iState -> ERequestStatePostInitial from %d", iState); |
|
412 iState = ERequestStatePostInitial; |
|
413 completed = ETrue; |
|
414 } |
|
415 else |
|
416 { |
|
417 LBSLOG(ELogP1, "CAdaptationPositioner::RequestCompleteNotify iPosInfo not set"); |
|
418 } |
|
419 |
|
420 return completed; |
|
421 } |
|
422 |
|
423 /** |
|
424 * CAdaptationPositioner::ReportStatus |
|
425 * Reports the PSY status to the MLFW |
|
426 * |
|
427 * @param aStatus The new position module status |
|
428 */ |
|
429 void CAdaptationPositioner::ReportStatus(const TPositionModuleStatus& aStatus) |
|
430 { |
|
431 MPositionerStatus* statusInf = this->PositionerStatus(); |
|
432 statusInf->ReportStatus(aStatus); |
|
433 } |
|
434 |
|
435 /** |
|
436 * Clears the fields of the aPosInfo |
|
437 * @param aPosInfo The position information to return |
|
438 */ |
|
439 void CAdaptationPositioner::ClearPositionInfo(TPositionInfoBase& aPosInfo) |
|
440 { |
|
441 if(&aPosInfo != NULL) |
|
442 { |
|
443 if (aPosInfo.PositionClassType() & EPositionSatelliteInfoClass) |
|
444 { |
|
445 // TPositionSatelliteInfo |
|
446 (void) new (&aPosInfo) (TPositionSatelliteInfo); |
|
447 } |
|
448 else if (aPosInfo.PositionClassType() & EPositionCourseInfoClass) |
|
449 { |
|
450 // TPositionCourseInfo |
|
451 (void) new (&aPosInfo) (TPositionCourseInfo); |
|
452 } |
|
453 else if (aPosInfo.PositionClassType() & EPositionGenericInfoClass) |
|
454 { |
|
455 // HPositionGenericInfo |
|
456 HPositionGenericInfo* genInfo = |
|
457 static_cast<HPositionGenericInfo*> ( &aPosInfo ); |
|
458 |
|
459 genInfo->ClearPositionData(); |
|
460 } |
|
461 else if (aPosInfo.PositionClassType() & EPositionInfoClass) |
|
462 { |
|
463 // TPositionInfo |
|
464 (void) new (&aPosInfo) (TPositionInfo); |
|
465 } |
|
466 else |
|
467 { |
|
468 // Unknown type, this should never happen |
|
469 // --> Panic if we get here |
|
470 __ASSERT_DEBUG(0, User::Panic(KAdaptationPanicCategory, EPanicUnknownPositioningClass)); |
|
471 } |
|
472 |
|
473 aPosInfo.SetModuleId(ImplementationUid()); |
|
474 } |
|
475 } |
|
476 |
|
477 |
|
478 TBool CAdaptationPositioner::IsActive() |
|
479 { |
|
480 return iActive; |
|
481 } |
|
482 |
|
483 TBool CAdaptationPositioner::IsWarmingDown() |
|
484 { |
|
485 if(iWarmDownTimer) |
|
486 { |
|
487 return iWarmDownTimer->IsActive(); |
|
488 } |
|
489 return EFalse; |
|
490 } |
|
491 |
|
492 void CAdaptationPositioner::StartMaxFixTimerL() |
|
493 { |
|
494 LBSLOG(ELogP1, "CAdaptationPositioner::StartMaxFixTimerL()"); |
|
495 if(iMaxFixTimer) // stop any that's currently running |
|
496 { |
|
497 iMaxFixTimer->Cancel(); |
|
498 } |
|
499 else |
|
500 { |
|
501 iMaxFixTimer = CLbsCallbackTimer::NewL(*this); |
|
502 } |
|
503 |
|
504 iMaxFixTimer->EventAfter(iTimeOutInterval, EMaxFixTimerEvent); |
|
505 } |
|
506 |
|
507 void CAdaptationPositioner::StopMaxFixTimer() |
|
508 { |
|
509 LBSLOG(ELogP1, "CAdaptationPositioner::StopMaxFixTimer()"); |
|
510 if(iMaxFixTimer) |
|
511 { |
|
512 iMaxFixTimer->Cancel(); |
|
513 } |
|
514 } |
|
515 |
|
516 void CAdaptationPositioner::StartWarmDownTimerL() |
|
517 { |
|
518 TTimeIntervalMicroSeconds32 timeout = KWarmDownTimeout; |
|
519 LBSLOG(ELogP1, "CAdaptationPositioner::StartWarmDownTimerL()"); |
|
520 if(iWarmDownTimer) // stop any that's currently running |
|
521 { |
|
522 iWarmDownTimer->Cancel(); |
|
523 } |
|
524 else |
|
525 { |
|
526 iWarmDownTimer = CLbsCallbackTimer::NewL(*this); |
|
527 } |
|
528 iWarmDownTimer->EventAfter(timeout, EWarmDownTimerEvent); |
|
529 } |
|
530 |
|
531 void CAdaptationPositioner::StopWarmDownTimer() |
|
532 { |
|
533 LBSLOG(ELogP1, "CAdaptationPositioner::StopWarmDownTimer()"); |
|
534 if(iWarmDownTimer) |
|
535 { |
|
536 iWarmDownTimer->Cancel(); |
|
537 } |
|
538 } |
|
539 |
|
540 /** |
|
541 MaxFixTimerEvent handling |
|
542 |
|
543 Stop warmdown timer |
|
544 */ |
|
545 void CAdaptationPositioner::MaxFixTimerEvent() |
|
546 { |
|
547 LBSLOG(ELogP1, "CAdaptationPositioner::MaxFixTimerEvent()"); |
|
548 |
|
549 // Cancel the warmdown timer since the module has stopped trying |
|
550 StopWarmDownTimer(); |
|
551 } |
|
552 |
|
553 /** |
|
554 MaxFixTimer error handling |
|
555 */ |
|
556 TInt CAdaptationPositioner::MaxFixTimerError(TInt /*aError*/) |
|
557 { |
|
558 return KErrNone; |
|
559 } |
|
560 |
|
561 /** |
|
562 MaxFixTimerEvent handling |
|
563 |
|
564 Stop warmdown timer |
|
565 */ |
|
566 void CAdaptationPositioner::WarmDownTimerEvent() |
|
567 { |
|
568 LBSLOG(ELogP1, "CAdaptationPositioner::MaxFixTimerEvent()"); |
|
569 |
|
570 // tell positioner Q that our warmdown timer has fired |
|
571 iRequestHandler->WarmDownTimerExpired(); |
|
572 } |
|
573 |
|
574 /** |
|
575 WarmDown error handling |
|
576 */ |
|
577 TInt CAdaptationPositioner::WarmDownTimerError(TInt /*aError*/) |
|
578 { |
|
579 return KErrNone; |
|
580 } |
|
581 |
|
582 |
|
583 /** |
|
584 from MLbsCallbackTimerObserver |
|
585 |
|
586 @param aTimerId Time event ID to identify different time events |
|
587 */ |
|
588 void CAdaptationPositioner::OnTimerEventL(TInt aTimerId) |
|
589 { |
|
590 switch(aTimerId) |
|
591 { |
|
592 case EMaxFixTimerEvent: |
|
593 MaxFixTimerEvent(); |
|
594 break; |
|
595 case EWarmDownTimerEvent: |
|
596 WarmDownTimerEvent(); |
|
597 break; |
|
598 default: |
|
599 __ASSERT_DEBUG(0, User::Panic(KAdaptationPanicCategory, EPanicUnknownTimerEventId)); |
|
600 } |
|
601 } |
|
602 /** |
|
603 Timer error handling |
|
604 |
|
605 @param aError Time error code |
|
606 @param aTimerId Time event ID to identify two different time events |
|
607 */ |
|
608 TInt CAdaptationPositioner::OnTimerError(TInt aError, TInt aTimerId) |
|
609 { |
|
610 switch(aTimerId) |
|
611 { |
|
612 case EMaxFixTimerEvent: |
|
613 MaxFixTimerError(aError); |
|
614 break; |
|
615 case EWarmDownTimerEvent: |
|
616 WarmDownTimerError(aError); |
|
617 break; |
|
618 default: |
|
619 __ASSERT_DEBUG(0, User::Panic(KAdaptationPanicCategory, EPanicUnknownTimerEventId)); |
|
620 } |
|
621 return KErrNone; // we have handled the error locally |
|
622 } |
|
623 |
|
624 |
|
625 TBool CAdaptationPositioner::IsAccurate(const TPositionInfo& aPositionInfo) |
|
626 { |
|
627 TBool accurate = ETrue; |
|
628 TPositionQuality reqQuality; |
|
629 iCriteria.GetRequiredQuality(reqQuality); |
|
630 TPosition pos; |
|
631 |
|
632 aPositionInfo.GetPosition(pos); |
|
633 if(pos.HorizontalAccuracy() > reqQuality.HorizontalAccuracy() ) |
|
634 { |
|
635 accurate = EFalse; |
|
636 } |
|
637 return accurate; |
|
638 } |
|
639 |
|
640 TUint CAdaptationPositioner::InactivityTimeout() |
|
641 { |
|
642 return iInactivityTimeout; |
|
643 } |
|
644 |
|
645 |
|
646 // End of File |