// ---------------------------------------------------------
// CPosTp4707::StartL
//
// (other items were commented in a header).
// ---------------------------------------------------------
//
void CT_LbsClientPosTp4707::StartL()
    {
    ConnectL();

    SetupProxyPSYsL();

    TInt err = OpenPositioner();
    _LIT(KOpenErr, "Error when opening positioner, %d");
    AssertTrueL(err == KErrNone, KOpenErr, err);
    
    _LIT(KServiceName, "TP4707");
    iPositioner.SetRequestor(CRequestor::ERequestorService, CRequestor::EFormatApplication, KServiceName);

    // Issue a pre position request
    TInt request = 100;
    TPositionInfo posInfo;
    RequestL(posInfo, request, KEspectedErrorCodePSY1);
    
    //
	// Request 1
	//
    // Check that partial update is not supported
    TPositionUpdateOptions updateOptions;
    updateOptions.SetAcceptPartialUpdates(ETrue);    
    iPositioner.SetUpdateOptions(updateOptions);
    
    request = 4707;
    RequestL(posInfo, request, KEspectedErrorCodePSY2);    

    VerifyPositionFromL(posInfo, iUidTestPsyPartialUpdate);    
    VerifyRequestTimeLessThanL(5001000);
    
    VerifyPositionL(posInfo, 30, 40, 50);
    }
示例#2
0
EXPORT_C void T_LbsUtils::GetConfigured_ModuleUpdateOptionsL(const TDesC& aConfigFileName, const TDesC& aConfigSection, TPositionUpdateOptions& aUpdateOpts)
/** Fills a module updata options class/structure with values read from a configuration ini file.

@param aConfigFileName	The name of the ini file to read. If the file name is empty (0 length) then
						default values will be used.
@param aConfigSection	The section within the ini file to read data from.
@param aUpdateOpts		The modified update options structure.
*/
	{
	// Use default values if file name not given.
	if (aConfigFileName.Length() == 0)
		{
		aUpdateOpts.SetUpdateInterval(0);
		aUpdateOpts.SetUpdateTimeOut(0);
		aUpdateOpts.SetMaxUpdateAge(0);
		aUpdateOpts.SetAcceptPartialUpdates(EFalse);			
		}
	
	else
		{
		CUpdateOptsConfigReader* reader;
	
		reader = CUpdateOptsConfigReader::NewL(aConfigFileName, aConfigSection, aUpdateOpts);
		CleanupStack::PushL(reader);
		
		reader->ProcessL();
	
		CleanupStack::PopAndDestroy(reader);
		}
	}
void CTTGPSLoggerPositionRequester::StartL()
	{
	Stop();
	//RDebug::Print(_L("%d\n"), __LINE__);

#ifdef POSMETH
	TPositionModuleInfo info;
	if ( (iPositioningMethod>0) &&
				((iPositionServer.GetModuleInfoByIndex(iPositioningMethod-1,info) == KErrNone) && (info.IsAvailable())) )
			{
			User::LeaveIfError(iPositioner.Open(iPositionServer, info.ModuleId()));
			}
	else
#endif
		User::LeaveIfError(iPositioner.Open(iPositionServer));
	
	//RDebug::Print(_L("%d\n"), __LINE__);
	User::LeaveIfError(iPositioner.SetRequestor(CRequestor::ERequestorService, CRequestor::EFormatApplication, KRequestor));
	//RDebug::Print(_L("%d\n"), __LINE__);
	const TTimeIntervalMicroSeconds KUpdateInterval(1000000);
	const TTimeIntervalMicroSeconds KTimeOut(2000000);
	const TTimeIntervalMicroSeconds KMaxUpdateAge(0);
	TPositionUpdateOptions options;
	options.SetUpdateInterval(KUpdateInterval);
	options.SetUpdateTimeOut(KTimeOut);
	options.SetMaxUpdateAge(KMaxUpdateAge);
	options.SetAcceptPartialUpdates(ETrue);
	//RDebug::Print(_L("%d\n"), __LINE__);
	User::LeaveIfError(iPositioner.SetUpdateOptions(options));
	//RDebug::Print(_L("%d\n"), __LINE__);
	iPositioner.NotifyPositionUpdate(*iPositionInfo, iStatus);
	//RDebug::Print(_L("%d\n"), __LINE__);
	SetActive();
	}
示例#4
0
//////////////////////////////////////////////////////////////
// Sets the interval for getting the regular notification   //
// the time interval set is in milli seconds                      //
//////////////////////////////////////////////////////////////
int CQMLBackendAO::setUpdateInterval(int aMilliSec)
{
#if !defined QT_NO_DEBUG
	qDebug() << "CQMLBackendAO::setUpdateInterval\n" ;
#endif
    int minimumUpdateInterval = 0;
    TInt64 mUpdateInterval = 0 ;


    if (mRequester)
        minimumUpdateInterval = mRequester->minimumUpdateInterval();
    else
        minimumUpdateInterval = mRequesterSatellite->minimumUpdateInterval();

    if (minimumUpdateInterval < 0)
        minimumUpdateInterval = 100;
    // if the current requesttype is  regular updates
    // then set the updateinterval otherwise ignore
    //if(mRequestType != REQ_REG_UPDATE)
    //    return;

    TPositionUpdateOptions  aPosOption;

    TInt error = mPositioner.GetUpdateOptions(aPosOption);

    // TTimeIntervalMicroSeconds is converted seconds
    TInt currentUpdateInterval  = aPosOption.UpdateInterval().Int64() / 1000;

    // If msec is not 0 and is less than the value returned by minimumUpdateInterval(),
    // the interval will be set to the minimum interval.
    // if (aMilliSec != 0 && aMilliSec <= minimumUpdateInterval) {
    // workaround, not accepting zero as value, see QTMOBILITY-995
    if (aMilliSec <= minimumUpdateInterval) {
        mUpdateInterval = minimumUpdateInterval;
    } else {
        mUpdateInterval = aMilliSec;
    }

    // if the same value is being set then just ignore it.
    if (currentUpdateInterval == mUpdateInterval) {
        return mUpdateInterval;
    }

    // will set Either zero, minimum or +ve value
    // seconds converted to TTimeIntervalMicroSeconds
    aPosOption.SetUpdateInterval(TTimeIntervalMicroSeconds(mUpdateInterval * 1000));
    // set the timeout to the smaller of 150% of interval or update interval + 10 seconds
    TInt64 mUpdateTimeout = (mUpdateInterval * 3) / 2;
    if (mUpdateTimeout > mUpdateInterval + 10000)
        mUpdateTimeout = mUpdateInterval + 10000;

    if (aMilliSec > 0)
        aPosOption.SetUpdateTimeOut(TTimeIntervalMicroSeconds(mUpdateTimeout * 1000));

    error = mPositioner.SetUpdateOptions(aPosOption);

    return mUpdateInterval;
}
// ---------------------------------------------------------
// CT_LbsClientPosTp272::SetPeriodicUpdateL
//
// (other items were commented in a header).
// ---------------------------------------------------------
//
void CT_LbsClientPosTp272::SetPeriodicUpdateL(const TInt& aUpdateInterval)
    {
    _LIT(KUpdateErr, "Error when setting update interval, %d");

    TPositionUpdateOptions updateOptions;
	updateOptions.SetUpdateInterval(TTimeIntervalMicroSeconds(aUpdateInterval));
    TInt err = iPositioner.SetUpdateOptions(updateOptions);
	AssertTrueL(err == KErrNone, KUpdateErr, err);   

    }
