|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.openlapi.Location
public class Location
The Location class represents the standard set of basic location information. This includes the timestamped coordinates, accuracy, speed, course, and information about the positioning method used for the location, plus an optional textual address.
The location method is indicated using a bit field. The individual bits are defined using constants in this class. This bit field is a bitwise combination of the location method technology bits (MTE_*), method type (MTY_*) and method assistance information (MTA_*). All other bits in the 32 bit integer than those that have defined constants in this class are reserved and MUST not be set by implementations (i.e. these bits must be 0).
A Location object may be either 'valid' or 'invalid'. The validity can be queried using the isValid method. A valid Location object represents a location with valid coordinates and the getQualifiedCoordinates method must return there coordinates. An invalid Location object doesn't have valid coordinates, but the extra info that is obtained from the getExtraInfo method can provide information about the reason why it was not possible to provide a valid Location. For an invalid Location object, the getQualifiedCoordinates method may return either null or some coordinates where the information is not necessarily fully correct. The periodic location updates to the LocationListener may return invalid Location objects if it isn't possible to determine the location.
This class is only a container for the information. When the platform implementation returns Location objects, it MUST ensure that it only returns objects where the parameters have values set as described for their semantics in this class.
Field Summary | |
---|---|
protected AddressInfo |
addressInfo
The AddressInfo associated to the Location object. |
protected java.lang.String |
extraInfo_LIF
Extra info, as an LIF Mobile Location Protocol TS 101 v3.0.0 XML string. |
protected java.lang.String |
extraInfo_NMEA
Extra info, as an NMEA 0183 v3.1 sentence. |
protected java.lang.String |
extraInfo_Text
Extra info, as a user readable string. |
protected int |
locationMethod
A bitfield identifying the used location method, the default is zero (unknown method). |
static int |
MTA_ASSISTED
Location method is assisted by the other party (Terminal assisted for Network based, Network assisted for terminal based). |
static int |
MTA_UNASSISTED
Location method is unassisted. |
static int |
MTE_ANGLEOFARRIVAL
Location method Angle of Arrival for cellular / terrestrial RF system. |
static int |
MTE_CELLID
Location method Cell-ID for cellular (in GSM, this is the same as CGI, Cell Global Identity). |
static int |
MTE_SATELLITE
Location method using satellites (for example, Global Positioning System (GPS)). |
static int |
MTE_SHORTRANGE
Location method Short-range positioning system (for example, Bluetooth LP). |
static int |
MTE_TIMEDIFFERENCE
Location method Time Difference for cellular / terrestrial RF system (for example, Enhanced Observed Time Difference (E-OTD) for GSM). |
static int |
MTE_TIMEOFARRIVAL
Location method Time of Arrival (TOA) for cellular / terrestrial RF system. |
static int |
MTY_NETWORKBASED
Location method is of type network based. |
static int |
MTY_TERMINALBASED
Location method is of type terminal based. |
protected QualifiedCoordinates |
qualifiedCoordinates
The coordinates of this location and their accuracy. |
protected long |
timestamp
The time the location was obtained, using the local clock in the terminal in milliseconds. |
protected boolean |
valid
Whether this Location instance represents a valid location with coordinates or an invalid one where all the data. |
Constructor Summary | |
---|---|
protected |
Location()
A protected constructor for the Location to allow implementations of LocationProviders to construct the Location instances. |
Method Summary | |
---|---|
AddressInfo |
getAddressInfo()
Returns the AddressInfo associated with this Location object. |
float |
getCourse()
Returns the terminal's course made good in degrees relative to true north. |
java.lang.String |
getExtraInfo(java.lang.String mimetype)
Returns extra information about the location. |
protected static Location |
getInvalid()
OpenLAPI specific factory method to return an invalid Location object. |
int |
getLocationMethod()
Returns information about the location method used. |
QualifiedCoordinates |
getQualifiedCoordinates()
Returns the coordinates of this location and their accuracy. |
float |
getSpeed()
Returns the terminal's current ground speed in meters per second (m/s) at the time of measurement. |
long |
getTimestamp()
Returns the time stamp at which the data was collected. |
boolean |
isValid()
Returns whether this Location instance represents a valid location with coordinates or an invalid one where all the data, especially the latitude and longitude coordinates, may not be present. |
protected void |
setCourse(float course)
Sets the terminal's course, ensuring that the value is always in the range [0.0,360.0) degrees. |
protected void |
setSpeed(float speed)
Set the current ground speed of the location object in m/s. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int MTA_ASSISTED
public static final int MTA_UNASSISTED
public static final int MTE_ANGLEOFARRIVAL
public static final int MTE_CELLID
public static final int MTE_SATELLITE
public static final int MTE_SHORTRANGE
public static final int MTE_TIMEDIFFERENCE
public static final int MTE_TIMEOFARRIVAL
public static final int MTY_NETWORKBASED
public static final int MTY_TERMINALBASED
protected AddressInfo addressInfo
protected java.lang.String extraInfo_LIF
protected java.lang.String extraInfo_NMEA
protected java.lang.String extraInfo_Text
protected int locationMethod
protected QualifiedCoordinates qualifiedCoordinates
protected long timestamp
protected boolean valid
Constructor Detail |
---|
protected Location()
This constructor sets the fields to implementation specific default values. Location providers are expected to set the fields to the correct values after constructing the object instance.
Method Detail |
---|
protected static Location getInvalid()
public AddressInfo getAddressInfo()
public float getCourse()
public java.lang.String getExtraInfo(java.lang.String mimetype)
This specification does not require implementations to support any extra information type.
The following MIME types are defined here together with their definitions in order to ensure interoperability of implementations wishing to use these types. The definition of these types here is not an indication that these formats are preferred over any other format not defined here.
When the MIME type is "application/X-jsr179-location-nmea", the returned string shall be a valid sequence of NMEA sentences formatted according to the syntax specified in the NMEA 0183 v3.1 specification. These sentences shall represent the set of NMEA sentences that are related to this location at the time this location was created.
When the MIME type is "application/X-jsr179-location-lif", the returned string shall contain an XML formatted document containing the "pd" element defined in the LIF Mobile Location Protocol TS 101 v3.0.0 as the root element of the document.
When the MIME type is "text/plain", the returned string shall contain textual extra information that can be displayed to the end user.
mimetype
- the MIME type of the requested extra information
public int getLocationMethod()
If the location is determined by combining several location technologies, the returned value may have several MTE_* bits set.
If the used location method is unknown, the returned value must have all the bits set to zero.
Only bits that have defined constants within this class are allowed to be used. Other bits are reserved and must be set to 0.
public QualifiedCoordinates getQualifiedCoordinates()
public float getSpeed()
public long getTimestamp()
public boolean isValid()
getExtraInfo(String)
public java.lang.String toString()
toString
in class java.lang.Object
protected void setCourse(float course) throws java.lang.IllegalArgumentException
course
- the course to set.
java.lang.IllegalArgumentException
- if the course is outside the range.protected void setSpeed(float speed) throws java.lang.IllegalArgumentException
speed
- must be non-negative or Float.NaN if unknown.
java.lang.IllegalArgumentException
- if the speed is negative
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |