UNPKG

dlms-protocol

Version:

DLMS Protocol parser for JavaScript

37 lines (36 loc) 979 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _DlmsDataType = _interopRequireDefault(require("../enum/DlmsDataType")); function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; } class Boolean { constructor() { let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; this.tag = _DlmsDataType.default.BOOLEAN; this.totalBytes = 0; this.rawValue = []; this.bodyBytes = []; this.value = null; if (data) { this.insertData(data); } } getStandardLength() { throw new Error("Method not implemented."); } getValue() { return this.value; } insertData(data) { if (this.tag !== data[0]) { throw new Error("Tag mismatch."); } this.bodyBytes = [data[1]]; this.value = data[1]; this.rawValue = data.slice(0, 2); this.totalBytes = this.rawValue.length; } } exports.default = Boolean;