UNPKG

zigbee-herdsman-zigate

Version:

An open source ZigBee gateway solution with node.js.

41 lines 1.46 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.ZGLevelUpdateMessage = void 0; const message_1 = require("../message"); const debug_1 = require("../../debug"); const buffer_reader_1 = __importDefault(require("../buffer-reader")); const constants_1 = require("../constants"); const debug = debug_1.Debug('driver:messages'); class ZGLevelUpdateMessage { constructor(payload) { this.label = 'LevelUpdate'; this.reader = new buffer_reader_1.default(payload); this.code = message_1.ZGMessageCode.LevelUpdate; this.payload = this.parsePayload(); debug.log.extend(`${this.getLabel()}`)(this.payload); } getCode() { return this.code; } getLabel() { return this.label; } getPayload() { return this.payload; } parsePayload() { return { sequence: this.reader.nextUInt8(), endpoint: this.reader.nextUInt8(), cluster: this.reader.nextUInt16BE(), addressMode: constants_1.ADDRESS_MODE[this.reader.nextUInt8()], address: '0x' + this.reader.nextUInt16BE().toString(16), status: this.reader.nextUInt8(), }; } } exports.ZGLevelUpdateMessage = ZGLevelUpdateMessage; //# sourceMappingURL=level-update.js.map