Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function coerceReadValueId(node) {
if (typeof node === "string" || node instanceof NodeId) {
return new read_service.ReadValueId({
nodeId: resolveNodeId(node),
attributeId: read_service.AttributeIds.Value,
indexRange: null,
dataEncoding: {namespaceIndex: 0, name: null}
});
} else {
assert(node instanceof Object);
return new read_service.ReadValueId(node);
}
}
function coerceReadValueId(node) {
if (typeof node === "string" || node instanceof NodeId) {
return new read_service.ReadValueId({
nodeId: resolveNodeId(node),
attributeId: read_service.AttributeIds.Value,
indexRange: null,
dataEncoding: {namespaceIndex: 0, name: null}
});
} else {
assert(node instanceof Object);
return new read_service.ReadValueId(node);
}
}
function ClientMonitoredItemBase(subscription, itemToMonitor, monitoringParameters) {
assert(subscription.constructor.name === "ClientSubscription");
const self = this;
self.itemToMonitor = new read_service.ReadValueId(itemToMonitor);
self.monitoringParameters = new subscription_service.MonitoringParameters(monitoringParameters);
self.subscription = subscription;
self.monitoringMode = subscription_service.MonitoringMode.Reporting;
assert(self.monitoringParameters.clientHandle === 4294967295, "should not have a client handle yet");
}
util.inherits(ClientMonitoredItemBase, EventEmitter);
MonitoredItemModifyResult, MonitoredItemNotification, MonitoringMode,
MonitoringParameters
} from "node-opcua-service-subscription";
import {
DataChangeFilter, DataChangeTrigger, DeadbandType,
isOutsideDeadbandAbsolute, isOutsideDeadbandNone, isOutsideDeadbandPercent,
PseudoRange
} from "node-opcua-service-subscription";
import { StatusCode, StatusCodes } from "node-opcua-status-code";
import { EventFieldList, MonitoringFilter, ReadValueIdOptions, SimpleAttributeOperand } from "node-opcua-types";
import { sameVariant, Variant } from "node-opcua-variant";
import { appendToTimer, removeFromTimer } from "./node_sampler";
import { validateFilter } from "./validate_filter";
const defaultItemToMonitor: ReadValueIdOptions = new ReadValueId({
attributeId: AttributeIds.Value,
indexRange: undefined,
});
const debugLog = make_debugLog(__filename);
const doDebug = checkDebugFlag(__filename);
function _adjust_sampling_interval(samplingInterval: number, node_minimumSamplingInterval: number): number {
assert(_.isNumber(node_minimumSamplingInterval), "expecting a number");
if (samplingInterval === 0) {
return (node_minimumSamplingInterval === 0)
? samplingInterval
: Math.max(MonitoredItem.minimumSamplingInterval, node_minimumSamplingInterval);
}