Ejemplo n.º 1
0
void CLcfPsyDummy3::GetPositionSatelliteInfoL(TPositionInfoBase& aPosInfo)
    {
    TPositionSatelliteInfo* satInfo = static_cast<TPositionSatelliteInfo*>(&aPosInfo);

    // prepare data
    satInfo->ClearSatellitesInView();

    satInfo->SetHorizontalDoP(DUMMY_SAT_INFO_HDOP);
    satInfo->SetVerticalDoP(DUMMY_SAT_INFO_VDOP);
    satInfo->SetTimeDoP(DUMMY_SAT_INFO_TDOP);
    satInfo->SetSatelliteTime(DUMMY_SAT_INFO_TIME);

    TSatelliteData satData;

    // first satellite
    satData.SetAzimuth(DUMMY_AZIMUTH1);
    satData.SetElevation(DUMMY_ELEVATION1);
    satData.SetIsUsed(DUMMY_IS_USED1);
    satData.SetSatelliteId(DUMMY_SATELLITE_ID1);
    satData.SetSignalStrength(DUMMY_SIGNAL_STRENGTH1);
    // add to info
    satInfo->AppendSatelliteData(satData);

    // second satellite
    satData.SetAzimuth(DUMMY_AZIMUTH2);
    satData.SetElevation(DUMMY_ELEVATION2);
    satData.SetIsUsed(DUMMY_IS_USED2);
    satData.SetSatelliteId(DUMMY_SATELLITE_ID2);
    satData.SetSignalStrength(DUMMY_SIGNAL_STRENGTH2);
    // add to info
    satInfo->AppendSatelliteData(satData);
    }
