Giter Site home page Giter Site logo

messgen's Introduction

JS CI CPP CI

Messgen

Lightweight and fast message serialization library. Generates message classes/structs from yml scheme.

Features:

  • Embedded-friendly
  • Fixed size arrays
  • Dynamic size arrays
  • Nested messages
  • Messages metadata
  • Supported languages: C++, Go, JavaScript

Dependencies

  • python 3.X

On Linux:

sudo apt install python3

On Windows 10:

  1. Download https://bootstrap.pypa.io/get-pip.py
  2. Execute python3 get_pip.py
  3. Execute pip3 install pyyaml

Generate messages

Each protocol should be placed in directory base_dir/vendor/protocol. base_dir is base directory for message definitions (is allowed to specify multiple base directories). vendor is protocol vendor, it is used as namespace in generated messages allowing to avoid conflict between protocols from different vendors if used in one application. protocol is protocol name, each protocol has protocol ID, that allows to use multiple protocols on single connection, e.g. bootloader and application protocols.

Message generator usage:

python3 generate.py -b <base_dir> -m <vendor>/<protocol> -l <lang> -o <out_dir> [-D variable=value]

For some languages it's necessary to specify some variables using -D option.

Generated messages placed in out_dir directory.

Go

Example for Go messages generation:

python3 generate.py -b ./base_dir -m my_vendor/my_protocol -l go -o out/go -D messgen_go_module=example.com/path/to/messgen

Variable messgen_go_module must point to messgen Go module (port/go/messgen), to add necessary imports in generated messages.

C++

Example for C++ messages generation:

python3 generate.py -b ./base_dir -m my_vendor/my_protocol -l cpp -o out/cpp

Variable metadata_json=true can be passed to generate metadata in JSON format, rather than legacy.

JS/TS

Example for JS messages generation:

python3 generate.py -b ./base_dir -m my_vendor/my_protocol -l json -o out/json

This command will generate json messages.

The types of these messages for TS can be generated as follows:

python3 generate.py -b ./base_dir -m my_vendor/my_protocol -l ts -o out/ts

if it is necessary to generate typed arrays for TS, it is necessary to pass the flag -D typed_arrays=true:

python3 generate.py -b ./base_dir -m my_vendor/my_protocol -l ts -o out/ts -D typed_arrays=true

MD

Example for protocol documentation generation:

python3 generate.py -b ./base_dir -m my_vendor/my_protocol -l md -o out/md

messgen's People

Contributors

meded7 avatar drton avatar zemledelec avatar roman- avatar nameofuser1 avatar sl-ru avatar meded90 avatar awskii avatar misterjulian avatar alexpantyukhin13 avatar onokonem avatar pavletto avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.