Coder Social home page Coder Social logo

pamxy / machinetalk-protobuf Goto Github PK

View Code? Open in Web Editor NEW

This project forked from machinekit/machinetalk-protobuf

0.0 2.0 0.0 5.42 MB

Protobuf declarations for machinekit messages

License: MIT License

Makefile 25.42% JavaScript 18.39% Python 39.56% HTML 12.42% Shell 4.21%

machinetalk-protobuf's Introduction

machinetalk-protobuf

Protobuf declarations for machinekit messages

This repo is integrated into github.com/machinekit/machinekit as a git subtree.

To change/add to message definitions:

  • send a PR against this repo
  • add a new remote in your machinekit repo referring to here
  • update the subtree in your machinekit repo like so
git remote add machinetalk-protobuf git://github.com/machinekit/machinetalk-protobuf.git
git fetch machinetalk-protobuf
git subtree merge --prefix=src/machinetalk/proto machinetalk-protobuf/master --squash

Now create a PR against the machinekit repo.

Python

Installation via PyPi

To use the Machinetalk protobuf Python modules in your projects, use:

pip install machinetalk-protobuf

Installation from source

Alternatively you can install the Python modules directly from the source code.

python setup.py build
sudo python setup.py install

Usage

See examples.

JavaScript (NPM/NodeJS)

Installation

To use machinetalk protobuf definitions in your npm-based projects, use:

npm install --save machinetalk-protobuf

Usage

See examples. If you want to try these examples, be sure to first run npm install in this repository.

Encoding

var machinetalkProtobuf = require('machinetalk-protobuf');
var messageContainer = {
  type: machinetalkProtobuf.message.ContainerType.MT_PING
};
var encodedMessageContainer = machinetalkProtobuf.message.Container.encode(messageContainer);

This results in a buffer that starts with 0x08 0xd2 0x01.

Decoding

var machinetalkProtobuf = require('machinetalk-protobuf');
var encodedBuffer = new Buffer([0x08, 0xd2, 0x01]);
var decodedMessageContainer = machinetalkProtobuf.message.Container.decode(encodedBuffer);

This results in a messageContainer like the one defined in Encoding.

JavaScript (Browser)

CDN usage

<script src="//cdn.rawgit.com/machinekit/machinetalk-protobuf/VERSION/dist/machinetalk-protobuf.js"></script>

With VERSION replaced by a valid tag or just master for testing the latest master build.

Encoding

var messageContainer = {
  type: machinetalk.protobuf.message.ContainerType.MT_PING
};
var encodedMessageContainer = machinetalk.protobuf.message.Container.encode(messageContainer);

This results in a buffer that starts with 0x08 0xd2 0x01.

Decoding

var encodedBuffer = new ArrayBuffer([0x08, 0xd2, 0x01]);
var decodedMessageContainer = machinetalk.protobuf.message.Container.decode(encodedBuffer);

This results in a messageContainer like the one defined in Encoding.

machinetalk-protobuf's People

Contributors

machinekoder avatar mhaberler avatar arceye avatar bobvanderlinden avatar luminize avatar

Watchers

James Cloos avatar  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.