UNPKG

knxultimate

Version:

KNX IP protocol implementation for Node. This is the ENGINE of Node-Red KNX-Ultimate node.

51 lines (42 loc) 891 B
/** * Utility buffer wrapper for KNX packet encoding. * * Written in Italy with love, sun and passion, by Massimo Saccani. * * Released under the MIT License. * Use at your own risk; the author assumes no liability for damages. */ export default class KNXDataBuffer { private _data: any private _info: any constructor(_data: Buffer, _info?: IDataPoint) { this._data = _data this._info = _info } get length(): number { return this._data == null ? 0 : this._data.length } get value(): any { return this._data } get info(): any { return this._info } sixBits(): boolean { if (this.info == null) { return true } // return !(this.info.type.type === '1'); return this.info.type.type } } export interface IDataPoint { id: string value: any type: { type: boolean } bind: any | null read: () => any | null write: ((data: any) => void) | null }