UNPKG

isoxml-angular

Version:

JavaScript library to parse and generate ISOXML (ISO11783-10) files

78 lines (77 loc) 2.15 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Device = void 0; const classRegistry_1 = require("../classRegistry"); const utils_1 = require("../utils"); const ATTRIBUTES = { A: { name: 'DeviceId', type: 'xs:ID', isPrimaryId: true, isOptional: false, isOnlyV4: false, }, B: { name: 'DeviceDesignator', type: 'xs:string', isPrimaryId: false, isOptional: true, isOnlyV4: false, }, C: { name: 'DeviceSoftwareVersion', type: 'xs:string', isPrimaryId: false, isOptional: true, isOnlyV4: false, }, D: { name: 'ClientNAME', type: 'xs:hexBinary', isPrimaryId: false, isOptional: false, isOnlyV4: false, }, E: { name: 'DeviceSerialNumber', type: 'xs:string', isPrimaryId: false, isOptional: true, isOnlyV4: false, }, F: { name: 'DeviceStructureLabel', type: 'xs:hexBinary', isPrimaryId: false, isOptional: false, isOnlyV4: false, }, G: { name: 'DeviceLocalizationLabel', type: 'xs:hexBinary', isPrimaryId: false, isOptional: false, isOnlyV4: false, }, }; const CHILD_TAGS = { DET: { name: 'DeviceElement', isOnlyV4: false }, DPT: { name: 'DeviceProperty', isOnlyV4: false }, DPD: { name: 'DeviceProcessData', isOnlyV4: false }, DVP: { name: 'DeviceValuePresentation', isOnlyV4: false }, }; class Device { constructor(attributes, isoxmlManager) { this.attributes = attributes; this.isoxmlManager = isoxmlManager; this.tag = "DVC" /* TAGS.Device */; } static fromXML(xml, isoxmlManager, internalId, targetClass = Device) { return (0, utils_1.fromXML)(xml, isoxmlManager, targetClass, ATTRIBUTES, CHILD_TAGS, internalId); } toXML() { return (0, utils_1.toXML)(this, ATTRIBUTES, CHILD_TAGS); } } exports.Device = Device; (0, classRegistry_1.registerEntityClass)('main', "DVC" /* TAGS.Device */, Device);