示例#6
0
//requestUpdate : request for position update once
void CQMLBackendAO::requestUpdate(int aTimeout)
{
#if !defined QT_NO_DEBUG
	qDebug() << "CQMLBackendAO::requestUpdate\n" ;
#endif
    TPositionUpdateOptions  aPosOption;

    mPositioner.GetUpdateOptions(aPosOption);

    aPosOption.SetUpdateInterval(TTimeIntervalMicroSeconds(0));

    aPosOption.SetUpdateTimeOut(TTimeIntervalMicroSeconds(aTimeout * 1000));

    mPositioner.SetUpdateOptions(aPosOption);

    startUpdates();
}
示例#7
0
void CPosition::ConstructL()
{
    User::LeaveIfError(iServer.Connect());
    User::LeaveIfError(iPositioner.Open(iServer));

    _LIT(KRequestor, "OpenMAR" );
    User::LeaveIfError(iPositioner.SetRequestor(CRequestor::ERequestorService, CRequestor::EFormatApplication, KRequestor));

    const TInt KSecond = 1000000;
    TPositionUpdateOptions updateOptions;
    updateOptions.SetUpdateInterval(TTimeIntervalMicroSeconds(10 * KSecond));
    updateOptions.SetUpdateTimeOut(TTimeIntervalMicroSeconds(30 * KSecond));
    updateOptions.SetMaxUpdateAge(TTimeIntervalMicroSeconds(1 * KSecond));
    updateOptions.SetAcceptPartialUpdates(EFalse);

    User::LeaveIfError(iPositioner.SetUpdateOptions(updateOptions));
}
示例#8
0
void CCxxPositioner::ConstructL()
{
  LEAVE_IF_ERROR_OR_SET_SESSION_OPEN(iPositionServer, iPositionServer.Connect());

  LEAVE_IF_ERROR_OR_SET_SESSION_OPEN(iPositioner, iPositioner.Open(iPositionServer, iModuleId));

  _LIT(KRequestor, "pytwink");
  User::LeaveIfError(iPositioner.SetRequestor(CRequestor::ERequestorService,
					      CRequestor::EFormatApplication, 
					      KRequestor));

  TPositionUpdateOptions updateOptions;
  updateOptions.SetAcceptPartialUpdates(EFalse);
  updateOptions.SetUpdateInterval(TTimeIntervalMicroSeconds(0)); // not periodic
  updateOptions.SetUpdateTimeOut(TTimeIntervalMicroSeconds(iUpdateTimeOut));
  updateOptions.SetMaxUpdateAge(TTimeIntervalMicroSeconds(iMaxUpdateAge));
  User::LeaveIfError(iPositioner.SetUpdateOptions(updateOptions));
}
void CGpsPositionRequest::ConstructL(const TDesC& aAppName)
    {
    iAppName = aAppName.AllocL();
    // connect to location server
    User::LeaveIfError(iLocationServer.Connect());
    // open positioner
    User::LeaveIfError(iPositioner.Open(iLocationServer));
    // set our application as location requestor
    User::LeaveIfError(iPositioner.SetRequestor(
        CRequestor::ERequestorService, CRequestor::EFormatApplication, *iAppName));
    // set maximum allowed time for a location request
    TTimeIntervalMicroSeconds timeOut(30000000); // 30 sec
    
  //  TTimeIntervalMicroSeconds timeOut(3000000000); // 50 minutes sec
    TPositionUpdateOptions updateOptions;
    updateOptions.SetUpdateTimeOut(timeOut);
    User::LeaveIfError(iPositioner.SetUpdateOptions(updateOptions));
    }
/** NetSim callbacks given for a MoLr, which we invoke as a result of the notify position update.
*/
void CT_LbsConflictStep_selflocatex3ppush::Connected()
	{
	// Call base implementation.
	CT_LbsConflictStep::Connected();
	
	// Kick off first pos update.
	
	// Create a posinfo and store in our shared array for later verification.
	RPointerArray<TAny>& posInfoArr = iParent.iSharedData->iCurrentPosInfoArr;
	TPositionInfo* posInfo = new(ELeave) TPositionInfo();

	T_LbsUtils utils;
	utils.ResetAndDestroy_PosInfoArr(posInfoArr);	// Clear previous entries before new entry is appended.

	posInfoArr.Append(posInfo);

	// Kick off pos update.
	TInt testCaseId;
	if (GetIntFromConfig(ConfigSection(), KTestCaseId, testCaseId))
		{
			switch (testCaseId)
			{
			// Test case LBS-UpdateOptions-001
			case 7:
				{
				TPositionUpdateOptions optsA;
				TTimeIntervalMicroSeconds interval = 30 * 1000000; // tracking!

				optsA.SetUpdateInterval(interval);
				iDoPosUpdate->SetOptions(optsA);
				break;
				}
				
			}
		}
			
	iDoPosUpdate->StartL(*posInfo);
	iState = EReqPosUpdate;
	}
示例#11
0
void CAzqInternalGPSReader::StartL()
	{

	Cancel();


	_LIT(KOurAppName,"AzenqosTester");
	User::LeaveIfError(iPositioner.SetRequestor(
	        CRequestor::ERequestorService, CRequestor::EFormatApplication, KOurAppName));

	TPositionUpdateOptions options;

	// Frequency of updates in microseconds
	const TTimeIntervalMicroSeconds KUpdateInterval(3*KMillion);
	// How long the application is willing to wait before timing out the request
	const TTimeIntervalMicroSeconds KTimeOut(60*KMillion);

	// The maximum acceptable age of the information in an update
	const TTimeIntervalMicroSeconds KMaxUpdateAge(2*KMillion);

	options.SetUpdateInterval(KUpdateInterval);
	options.SetUpdateTimeOut(KTimeOut);
	options.SetMaxUpdateAge(KMaxUpdateAge);
	options.SetAcceptPartialUpdates(EFalse);

	User::LeaveIfError(iPositioner.SetUpdateOptions(options));

	/* Now when the application requests location information
	it will be provided with these options */

	iState = EReading;

	iPositioner.NotifyPositionUpdate(iPositionInfo, iStatus);
	SetActive();

	}
