doc(main): update documentation and flows
This commit is contained in:
30
dist/devices/gateway/GatewayMessage.js
vendored
Normal file
30
dist/devices/gateway/GatewayMessage.js
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
class GatewayMessage {
|
||||
constructor(raw) {
|
||||
Object.assign(this, raw);
|
||||
if (raw.port) {
|
||||
this.port = parseInt(raw.port);
|
||||
}
|
||||
if (raw.data) {
|
||||
this.data = JSON.parse(raw.data) || raw.data;
|
||||
}
|
||||
this.timestamp = +new Date;
|
||||
}
|
||||
isHeartbeat() {
|
||||
return this.cmd === "heartbeat";
|
||||
}
|
||||
isIam() {
|
||||
return this.cmd === "iam";
|
||||
}
|
||||
isGetIdListAck() {
|
||||
return this.cmd === "get_id_list_ack";
|
||||
}
|
||||
isReadAck() {
|
||||
return this.cmd === "read_ack";
|
||||
}
|
||||
isReport() {
|
||||
return this.cmd === "report";
|
||||
}
|
||||
}
|
||||
exports.GatewayMessage = GatewayMessage;
|
||||
Reference in New Issue
Block a user