Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// note : OutputArguments property is optional thus may be missing
outputArgumentRef = (outputArgumentRef.length === 1) ? outputArgumentRef[0] : null;
//xx console.log("xxxx argument", util.inspect(argument, {colors: true, depth: 10}));
//xx console.log("xxxx argument nodeId", argument.nodeId.toString());
let inputArguments = [], outputArguments = [];
const nodesToRead = [];
const actions = [];
if (inputArgumentRef) {
nodesToRead.push({
nodeId: inputArgumentRef.nodeId,
attributeId: read_service.AttributeIds.Value
});
actions.push(function (result) {
inputArguments = result.value.value;
});
}
if (outputArgumentRef) {
nodesToRead.push({
nodeId: outputArgumentRef.nodeId,
attributeId: read_service.AttributeIds.Value
});
actions.push(function (result) {
outputArguments = result.value.value;
});
}
if (nodesToRead.length === 0) {
value: new DataValue({value: value})
};
this.write(nodeToWrite, function (err, statusCode) {
/* istanbul ignore next */
if (err) {
return callback(err);
}
assert(statusCode);
callback(null, statusCode);
});
};
const keys = Object.keys(read_service.AttributeIds).filter(function (k) {
return k !== "INVALID";
});
function composeResult(nodes, nodesToRead, dataValues) {
assert(nodesToRead.length === dataValues.length);
let i = 0, c = 0;
const results = [];
let dataValue, k, nodeToRead;
for (let n = 0; n < nodes.length; n++) {
const node = nodes[n];
const data = {};
const BaseNode = require("node-opcua-address-space").BaseNode;
const sameDataValue = require("node-opcua-data-value").sameDataValue;
const sameVariant = require("node-opcua-variant").sameVariant;
const isValidVariant = require("node-opcua-variant").isValidVariant;
const MonitoringMode = subscription_service.MonitoringMode;
const MonitoringParameters = subscription_service.MonitoringParameters;
const MonitoredItemModifyResult = subscription_service.MonitoredItemModifyResult;
const TimestampsToReturn = read_service.TimestampsToReturn;
const EventFilter = require("node-opcua-service-filter").EventFilter;
const apply_timestamps = require("node-opcua-data-value").apply_timestamps;
const UAVariable = require("node-opcua-address-space").UAVariable;
const defaultItemToMonitor = {indexRange: null, attributeId: read_service.AttributeIds.Value};
const SessionContext = require("node-opcua-address-space").SessionContext;
const NumericRange = require("node-opcua-numeric-range").NumericRange;
const debugLog = require("node-opcua-debug").make_debugLog(__filename);
const doDebug = require("node-opcua-debug").checkDebugFlag(__filename);
function _adjust_sampling_interval(samplingInterval,node_minimumSamplingInterval) {
assert(_.isNumber(node_minimumSamplingInterval,"expecting a number"));
if (samplingInterval === 0) {
return (node_minimumSamplingInterval === 0) ? samplingInterval : Math.max(MonitoredItem.minimumSamplingInterval,node_minimumSamplingInterval);
}