void CT_LbsClientPosTp178::TestOptionL()
    {
    SetupPsyL(iUidTestPsy3);
    
    RPositioner positioner;
    
    ConnectL();
    
    User::LeaveIfError(positioner.Open(iPosServer,iUidTestPsy3));
    CleanupClosePushL(positioner);
    
    _LIT(KKalle, "Kalle");
    positioner.SetRequestor(CRequestor::ERequestorService,
        CRequestor::EFormatApplication, KKalle);
    
    TPositionUpdateOptions updateOptions;
    
    TTimeIntervalMicroSeconds timeoutInterval(4000000);
    TTimeIntervalMicroSeconds periodicInterval(7000000);
    
    updateOptions.SetUpdateTimeOut(timeoutInterval);
    updateOptions.SetUpdateInterval(periodicInterval);
    TInt err = positioner.SetUpdateOptions(updateOptions);
    if (err != KErrArgument)
        {
        _LIT(KErrArg, "Possible to set timout < update interval, error code = %d");
        TBuf<100> buf;
        buf.Format(KErrArg, err);
        INFO_PRINTF1(buf);
        LogErrorAndLeaveL(buf);
        }

    //should never be runned;
    CleanupStack::PopAndDestroy(1); //positioner
    Disconnect();
    }
/**
 * @return - TVerdict code
 * Override of base class pure virtual
 * Our implementation only gets called if the base class doTestStepPreambleL() did
 * not leave. That being the case, the current test result value will be EPass.
 */
