Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this._samplingId = undefined;
this.filter = null;
this._set_parameters(options);
this.monitoredItemId = options.monitoredItemId; // ( known as serverHandle)
this.queue = [];
this.overflow = false;
this.oldDataValue = new DataValue({ statusCode: StatusCodes.BadDataUnavailable }); // unset initially
// user has to call setMonitoringMode
this.monitoringMode = MonitoringMode.Invalid;
this.timestampsToReturn = options.timestampsToReturn || TimestampsToReturn.Neither;
this.itemToMonitor = options.itemToMonitor;
this._node = null;
this._semantic_version = 0;
if (doDebug) {
debugLog("Monitoring ", options.itemToMonitor.toString());
}
this._on_node_disposed_listener = null;
MonitoredItem.registry.register(this);
}
nodeToRead: ReadValueIdOptions,
timestampsToReturn?: TimestampsToReturn
): DataValue {
assert(context instanceof SessionContext);
const engine = this;
const nodeId = nodeToRead.nodeId!;
const attributeId = nodeToRead.attributeId!;
const indexRange = nodeToRead.indexRange;
const dataEncoding = nodeToRead.dataEncoding;
if (timestampsToReturn === TimestampsToReturn.Invalid) {
return new DataValue({ statusCode: StatusCodes.BadTimestampsToReturnInvalid });
}
timestampsToReturn = (timestampsToReturn !== undefined) ? timestampsToReturn : TimestampsToReturn.Neither;
const obj = engine.__findObject(nodeId!);
let dataValue;
if (!obj) {
// may be return BadNodeIdUnknown in dataValue instead ?
// Object Not Found
return new DataValue({ statusCode: StatusCodes.BadNodeIdUnknown });
} else {
// check access
// BadUserAccessDenied
// BadNotReadable
// invalid attributes : BadNodeAttributesInvalid
// invalid range : BadIndexRangeInvalid
try {