UNPKG

@bacnet-js/device

Version:

A TypeScript library for implementing BACnet IP devices in Node.js.

24 lines 1.46 kB
import { BDSingletProperty } from '../../properties/index.js'; import { BDObject } from '../generic/object.js'; import { ObjectType, ApplicationTag, EngineeringUnits, PropertyIdentifier, } from '@bacnet-js/client'; const tagToCovIncrementTag = { [ApplicationTag.REAL]: ApplicationTag.REAL, [ApplicationTag.UNSIGNED_INTEGER]: ApplicationTag.UNSIGNED_INTEGER, [ApplicationTag.SIGNED_INTEGER]: ApplicationTag.UNSIGNED_INTEGER, }; export class BDNumericObject extends BDObject { presentValue; engineeringUnit; covIncrement; maxPresentValue; minPresentValue; constructor(identifier, tag, opts) { super(identifier, opts.name, opts.description); this.presentValue = this.addProperty(new BDSingletProperty(PropertyIdentifier.PRESENT_VALUE, tag, opts.writable ?? false, opts.presentValue)); this.engineeringUnit = this.addProperty(new BDSingletProperty(PropertyIdentifier.UNITS, ApplicationTag.ENUMERATED, false, opts.unit)); this.covIncrement = this.addProperty(new BDSingletProperty(PropertyIdentifier.COV_INCREMENT, tagToCovIncrementTag[tag], true, opts.covIncrement ?? 0)); this.maxPresentValue = this.addProperty(new BDSingletProperty(PropertyIdentifier.MAX_PRES_VALUE, tag, false, opts.maxPresentValue)); this.minPresentValue = this.addProperty(new BDSingletProperty(PropertyIdentifier.MIN_PRES_VALUE, tag, false, opts.minPresentValue)); } } //# sourceMappingURL=numeric.js.map