TVerdict CT_LbsClientStep_PartialUpdate::doTestStepL()
{
    // Generic test step used to test the LBS SetUpdateOptions API.
    INFO_PRINTF1(_L("&gt;&gt;CT_LbsClientStep_PartialUpdate::doTestStepL()"));

    if (TestStepResult()==EPass)
    {
        TInt err = KErrNone;
        iPosUpdateStatus = EPositionUpdateStart;

        //Configure partial Updates
        TPositionUpdateOptions optsA;
        optsA.SetAcceptPartialUpdates(ETrue);

        if(!optsA.AcceptPartialUpdates())
        {
            INFO_PRINTF1(_L("Partial Updates not set."));
            SetTestStepResult(EFail);
        }

        err = iDoPosUpdatePtr->SetOptions(optsA);
        User::LeaveIfError(err);

        CLbsAdmin* lbsAdminApi = CLbsAdmin::NewL();
        CleanupStack::PushL(lbsAdminApi);

        // Carryout unique test actions.
        if (GetIntFromConfig(ConfigSection(), KTestCaseId, iTestCaseId))
        {
            switch (iTestCaseId)
            {
            // Test case LBS-Partial-Update-Options-0001
            case 1:
            {
                CLbsAdmin::TGpsMode gpsMode = CLbsAdmin::EGpsAutonomous;
                lbsAdminApi->Set(KLbsSettingHomeGpsMode,gpsMode);

                //Configure Partial Update to EFalse
                TPositionUpdateOptions updOpts;
                updOpts.SetUpdateTimeOut(10*1000000);
                updOpts.SetAcceptPartialUpdates(EFalse);
                if(EFalse != updOpts.AcceptPartialUpdates())
                {
                    INFO_PRINTF1(_L("Partial Updates not set."));
                    SetTestStepResult(EFail);
                }

                err = iDoPosUpdatePtr->SetOptions(updOpts);
                User::LeaveIfError(err);

                break;
            }

            // Test case LBS-Partial-Update-Options-0002
            case 2:
            case 3:
            case 4:
            case 5:
            case 6:
            case 7:
            {
                CLbsAdmin::TGpsMode gpsMode = CLbsAdmin::EGpsAutonomous;
                lbsAdminApi->Set(KLbsSettingHomeGpsMode,gpsMode);

                break;
            }

            case 21:
            case 22:
            case 24:
            case 25:
            case 26:
            {
                CLbsAdmin::TGpsMode gpsMode = CLbsAdmin::EGpsPreferTerminalBased;
                lbsAdminApi->Set(KLbsSettingHomeGpsMode,gpsMode);

                break;
            }

            case 23:
            {
                CLbsAdmin::TGpsMode gpsMode = CLbsAdmin::EGpsPreferTerminalBased;
                lbsAdminApi->Set(KLbsSettingHomeGpsMode,gpsMode);

                //Configure Partial Update to EFalse
                TPositionUpdateOptions updOpts;
                updOpts.SetAcceptPartialUpdates(EFalse);
                if(EFalse != updOpts.AcceptPartialUpdates())
                {
                    INFO_PRINTF1(_L("Partial Updates not set."));
                    SetTestStepResult(EFail);
                }

                err = iDoPosUpdatePtr->SetOptions(updOpts);
                User::LeaveIfError(err);

                break;
            }

            case 27:
            case 28:
            {
                //Tracking
                CLbsAdmin::TGpsMode gpsMode;
                if(iTestCaseId == 27)
                {
                    gpsMode = CLbsAdmin::EGpsAutonomous;
                }
                else
                {
                    gpsMode = CLbsAdmin::EGpsPreferTerminalBased;
                }

                lbsAdminApi->Set(KLbsSettingHomeGpsMode,gpsMode);

                TPositionUpdateOptions updOpts;
                updOpts.SetUpdateInterval(10*1000000); //Set Update Interval to 10 secs
                updOpts.SetAcceptPartialUpdates(ETrue);

                err = iDoPosUpdatePtr->SetOptions(updOpts);
                User::LeaveIfError(err);

                break;
            }

            default:
                User::Panic(KLbsClientStep_PartialUpdate, KErrUnknown);

            }
        }

        User::LeaveIfError(OpenNetSim());

        // Kick off the test abort and keep alive timers.
        TTimeIntervalMicroSeconds32 keepAliveInterval(KLbsKeepAlivePeriod);
        iKeepAliveTimer->SetTimer(keepAliveInterval);

        // Kick off test.
        CActiveScheduler::Start();

        // Verify location data.
        VerifyPosInfos();

        //Reset Test module timeout
        TModuleDataIn modDataIn;
        modDataIn.iRequestType = TModuleDataIn::EModuleRequestTimeOut;
        modDataIn.iTimeOut = 0;

        T_LbsUtils utils;
        utils.NotifyModuleOfConfigChangeL(modDataIn);

        // Clean up.
        CloseNetSim();

        CleanupStack::PopAndDestroy(lbsAdminApi);
    }

    INFO_PRINTF1(_L("&lt;&lt;CT_LbsClientStep_PartialUpdate::doTestStepL()"));

    return TestStepResult();
}
示例#14
0
// ---------------------------------------------------------
// CT_LbsClientPosTp1::StartL
//
// (other items were commented in a header).
// ---------------------------------------------------------
//
void CT_LbsClientPosTp1::StartL()
    {
    ConnectL();
    
    CPosModules* db = CPosModules::OpenL();
    CleanupStack::PushL(db); 

    SetupPsyL(iUidMultiPsy);

    _LIT(KSetupPSY, "TP1: Has Setup Multi PSY");
    INFO_PRINTF1(KSetupPSY);
    
    //setting priority
	TPositionModuleInfo moduleInfoHp;//Hp - high prio;
	TPositionModuleInfo moduleInfoLp;//Lp - low prio;

    CPosModuleIdList* prioList = db->ModuleIdListLC();	
    db->GetModuleInfoL(prioList->At(0), moduleInfoHp);

    CPosModuleUpdate* moduleUpdate = CPosModuleUpdate::NewLC();
    moduleUpdate->SetUpdateAvailability(ETrue);

    if (iUidMultiPsy.iUid == moduleInfoHp.ModuleId().iUid)
		{
		// Case when Multi PSY has highest prio: 
		// Ensuring it is enabled
	    _LIT(KMultiHighest, "TP1: Case when Multi PSY has highest prio");
	    INFO_PRINTF1(KMultiHighest);	    
		db->UpdateModuleL((*prioList)[0], *moduleUpdate);
		}
	else
		{
		// Case when Multi PSY has not highest prio: 
		// 
	    _LIT(KMultiNotHighest, "TP1: Case when Multi PSY has NOT highest prio");	    
	    INFO_PRINTF1(KMultiNotHighest);	    
        db->GetModuleInfoL(iUidMultiPsy, moduleInfoLp);
		// Ensuring it is enabled
		db->UpdateModuleL(iUidMultiPsy, *moduleUpdate);

		TUint hp = db->PriorityL(moduleInfoHp.ModuleId());
		TUint lp = db->PriorityL(moduleInfoLp.ModuleId());

		// Changing prio of highest prio PSY and Multi PSY.
		// Setting Multi PSY to highest prio
		db->SetModulePriorityL(iUidMultiPsy, hp);
        db->SetModulePriorityL((*prioList)[0], lp); 
		}

	_LIT(KTestPSY1On, "TP1: Enabling Test PSY 1");
    INFO_PRINTF1(KTestPSY1On);	    
	db -> UpdateModuleL(iUidTestPsy1, *moduleUpdate);
	_LIT(KTestPSY2On, "TP1: Enabling Test PSY 2");
    INFO_PRINTF1(KTestPSY2On);
	db -> UpdateModuleL(iUidTestPsy2, *moduleUpdate);
    
	CleanupStack::PopAndDestroy(moduleUpdate);
	CleanupStack::PopAndDestroy(2, db); // db, prioList

    User::LeaveIfError(OpenPositioner());

    // Request data from default psy should be Multi psy
    _LIT(KService, "service");
    TPositionInfo posInfo = TPositionInfo();
    TInt err = PerformSyncRequest(KService, &posInfo);
    if (err != KErrNone)
        {
        _LIT(KErrorRequest, "The request was not completed with KErrNone");
        LogErrorAndLeaveL(KErrorRequest, err);
        }
	
    if (iUidMultiPsy.iUid != posInfo.ModuleId().iUid)
		{
		_LIT(KIncorrectPsyError, "TP1. Position from wrong PSY received");
		LogErrorAndLeaveL(KIncorrectPsyError);
		}

	HPositionGenericInfo* genericInfo = HPositionGenericInfo::NewLC();
	err = PerformSyncRequest(KService, &(*genericInfo));
    if (err != KErrNone)
        {
        _LIT(KErrorRequest, "The request was not completed with KErrNone");
        LogErrorAndLeaveL(KErrorRequest);
        }

	 if (iUidMultiPsy.iUid != (genericInfo -> ModuleId()).iUid)
		{
		_LIT(KIncorrectPsyError,
           "TP1. Position from wrong PSY received");
		LogErrorAndLeaveL(KIncorrectPsyError);
		}

	TPositionCourseInfo courseInfo = TPositionCourseInfo();
	err = PerformSyncRequest(KService, &courseInfo);
    if (err != KErrNone)
        {
        _LIT(KErrorRequest, "Course info supported by default, but request failed");
        LogErrorAndLeaveL(KErrorRequest);
        }

	TPositionSatelliteInfo satelliteInfo = TPositionSatelliteInfo();
	err = PerformSyncRequest(KService, &satelliteInfo);
    if (err != KErrNone)
        {
        _LIT(KErrorRequest, "Satellite info supported by default, but request failed");
        LogErrorAndLeaveL(KErrorRequest);
        }	

    //Changing the priority and verifiy that it still possilbe
    //to request updated from a psy if basic position information
    //is used and that it is not possilbe to request sat or cource
    //any more.
    SetupPsyL(iUidTestPsy2);
    User::After(3000000);

    // Request data from default psy should be test psy 2 now
    err = PerformSyncRequest(KService, &posInfo);
    if (err != KErrNone)
        {
        _LIT(KErrorRequest, "The request was not completed with KErrNone");
        LogErrorAndLeaveL(KErrorRequest);
        }
	
    if (iUidTestPsy2.iUid != posInfo.ModuleId().iUid)
		{
		_LIT(KIncorrectPsyError,
           "TP1. Position from wrong PSY received");
		LogErrorAndLeaveL(KIncorrectPsyError);
		}

	err = PerformSyncRequest(KService, &(*genericInfo));
    if (err != KErrNone)
        {
        _LIT(KErrorRequest, "The request was not completed with KErrNone");
        LogErrorAndLeaveL(KErrorRequest);
        }

	 if (iUidTestPsy2.iUid != (genericInfo -> ModuleId()).iUid)
		{
		_LIT(KIncorrectPsyError,
           "TP1. Position from wrong PSY received");
		LogErrorAndLeaveL(KIncorrectPsyError);
        }

    err = PerformSyncRequest(KService, &courseInfo);
    if (err != KErrArgument)
        {
        _LIT(KErrorRequest, "Course info not supported by default, KErrArgument not returned");
        LogErrorAndLeaveL(KErrorRequest);
        }


	err = PerformSyncRequest(KService, &satelliteInfo);
    if (err != KErrArgument)
        {
        _LIT(KErrorRequest, "Satellite info not supported by default, KErrArgument not returned");
        LogErrorAndLeaveL(KErrorRequest);
        }

    //check that it is possilbe to change the different
    //type of class info during periodic request and
    //that the periodic update will fail if the class
    //type is incorrect.
    TTimeIntervalMicroSeconds interval = TTimeIntervalMicroSeconds(1000000);
    TPositionUpdateOptions posOption;
	posOption.SetUpdateInterval(interval);
	_LIT(KUpdateErr, "Error when setting update interval,  %d");
	err = iPositioner.SetUpdateOptions(posOption);
    AssertTrueL(err == KErrNone, KUpdateErr, err);

    _LIT(KErrPeriodic, "The periodic request did not return KErrNone, %d");
    err = PerformSyncRequest(KService, &posInfo);
    AssertTrueL(err == KErrNone , KErrPeriodic, err);
    
    _LIT(KErrPeriodicArr, "The periodic request did not return KErrArgument, %d");
    err = PerformSyncRequest(KService, &satelliteInfo);
    AssertTrueL(err == KErrArgument , KErrPeriodicArr, err);
    SetupPsyL(iUidMultiPsy);
    User::After(3000000);
    err = PerformSyncRequest(KService, &satelliteInfo);
    AssertTrueL(err == KErrNone , KErrPeriodic, err);

    CleanupStack::PopAndDestroy(genericInfo);
    ClosePositioner();
    Disconnect();
    }
