UNPKG

knxultimate

Version:

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

26 lines 841 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); class TLVInfo { constructor(type, length, info) { this.type = type; this.length = length; this.info = info; } static createFromBuffer(buffer, offset = 0) { const type = buffer.readUInt8(offset++); const length = buffer.readUInt8(offset++); const info = Buffer.alloc(length); for (let i = 0; i < length; i++) { info.writeUInt8(buffer.readUInt8(offset++), i); } return new TLVInfo(type, length, info); } toBuffer() { const buffer = Buffer.alloc(2); buffer.writeUInt8(this.type, 0); buffer.writeUInt8(this.length, 1); return Buffer.concat([buffer, this.info]); } } exports.default = TLVInfo; //# sourceMappingURL=TLVInfo.js.map