Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it("should bind an xml-preloaded Extension Object Variable : ServerStatus ", function (done) {
// in this test, we verify that we can easily bind the Server_ServerStatus object
// the process shall automatically bind variables and substructures recursively
var VariableIds = require("node-opcua-constants").VariableIds;
var makeNodeId = require("node-opcua-nodeid").makeNodeId;
var serverStatus = addressSpace.findNode(makeNodeId(VariableIds.Server_ServerStatus));
serverStatus.browseName.toString().should.eql("ServerStatus");
// before bindExtensionObject is called, startTime property exists but is not bound
serverStatus.should.have.property("startTime");
serverStatus.startTime.readValue().value.dataType.should.eql(DataType.Null);
serverStatus.readValue().value.dataType.should.eql(DataType.Null);
//Xx value.startTime.should.eql(DataType.Null);
//xx debugLog("serverStatus.startTime =",serverStatus.startTime.readValue().value.toString());
serverStatus.bindExtensionObject();
serverStatus.readValue().value.value.startTime.toISOString().should.eql("1601-01-01T00:00:00.000Z");
serverStatus.startTime.readValue().value.value.toISOString().should.eql("1601-01-01T00:00:00.000Z");
function bindServerStatus() {
const serverStatusNode =
addressSpace.findNode(makeNodeId(VariableIds.Server_ServerStatus)) as UAServerStatus;
if (!serverStatusNode) {
return;
}
if (serverStatusNode) {
serverStatusNode.bindExtensionObject(engine.serverStatus);
// xx serverStatusNode.updateExtensionObjectPartial(self.serverStatus);
// xx self.serverStatus = serverStatusNode.$extensionObject;
serverStatusNode.minimumSamplingInterval = 1000;
}
const currentTimeNode =
addressSpace.findNode(makeNodeId(VariableIds.Server_ServerStatus_CurrentTime)) as UAVariable;
if (currentTimeNode) {
currentTimeNode.minimumSamplingInterval = 1000;
function bindServerStatus() {
const serverStatusNode = engine.addressSpace.findNode(makeNodeId(VariableIds.Server_ServerStatus));
if (!serverStatusNode) {
return;
}
if (serverStatusNode) {
serverStatusNode.bindExtensionObject(engine.serverStatus);
//xx serverStatusNode.updateExtensionObjectPartial(self.serverStatus);
//xx self.serverStatus = serverStatusNode.$extensionObject;
serverStatusNode.minimumSamplingInterval = 1000;
}
const currentTimeNode = engine.addressSpace.findNode(makeNodeId(VariableIds.Server_ServerStatus_CurrentTime));
if (currentTimeNode) {
currentTimeNode.minimumSamplingInterval = 1000;
}
const secondsTillShutdown = engine.addressSpace.findNode(makeNodeId(VariableIds.Server_ServerStatus_SecondsTillShutdown));
if (secondsTillShutdown) {