/*
 * Make two client sessions. First client request position and waits for time of aDelay. 
 * Next set Max Update Age of second client and issue position request of second client. 
 * If aLatitudeDiff and aLongitudeDiff parameters are set method will use them to
 * return calculated difference of client positions.
 * @param aIsSps set to ETrue if function should use SPS simulation mode, EFalse for NMEA simulation mode.
 * @param aSecondClientDelay is delay in milliseconds of second positioner request.
 * @param aMaxUpdateAge value in milliseconds that will be set to Max Update Age option of second positioner.
 * @param aLatitudeDiff this parameter will store difference of latitude between clients position.
 * @param aLongitudeDiff this parameter will store difference of longitude between clients position.
 * @return ETrue if clients positions are equal. Otherwise EFalse.
 */
TBool CT_LbsSimulationPsyPosTp400::TwoClientRequestL(TBool aIsSps,
		TInt aSecondClientDelay, TInt aMaxUpdateAge, TReal* aLatitudeDiff,
		TReal* aLongitudeDiff)
	{
	_LIT(KErrorRequestingPosition, "Position Request Error.");
	_LIT(KGetUpdateOptionsErr, "Error %d when getting update options.");
	_LIT(KSetUpdateOptionsErr, "Error %d when setting Max Update Age option.");

#ifdef __WINS__
	_LIT(KTrpNmeaFile, "z:\\system\\test\\testdata\\trpnmeadatafile.nme");
	_LIT(KTrpSpsFile, "z:\\system\\test\\testdata\\trpspsdatafile.sps");
#else
	_LIT(KTrpNmeaFile, "c:\\system\\test\\testdata\\trpnmeadatafile.nme");
	_LIT(KTrpSpsFile, "c:\\system\\test\\testdata\\trpspsdatafile.sps");
#endif
	
	iOldTrpMode = TrpModeL();
	SetTrpModeL(KTrpModeEnable);
	
	//Creating client subsessions to position server.
	RPositioner positioner1;
	RPositioner positioner2;
	if (aIsSps)
		{
		OpenNewSourceFileLC(KTrpSpsFile, positioner1);
		OpenNewSourceFileLC(KTrpSpsFile, positioner2);
		}
	else
		{
		OpenNewSourceFileLC(KTrpNmeaFile, positioner1);
		OpenNewSourceFileLC(KTrpNmeaFile, positioner2);
		}
	
	//Seting Max Update Age option for second Positioner.
	TPositionUpdateOptions posOption;
	TInt err = positioner2.GetUpdateOptions(posOption);
	AssertTrueL(err == KErrNone, KGetUpdateOptionsErr, err);

	posOption.SetMaxUpdateAge(aMaxUpdateAge);
	err = positioner2.SetUpdateOptions(posOption);
	AssertTrueL(err == KErrNone, KSetUpdateOptionsErr, err);

	TPositionInfo fix1;
	TPositionInfo fix2;
	
	//Position request of First client.
	err = PerformSyncRequest(fix1, positioner1);
	AssertTrueL(err == KErrNone, KErrorRequestingPosition, err);
	
	//Delay of second positioner.
	User::After(aSecondClientDelay);
	
	//Position request of Second client.
	err = PerformSyncRequest(fix2, positioner2);
	AssertTrueL(err == KErrNone, KErrorRequestingPosition, err);
	
	//Getting fixed positions.
	TPosition pos1;
	fix1.GetPosition(pos1);
	TPosition pos2;
	fix2.GetPosition(pos2);

	//Closing positioners
	CleanupStack::PopAndDestroy(&positioner2);
	CleanupStack::PopAndDestroy(&positioner1);
	
	//Seting longitude and latitude difference.
	if (aLatitudeDiff != NULL)
		{
		*aLatitudeDiff = pos2.Latitude() - pos1.Latitude();
		}
	if (aLongitudeDiff != NULL)
		{
		*aLongitudeDiff = pos2.Longitude() - pos1.Longitude();
		}
	
	return pos1.Latitude() == pos2.Latitude() && pos1.Longitude() == pos2.Longitude();
	}
示例#16
0
EXPORT_C TBool Compare_ModuleUpdateOptions(TPositionUpdateOptions& aModUpdateOptsSideA, TPositionUpdateOptions& aModUpdateOptsSideB)
	{
	// Compare base class items.
	if(aModUpdateOptsSideA.PositionClassSize() != aModUpdateOptsSideB.PositionClassSize())
		{
			return EFalse;
		}

	if(aModUpdateOptsSideA.PositionClassType() != aModUpdateOptsSideB.PositionClassType())
		{
			return EFalse;
		}
	
	// Compare interval option.
	if(aModUpdateOptsSideA.UpdateInterval() != aModUpdateOptsSideB.UpdateInterval())
		{
			return EFalse;
		}
	
	// Compare timeout option.
	if(aModUpdateOptsSideA.UpdateTimeOut() != aModUpdateOptsSideB.UpdateTimeOut())
		{
			return EFalse;
		}

	// Compare maxage option.
	if(aModUpdateOptsSideA.MaxUpdateAge() != aModUpdateOptsSideB.MaxUpdateAge())
		{
			return EFalse;
		}

	// Compare partial update option.
	if(aModUpdateOptsSideA.AcceptPartialUpdates() != aModUpdateOptsSideB.AcceptPartialUpdates()) 
		{
			return EFalse;
		}
		
	return ETrue;
	}
