Git Product home page Git Product logo

cobs's Introduction

Consistent Overhead Byte Stuffing

COBS encoder breaks a packet into one or more sequences of non-zero bytes. The encoding routine searches through the first 254 bytes of the packet looking for the first occurrence of a zero byte. If no zero is found, then a code of 0xFF is output, followed by the 254 non-zero bytes. If a zero is found, then the number of bytes examined, n, is output as the code byte, followed by the actual values of the (n-1) non-zero bytes up to (but not including) the zero byte. This process is repeated until all the bytes of the packet have been encoded.

Links

cobs's People

Contributors

dim13 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

cobs's Issues

Version 1.0.1 Encode does not work as intended

Describe the bug
Encode in version 1.0.1 does not zero-terminate the resulting byte array.

example:
non zero-ended
bytes: [1 2 6 0 0 1 1 8 192 11 0 198]
encoded: [4 1 2 6 1 6 1 1 8 192 11 2 198]

zero-ended
bytes: [1 2 6 0 0 1 1 8 192 11 0 198 0]
encoded: [4 1 2 6 1 6 1 1 8 192 11 2 198]

To Reproduce
Steps to reproduce the behavior:

  1. Use any byte array
  2. input it to Encode function with the v1.0.1 version
  3. See that the result isn't zero-terminated

Expected behavior
Expect the Encoded byte array to be zero-terminated

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.