==========================
Satlab Control Application
==========================

The Satlab Control Application, ``satctl``, can be used to communicate with Satlab products using CSP via CAN-bus, UART/RS-422 or multicast Ethernet.

Dependencies
============

Python, Jinja2 and GCC are required for building. The CAN-bus support requires a Linux kernel with SocketCAN support (CONFIG_CAN).

Building
========

The application is built using the `Waf build system <https://waf.io/>`_.

To build, run::

   satlab@satlab:~$ python waf distclean configure build

Running
=======

The application binary is located in the ``build`` directory. To show available command line options, run::

    satlab@satlab:~$ ./build/satctl -h
    usage: satctl [options] [command]

    Satlab Control Application v1.1.0
    Copyright (c) 2014-2018 Satlab ApS <satlab@satlab.com>

    Options:
     -c,        Use CAN as transport interface
     -m,        Use MCAST as transport interface
     -u,        Use UART/KISS as transport interface
     -d DEVICE, Use DEVICE as CAN/UART/MCAST interface
     -r RATE,   Use RATE bps as CAN/UART/MCAST bitrate
     -n NODE    Use NODE as own CSP addres
     -k KEY     Use KEY as CSP XTEA/HMAC key
     -h,        Print this help and exit

One communication interface must be selected. To use 1 Mbit/s CAN-bus on the ``can0`` SocketCAN interface, the application can e.g. be run as::

    satlab@satlab:~$ ./build/satctl -c -d can0 -r 1000000
    Satlab Control Application v1.1.0
    Copyright (c) 2014-2018 Satlab ApS <satlab@satlab.com>

    Run 'help' for a list of available commands

    [satctl] csp ping 20
    Reply in 1 ms
    [satctl] polaris prop list store
    Property        Type    Value
    enable          bool    true 
    seq             u32     607651 
    stored          u32     261106 frames

Run ``help`` to show a list of built-in commands. The application is closed by running ``exit`` or pressing ``^D``.
