Skip to content

nstrct/nstrct-objc

Repository files navigation

nstrct-objc

Version Platform

a multi-purpose binary protocol for instruction interchange

Interchange formats like json or xml are great to keep data visible, but due to their parse and pack complexity they aren't used in embedded applications. There are alternatives like msgpack or Google's protocol buffer, which allow a more binary representation of data, but these protcols are still heavy and developers tend to rather implement their own 'simple' binary protocols instead of porting or using the big ones.

The protcol nstrct is designed to be an alternative in those situations where a tiny and versatile protocol is needed. The main transportable unit in nstrct are instructions which carry a dynamic amount of data in the form of arguments. Each instruction is identified by a code between 0-65535 which can be used by two communicating applications to identify the blueprint of the message. Arguments support all standard types of integers(boolean, int8-64, uint8-64, float32/64), strings, and arrays of integers or strings. There is no support for hashes by design to keep the pack and unpacking functions as small as possible. Check the main repository for the binary layout of the instructions.

Start using nstrct by getting the library for your favorite programming language:

This software has been open sourced by ElectricFeel Mobility Systems Gmbh and is further maintained by Joël Gähwiler.

Installation

nstrct-objc is available through CocoaPods, to install it simply add the following line to your Podfile:

pod "nstrct-objc"

Instruction Composing

NCInstruction* instruction = [[NCInstruction alloc] initWithCode:234];
NSData* [instruction pack];

Instruction Processing

NCFrame* frame = [NCFrame parseFromBuffer:subdata];
NCInstruction* instruction = frame.instruction;

instruction.code

About

objective-c library for the nstrct protocol

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published