26 lines
865 B
JavaScript
26 lines
865 B
JavaScript
![]() |
"use strict";
|
||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||
|
const utils = require("./utils");
|
||
|
class EspThermMessage {
|
||
|
constructor(client, temperature, voltage, timeConsumed) {
|
||
|
this._client = client;
|
||
|
this._temperature = temperature;
|
||
|
this._voltage = voltage;
|
||
|
this._timeConsumed = timeConsumed;
|
||
|
}
|
||
|
toString() {
|
||
|
return JSON.stringify(this);
|
||
|
}
|
||
|
toJSON() {
|
||
|
return utils.jsonPrepaper(this, []);
|
||
|
}
|
||
|
}
|
||
|
exports.EspThermMessage = EspThermMessage;
|
||
|
function espThermToJson(message) {
|
||
|
let messageStr = "" + message;
|
||
|
let parts = messageStr.split(' ');
|
||
|
let espThermMessage = new EspThermMessage(parts[0], parseFloat(parts[1]), parseFloat(parts[2]), parseInt(parts[3]));
|
||
|
return espThermMessage;
|
||
|
}
|
||
|
exports.espThermToJson = espThermToJson;
|
||
|
//# sourceMappingURL=espthermtojson.js.map
|