UNPKG

@robotical/roboticaljs

Version:

Javascript/TS library for Robotical products

77 lines 2.46 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.RICHWElemList_Str = exports.RICHWElemList_Min = exports.RICHWElemList = void 0; class RICHWElemList { constructor() { this.req = ''; this.rslt = 'ok'; this.hw = []; } } exports.RICHWElemList = RICHWElemList; class RICHWElemList_Min { constructor() { // Members this.req = ''; this.rslt = 'ok'; this.hw = []; } // Method to convert to RICHWElemList static expand(hwMin) { const hwList = new RICHWElemList(); for (const hwElem of hwMin.hw) { hwList.hw.push({ name: hwElem.n, type: hwElem.t, busName: '', addr: '', addrValid: 0, IDNo: hwElem.I, whoAmI: hwElem.w, whoAmITypeCode: hwElem.W, SN: hwElem.S, versionStr: hwElem.v, commsOk: hwElem.c, }); } return hwList; } } exports.RICHWElemList_Min = RICHWElemList_Min; // RICHWElemList containing coded strings for each HWElem field class RICHWElemList_Str { constructor() { this.req = ''; this.rslt = 'ok'; this.hw = []; } // Method to convert to RICHWElemList static expand(hwStr) { const hwList = new RICHWElemList(); for (const hwElem of hwStr.hw) { if (hwElem.a) { const hwElemStr = hwElem.a.split('|'); hwList.hw.push({ name: RICHWElemList_Str.unesc(hwElemStr[0]), type: RICHWElemList_Str.unesc(hwElemStr[1]), busName: "", addr: "", addrValid: 0, IDNo: RICHWElemList_Str.unesc(hwElemStr[2]), whoAmI: RICHWElemList_Str.unesc(hwElemStr[3]), whoAmITypeCode: RICHWElemList_Str.unesc(hwElemStr[4]), SN: RICHWElemList_Str.unesc(hwElemStr[5]), versionStr: RICHWElemList_Str.unesc(hwElemStr[6]), commsOk: Number(hwElemStr[7]), }); } } return hwList; } // Method to unescape a pipe character static unesc(s) { return s.replace(/\/x7c/g, '|'); } } exports.RICHWElemList_Str = RICHWElemList_Str; //# sourceMappingURL=RICHWElem.js.map