263 } |
268 } |
264 // Test case LBS-Client-LastKnownPosArea-0003 |
269 // Test case LBS-Client-LastKnownPosArea-0003 |
265 // Verify that the last position is returned if current network position is unavailable |
270 // Verify that the last position is returned if current network position is unavailable |
266 case 3: |
271 case 3: |
267 { |
272 { |
|
273 // The SIM config file used by this test switches between valid and non-valid area configs. |
|
274 // If we move from a valid config to an invalid config, GetLastKnownPositionArea should return |
|
275 // with the last stored position (posInfo) together with area information that shows the |
|
276 // area accuracy to be TPositionAreaInfo::EAreaUnknown. |
|
277 |
268 TPositionInfo* posInfo = new(ELeave) TPositionInfo(); |
278 TPositionInfo* posInfo = new(ELeave) TPositionInfo(); |
269 posInfoArr.Append(posInfo); |
279 posInfoArr.Append(posInfo); |
270 TInt err = KErrNone; |
280 TInt err = KErrNone; |
271 |
281 |
272 // The SIM config file used by this test contains an |
282 // Empty Database |
273 // invalid global cell-id (LAC is zero). A transition to |
283 TRequestStatus emptyStatus; |
274 // a new valid cell is not provoked by this test. Therefore |
284 iServer.EmptyLastKnownPositionStore(emptyStatus); |
275 // the Location Monitor never gets to know a valid cell in this test. |
285 User::WaitForRequest(emptyStatus); |
276 |
286 |
277 // Request a position so that the position goes into the database |
287 // Whilst the area is not known, request a position. This shouldn't go into the database. |
|
288 // Therefore a subsequent getlastknownposarea will return KErrUnknown |
|
289 INFO_PRINTF1(_L("Check invalid positions don't go into the database")); |
|
290 |
278 err = DoNotifyUpdateL(*posInfo); |
291 err = DoNotifyUpdateL(*posInfo); |
279 if (KErrNone != err) |
292 if (KErrNone != err) |
280 { |
293 { |
281 ERR_PRINTF2(_L("Incorrect err %d returned"), err); |
294 ERR_PRINTF2(_L("Incorrect err %d returned"), err); |
282 SetTestStepResult(EFail); |
295 SetTestStepResult(EFail); |
283 } |
296 } |
284 |
297 |
285 // Since the Location Monitor never received a valid value of |
|
286 // GCI, the call to GetLastKnownPositionArea should return |
|
287 // the last stored position (posInfo) together with area information |
|
288 // that shows the "rough area accuracy" to be TPositionAreaInfo::EAreaUnknown. |
|
289 TPositionInfo posInfo2; |
298 TPositionInfo posInfo2; |
290 TPositionAreaExtendedInfo matchLevel, expectedMatchLevel; |
299 TPositionAreaExtendedInfo matchLevel; |
291 err = DoLastKnownPosAreaL(posInfo2, matchLevel); |
300 err = DoLastKnownPosAreaL(posInfo2, matchLevel); |
292 if (KErrNone != err) |
301 if (KErrUnknown != err) |
293 { |
302 { |
294 ERR_PRINTF2(_L("Incorrect err %d returned"), err); |
303 ERR_PRINTF2(_L("Expected KErrUnknown, incorrect err %d returned"), err); |
295 SetTestStepResult(EFail); |
304 SetTestStepResult(EFail); |
296 } |
305 } |
|
306 |
|
307 //1. Move to GSM cell 234.15.1911.36463 - all valid |
|
308 err = RProperty::Set(KUidPSSimTsyCategory, KPSSimTsyTimersReduceTime, KReduceSimTsyTimers); |
|
309 User::After(KSimTsyTransitionDelay); |
297 |
310 |
298 // Verify that the position received in the call to GLKPA is the last known position |
311 // Request a position so that the position goes into the database |
299 // due to the NPUD and also that the accuracy is set to TPositionAreaInfo::EAreaUnknown |
312 // then call GetLastKnownPosArea and check everything now matches. |
300 // (in this case the rest of boolean values passed in Validate() are irrelevant). |
313 INFO_PRINTF1(_L("Check that we get EAreaCity once a position is available")); |
|
314 err = DoNotifyUpdateL(*posInfo); |
|
315 if (KErrNone != err) |
|
316 { |
|
317 ERR_PRINTF2(_L("Incorrect err %d returned"), err); |
|
318 SetTestStepResult(EFail); |
|
319 } |
|
320 err = DoLastKnownPosAreaL(posInfo2, matchLevel); |
|
321 if (KErrNone != err) |
|
322 { |
|
323 ERR_PRINTF2(_L("Incorrect err %d returned"), err); |
|
324 SetTestStepResult(EFail); |
|
325 } |
|
326 Validate(*posInfo, posInfo2, matchLevel, TPositionAreaInfo::EAreaCity, ETrue, ETrue, ETrue, ETrue); |
|
327 |
|
328 // Next error condition, WCDMA network and cell id is too low... |
|
329 INFO_PRINTF1(_L("Check that invalid current WCDMA cell id is accepted and we get EAreaCountry match")); |
|
330 |
|
331 //1. Move to WCDMA cell 234.15.1911.36463 - the WCDMA spec expects a non-zero |
|
332 // RNC ID which implies the cell id should be greater than 0x10000. However, |
|
333 // certain networks break the rule, so check this 'illegal' cell id accepted. |
|
334 err = RProperty::Set(KUidPSSimTsyCategory, KPSSimTsyTimersReduceTime, KReduceSimTsyTimers); |
|
335 User::After(KSimTsyTransitionDelay); |
|
336 |
|
337 err = DoLastKnownPosAreaL(posInfo2, matchLevel); |
|
338 if (KErrNone != err) |
|
339 { |
|
340 ERR_PRINTF2(_L("Incorrect err %d returned"), err); |
|
341 SetTestStepResult(EFail); |
|
342 } |
|
343 |
|
344 // Expect EAreaCountry. The current 'broken' cell position should have been accepted |
|
345 // and we match on country and network code (but not LAC as earlier one was GSM LAC!). |
|
346 Validate(*posInfo, posInfo2, matchLevel, TPositionAreaInfo::EAreaCountry, ETrue, ETrue, EFalse, EFalse); |
|
347 |
|
348 // Next error condition, GSM network with too high a cell id. In this case, the cell will |
|
349 // have been rejected and effectively we are unregistered, so EAreaUnknown is correct. |
|
350 INFO_PRINTF1(_L("Check that invalid GSM cell id is identified and we get EAreaUnknown returned")); |
|
351 |
|
352 //1. Move to GSM cell 234.15.1911.90000 - 90000 is too high a cell id for GSM |
|
353 err = RProperty::Set(KUidPSSimTsyCategory, KPSSimTsyTimersReduceTime, KReduceSimTsyTimers); |
|
354 User::After(KSimTsyTransitionDelay); |
|
355 |
|
356 err = DoLastKnownPosAreaL(posInfo2, matchLevel); |
|
357 if (KErrNone != err) |
|
358 { |
|
359 ERR_PRINTF2(_L("Incorrect err %d returned"), err); |
|
360 SetTestStepResult(EFail); |
|
361 } |
|
362 // As current position information is broken, expect area EAreaUknown etc. |
301 Validate(*posInfo, posInfo2, matchLevel, TPositionAreaInfo::EAreaUnknown, EFalse, EFalse, EFalse, EFalse); |
363 Validate(*posInfo, posInfo2, matchLevel, TPositionAreaInfo::EAreaUnknown, EFalse, EFalse, EFalse, EFalse); |
302 |
364 |
|
365 // Go back to a valid cell, differing only in the cell-id, check that the |
|
366 //correct accuracy is returned. |
|
367 INFO_PRINTF1(_L("Valid GSM area, only cell id varies from earlier location, so should return EAreaRegion")); |
|
368 |
|
369 //1. Move to GSM cell 234.15.1911.36000 |
|
370 err = RProperty::Set(KUidPSSimTsyCategory, KPSSimTsyTimersReduceTime, KReduceSimTsyTimers); |
|
371 User::After(KSimTsyTransitionDelay); |
|
372 |
|
373 err = DoLastKnownPosAreaL(posInfo2, matchLevel); |
|
374 if (KErrNone != err) |
|
375 { |
|
376 ERR_PRINTF2(_L("Incorrect err %d returned"), err); |
|
377 SetTestStepResult(EFail); |
|
378 } |
|
379 Validate(*posInfo, posInfo2, matchLevel, TPositionAreaInfo::EAreaRegion, ETrue, ETrue, ETrue, EFalse); |
|
380 |
303 //7. Clear Database |
381 //7. Clear Database |
304 TRequestStatus emptyStatus; |
|
305 iServer.EmptyLastKnownPositionStore(emptyStatus); |
382 iServer.EmptyLastKnownPositionStore(emptyStatus); |
306 User::WaitForRequest(emptyStatus); |
383 User::WaitForRequest(emptyStatus); |
307 break; |
384 break; |
308 } |
385 } |
309 // Test case LBS-Client-LastKnownPosArea-0004 |
386 // Test case LBS-Client-LastKnownPosArea-0004 |
531 TRequestStatus emptyStatus; |
608 TRequestStatus emptyStatus; |
532 iServer.EmptyLastKnownPositionStore(emptyStatus); |
609 iServer.EmptyLastKnownPositionStore(emptyStatus); |
533 User::WaitForRequest(emptyStatus); |
610 User::WaitForRequest(emptyStatus); |
534 break; |
611 break; |
535 } |
612 } |
|
613 case 9: |
|
614 { |
|
615 // Here we have both GSM and WCDMA positions in the database and we check that GetLastKnownPosArea returns the correct |
|
616 // position and match level as we switch between GSM and WCDMA cells. |
|
617 |
|
618 // Empty Database |
|
619 TRequestStatus emptyStatus; |
|
620 iServer.EmptyLastKnownPositionStore(emptyStatus); |
|
621 User::WaitForRequest(emptyStatus); |
|
622 |
|
623 TPositionInfo lastKnownPosInfo; |
|
624 TPositionAreaExtendedInfo matchLevel; |
|
625 |
|
626 //1. Get a position in the database.for a GSM cell of 234.15.1911.65535. Note that |
|
627 //this is the highest possible GSM cell id) |
|
628 INFO_PRINTF1(_L("Get a position in the database.for a GSM cell of 234.15.1911.65535")); |
|
629 TPositionInfo* gsmPosInfo = new(ELeave) TPositionInfo(); |
|
630 posInfoArr.Append(gsmPosInfo); |
|
631 err = RProperty::Set(KUidPSSimTsyCategory, KPSSimTsyTimersReduceTime, KReduceSimTsyTimers); |
|
632 User::After(KSimTsyTransitionDelay); |
|
633 if (KErrNone == err) |
|
634 { |
|
635 err = DoNotifyUpdateL(*gsmPosInfo); |
|
636 } |
|
637 if (KErrNone != err) |
|
638 { |
|
639 ERR_PRINTF2(_L("Incorrect err %d returned"), err); |
|
640 SetTestStepResult(EFail); |
|
641 } |
|
642 |
|
643 //2. Move to WCDMA cell 234.15.1913.65536 (lowest possible WCDMA cell id) and get this in the database |
|
644 TPositionInfo* wcdmaPosInfo = new(ELeave) TPositionInfo(); |
|
645 posInfoArr.Append(wcdmaPosInfo); |
|
646 INFO_PRINTF1(_L("Move to WCDMA cell 234.15.1913.65536 and get this in the database")); |
|
647 err = RProperty::Set(KUidPSSimTsyCategory, KPSSimTsyTimersReduceTime, KReduceSimTsyTimers); |
|
648 User::After(KSimTsyTransitionDelay); |
|
649 |
|
650 //2. NPUD |
|
651 if (KErrNone == err) |
|
652 { |
|
653 err = DoNotifyUpdateL(*wcdmaPosInfo); |
|
654 } |
|
655 if (KErrNone != err) |
|
656 { |
|
657 ERR_PRINTF2(_L("Incorrect err %d returned"), err); |
|
658 SetTestStepResult(EFail); |
|
659 } |
|
660 |
|
661 // Check that GetLastKnownPosArea returns the WCDMA position with area as TPositionAreaInfo::EAreaCity. |
|
662 INFO_PRINTF1(_L("check GetLastKnownPosArea returns WCDMA position - all area fields matching")); |
|
663 err = DoLastKnownPosAreaL(lastKnownPosInfo, matchLevel); |
|
664 if (KErrNone != err) |
|
665 { |
|
666 ERR_PRINTF2(_L("Incorrect err %d returned"), err); |
|
667 SetTestStepResult(EFail); |
|
668 } |
|
669 Validate(*wcdmaPosInfo, lastKnownPosInfo, matchLevel, TPositionAreaInfo::EAreaCity, ETrue, ETrue, ETrue, ETrue); |
|
670 |
|
671 |
|
672 // Move to GSM cell 234.15.1913.32121 and check GetLastKnownPosArea returns the WCDMA |
|
673 // position (as it is the most recent) with area as TPositionAreaInfo::EAreaCountry |
|
674 INFO_PRINTF1(_L("Move to GSM cell 234.15.1913.32121 and check GetLastKnownPosArea returns the WCDMA position")); |
|
675 err = RProperty::Set(KUidPSSimTsyCategory, KPSSimTsyTimersReduceTime, KReduceSimTsyTimers); |
|
676 User::After(KSimTsyTransitionDelay); |
|
677 |
|
678 if (KErrNone == err) |
|
679 { |
|
680 err = DoLastKnownPosAreaL(lastKnownPosInfo, matchLevel); |
|
681 } |
|
682 if (KErrNone != err) |
|
683 { |
|
684 ERR_PRINTF2(_L("Incorrect err %d returned"), err); |
|
685 SetTestStepResult(EFail); |
|
686 } |
|
687 Validate(*wcdmaPosInfo, lastKnownPosInfo, matchLevel, TPositionAreaInfo::EAreaCountry, ETrue, ETrue, |
|
688 EFalse, EFalse); |
|
689 |
|
690 // Move to WDCMA cell 234.15.1911.88880 and check GetLastKnownPosArea returns the WDCMA position |
|
691 // (as it is the most recent) with area as TPositionAreaInfo::EAreaCountry. |
|
692 INFO_PRINTF1(_L("Move to WDCMA cell 234.15.1911.88880 and check GetLastKnownPosArea returns the WDCMA position")); |
|
693 err = RProperty::Set(KUidPSSimTsyCategory, KPSSimTsyTimersReduceTime, KReduceSimTsyTimers); |
|
694 User::After(KSimTsyTransitionDelay); |
|
695 if (KErrNone == err) |
|
696 { |
|
697 err = DoLastKnownPosAreaL(lastKnownPosInfo, matchLevel); |
|
698 } |
|
699 if (KErrNone != err) |
|
700 { |
|
701 ERR_PRINTF2(_L("Incorrect err %d returned"), err); |
|
702 SetTestStepResult(EFail); |
|
703 } |
|
704 Validate(*wcdmaPosInfo, lastKnownPosInfo, matchLevel, TPositionAreaInfo::EAreaCountry, ETrue, ETrue, |
|
705 EFalse, EFalse); |
|
706 |
|
707 // Move to WDCMA cell 234.15.1913.76554 and check GetLastKnownPosArea returns the WDCMA position |
|
708 // (since it matches with most fields) with area as TPositionAreaInfo::EAreaRegion. |
|
709 INFO_PRINTF1(_L("Move to WDCMA cell 234.15.1913.76554 and check GetLastKnownPosArea returns the WDCMA position")); |
|
710 err = RProperty::Set(KUidPSSimTsyCategory, KPSSimTsyTimersReduceTime, KReduceSimTsyTimers); |
|
711 User::After(KSimTsyTransitionDelay); |
|
712 if (KErrNone == err) |
|
713 { |
|
714 err = DoLastKnownPosAreaL(lastKnownPosInfo, matchLevel); |
|
715 } |
|
716 if (KErrNone != err) |
|
717 { |
|
718 ERR_PRINTF2(_L("Incorrect err %d returned"), err); |
|
719 SetTestStepResult(EFail); |
|
720 } |
|
721 Validate(*wcdmaPosInfo, lastKnownPosInfo, matchLevel, TPositionAreaInfo::EAreaRegion, ETrue, ETrue, |
|
722 ETrue, EFalse); |
|
723 |
|
724 |
|
725 // Move to GSM cell 234.15.1911.19980 and check GetLastKnownPosArea returns the GSM position |
|
726 // (since it matches on most fields) with area as TPositionAreaInfo::EAreaRegion. |
|
727 INFO_PRINTF1(_L("Move to GSM cell 234.15.1911.19980 and check GetLastKnownPosArea returns the GSM position")); |
|
728 err = RProperty::Set(KUidPSSimTsyCategory, KPSSimTsyTimersReduceTime, KReduceSimTsyTimers); |
|
729 User::After(KSimTsyTransitionDelay); |
|
730 if (KErrNone == err) |
|
731 { |
|
732 err = DoLastKnownPosAreaL(lastKnownPosInfo, matchLevel); |
|
733 } |
|
734 if (KErrNone != err) |
|
735 { |
|
736 ERR_PRINTF2(_L("Incorrect err %d returned"), err); |
|
737 SetTestStepResult(EFail); |
|
738 } |
|
739 Validate(*gsmPosInfo, lastKnownPosInfo, matchLevel, TPositionAreaInfo::EAreaRegion, ETrue, ETrue, |
|
740 ETrue, EFalse); |
|
741 |
|
742 // Move to an ENetworkModeTdcdma cell 234.15.1911.66003 on a different network and check GetLastKnownPosArea |
|
743 // returns the WCDMA position (the most recent matching on 'Country') with area as TPositionAreaInfo::EAreaCountry. |
|
744 INFO_PRINTF1(_L("Move to an ENetworkModeTdcdma cell 234.15.1911.66003 on a different network")); |
|
745 err = RProperty::Set(KUidPSSimTsyCategory, KPSSimTsyTimersReduceTime, KReduceSimTsyTimers); |
|
746 User::After(KSimTsyTransitionDelay); |
|
747 if (KErrNone == err) |
|
748 { |
|
749 err = DoLastKnownPosAreaL(lastKnownPosInfo, matchLevel); |
|
750 } |
|
751 if (KErrNone != err) |
|
752 { |
|
753 ERR_PRINTF2(_L("Incorrect err %d returned"), err); |
|
754 SetTestStepResult(EFail); |
|
755 } |
|
756 Validate(*wcdmaPosInfo, lastKnownPosInfo, matchLevel, TPositionAreaInfo::EAreaCountry, ETrue, EFalse, |
|
757 EFalse, EFalse); |
|
758 |
|
759 //1. Now get a position in the database.for a GSM cell of 234.15.1911.100. |
|
760 INFO_PRINTF1(_L("Now get a position in the database.for a GSM cell of 234.15.1911.100")); |
|
761 TPositionInfo* gsmPosInfo2 = new(ELeave) TPositionInfo(); |
|
762 posInfoArr.Append(gsmPosInfo2); |
|
763 |
|
764 err = RProperty::Set(KUidPSSimTsyCategory, KPSSimTsyTimersReduceTime, KReduceSimTsyTimers); |
|
765 User::After(KSimTsyTransitionDelay); |
|
766 if (KErrNone == err) |
|
767 { |
|
768 err = DoNotifyUpdateL(*gsmPosInfo2); |
|
769 } |
|
770 if (KErrNone != err) |
|
771 { |
|
772 ERR_PRINTF2(_L("Incorrect err %d returned"), err); |
|
773 SetTestStepResult(EFail); |
|
774 } |
|
775 |
|
776 // Move to WDCMA cell 234.15.1911.88880 and check GetLastKnownPosArea returns the most recent |
|
777 // GSM position with area as TPositionAreaInfo::EAreaCountry. |
|
778 INFO_PRINTF1(_L("Move to WDCMA cell 234.15.1911.88880, check GetLastKnownPosArea returns recent GSM position")); |
|
779 err = RProperty::Set(KUidPSSimTsyCategory, KPSSimTsyTimersReduceTime, KReduceSimTsyTimers); |
|
780 User::After(KSimTsyTransitionDelay); |
|
781 if (KErrNone == err) |
|
782 { |
|
783 err = DoLastKnownPosAreaL(lastKnownPosInfo, matchLevel); |
|
784 } |
|
785 if (KErrNone != err) |
|
786 { |
|
787 ERR_PRINTF2(_L("Incorrect err %d returned"), err); |
|
788 SetTestStepResult(EFail); |
|
789 } |
|
790 Validate(*gsmPosInfo2, lastKnownPosInfo, matchLevel, TPositionAreaInfo::EAreaCountry, ETrue, ETrue, |
|
791 EFalse, EFalse); |
|
792 |
|
793 //7. Clear Database |
|
794 iServer.EmptyLastKnownPositionStore(emptyStatus); |
|
795 User::WaitForRequest(emptyStatus); |
|
796 break; |
|
797 |
|
798 } |
|
799 |
|
800 |
536 default: |
801 default: |
537 User::Panic(KLbsClientStepLastKnownPosArea, KErrUnknown); |
802 User::Panic(KLbsClientStepLastKnownPosArea, KErrUnknown); |
538 } |
803 } |
539 } |
804 } |
540 // All done, clean up. |
805 // All done, clean up. |