Hexadecimal frame parser

Encode & decode hexadecimal frames with ease
Install
$ npm install --save hex-frame-parser
Usage
const Decoder = require('hex-frame-parser').Decoder;
const DecoderProperty = require('hex-frame-parser').DecoderProperty;
const decoder = new Decoder('47c85d800f03');
decoder.decoderProperties.push(new DecoderProperty(0, 32, false, 'pressure', 'float', 'hPa', null, null, 100, null));
console.log(decoder.decode());
Properties
bitStartPos: Number defines the position of the starting bit to decode
bitEndPos: Number defines the position of the ending bit to decode
isSigned: Boolean defines if the data is signed or unsigned
key: String defines the name of the data to decode
type: String defines the type of the data to decode (see below for usable types)
unit: String defines the unit of the data to decode
add: Number defines the number to add to the data
subtract: Number defines the number to subtract to the data
multiply: Number defines the number to multiply to the data
divide: Number defines the number to divide to the data
Types (32bits architecture)
type can be:
char
short
int
long
float
bool
Examples
const Decoder = require('hex-frame-parser').Decoder;
const DecoderProperty = require('hex-frame-parser').DecoderProperty;
const decoder_1 = new Decoder('47c85d800f03');
decoder_1.decoderProperties.push(new DecoderProperty(0, 32, false, 'pressure', 'float', 'hPa', null, null, null, 100));
decoder_1.decoderProperties.push(new DecoderProperty(8, 16, false, 'humidity', 'int', '%'));
console.log(decoder_1.decode());
const decoder_2 = new Decoder('b6096249');
decoder_2.decoderProperties.push(new DecoderProperty(8, 13, false, 'mode', 'bool', ''));
console.log(decoder_2.decode());
const decoder_3 = new Decoder('1a00bd4aa5181d');
decoder_3.decoderProperties.push(new DecoderProperty(8, 24, true, 'temperature', 'int', '°C', null, null, null, 8));
decoder_3.decoderProperties.push(new DecoderProperty(24, 32, false, 'humidity', 'int', '%', null, null, null, 2));
console.log(decoder_3.decode());
const decoder_4 = new Decoder('32b641e0224484');
decoder_4.decoderProperties.push(new DecoderProperty(4, 13, true, 'temperature', 'int', '°C', null, null, 0.25, null));
console.log(decoder_4.decode());