UNPKG

zigbee-herdsman-zigate

Version:

An open source ZigBee gateway solution with node.js.

36 lines 1.12 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ZGPermitJoinCommand = void 0; const debug_1 = require("../../debug"); const debug = debug_1.Debug('driver:commands'); const toBuffer = (payload) => { const buf = Buffer.alloc(4); buf.writeUInt16BE(payload.targetShortAddress, 0); buf.writeUInt8(payload.interval, 2); buf.writeUInt8(payload.TCsignificance, 3); return buf; }; class ZGPermitJoinCommand { constructor(code, payload) { this.label = 'permit-join'; this.code = code; this.defaultPayload = { targetShortAddress: 0xfffc, interval: 254, TCsignificance: 0, }; this.payload = Object.assign(Object.assign({}, this.defaultPayload), payload); debug.log.extend(`command:${this.getLabel()}`)(this.payload); } getCode() { return this.code; } getLabel() { return this.label; } getBufferedPayload() { return toBuffer(this.payload); } } exports.ZGPermitJoinCommand = ZGPermitJoinCommand; //# sourceMappingURL=permit-join.js.map