Description

utils/consoleGPS.h provides the following function (from the DICE_GPS- Library) to a console application:

  • s_console_gps_cmds() : delivers the following commands
    • gps get – prints the current location
    • gps google – creates a link to the position in google maps
    • gps time – prints the current gps time
    • gpsSetCAN_longLat <CANID> <interval ms> – get/set CANID(hex) to send the longitude & latitude on the CAN-bus
    • gpsSetCAN_time <CANID> <interval ms> – get/set CANID(hex) to send the time (epoch time) on the CAN-bus

Syntax (example)

#include "utils/consoleGPS.h"
. . .
GPS.begin();
. . .
s_console_string = s_console_gps_cmds( s_console_string );

Parameters

String s_console_string – String that holds the user command. Normally returned by s_console_routine() or a previous console function.

Returns

String : the user command or an empty String “” if the user command was recognised and processed by this function. (see of commands above)

Example Code:

The following example runs on all devices. It uses the embedded GPS receiver if present or uses the GPS information that is distributed on the CAN bus by e.g. dice-GNSS, dice-GSM etc.

#include "consoleLogin.h"
#include "utils/consoleGPS.h"

void setup() {
  GPS.begin();
  console_init(&Serial);
}

void loop() {
  String s_console_string = s_console_routine();  
  s_console_gps_cmds(s_console_string);
}

Notes and Warnings

This console-function and its commands are helpful to test and learn how to work with the DICE_GPS- Library. See the source code as example code for your own application:

C:\Users\yourName\AppData\Local\Arduino15\packages\dice\hardware\samc\1.0.0\libraries\Console\src\... 

In a ‘real world’ application, these commands might not be required but during development it could be helpful to test the GPS library. During commissioning it could be used to find the right mounting spot for the dice-GNSS or its antenna.

Please keep in mind that each included file and its used function increase the size of the resulting application. So in order to keep the application binaries as small as possible, include only functions that are really necessary for the final application.

An example can be found in the Arduino IDE menu:
File -> Examples -> Consoles -> Dev_Console

See also

DICE_GPS- Library
Datapool – Library