ztcl::location get
Gives one position.
ztcl::location get ?-accuracy best|balanced|low? ?-timeout MS? -command SCRIPT
Description
Gives a handle, and runs SCRIPT one time with a dict appended, from the event loop: a position, or {error denied}, {error unavailable}, or {error timeout}. The handle then ends.
A position has the keys latitude and longitude (degrees), altitude and vaccuracy (meters, when the device has them), accuracy (the radius in meters), speed (m/s) and course (degrees from north) when the device has them, and time (milliseconds of the epoch).
-accuracy best is the GPS, balanced about 100 meters, and low about 3 kilometers; the default is best. -timeout MS gives {error timeout} when no position came in MS milliseconds, 0 to 3,600,000.
Returns
A handle, such as location1.
Examples
% catch {ztcl::location get -timeout 5000 -command puts} msg; set msg
the location is not available on this platform
Errors
% ztcl::location get
wrong # args: should be "ztcl::location get ?-accuracy best|balanced|low? ?-timeout ms? -command script"
-errorcode TCL WRONGARGS
% ztcl::location get -accuracy gps -command puts
bad accuracy "gps": must be best, balanced, or low
-errorcode NONE
% ztcl::location get -timeout 4000000 -command puts
bad timeout "4000000": must be 0 to 3600000 milliseconds
-errorcode ZTCL LOCATION VALUE
Facts
- Capability
location. A new interpreter does not have it until the host turns it on.- Tcl release
- Tcl 9.1 and 8.6.
- Since
- ztcl 1.0.0-beta.6