location.get — Get location information.
location.get
timeout
|
-callback
callbackProc
[
-timeout
timeout
]
[
-onerror
onErrorProc
]
The location.get command operates in two ways:
The simplest way is to simply call the command with a
timeout
argument. The program will block until
the command returns an answer, in the form of a hash table (see
below), which could take up to several minutes.
The alternative way of calling
location.get is to pass it a
-callback
,
which is the name of a proc that will be called when
the information is available, with a hash table
specifying the results. Program execution continues
and does not block on the location.get call. The
callbackProc
callbackProc
takes one argument,
which is a hash of information about the location.
When using -callback
it is also
possible to specify a -timeout
option
(in seconds), and an -onerror
option.
This is used in case of errors: the specified
onErrorProc
Either method will supply the user with a hash table with the following elements. See also the JavaDocs here: javax/microedition/location/Location
lat
: latitude.
lon
: longitude.
alt
: altitude.
haccuracy
: horizontal accuracy, in meters.
vaccuracy
: vertical accuracy, in meters.
location_method
: contains a hash table of
its own with information about the method used to ascertain the
location. Possible values include:
ASSISTED
: Location method is assisted.
UNASSISTED
: Location method is unassisted.
NETWORKBASED
: Location is derived
from the network.
TERMINALBASED
: Location is obtained
from a GPS terminal.
ANGLEOFARRIVAL
: Location method
Angle of Arrival for cellular / terrestrial RF system.
CELLID
: Location method Cell-ID for
cellular (in GSM, this is the same as CGI, Cell Global
Identity).
SATELLITE
: Location method using
satellites (for example, Global Positioning System
(GPS)).
SHORTRANGE
: Location method
Short-range positioning system (for example, Bluetooth
LP).
TIMEDIFFERENCE
: Location method
Time Difference for cellular / terrestrial RF system (for
example, Enhanced Observed Time Difference (E-OTD) for
GSM).
TIMEOFARRIVAL
: Location method Time
of Arrival (TOA) for cellular / terrestrial RF system.
speed
: ground speed, in meters per second.
course
: course, in degrees relative to true
north.