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).
This commit is contained in:
36
messages/SLGetGatewayDataMessage.js
Normal file
36
messages/SLGetGatewayDataMessage.js
Normal file
@ -0,0 +1,36 @@
|
||||
'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;
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user