Giter VIP home page Giter VIP logo

glassgem's Introduction

GlassGem


GlassGem is a Swift package that implements the Consistent Overhead Byte Stuffing (COBS) algorithm for encoding arbitrary data with single byte packet delimiters.

It consists of an extension on Data with exactly two methods: encodedUsingCOBS() and decodedFromCOBS().

Usage

Encoding:

let someData = ...
let cobsEncodedData = someData.encodedUsingCOBS()
// Do something with cobsEncodedData, e.g. sending across a communications link

Decoding:

let someCOBSEncodeData = ... // e.g. from a communications link
let someData = someData.decodedFromCOBS()
// Use someData like normal

The package includes a suite of unit tests.

Installation

To use the GlassGem library in a SwiftPM project, add the following line to the dependencies in your Package.swift file:

.package(url: "https://github.com/armadsen/GlassGem", from: "1.0.0"),

Include "GlassGem" as a dependency for your executable target:

.target(name: "<target>", dependencies: [
    .product(name: "GlassGem", package: "GlassGem"),
]),

Finally, add import GlassGem to your source code.

To Do

GlassGem is already completely usable for the most common scenarios. However, there are a few things I'd like to implement in the future. Pull requests for these are completely welcome. Please include tests for anything you add.

  • Support for using GlassGem from Objective-C
  • Support for arbitrary delimiter bytes, not just 0x00
  • Performance improvements (while still emphasizing readability)
  • Make documentation work with DocC

glassgem's People

Contributors

armadsen avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

lhoward

glassgem's Issues

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.