300 void CBlidLocation::RunL() |
300 void CBlidLocation::RunL() |
301 { |
301 { |
302 iPosStatus = iStatus; |
302 iPosStatus = iStatus; |
303 |
303 |
304 iDeviceStatus = EDeviceConnected; |
304 iDeviceStatus = EDeviceConnected; |
305 |
|
306 /// Check if we have satellite data |
|
307 if(!(iStatus.Int() == KErrNone || |
|
308 iStatus.Int() == KPositionPartialUpdate) ) |
|
309 { |
|
310 iPositionInfo.ClearSatellitesInView(); |
|
311 } |
|
312 SortSatelliteDataL(); |
305 SortSatelliteDataL(); |
313 |
306 |
314 switch ( iStatus.Int() ) |
307 switch (iStatus.Int()) |
315 { |
308 { |
316 //case KPositionPartialUpdate: |
309 //case KPositionPartialUpdate: |
317 case KErrNone: // Success |
310 case KErrNone: // Success |
318 { |
311 { |
319 iOnlineMode = ETrue; |
312 iOnlineMode = ETrue; |
320 iUpdateReceived = ETrue; |
313 iUpdateReceived = ETrue; |
321 iGPSDataAvailable = ETrue; |
314 iGPSDataAvailable = ETrue; |
322 iPositionInfo.GetPosition( iPosition ); |
315 iPositionInfo.GetPosition(iPosition); |
323 iPositionInfo.GetCourse( iCourse ); |
316 iPositionInfo.GetCourse(iCourse); |
324 iLastGoodFixTime.UniversalTime(); |
317 iLastGoodFixTime.UniversalTime(); |
325 |
318 |
326 CalculateCourse(); |
319 CalculateCourse(); |
327 |
320 |
328 if(iIsTripStart) |
321 if (iIsTripStart) |
329 { |
322 { |
330 if(!iIsPreviousPositionUpdated) |
323 if (!iIsPreviousPositionUpdated) |
331 { |
324 { |
332 iIsPreviousPositionUpdated = ETrue; |
325 iIsPreviousPositionUpdated = ETrue; |
333 iPrevPosition = GetCurrentPosition(); |
326 iPrevPosition = GetCurrentPosition(); |
334 } |
327 } |
335 UpdateTripData(); |
328 UpdateTripData(); |
336 } |
329 } |
337 |
330 if (iObserver) |
338 //SortSatelliteDataL(); |
331 { |
339 |
332 iObserver->NotifyL(iOnlineMode); |
340 if(iObserver) |
333 } |
341 { |
334 if (iRequesting) |
342 iObserver->NotifyL( iOnlineMode ); |
335 { |
343 } |
336 //DEBUG("KErrNone : NotifyPositionUpdate"); |
344 if ( iRequesting ) |
337 iPositioner.NotifyPositionUpdate(iPositionInfo, iStatus); |
345 { |
338 SetActive(); |
346 //DEBUG("KErrNone : NotifyPositionUpdate"); |
339 } |
347 iPositioner.NotifyPositionUpdate( iPositionInfo, iStatus ); |
|
348 SetActive(); |
|
349 } |
|
350 break; |
340 break; |
351 } |
341 } |
352 case KErrAccessDenied: |
342 case KErrAccessDenied: |
353 /* |
343 /* |
354 Happens if we don't specify requestor information. |
344 Happens if we don't specify requestor information. |
355 This condition should not be encountered. |
345 This condition should not be encountered. |
356 */ |
346 */ |
357 { |
347 { |
|
348 iPositionInfo.ClearSatellitesInView(); |
358 iRequesting = EFalse; |
349 iRequesting = EFalse; |
359 User::Leave( KErrAccessDenied ); |
350 User::Leave(KErrAccessDenied); |
360 break; |
351 break; |
361 } |
352 } |
362 case KErrCancel: // Postion update request cancelled |
353 case KErrCancel: // Postion update request cancelled |
363 { |
354 { |
364 // We canceled the request so do nothing |
355 // We canceled the request so do nothing |
|
356 iPositionInfo.ClearSatellitesInView(); |
365 break; |
357 break; |
366 } |
358 } |
367 case KPositionPartialUpdate: // Incomplete position information |
359 case KPositionPartialUpdate: // Incomplete position information |
368 { |
|
369 if ( iRequesting ) |
|
370 { |
360 { |
371 //DEBUG("KPositionPartialUpdate : NotifyPositionUpdate"); |
361 TTime now; |
372 iPositioner.NotifyPositionUpdate( iPositionInfo, iStatus ); |
362 now.UniversalTime(); |
373 SetActive(); |
363 TTimeIntervalSeconds secondsSinceLastGoodFix; |
|
364 now.SecondsFrom(iLastGoodFixTime, secondsSinceLastGoodFix); |
|
365 if (secondsSinceLastGoodFix.Int() > 15) |
|
366 { |
|
367 iLastGoodFixTime.UniversalTime(); |
|
368 if (iObserver) |
|
369 { |
|
370 iObserver->NotifyErrorL(KErrTimedOut); |
|
371 } |
|
372 } |
|
373 |
|
374 else |
|
375 { |
|
376 iLastGoodFixTime.UniversalTime(); |
|
377 } |
|
378 // end of addition for TSW error |
|
379 |
|
380 iGPSDataAvailable = EFalse; |
|
381 iUpdateReceived = ETrue; |
|
382 |
|
383 // All cases are errors and hence go to offline mode |
|
384 iOnlineMode = EFalse; |
|
385 if (iObserver) |
|
386 { |
|
387 iObserver->NotifyErrorL(iStatus.Int()); |
|
388 } |
|
389 if (iRequesting) |
|
390 { |
|
391 iPositioner.NotifyPositionUpdate(iPositionInfo, iStatus); |
|
392 SetActive(); |
|
393 } |
|
394 break; |
374 } |
395 } |
375 break; |
396 |
376 } |
|
377 case KErrTimedOut: // Position update timed out |
397 case KErrTimedOut: // Position update timed out |
378 case KPositionQualityLoss: //GPS not connected |
398 case KPositionQualityLoss: //GPS not connected |
379 { |
399 { |
|
400 iPositionInfo.ClearSatellitesInView(); |
380 iUpdateReceived = ETrue; |
401 iUpdateReceived = ETrue; |
381 iGPSDataAvailable = EFalse; |
402 iGPSDataAvailable = EFalse; |
382 if(iIsTripStart && !iIsTripClear) |
403 if (iIsTripStart && !iIsTripClear) |
383 { |
404 { |
384 iTripGPSDataLost = ETrue; |
405 iTripGPSDataLost = ETrue; |
385 } |
406 } |
386 // Leaving break is intentional |
407 // Leaving break is intentional |
387 } |
408 } |
388 //-fallthrough |
409 //-fallthrough |
389 case KErrNotFound: // No PSY selected. |
410 case KErrNotFound: // No PSY selected. |
390 case KErrUnknown: // This will be returned by MLFW |
411 case KErrUnknown: // This will be returned by MLFW |
391 case KErrArgument: |
412 case KErrArgument: |
392 /* |
413 |
393 PSY does not support the information type specified |
414 /* |
394 by BLID. |
415 PSY does not support the information type specified |
395 */ |
416 by BLID. |
|
417 */ |
396 default: |
418 default: |
397 { |
419 { |
398 if(iStatus.Int() != KPositionPartialUpdate ) |
420 iDeviceStatus = EDeviceNotFound; |
|
421 iWaitingGpsData = EFalse; |
|
422 if (iObserver) |
399 { |
423 { |
400 iDeviceStatus = EDeviceNotFound; |
424 iObserver->NotifyErrorL(KErrNotFound); |
401 iPositionInfo.ClearSatellitesInView(); |
|
402 iWaitingGpsData = EFalse; |
|
403 } |
425 } |
404 // added for TSW error. |
426 if (iRequesting) |
405 if(iStatus.Int() == KPositionPartialUpdate ) |
|
406 { |
427 { |
407 //SortSatelliteDataL(); |
428 iPositioner.NotifyPositionUpdate(iPositionInfo, iStatus); |
408 TTime now; |
429 SetActive(); |
409 now.UniversalTime(); |
|
410 TTimeIntervalSeconds secondsSinceLastGoodFix; |
|
411 now.SecondsFrom( iLastGoodFixTime , secondsSinceLastGoodFix ); |
|
412 if ( secondsSinceLastGoodFix.Int() > 15 ) |
|
413 { |
|
414 iLastGoodFixTime.UniversalTime(); |
|
415 if(iObserver) |
|
416 { |
|
417 iObserver->NotifyErrorL( KErrTimedOut ); |
|
418 } |
|
419 } |
|
420 } |
430 } |
421 else |
431 } |
422 { |
|
423 iLastGoodFixTime.UniversalTime(); |
|
424 } |
|
425 // end of addition for TSW error |
|
426 |
|
427 iGPSDataAvailable = EFalse; |
|
428 iUpdateReceived = ETrue; |
|
429 |
|
430 // All cases are errors and hence go to offline mode |
|
431 iOnlineMode = EFalse; |
|
432 if(iObserver) |
|
433 { |
|
434 iObserver->NotifyErrorL(iStatus.Int()); |
|
435 } |
|
436 if ( iRequesting ) |
|
437 { |
|
438 |
|
439 iPositioner.NotifyPositionUpdate( iPositionInfo, iStatus ); |
|
440 SetActive(); |
|
441 } |
|
442 break; |
432 break; |
443 } |
|
444 } |
433 } |
445 |
|
446 /*if( iStatus.Int() != KErrCancel ) |
434 /*if( iStatus.Int() != KErrCancel ) |
447 { |
435 { |
448 //DEBUG("RUNL : SetUpdateOptions"); |
436 //DEBUG("RUNL : SetUpdateOptions"); |
449 SetUpdateOptions(); |
437 SetUpdateOptions(); |
450 }*/ |
438 }*/ |
451 if(iStatus.Int() != KPositionPartialUpdate ) |
439 if (iStatus.Int() != KPositionPartialUpdate) |
452 { |
440 { |
453 iWaitingGpsData = CheckIfWaitingGPSData(); |
441 iWaitingGpsData = CheckIfWaitingGPSData(); |
454 } |
442 } |
455 } |
443 } |
456 |
444 |
457 // ---------------------------------------------------------------------------- |
445 // ---------------------------------------------------------------------------- |
458 // CBlidLocation::SetUpdateOptions |
446 // CBlidLocation::SetUpdateOptions |
459 // ---------------------------------------------------------------------------- |
447 // ---------------------------------------------------------------------------- |