TVerdict CTrackingSessionStep::doTestStepL()
/**
 * @return - TVerdict code
 * Override of base class pure virtual
 * Our implementation only gets called if the base class doTestStepPreambleL() did
 * not leave. That being the case, the current test result value will be EPass.
 */
	{
    StandardPrepareL();

    const TInt KInterval = 1 * KSecondsToMicro;
    const TTimeIntervalMicroSeconds KFirstRequestDelay = 200 * 1000; // 0.2 sec
    const TTimeIntervalMicroSeconds KNormalRequestDelay = 200 * 1000; // 0.2 sec
    const TInt KDiff = 200 * 1000; // 0.2 sec
    const TInt KIntervalError = 100 * 1000; // 0.1 sec

    TRequestStatus status;
    TWatch watch;
    TTime secondRequest, stopTracking;
    TInt interval;

    HPositionGenericInfo* genInfo = HPositionGenericInfo::NewLC();

    // setup : only PSY6
    ToggleModuleL(KUidLcfPsy1, EFalse);
    ToggleModuleL(KUidLcfPsy3, EFalse);
    
    User::After(KSecond * 7);
        
    InitPsyListInDefaultProxyL();

    // make one request to allow default proxy rebuild its database
    // this will guarantee that first request will be as fast as possible
    TPositionCourseInfo courseInfo;
    PositionRequestWithCheck(courseInfo, KErrArgument, KNullUid);

    // setup tracking session
    TPositionUpdateOptions updateOptions;
    updateOptions.SetUpdateInterval(KInterval);
    iPositioner.SetUpdateOptions(updateOptions);

    // 1st request
    // first request must be quick
    watch.Tick();
    PositionRequestWithCheck(*genInfo, KErrNone, KUidLcfPsy6);
    if(watch.ElapsedFromTick() > KFirstRequestDelay)
        {
        ERR_PRINTF1(KFirstDelayTooLong);
        SetTestStepResult(EFail);
        }
    
    // drop delay and make 2nd and 3rd requests
    genInfo->ClearRequestedFields();
    {
        watch.Tick();
        PositionRequestWithCheck(*genInfo, KErrNone, KUidLcfPsy6);
        secondRequest.UniversalTime();
        interval = (TInt) watch.ElapsedFromTick().Int64();
        if(Abs(interval - KInterval) > KIntervalError)
            {
            ERR_PRINTF1(KSecondDelayOutOfRange);
            SetTestStepResult(EFail);
            }
        
        watch.Tick();
        PositionRequestWithCheck(*genInfo, KErrNone, KUidLcfPsy6);
        interval = watch.ElapsedFromTick().Int64();
        if(Abs(interval - KInterval) > KIntervalError)
            {
            ERR_PRINTF1(KThirdDelayOutOfRange);
            SetTestStepResult(EFail);
            }
    }

    // stop tracking
    updateOptions.SetUpdateInterval(TTimeIntervalMicroSeconds(0));
    iPositioner.SetUpdateOptions(updateOptions);
    stopTracking.UniversalTime();

    // psy6 must return event log
    genInfo->SetRequestedField(KPSY6FieldEventLog);
    watch.Tick();
    PositionRequestWithCheck(*genInfo, KErrNone, KUidLcfPsy6);
    if(watch.ElapsedFromTick() > KNormalRequestDelay)
        {
        ERR_PRINTF1(KNormalDelayTooBig);
        SetTestStepResult(EFail);
        }
    
    // Analyze event log from PSY6
    TQueryEvent* eventArray = GetPsy6EventLogL(*genInfo);

    TInt32 logSize;
    if(KErrNone != genInfo->GetValue(KPSY6FieldEventLogSize, logSize))
        {
        ERR_PRINTF1(KFailedReadLogsize);
        SetTestStepResult(EFail);
        return TestStepResult();
        }
    
    TUint expectedEvents[] = {EUpdate, 
                              ETrackingStart,
                              EUpdate,
                              EUpdate,
                              ETrackingStop, 
                              EUpdate};
    TUint numExpectedEvents = sizeof(expectedEvents) / sizeof(TUint);

    CheckExpectedResult(logSize, numExpectedEvents, KWrongEventNumberPSY6);

    // check event types
    for (TInt32 index = 0; index < Min(logSize, numExpectedEvents); index++)
        {
        TQueryEvent& event = *(eventArray + index);
        CheckExpectedResult(event.iEventType, expectedEvents[index], KUnexpectedEvent);
        }

    // check event times
    if(logSize != numExpectedEvents)
        {
        ERR_PRINTF1(KCannotCheckEventTimes);
        SetTestStepResult(EFail);
        return TestStepResult();
        }
    
    
    // ( ETrackingStart should have happenned right after first
    // request was completed )
    // Harley: Because of intelligent Default Proxy change, the tracking start
    // shall happen just before the second location request is issued to the PSY.
    TQueryEvent& event = *(eventArray + 1);
    if(Abs(secondRequest.MicroSecondsFrom(event.iTime).Int64()) > KDiff)
        {
        ERR_PRINTF1(KStartEventBeyondExpectendRange);
        SetTestStepResult(EFail);
        }
    
    // ETrackingStop should have happenned right after second
    // SetUpdateOptions
    event = *(eventArray + 4);

    if(Abs(stopTracking.MicroSecondsFrom(event.iTime).Int64()) > KDiff)
        {
        ERR_PRINTF1(KStopEventBeyondExpectendRange);
        SetTestStepResult(EFail);
        }
    // cleanup
    CleanupStack::PopAndDestroy(genInfo);
    StandardCleanup();
	return TestStepResult();
	}