// ---------------------------------------------------------
// CPosPSYClearPositionDataTest::HandlePositionCompleteL
//
// (other items were commented in a header).
// ---------------------------------------------------------
//
void CPosPSYClearPositionDataTest::HandlePositionCompleteL(
	TInt aCompleteCode,
	TTimeIntervalMicroSeconds /*aRequestTime*/)
	{
	if (iTestStatus == KErrCancel)
		{
		CompleteClearPositionDataTest(iTestStatus);
		return;
		}

	if (iCurrentTestClass == 0 || iCurrentTestClass == EPositionInfoClass)
		{
		_LIT(KTitleTestInfo, "==== Testing clearing of TPositionInfo ====");
		AddTestResultL(KTitleTestInfo, EDisplayMessage);
		if (iPSYInfo.ClassesSupported() & EPositionInfoClass && 
			!(iClassesTested & EPositionInfoClass))
			{
			iCurrentTestClass = EPositionInfoClass;
			
			if (iRequestNumber == 0) 
				{
				iClassesTested |= EPositionInfoClass;
				PerformTestL(aCompleteCode);
				}
			}
		else
			{
			_LIT(KTestInfo, "Clearing of position data tests not performed with TPositionInfo because PSY didn't support it.");
			AddTestResultL(KTestInfo, EInfoMessage);
			}
		}

	if (iCurrentTestClass == 0 || iCurrentTestClass == EPositionGenericInfoClass)
		{
		if (iRequestNumber == 0)
			{
			_LIT(KTestInfoGeneric, "==== Testing clearing of HPositionGenericInfo ====");
			AddTestResultL(KTestInfoGeneric, EDisplayMessage);
			}
		if (iPSYInfo.ClassesSupported() & EPositionGenericInfoClass && 
			!(iClassesTested & EPositionGenericInfoClass))
			{
			iCurrentTestClass = EPositionGenericInfoClass;
			
			if (iRequestNumber == 1) 
				{
				iClassesTested |= EPositionGenericInfoClass;
				PerformTestL(aCompleteCode);	
				}
			else
				{
				HPositionGenericInfo* genInfo = HPositionGenericInfo::NewLC(KPositionGenericInfoDefaultBufferSize * 2, 
													  KPositionGenericInfoDefaultMaxFields * 2);

				SetHPositionGenericInfoDataL(*genInfo);
				CleanupStack::Pop(genInfo);
				genInfo->SetPosition(iPosition);
				iPosInfo = static_cast<TPositionInfo*> (genInfo);
				iRequester->MakeRequest(*iPosInfo);
				iRequestNumber++;
				}
			}
		else
			{
			_LIT(KTestInfo, "Clearing of position data tests not performed with HPositionGenericInfo because PSY didn't support it.");
			AddTestResultL(KTestInfo, EInfoMessage);
			}
		}
    
	if (iCurrentTestClass == 0 || iCurrentTestClass == EPositionCourseInfoClass)
		{
		if (iRequestNumber == 0)
			{
			_LIT(KTestInfo, "==== Testing clearing of TPositionCourseInfo ====");
			AddTestResultL(KTestInfo, EDisplayMessage);
			}
		if (iPSYInfo.ClassesSupported() & EPositionCourseInfoClass && 
			!(iClassesTested & EPositionCourseInfoClass))
			{
			iCurrentTestClass = EPositionCourseInfoClass;
			if (iRequestNumber == 1) 
				{
				iClassesTested |= EPositionCourseInfoClass;
				PerformTestL(aCompleteCode);
				}
			else
				{
				TPositionCourseInfo* courseInfo = new (ELeave) TPositionCourseInfo;
				courseInfo->SetCourse(iCourse);
				courseInfo->SetPosition(iPosition);
				iPosInfo = static_cast<TPositionInfo*> (courseInfo);
				iRequester->MakeRequest(*iPosInfo);
				iRequestNumber++;
				}
			}
		else
			{
			_LIT(KTestInfo, "Clearing of position data tests not performed with TPositionCourseInfo because PSY didn't support it.");
			AddTestResultL(KTestInfo, EInfoMessage);
			}
		}

	if (iCurrentTestClass == 0 || iCurrentTestClass == EPositionSatelliteInfoClass)
		{
		if (iRequestNumber == 0)
			{
			_LIT(KTestInfo, "==== Testing clearing of TPositionSatelliteInfo ====");
			AddTestResultL(KTestInfo, EDisplayMessage);
			}
		if (iPSYInfo.ClassesSupported() & EPositionSatelliteInfoClass &&
			!(iClassesTested & EPositionSatelliteInfoClass))
			{
			iCurrentTestClass = EPositionSatelliteInfoClass;
			if (iRequestNumber == 1)
				{
				iClassesTested |= EPositionSatelliteInfoClass;
				PerformTestL(aCompleteCode);
				}
			else
				{
				TPositionSatelliteInfo* satInfo = new (ELeave) TPositionSatelliteInfo;
				
				satInfo->SetSatelliteTime(KSatelliteTime);
				satInfo->SetHorizontalDoP(KSatelliteHorizontalDoP);
				satInfo->SetVerticalDoP(KSatelliteVerticalDoP);
				satInfo->SetTimeDoP(KSatelliteTimeDoP);

				for (TInt  i = 0; i < KSatelliteNumInView; i++)
					{
					TSatelliteData satellite;
					satellite.SetSatelliteId(KSatelliteId+i);
					satellite.SetAzimuth(KAzimuth);
					satellite.SetElevation(KElevation);
					satellite.SetIsUsed(KIsUsed);
					satellite.SetSignalStrength(KSignalStrength);
	
					satInfo->AppendSatelliteData(satellite);
					}
				
				satInfo->SetCourse(iCourse);
				satInfo->SetPosition(iPosition);
				iPosInfo = static_cast<TPositionInfo*> (satInfo);
				iRequester->MakeRequest(*iPosInfo);
				iRequestNumber++;
				}
			}
		else
			{
			_LIT(KTestInfo, "Clearing of position data tests not performed with TPositionSatelliteInfo because PSY didn't support it.");
			AddTestResultL(KTestInfo, EInfoMessage);
			}
		}
	}