UNPKG

@joergmittaglawo/dmvconfig

Version:

DMV Configuration scripts for Lawo V__matrix Distributed Multiviewers.

77 lines (76 loc) 3.8 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Enums = exports.AnalogReference = exports.SourceAsTableRow = exports.Source = exports.lower = exports.lift = void 0; const VScript = require("vscript"); const _PTP = require("./PTP"); exports.lift = { AnalogReference: (kwl, socket) => kwl ? (new AnalogReference(new VScript.Subtree(socket, kwl))) : null, Source: (kwl, socket) => kwl ? (new Source(new VScript.Subtree(socket, kwl))) : null, SourceCharacteristics: (x, _) => { return x ? { offset_type: x[0], grain_rate: x[1], drift_reference: x[2], remoteness: x[3], cycle_detector: x[4] } : null; }, TimestampedTimecode: (x, _) => { return x ? { ltc: x[0], vtc1: x[1], vtc2: x[2], fc: x[3], micro_epoch_index: x[4] } : null; }, TimestampedDrift: (x, _) => { return x ? { value: x[0], error: x[1], fc: x[2], micro_epoch_index: x[3] } : null; }, Drift: (x, _) => { return x ? { value: x[0], error: x[1] } : null; }, TimestampedOffset: (x, _) => { return x ? { value: x[0], error: x[1], fc: x[2], micro_epoch_index: x[3] } : null; }, Offset: (x, _) => { return x ? { value: x[0], error: x[1] } : null; } }; exports.lower = { AnalogReference: (ref) => ref ? ref.raw.kwl : null, Source: (ref) => ref ? ref.raw.kwl : null, SourceCharacteristics: (x) => x ? [x.offset_type, x.grain_rate, x.drift_reference, x.remoteness, x.cycle_detector] : null, TimestampedTimecode: (x) => x ? [x.ltc, x.vtc1, x.vtc2, x.fc, x.micro_epoch_index] : null, TimestampedDrift: (x) => x ? [x.value, x.error, x.fc, x.micro_epoch_index] : null, Drift: (x) => x ? [x.value, x.error] : null, TimestampedOffset: (x) => x ? [x.value, x.error, x.fc, x.micro_epoch_index] : null, Offset: (x) => x ? [x.value, x.error] : null }; class Source { constructor(raw) { this.raw = raw; } get brief() { return new VScript.rKeyword(this, "brief"); } get characteristics() { return new VScript.rKeyword(this, "characteristics", { lift: exports.lift.SourceCharacteristics, lower: exports.lower.SourceCharacteristics }); } get drift() { return new VScript.rKeyword(this, "drift", { lift: exports.lift.TimestampedDrift, lower: exports.lower.TimestampedDrift }); } get offset() { return new VScript.rKeyword(this, "offset", { lift: exports.lift.TimestampedOffset, lower: exports.lower.TimestampedOffset }); } get time_code() { return new VScript.rKeyword(this, "time_code", { lift: exports.lift.TimestampedTimecode, lower: exports.lower.TimestampedTimecode }); } get ptp_traits() { return new VScript.rKeyword(this, "ptp_traits", { lift: _PTP.lift.Traits, lower: _PTP.lower.Traits }); } } exports.Source = Source; class SourceAsTableRow extends Source { constructor(raw_row, enclosing_table) { super(new VScript.Subtree(raw_row.socket, raw_row.kwl)); this.enclosing_table = enclosing_table; this.index = raw_row.index; } } exports.SourceAsTableRow = SourceAsTableRow; /** TODO: use this in IOModule (requires AnalogRefTracker/GrainTracker cleanup) */ class AnalogReference { constructor(raw) { this.raw = raw; } get output() { return new Source(this.raw.find("output")); } get ptp_traits() { return new _PTP.Traits(this.raw.find("ptp_traits")); } } exports.AnalogReference = AnalogReference; exports.Enums = { TimecodeType: ["LTC", "VTC1", "VTC2"], MediaClockFrequency: ["mcf_48k", "mcf_90k", "mcf_27M"], GrainRate: ["g23_98", "g24", "g25", "g29_97", "g30", "g50", "g59_94", "g60", "gRTP_48k", "gRTP_90k", "gRTP_27M"], Standard: ["TAI", "UTC"], OffsetType: ["Shift", "GrainAccurateTime", "AbsoluteTime"], ReferenceFrame: ["PTP", "FreeRunningCounter"] };