|  |  | Using GPSMan in Command-line Mode

# Using GPSMan in Command-line Mode

The command-line mode can only be used in operating systems supporting command line arguments, namely Unix/Linux systems. For the time being only Garmin receivers are supported in commands requiring a receiver.

In graphical mode GPSMan is launched by invoking `gpsman` or `gpsman.tcl` with either no arguments or a single argument standing for the serial or USB device, while in command-line mode there will always be 2 or more arguments. This is used to distinguish between the two situations, although the graphical mode can be entered from command-line mode.

The general form of invocation is (in the usual Unix notation)

    gpsman [OPTIONS] COMMAND [COMMAND_ARGS]

Some commands accept parameters in the form `NAME=VALUE`. The term parameter when used here referring to arguments of a command has always this meaning. Care should be taken if the value part is a string with spaces (or other characters with special meaning for the shell or system command interpreter) in which case quotes or some other form of quoting should be used.

The possible options are:

`-dev DEVICE`
  gives the serial device path
`-log`
  creates a log file of the serial communication named `logfile` in the GPSMan user directory
`-rec Garmin | Lowrance | Magellan`
  changes the brand of the receiver (NOTE: at present will only work with `Garmin`); this option can be useful to override the options in the preferences file; cannot be used with the `readput` command, nor with the `-prefs` option, and cannot occur after the `-prot` option;
`-prefs PREFSFILE`
  gives the path for an alternative preferences file (read after the user preferences file); cannot be used with the `-rec` option
`-prot PROTOCOL`
  selects the protocol to be used overriding the default protocol given in the preferences file; cannot occur before the `-rec` option; the `show protocols` command can be used to find out which protocols are available

Options not related with `COMMAND` will be silently ignored.

GPSMan exits with either a 0 if the command was successfully executed, or a 1 if not. Some commands will write information to the standard output channel. Error messages can possibly be written to the standard error channel, but most of the errors will not be explained. In case of doubt the graphical mode should be used to see if there are problems with files or the receiver.

Note that in command-line mode the saved state is not restored and the state is not saved unless the graphical mode is entered.

Available commands are:

`is available`
  exits with 0

`is connected`
  exits with 0 if a connection check with the receiver succeeds

`show WHAT`
  writes help information to the standard output

`haslib LIBRARY`
  checks availability of library

`getwrite IN-TYPES FORMAT [OUT-PARAMS] [OUT-TYPES] PATH`
  transfers data from the receiver to a file

`readput FORMAT [IN-PARAMS] [IN-TYPES] PATH [OUT-TYPES]`
  transfers data from a file to the receiver

`getrtimelog PATH [INTERVAL]`
  gets the real-time log from the receiver and saves it to a file

`getfix PATH [TIMEOUT]`
  gets the current fix data and saves it to a file

`getalmanac PATH`
  gets the current almanac data and saves it to a file

`read FORMAT [PARAMS] [TYPES] PATH`
  reads a data file and launches the graphical interface

`translate`
  `IN-FORMAT [IN-PARAMS] [IN-TYPES] IN-PATH [HOW-PARAMS] OUT-FORMAT [OUT-PARAMS] [OUT-TYPES] OUT-PATH` translates from a file format to another one

`start travel [INTERVAL]`
  launches the graphical mode and starts real-time logging, animation and travelling, unless the connection to the receiver could not be established

`project LATD LONGD DATUM PROJECTION [PARAMS]`
  writes to the standard output the projection of a point

`georef`
  `IMGPATH TRANSF LATD LONGD LATD LONGD [LATD LONGD] DATUM X Y X Y [X Y] PROJECTION [PARAMS]` writes to the standard output a map information file

`geopicts`
  `IN-FORMAT [IN-PARAMS] IN-TYPE IN-PATH [PROC-PARAMS] OUT-FORMAT] [OUT-PARAMS] OUT-PATH PICT-PATHS` geo-references files using either their time-stamps and a given track, or the sequence of waypoints in a group

`source PATH`
  executes a Tcl/Tk script

`exec PATH`
  executes a GPSMan script

File format names should be given as they appear in the output of the `show formats` command, or using only lowercase letters.

- The `is available` Command
- The `is connected` Command
- The `show WHAT` Command
- The `haslib` Command
- The `getwrite` Command
- The `readput` Command
- The `getrtimelog` Command
- The `getfix` Command
- The `getalmanac` Command
- The `read` Command
- The `start travel` Command
- The `translate` Command
- The `project` Command
- The `georef` Command
- The `geopicts` Command
- The `source` Command
- The `exec` Command

|  |  | Using GPSMan in Command-line Mode