For information on how to retrieve locations from the Location Framework (LFW), see
C++ API Documentation > S60 API Reference Guide > C++ API Reference > S60 Platform Services > Location Services > Location Acquisition API
Java API documentation > JavaDocs > JSR-179: Location API
To get a location from the Simulation PSY, a user first needs to connect
to RPositionServer
. Then it is possible to open a sub-session
to Simulation PSY using RPositioner
via RPositionServer
.
Before opening a sub-session to Simulation PSY, the PSY should be enabled
in the S60 platform Location Settings UI.
For example:
TPositionInfo posInfo; TRequestStatus status; RPositionServer positionServer; RPositioner simPSY; User::LeaveIfError(positionServer.Connect()); CleanupClosePushL(positionServer); User::LeaveIfError(simPSY.Open(positionServer)); CleanupClosePushL(simPSY); // Set Requestor information User::LeaveIfError(simPSY.SetRequestor(CRequestor::ERequestorService, CRequestor::EFormatUrl, _L("http://www.example.com"))); simPSY.NotifyPositionUpdate(posInfo, status); User::WaitForRequest(status); // Do something with posInfo CleanupStack::PopAndDestroy(2, &positionServer); // simPSY
Alternatively, the sub-session to Simulation PSY can be opened directly using its positioning plug-in ID, 0x101f7a81.
Simulation PSY supports the class types TPositionInfo
, TPositionCourseInfo
, TPositionSatelliteInfo
and HPositionGenericInfo
, which means that the argument
to RPositioner::NotifyPositionUpdate()
must be of these
classes. HPositionGenericInfo
, TPositionCourseInfo
and TPositionSatelliteInfo
are
all derived from TPositionInfo
.
In the Simulated Movement mode, no class specific position information
is stored in the incoming position class. Only position information specific
to TPositionInfo
is stored.
In the NMEA mode, position data is stored depending on the incoming
position class. For HPositionGenericInfo
, a request field
is present for each retrievable position data. If a field is set as requested
in HPositionGenericInfo
, the Simulation PSY stores the
corresponding position data. For example, if the field EPositionFieldNMEASentences
is
set as requested, the raw NMEA sentences that constitute the position fix
are stored in HPositionGenericInfo
. The number of the
returned NMEA sentences is placed into the EPositionFieldNMEASentences
field.
The returned type is TUint8. The first sentence is placed into the EPositionFieldNMEASentencesStart
field,
the second sentence in the EPositionFieldNMEASentencesStart+1
field,
etc. The returned type is TDesC8
. The format of the returned
location estimates, WGS 84, is used in both NMEA and Simulated Movement mode.
In Fixed Data Mode, no class specific position information is stored
in the incoming position class. Only position information specific to TPositionInfo
is
stored.
When two clients connect to Simulation PSY, two instances are constructed. It is possible for both to read from the configuration file and/or simulation file at the same time. The outputs of the two sessions are completely independent of each other.
It is possible to set update options on a positioning plug-in in the Location Acquisition API (C++) and Location API (JSR-179) (Java). ( See Java Documentation > JavaDocs )
Simulation PSY supports the following update options: timeout, interval and partial updates. Partial updates are only supported in the NMEA mode, meaning that no partial updates could be returned for the Simulated Movement mode. See Location Acquisition API for more information about partial updates.
HPositionGenericInfo
, TPositionCourseInfo
and TPositionSatelliteInfo
are
supported in both modes. Only the NMEA mode supports position data specific
for these position classes.
When trying to open the PSY with RPositioner::Open()
,
one of these error codes could be returned:
KErrNotFound
; Simulation PSY cannot
find a needed file.
KErrCorrupt
; the syntax of the Simulated
Movement file is incorrect or all words are not present.
KErrNotSupported
; the extension of the
simulation file is recognized, neither of SPS nor NME.
When trying to get a location estimate with RPositioner::NotifyPositionUpdate()
,
one of these error codes could be returned:
KPositionQualityLoss
; the configuration
for requests is set to fail in the Simulated Movement mode.
KPositionPartialUpdate
; NMEA is missing
position info and the client allows partial updates.
System wide error codes from TLexer
and Math
Other system wide error codes.
When trying to cancel a location estimate with RPositioner::CancelNotifyPositionUpdate()
,
following error code could be returned:
KErrCancel
; ongoing request is properly
cancelled.