lot of changes for first actual use
This commit is contained in:
26
dist/espthermtojson.js
vendored
Normal file
26
dist/espthermtojson.js
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
"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
|
Reference in New Issue
Block a user