No Description
Nicholas Muggio 5372f5b72a Update README.md 1 year ago
transmission-core Cleaned up formatting. 1 year ago
.gitattributes Add .gitignore and .gitattributes. 2 years ago
.gitignore Add .gitignore and .gitattributes. 2 years ago
.gitlab-ci.yml Adjusted name of artifact - now includes project name and commit ref 2 years ago
README.md Update README.md 1 year ago
transmission.sln Removed cpp_test project. 2 years ago

README.md

:octagonal_sign: Note: this project is no longer maintained in favor of using Bright Ascension’s Generation One software to manage communications.

Transmission is built on the .NET Core, so it can be built and run on Windows, Linux and OSX (in theory, at least). So far, it’s been tested on Windows 10 and Debian Jessie.

Getting Started

To get transmission up and running, make sure you’ve installed .NET Core - read the instructions available here. Once you’ve gotten that ready, clone this repository and cd into the directory you put it in, then into transmission-core. Before you build transmission, you need to make sure your runtime is listed in project.json under the "runtimes" section. If not, read this article from Microsoft about adding it. Once your runtime is added to project.json, run these commands:

$ dotnet restore
$ dotnet build

This will give you a debug build. This is probably fine for most users. To run transmission, cd into bin/Debug/netcoreapp1.0/[your runtime] and execute transmission-core (Linux/Mac) or transmission-core.exe (Windows) and give it the name of the file where your XML specification is. Alternatively, you can also pipe your XML into transmission.

$ # Specify filename directly, using trans.xml included in the repository
$ ./transmission-core ../../../../trans.xml

$ # Send XML via standard in
$ ./transmission-core < ../../../../trans.xml

$ # Format the output and send it to commands.h (requires 'indent' to be installed)
$ ./transmission-core < ../../../../trans.xml | indent -kr -ts4 > commands.h

:exclamation: Note: An issue has been found on some Windows machines where using transmission with input redirection, e.g. transmission-core.exe < params.xml, has led to a crash. There are no plans in place at the moment to fix this, as launching transmission with the filename specified appears to work correctly even when input redirection is failing.

Sample Input/Output

The following XML contains most of the features that Transmission supports. Below that, you can see the generated flight code (as of 026c53e5). This XML file can be found here.

<?xml version="1.0" encoding="utf-8"?>
<specification xmlns="http://muggio.xyz/transmission/2016">
  <header>
    <part type="uint8" id="opcode"/>
    <part type="uint8" id="payload_len"/>
    <part type="uint8" id="priority"/>
    <part type="uint32" id="crc"/>
    <part type="uint32" id="runtime"/>
  </header>
  <enums>
    <enum id="axis" type="uint8">
      <value id="x" value="0"/>
      <value id="y" value="1"/>
      <value id="z" value="2"/>
    </enum>
  </enums>
  <transmissions>
    <set id="request_attention" source="ground satellite">
      <ground/>
      <satellite/>
    </set>

    <set id="get_parameter" source="ground" privileged="true">
      <method id="test" return="void**">
        <param id="nope" type="void****"/>
        <param id="def_test" type="int16" default="1234"/>
      </method>
      <ground>
        <part id="param_index" type="uint8"/>
        <part id="pointer" type="uint8" count="51231"/>
      </ground>
      <satellite>
        <part id="type" type="uint8"/>
        <union id="banana" count="3">
          <part id="uchar" type="uint8"/>
          <part id="ushort" type="uint16"/>
          <part id="uint" type="uint32"/>
          <part id="ulong" type="uint64"/>
          <part id="char" type="int8"/>
          <part id="short" type="int16"/>
          <part id="int" type="int32"/>
          <part id="long" type="int64"/>
          <part id="flt" type="float"/>
          <part id="dbl" type="double"/>
        </union>
        <bits type="uint8">
          <field id="aardvark" size="5"/>
        </bits>
      </satellite>
    </set>
  </transmissions>

  <method id="execute" return="void"/>
  <method id="square" return="double">
    <param id="d" type="double" default="1"/>
  </method>
</specification>

This is the generated flight code (it’s been indented to be easier to read, but is the same as the generated code in all other respects). This should be put in a header (eg commands.h) and included by any command implementations (see below).

#
pragma once

# include < stdint.h >
  namespace commands {
    struct header {
      uint8_t opcode;
      uint8_t payload_len;
      uint8_t priority;
      uint32_t crc;
      uint32_t runtime;
    };

    class packet {
      public:
        const uint8_t opcode = 0;
      const uint32_t up_size = sizeof(up);
      const uint32_t down_size = sizeof(down);
      header header;
      virtual void execute() = 0;
      virtual double square(double d = 1) = 0;

      struct {}
      up;
      struct {}
      down;
    };

    enum axis: uint8_t {
      x = 0,
        y = 1,
        z = 2,
    };

    class request_attention: public packet {
      public: const uint8_t privileged = 0;
      const uint8_t opcode = 128;

      const uint32_t up_size = sizeof(up);
      const uint32_t down_size = sizeof(down);

      void execute();
      double square(double d = 1);

      struct {}
      up;

      struct {}
      down;

    };

    class get_parameter: public packet {
      public: const uint8_t privileged = 1;
      const uint8_t opcode = 129;

      const uint32_t up_size = sizeof(up);
      const uint32_t down_size = sizeof(down);

      void execute();
      double square(double d = 1);

      void * * test(void * * * * nope, int16 def_test = 1234);

      struct {
        uint8_t param_index;
        uint8_t pointer[51231];
      }
      up;

      struct {
        uint8_t aardvark: 5;

        uint8_t type;
        union {
          uint8_t uchar;
          uint16_t ushort;
          uint32_t uint;
          uint64_t ulong;
          int8_t char;
          int16_t short;
          int32_t int;
          int64_t long;
          float flt;
          double dbl;
        }
        banana[3];

      }
      down;

    };

  }

The following snippet includes two files, request_attention.cpp and get_parameter.cpp. Neither of them really do anything, but they demonstrate how to implement individual commands with respect to the generated command descriptions.

// request_attention.cpp

#include "commands.h"

namespace commands {
	void request_attention::execute() {
		return;
	}
}

// get_parameter.cpp

#include "commands.h"

namespace commands {
	void get_parameter::execute() {
		return;
	}
}