void CGpsDataHandler::RunL() {
#ifndef __SERIES60_3X__
	TPtr8 pBuffer = iBuffer->Des();

	THostName aHostName;
	TInquirySockAddr aInquiry;
	TInt aServiceClass;

	switch(iEngineStatus) {
		case EGpsResolving:
			if(iStatus == KErrNone) {
				// Next device found
				aHostName = iNameEntry().iName;

				aInquiry = TInquirySockAddr::Cast(iNameEntry().iAddr);
				aServiceClass = aInquiry.MajorServiceClass();
				iBTAddr.SetBTAddr(aInquiry.BTAddr());
				iBTAddr.SetPort(1);

				if(aServiceClass & 0x08 || aHostName.Find(_L("GPS")) != KErrNotFound || aHostName.Find(_L("gps")) != KErrNotFound) {
					// Found Positioning device
					if(iSocket.Open(iSocketServ, KBTAddrFamily, KSockStream, KRFCOMM) == KErrNone) {
						iEngineStatus = EGpsConnecting;
						//iResolver.Close();

						iSocket.Connect(iBTAddr, iStatus);
						SetActive();
					}
					else {
						iSocketServ.Close();
						iEngineStatus = EGpsDisconnected;
						iObserver->GpsError(EGpsConnectionFailed);
					}
				}
				else {
					// Get next
					iResolver.Next(iNameEntry, iStatus);
    				SetActive();
				}

				// TODO - Is correct device?

			}
			else if(iStatus == KErrHostResNoMoreResults) {
				// No (more) devices found
				iSocketServ.Close();
				iEngineStatus = EGpsDisconnected;
				iGpsDeviceResolved = false;
				iObserver->GpsError(EGpsDeviceUnavailable);
			}
			else {
				iSocketServ.Close();
				iEngineStatus = EGpsDisconnected;
				iObserver->GpsError(EGpsDeviceUnavailable);
			}
			break;
		case EGpsConnecting:
			if(iStatus == KErrNone) {
				iEngineStatus = EGpsReading;
				iGpsDeviceResolved = true;
				iResolver.Close();

				pBuffer.Zero();

				iSocket.Recv(iChar, 0, iStatus);
				SetActive();
			}
			else {
				if(iGpsDeviceResolved) {
					iSocket.Close();
					iSocketServ.Close();
					iEngineStatus = EGpsDisconnected;
					iObserver->GpsError(EGpsConnectionFailed);
				}
				else {
					// Get next
					iEngineStatus = EGpsResolving;
					iResolver.Next(iNameEntry, iStatus);
					SetActive();
				}
			}
			break;
		case EGpsReading:
			if(iStatus == KErrNone) {
				iEngineStatus = EGpsConnected;

				if(pBuffer.Length() + iChar.Length() > pBuffer.MaxLength()) {
					iBuffer = iBuffer->ReAlloc(pBuffer.MaxLength()+iChar.Length());
					pBuffer.Set(iBuffer->Des());
				}

				pBuffer.Append(iChar);
				ProcessData();
			}
			else {
				iSocket.Close();
				iSocketServ.Close();
				iEngineStatus = EGpsDisconnected;
				iObserver->GpsError(EGpsConnectionFailed);
			}
			break;
		case EGpsDisconnecting:
			iResolver.Close();
			iSocket.Close();
			iSocketServ.Close();
			iEngineStatus = EGpsDisconnected;
			break;
		default:;
	}
#else
	switch(iEngineStatus) {
		case EGpsReading:
			iEngineStatus = EGpsConnected;
			
			if(iStatus == KErrNone) {
				TPosition aPosition;
				iPositionInfo.GetPosition(aPosition);

				iObserver->GpsData(aPosition.Latitude(), aPosition.Longitude(), aPosition.HorizontalAccuracy());
				
				if( !iGpsWarmedUp ) {
					iGpsWarmedUp = true;
					
					TPositionUpdateOptions aOptions;
					aOptions.SetUpdateTimeOut(30000000);	
					aOptions.SetAcceptPartialUpdates(true);
					iPositioner.SetUpdateOptions(aOptions);
				}
			}
			else {
				iObserver->GpsError(EGpsDeviceUnavailable);
			}
			break;
		case EGpsDisconnecting:
			iPositioner.Close();
			iPositionServ.Close();
			iEngineStatus = EGpsDisconnected;
			break;
		default:;
	}
#endif
}
void CGpsDataHandler::ResolveAndConnectL() {
	TInt aResult;

#ifndef __SERIES60_3X__

	if((aResult = iSocketServ.Connect()) == KErrNone) {
		if(iGpsDeviceResolved) {
			if((aResult = iSocket.Open(iSocketServ, KBTAddrFamily, KSockStream, KRFCOMM)) == KErrNone) {
				iEngineStatus = EGpsConnecting;

				iSocket.Connect(iBTAddr, iStatus);
				SetActive();
			}
		}
		else {
			_LIT(KLinkMan, "BTLinkManager");
			//_LIT(KLinkMan, "RFCOMM");
			TProtocolName aProtocolName(KLinkMan);

			if((aResult = iSocketServ.FindProtocol(aProtocolName, iProtocolDesc)) == KErrNone) {
				if((aResult = iResolver.Open(iSocketServ, iProtocolDesc.iAddrFamily, iProtocolDesc.iProtocol)) == KErrNone) {
					TInquirySockAddr aInquiry;
					aInquiry.SetIAC(KGIAC);
					//aInquiry.SetMajorServiceClass(EMajorServicePositioning);
					aInquiry.SetAction(KHostResName | KHostResInquiry | KHostResIgnoreCache);
					iResolver.GetByAddress(aInquiry, iNameEntry, iStatus);

					iEngineStatus = EGpsResolving;
					SetActive();
				}
			}
		}
	}

	if(aResult != KErrNone) {
		iEngineStatus = EGpsDisconnected;
		iSocketServ.Close();
		iObserver->GpsError(EGpsConnectionFailed);
	}
#else
	TBool aDeviceFound = false;

	if((aResult = iPositionServ.Connect()) == KErrNone) {
		iEngineStatus = EGpsConnecting;
		TUint aNumOfModules;

		if((aResult = iPositionServ.GetNumModules(aNumOfModules)) == KErrNone) {
			TPositionModuleInfo aModuleInfo;
			TUid aModuleId;
			
			for(TUint i = 0; i < aNumOfModules && aResult == KErrNone && !aDeviceFound; i++) {
				if((aResult = iPositionServ.GetModuleInfoByIndex(i, aModuleInfo)) == KErrNone) {
					aModuleId = aModuleInfo.ModuleId();
					
					if(aModuleInfo.IsAvailable() && aModuleInfo.TechnologyType() != TPositionModuleInfo::ETechnologyNetwork) {
						aDeviceFound = true;
					}
				}
			}

			if(aResult == KErrNone && aDeviceFound) {
				if((aResult = iPositioner.Open(iPositionServ, aModuleId)) == KErrNone) {
					iEngineStatus = EGpsConnected;

					if((aResult = iPositioner.SetRequestor(CRequestor::ERequestorService, CRequestor::EFormatApplication, _L("Buddycloud"))) == KErrNone) {
						iEngineStatus = EGpsReading;
						
						TPositionUpdateOptions aOptions;
						aOptions.SetAcceptPartialUpdates(true);				
						iPositioner.SetUpdateOptions(aOptions);	
						
						iPositioner.NotifyPositionUpdate(iPositionInfo, iStatus);
						SetActive();
					}

					if(aResult != KErrNone) {
						iPositioner.Close();
					}
				}
			}
		}
	}

	if(aResult != KErrNone || !aDeviceFound) {
		iEngineStatus = EGpsDisconnected;
		iPositionServ.Close();
		iObserver->GpsError(EGpsConnectionFailed);
	}
#endif
}
// ---------------------------------------------------------
// CT_LbsClientPosTp178::StartL
//
// (other items were commented in a header).
// ---------------------------------------------------------
//
void CT_LbsClientPosTp178::StartL()
    {
    _LIT(KServiceAccept, "SAAA");
    
    SetupPsyL(iUidTestPsy3);
    
    RPositioner positioner;
    TPositionInfo info = TPositionInfo();
    
    ConnectL();
    
    User::LeaveIfError(positioner.Open(iPosServer,iUidTestPsy3));
    CleanupClosePushL(positioner);
    
    TInt Err = positioner.SetRequestor(CRequestor::ERequestorService,
        CRequestor::EFormatApplication, KServiceAccept);
    
    TPositionUpdateOptions updateOptionsLong, updateOptionsShort;
    
    TTimeIntervalMicroSeconds longInterval(7000000);
    
    updateOptionsLong.SetUpdateTimeOut(longInterval);
    Err = positioner.SetUpdateOptions(updateOptionsLong);
    
    TTimeIntervalMicroSeconds shortInterval(2000000);
    updateOptionsShort.SetUpdateTimeOut(shortInterval);
    
    TPositionUpdateOptions theUpdateOptions;
    Err = positioner.GetUpdateOptions(theUpdateOptions);
    
    if (theUpdateOptions.UpdateTimeOut() != updateOptionsLong.UpdateTimeOut() ||
        updateOptionsLong.UpdateTimeOut() != longInterval)
    {
        _LIT(KUpdateOptions, "The update option was not set correctly");
        LogErrorAndLeaveL(KUpdateOptions);
    }
    
    _LIT(KDelayMsg, "The successfull requests was completed within %d microsecs.");
    _LIT(KCancelMsg, "The canceled requests was completed within %d microsecs.");
    
    TRequestStatus status;
    
    for (TInt i = 0; i < 10; i++) // makes 10 test inorder to get some statistic
    {         
        
        positioner.SetUpdateOptions(updateOptionsLong);
        TTime requestStartTime;
        
        requestStartTime.UniversalTime();
        positioner.NotifyPositionUpdate(info, status);
        User::WaitForRequest(status);
        TTime requestStopTime;
        requestStopTime.UniversalTime();
        
        TTimeIntervalMicroSeconds durationMicro = requestStopTime.MicroSecondsFrom(requestStartTime);
        
        TInt duration = durationMicro.Int64();
        
        TBuf<100> timeMsg;
        timeMsg.Format(KDelayMsg, duration);
        INFO_PRINTF1(timeMsg);
        
        //check error status
        if (status != KErrNone)
        {
            _LIT(KErrPositionRequest, "error code returned from NotifyPositionUpdate, error code = %d");
            TBuf<100> buf;
            buf.Format(KErrPositionRequest, status.Int());
            LogErrorAndLeaveL(buf);
        }
        
        
        TTimeIntervalMicroSeconds shortInterval(2000000);
        updateOptionsShort.SetUpdateTimeOut(shortInterval);
        
        positioner.SetUpdateOptions(updateOptionsShort);
        
        requestStartTime.UniversalTime();
        positioner.NotifyPositionUpdate(info, status);
        User::WaitForRequest(status);
        requestStopTime.UniversalTime();
        
        durationMicro = requestStopTime.MicroSecondsFrom(requestStartTime);
        
        duration = durationMicro.Int64();
        
#ifdef __WINS__
        TTimeIntervalMicroSeconds winsFail(100000);
        durationMicro = TTimeIntervalMicroSeconds(durationMicro.Int64()+winsFail.Int64());
#endif
        
        timeMsg.Format(KCancelMsg, duration);
        INFO_PRINTF1(timeMsg);
        
        
        if (status != KErrTimedOut)
        {
            _LIT(KErrPositionRequest, "Request did not returned KErrTimedOut, status code = %d.");
            TBuf<100> buf;
            buf.Format(KErrPositionRequest, status.Int());
            LogErrorAndLeaveL(buf);
        }

        //Check that the request was not aborted before the Interval
        //Remove this condition if a lot of data is needed in test log.
        if (durationMicro < shortInterval)
        {
            _LIT(KErrInterval, " The request was aborted before the set timed out ");
            LogErrorAndLeaveL(KErrInterval);
        }
        
        
    } // end for loop
    CleanupStack::PopAndDestroy(1); //positioner
    Disconnect();

    // Do timeout test
    TestTimeoutL();

    // Do cancel test
    TestCancelL();

    // ESLI-5QRA7U just check that it is not possible to set a timeout that is less than
    // the update interval
    TestOptionL();
    }
