Files
node-screenlogic/messages/SLGetGatewayDataMessage.js
Parnic a09df2569b Added support for remote + passworded access
This password encoder was decompiled from the Android app then manually cleaned up and ported to Javascript. It ain't pretty, but it works.

I don't know that this is all necessarily the most correct or idiomatic way to implement these features, but I wanted to make sure the functionality got committed to help out people wanting to use this for smart home appliances (#1).
2019-02-22 16:06:11 -06:00

37 lines
788 B
JavaScript

'use strict';
const SLMessage = require('./SLMessage.js').SLMessage;
const MSG_ID = 18003;
exports.SLGetGatewayDataMessage = class SLGetGatewayDataMessage extends SLMessage {
constructor(buf) {
super(0, MSG_ID);
if (typeof buf === 'string') {
this.writeSLString(buf);
this.writeSLString(buf);
} else if (buf) {
this._wroteSize = true;
this.writeBuffer(buf, 0);
this.decode();
}
}
decode() {
super.decode();
this.gatewayFound = this.readUInt8() !== 0;
this.licenseOK = this.readUInt8() !== 0;
this.ipAddr = this.readSLString();
this.port = this.readUInt16LE();
this.portOpen = this.readUInt8() !== 0;
this.relayOn = this.readUInt8() !== 0;
}
static getResponseId() {
return MSG_ID + 1;
}
};