GPS

The GPS sample App

This sample app demonstrates the usage of the GNSS service along with a few other services and APIs to find nearby points of interest using reverse-geocoding, along with their distances. It also allows for finding the current location in the form of a physical address.

It uses the following internal services and APIs:

As well as the following external libraries and APIs:

  • cURL, a library for transferring data with URLs.
  • MapBox, a 3rd-party API that performs geocoding on coordinates.

The gpsApp is a sample application exposing the above services and APIs and demonstrating their usage as well as how they can work together to solve a real world problem. This sample app provides two executables, one for the service and another one for the controller. You can find:

  • An .adef file:
    • gpsApp.adef to define the executables, processes, requires, bindings, and externals.
  • An .sdef file:
    • gpsApp.sdef to define the commands, and the system structure
  • Two .cdef files:
    • Component.cdef for the service component
    • Component.cdef for the controller
Note
The app is built along with a complete system using the .sdef in order to use the command line tools to control the application.

Go to the sample code.

Install the sample app:

$ cd apps/sample/gpsApp
$ make wp76xx
$ app install gpsApp.wp76xx.update <ip address>

where ip address is the address of your target device.

If you're not using a Sierra Wireless WP76xx module, replace wp76xx with the appropriate identifier for your target.

Note
The gpsApp has only been tested on WP76xx.

Usage

To use the app to find your current location, use the following command :

map locate
Note
An optional accuracy option can be set to fine-tune the level of accuracy to which an address is generated. For example, the following command only tries to locate to within 30 meters of accuracy.
map -a 30 locate

To use the app to find points of interest, use the following command :

map find <Name of POI>
Note
Accuracy can be set using the same method as above. A boundary box can also be set to only search within a box. For example, the following command can be used to find a cafe to within a distance of 5 KMs. Accuracy will also be set to 5 meters.
map -a 5 -w 5 find cafe
For more information on specific commands, read the following section taken from the app's help.
"NAME\n"
" map - perform GNSS/positioning operations such as finding nearby places using forward geocoding.\n"
"\n"
"Prerequisites\n"
" A MapBox Access Token is needed for all operations.\n"
" A GNSS receiver as well as data connection are required as well.\n"
"\n"
"SYNOPSIS\n"
" map [OPTION]... COMMAND [Place Name]\n"
" map -h\n"
" map --help\n"
"\n"
"COMMANDS\n"
" find\n"
" Searches for <Place Name> in the proximity of the current coordinates provided by the GNSS\n"
" service and fed into the mapbox api.\n"
"\n"
" locate\n"
" Get the current coordinates using the GNSS service, and feed them into mapbox's reverse-\n"
" geocoding api to turn the coordinates into an address.\n"
"\n"
"OPTIONS\n"
" -w N\n"
" --within=N\n"
" Confine the search to within an imaginary square with sides 2*N KM and your current\n"
" coordinates are at the center of the square. The provided N KMs will be converted\n"
" to coordinates and fed into the mapbox api.\n"
" If not specified, the current coordinates will be used and results will be found,\n"
" within the proximity of the current location.\n"
" -a N\n"
" --accuracy=N\n"
" This is the accuracy in meters to which the device will be located. In other words,\n"
" if the accuracy reaches 20m the algorithm will not try to further the accuracy and use\n"
" the available coordinates.\n"
" If not specified, it will be set to 20 meters by default.\n"