isoxml
Version:
JavaScript library to parse and generate ISOXML (ISO11783-10) files
123 lines (122 loc) • 3.08 kB
JavaScript
import { TAGS } from './constants';
import { registerEntityClass } from '../classRegistry';
import { fromXML, toXML } from '../utils';
const ATTRIBUTES = {
A: {
name: 'DataLogDDI',
type: 'xs:hexBinary',
isPrimaryId: false,
isOptional: false,
isOnlyV4: false,
},
B: {
name: 'DataLogMethod',
type: 'xs:unsignedByte',
isPrimaryId: false,
isOptional: false,
isOnlyV4: false,
minValue: 1,
maxValue: 31,
},
C: {
name: 'DataLogDistanceInterval',
type: 'xs:long',
isPrimaryId: false,
isOptional: true,
isOnlyV4: false,
minValue: 0,
maxValue: 1000000,
},
D: {
name: 'DataLogTimeInterval',
type: 'xs:long',
isPrimaryId: false,
isOptional: true,
isOnlyV4: false,
minValue: 0,
maxValue: 60000,
},
E: {
name: 'DataLogThresholdMinimum',
type: 'xs:long',
isPrimaryId: false,
isOptional: true,
isOnlyV4: false,
minValue: -2147483647,
maxValue: 2147483647,
},
F: {
name: 'DataLogThresholdMaximum',
type: 'xs:long',
isPrimaryId: false,
isOptional: true,
isOnlyV4: false,
minValue: -2147483647,
maxValue: 2147483647,
},
G: {
name: 'DataLogThresholdChange',
type: 'xs:long',
isPrimaryId: false,
isOptional: true,
isOnlyV4: false,
minValue: -2147483647,
maxValue: 2147483647,
},
H: {
name: 'DeviceElementIdRef',
type: 'xs:IDREF',
isPrimaryId: false,
isOptional: true,
isOnlyV4: false,
},
I: {
name: 'ValuePresentationIdRef',
type: 'xs:IDREF',
isPrimaryId: false,
isOptional: true,
isOnlyV4: false,
},
J: {
name: 'DataLogPGN',
type: 'xs:unsignedLong',
isPrimaryId: false,
isOptional: true,
isOnlyV4: false,
minValue: 0,
maxValue: 262143,
},
K: {
name: 'DataLogPGNStartBit',
type: 'xs:unsignedByte',
isPrimaryId: false,
isOptional: true,
isOnlyV4: false,
minValue: 0,
maxValue: 63,
},
L: {
name: 'DataLogPGNStopBit',
type: 'xs:unsignedByte',
isPrimaryId: false,
isOptional: true,
isOnlyV4: false,
minValue: 0,
maxValue: 63,
},
};
const CHILD_TAGS = {};
export class DataLogTrigger {
constructor(attributes, isoxmlManager) {
this.attributes = attributes;
this.isoxmlManager = isoxmlManager;
this.tag = TAGS.DataLogTrigger;
}
static fromXML(xml, isoxmlManager, internalId, targetClass = DataLogTrigger) {
return fromXML(xml, isoxmlManager, targetClass, ATTRIBUTES, CHILD_TAGS, internalId);
}
toXML() {
return toXML(this, ATTRIBUTES, CHILD_TAGS);
}
}
registerEntityClass('main', TAGS.DataLogTrigger, DataLogTrigger);