Skip to content

tzijnge/LotusRpc

Repository files navigation

Automated build

Code Smells

Quality gate

Code style: black

LotusRPC 🌼

WARNING: This project is work in progress

LotusRPC is an RPC framework for embedded systems based on ETL. It generates C++ code with no dynamic memory allocations, no exceptions, no RTTI, etc. Code generator and client side CLI application in a simple Python package.

Installation

Install from PyPI with pip install lotusrpc

Basic usage

Installing the Python package installs the lrpcg tool on your system. This is the LotusRPC generator. It also installs the lrpcc tool on your system. This is the LotusRpc CLI client.

Your RPC interface is specified in a YAML file

File name: example.lrpc.yaml

services:
  - name: "battery"
    functions:
      - name: "get"
        params:
          - name: "option"
            type: "@VoltageScales"
        returns:
          - name: "voltage"
            type: double
enums:
  - name: "VoltageScales"
    fields:
        name: "microvolts"
        name: "millivolts"
        name: "volts"

Generate server side code by simply running this command

lrpcg example.lrpc.yaml -o output-dir

Give the generated code a meaningful implementation and hook it up to a transport layer. Flash your embedded device. Then use lrpcc to communicate with your device and print the result to the console

lrpcc battery get microvolts

Documentation

Please find more detailed information here