Giter VIP home page Giter VIP logo

binaryprotocolforarduino's Introduction

Binary Protocol for Arduino (BPA)

Binary message format

<start-byte><device-id><message-id><payload-length>[<payload><hash>]

byte-mask: SDML[(P*)HH]

Start byte

ASCII code Symbol Description
0 Undefined
48 0 Input message (Protocol version 1)
... ... ...
57 9 Input message (Protocol version 10)
65 A Confirmation - input message was received and parsed
... ... ...
70 F Response - format incorrect
... ... ...
72 H Response - hash error
... ... ...
82 R Response - reject input message
... ... ...
90 Z Reserved
42 * Handshake init
43 + Handshake response
46 . Handshake complete
126 ~ Disconnect (no response needed)

Device ID

A one-byte value that uniquely identifies the client device.

Message ID

A byte value that allows a message to be separated from another in a short period of time. BPA doesn't store history, so it's enough to distinguish two messages semintaniusly.

Length

A byte value indicating the number of bytes we should read as a payload.

Payload

Up to 256 byte array of the message.

Hash

Two byte values representing the Fowler-Noll-Vo (FNL) hash of the previous bytes. Here is an example of the hash function:

uint16_t fnv1a_hash16(uint8_t* bytes, size_t length) {
    uint16_t hash = (uint16_t)0x97;
    for (size_t i = 0; i < length; i++)
    {
        hash ^= bytes[i];
        hash *= 0xA1;
    }
    return hash;
}

UDP Tunneling

TBD

binaryprotocolforarduino's People

Contributors

paslavsky avatar

Watchers

 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.