// ---------------------------------------------------------
// CT_LbsClientPosTp178::TestTimeout
//
// (other items were commented in a header).
// ---------------------------------------------------------
//
void CT_LbsClientPosTp178::TestTimeoutL()
    {
    _LIT(KSTART, "TestTimeout()");
    _LIT(KEND, "TestTimeout() passed");
    _LIT(KTIME, "Request took %d us");
    
    // Setup verification stuff
    INFO_PRINTF1(KSTART);
    
    //TPrivDlgDiagnostics tmpdiag;
    TTime requestStartTime;
    TTime requestStopTime;
    TTimeIntervalMicroSeconds durationMicro;
    
    TBuf<100> buf;
    
	_LIT(KService, "SAAA");
    TPositionUpdateOptions updateOptions;
    
    TTimeIntervalMicroSeconds longInterval(7000000);
    ConnectL();
    SetupPsyL(iUidTestPsy3);

    OpenPositionerByName(iUidTestPsy3);    
    updateOptions.SetUpdateTimeOut(longInterval);
    
    // Access protected member (iPositioner) here
    iPositioner.SetUpdateOptions(updateOptions);
    
    _LIT(KONE, "Perform first request, should NOT time out");
    INFO_PRINTF1(KONE);
    
    requestStartTime.UniversalTime();
    //Make one request to verify psy
    PerformRequestL(KService, CRequestor::ERequestorService, CRequestor::EFormatApplication);
    
    CheckRequestResultL(KErrNone);
    requestStopTime.UniversalTime();

    durationMicro = requestStopTime.MicroSecondsFrom(requestStartTime);
    TInt duration = durationMicro.Int64();
    
    buf.Format(KTIME, duration);
    INFO_PRINTF1(buf);
    
    ClosePositioner();
    
    OpenPositionerByName(iUidTestPsy3);
    // ECancelButton means that the Automatised class should wait for a cancel call
    // before returning result
    
    updateOptions.SetUpdateTimeOut(longInterval);
    
    // Access protected (iPositioner) member here
    iPositioner.SetUpdateOptions(updateOptions);
    
    _LIT(KTWO, "Perform second request, should not time out");
    INFO_PRINTF1(KTWO);
    
    //Make one request to verify psy
    TPositionInfo info = TPositionInfo();
    requestStartTime.UniversalTime();
    TInt err = PerformSyncRequest(KService, &info);
    requestStopTime.UniversalTime();
    
    if (err != KErrNone)
    {
        _LIT(KError, "Wrong result from iStatus, should be KErrNone, was %d");
        TBuf<100> buf;
        buf.Format(KError, err);
        LogErrorAndLeaveL(buf);
    }
    
    durationMicro = requestStopTime.MicroSecondsFrom(requestStartTime); 
    duration = durationMicro.Int64();
    
    buf.Format(KTIME, duration);
    INFO_PRINTF1(buf);
    
    ClosePositioner();
    Disconnect();

    INFO_PRINTF1(KEND);
}