Original Author Paul Laughton, 2011
Page 191
De Re BASIC!
GPS Control commands
Gps.open {{<status_nvar>},{<time_nexp>},{<distance_nexp>}}
Connects to the GPS hardware and starts it reporting location information. This command must be
issued before using any of the other GPS commands.
The three parameters are all optional; use commas to indicate missing parameters. The parameters are
available for advanced usage. The most common way to use this command is simply GPS.open.
If you provide a status return variable <status_nvar>, it is set to 1.0 (TRUE) if the open succeeds, or 0.0
(FALSE) if the open fails. If the open fails, you may get information about the failure from the
GETERROR$() function.
The time interval expression <time_nexp> sets the minimum time between location updates. The time is
in milleseconds. If you do not set an interval, it defaults to the minimum value allowed by your Android
device. This is typically one second. Note: to reduce battery usage, Android recommends a minimum
interval of five minutes.
If you provide a distance parameter <distance_nexp>, it is a numerical expression that sets the minimum
distance between location updates, in meters. That is, your program will not be informed of location
changes until your device has moved at least as far as the minimum distance setting. If you do not set a
distance, any location change that can be detected will be reported.
This command attempts to get an initial "last known location". If the GPS hardware does not report a
last known location, BASIC! tries to get one from the network location service. If neither source can
provide one, the location information is left empty. If you use GPS commands to get location
information before the GPS hardware starts reporting current location information, you will get this
"last known location" data. The last known location may be stale, hours or days old, and so may not be
useful.
Gps.close
Disconnects from the GPS hardware and stops the location reports. GPS is automatically closed when
you stop your BASIC! program. GPS is not turned off if you tap the HOME key while your GPS program is
running.
Gps.status {{<status_var>}, {<infix_nvar>},{inview_nvar}, {<sat_list_nexp>}}
Returns the data from a GPS status report. The parameters are all optional; use commas to indicate
omitted parameters (see Optional Parameters).
This kind of report contains the type of the last GPS event and a list of the satellites that were detected
by the GPS hardware when that event occurred. As a convenience, this command analyzes the satellite
list to report how many satellites were detected ("in view") and how many of those were used in the last
location fix ("in fix").