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();
	}
Beispiel #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);
		}
	}
Beispiel #3
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));
}
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 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();

	}
/*
 * 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();
	}