Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
serverStatus.readValue().value.value.buildInfo.productName.should.eql("productName1");
serverStatus.buildInfo.productName.readValue().value.value.should.eql("productName1");
serverStatus.buildInfo.productName.setValueFromSource({dataType: DataType.String, value: "productName2"});
serverStatus.readValue().value.value.buildInfo.productName.should.eql("productName2");
serverStatus.buildInfo.productName.readValue().value.value.should.eql("productName2");
var async = require("async");
var StatusCodes = require("node-opcua-status-code").StatusCodes;
var write_service = require("node-opcua-service-write");
var WriteValue = write_service.WriteValue;
var makeAccessLevel = require("node-opcua-data-model").makeAccessLevel;
// now use WriteValue instead
// make sure value is writable
var rw = makeAccessLevel("CurrentRead | CurrentWrite");
serverStatus.buildInfo.productName.accessLevel = rw;
serverStatus.buildInfo.productName.userAccessLevel = rw;
serverStatus.buildInfo.accessLevel = rw;
serverStatus.buildInfo.userAccessLevel = rw;
serverStatus.accessLevel = rw;
serverStatus.userAccessLevel = rw;
async.series([
function (callback) {
var writeValue = new WriteValue({
attributeId: 13, // value
value: {
statusCode: StatusCodes.Good,
function convertAccessLevel(accessLevel) {
accessLevel = parseInt(accessLevel || 1); // CurrentRead if not specified
return makeAccessLevel(accessLevel);
}
function adjust_userAccessLevel(userAccessLevel, accessLevel) {
userAccessLevel = utils.isNullOrUndefined(userAccessLevel) ? "CurrentRead | CurrentWrite" : userAccessLevel;
userAccessLevel = makeAccessLevel(userAccessLevel);
accessLevel = utils.isNullOrUndefined(accessLevel) ? "CurrentRead | CurrentWrite" : accessLevel;
accessLevel = makeAccessLevel(accessLevel);
return makeAccessLevel(accessLevel.value & userAccessLevel.value);
}
function adjust_accessLevel(accessLevel) {
accessLevel = utils.isNullOrUndefined(accessLevel) ? "CurrentRead | CurrentWrite" : accessLevel;
accessLevel = makeAccessLevel(accessLevel);
assert(_.isFinite(accessLevel.value));
return accessLevel;
}
function adjust_userAccessLevel(userAccessLevel, accessLevel) {
userAccessLevel = utils.isNullOrUndefined(userAccessLevel) ? "CurrentRead | CurrentWrite" : userAccessLevel;
userAccessLevel = makeAccessLevel(userAccessLevel);
accessLevel = utils.isNullOrUndefined(accessLevel) ? "CurrentRead | CurrentWrite" : accessLevel;
accessLevel = makeAccessLevel(accessLevel);
return makeAccessLevel(accessLevel.value & userAccessLevel.value);
}
function adjust_userAccessLevel(userAccessLevel, accessLevel) {
userAccessLevel = utils.isNullOrUndefined(userAccessLevel) ? "CurrentRead | CurrentWrite" : userAccessLevel;
userAccessLevel = makeAccessLevel(userAccessLevel);
accessLevel = utils.isNullOrUndefined(accessLevel) ? "CurrentRead | CurrentWrite" : accessLevel;
accessLevel = makeAccessLevel(accessLevel);
return makeAccessLevel(accessLevel.value & userAccessLevel.value);
}