Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function build_server_with_temperature_device(options, done) {
assert(_.isFunction(done, "expecting a callback function"));
assert(typeof opcua.nodesets.standard_nodeset_file === "string");
//xx console.log("xxx building server with temperature device");
// use mini_nodeset_filename for speed up if not otherwise specified
options.nodeset_filename = options.nodeset_filename ||
[
opcua.nodesets.standard_nodeset_file
];
options.userManager = userManager;
const server = new OPCUAServer(options);
// we will connect to first server end point
server.on("session_closed", function (session, reason) {
//xx console.log(" server_with_temperature_device has closed a session :",reason);
//xx console.log(chalk.cyan(" session name: "),session.sessionName.toString());
});
server.on("post_initialize", function () {
const addressSpace = server.engine.addressSpace;
function build_server_with_temperature_device(options, done) {
assert(_.isFunction(done, "expecting a callback function"));
assert(typeof opcua.nodesets.standard_nodeset_file === "string");
//xx console.log("xxx building server with temperature device");
// use mini_nodeset_filename for speed up if not otherwise specified
options.nodeset_filename = options.nodeset_filename ||
[
opcua.nodesets.standard_nodeset_file
];
options.userManager = userManager;
const server = new OPCUAServer(options);
// we will connect to first server end point
server.on("session_closed", function (session, reason) {
//xx console.log(" server_with_temperature_device has closed a session :",reason);
#!/usr/bin/env node
"use strict";
/*global require,setInterval,console */
const path = require("path");
const opcua = require("node-opcua");
function constructFilename(filename) {
return path.join(__dirname,"../",filename);
}
const server_certificate_file = constructFilename("certificates/server_selfsigned_cert_2048.pem");
const server_certificate_privatekey_file = constructFilename("certificates/server_key_2048.pem");
const nodeset_filenames = [ opcua.nodesets.standard_nodeset_file ];
const server = new opcua.OPCUAServer({
certificateFile: server_certificate_file,
privateKeyFile: server_certificate_privatekey_file,
port: 4334, // the port of the listening socket of the server
resourcePath: "/UA/MyLittleServer", // this path will be added to the endpoint resource name
buildInfo : {
productName: "DemoAlarmServer",
buildNumber: "1",
buildDate: new Date(2016,9,27)
},
nodeset_filename: nodeset_filenames
});
Error.stackTraceLimit = Infinity;
const argv = require("yargs")
.wrap(132)
.string("port")
.describe("port")
.alias('p', 'port')
.argv;
const rootFolder = path.join(__dirname,"../");
function constructFilename(pathname) {
return path.join(__dirname,"../../",pathname);
}
const OPCUAServer = opcua.OPCUAServer;
const standard_nodeset_file = opcua.nodesets.standard_nodeset_file;
const port = parseInt(argv.port) || 26555;
const server_certificate_file = constructFilename("certificates/server_cert_2048.pem");
const server_certificate_privatekey_file = constructFilename("certificates/server_key_2048.pem");
const server_options = {
certificateFile: server_certificate_file,
privateKeyFile: server_certificate_privatekey_file,
port: port,
nodeset_filename: [
standard_nodeset_file,
path.join(rootFolder,"modeling/my_data_type.xml")
]
};
Error.stackTraceLimit = Infinity;
const argv = require("yargs")
.wrap(132)
.string("port")
.describe("port")
.alias('p', 'port')
.argv;
const rootFolder = path.join(__dirname,"../");
function constructFilename(pathname) {
return path.join(__dirname,"../../",pathname);
}
const OPCUAServer = opcua.OPCUAServer;
const standard_nodeset_file = opcua.nodesets.standard_nodeset_file;
const port = parseInt(argv.port) || 26555;
const server_certificate_file = constructFilename("certificates/server_cert_1024.pem");
const server_certificate_privatekey_file = constructFilename("certificates/server_key_1024.pem");
const server_options = {
certificateFile: server_certificate_file,
privateKeyFile: server_certificate_privatekey_file,
port: port,
nodeset_filename: [
standard_nodeset_file,
path.join(rootFolder,"modeling/my_data_type.xml")
]
};
beforeEach((done) => {
addressSpace = opcua.AddressSpace.create();
const nodesets: string[] = [
opcua.nodesets.standard_nodeset_file
];
opcua.generateAddressSpace(addressSpace, nodesets, (err?: Error) => {
done(err);
});
});
Error.stackTraceLimit = Infinity;
const argv = require("yargs")
.wrap(132)
.string("port")
.describe("port")
.alias('p', 'port')
.argv;
const rootFolder = path.join(__dirname,"../");
function constructFilename(pathname) {
return path.join(__dirname,"../../",pathname);
}
const OPCUAServer = opcua.OPCUAServer;
const standard_nodeset_file = opcua.nodesets.standard_nodeset_file;
const port = parseInt(argv.port) || 26555;
const server_certificate_file = constructFilename("certificates/server_cert_2048.pem");
const server_certificate_privatekey_file = constructFilename("certificates/server_key_2048.pem");
const server_options = {
certificateFile: server_certificate_file,
privateKeyFile: server_certificate_privatekey_file,
port: port,
nodeset_filename: [
standard_nodeset_file,
path.join(rootFolder,"modeling/my_data_type.xml")
]
};
before((done: (err: Error | null) => void) => {
addressSpace = opcua.AddressSpace.create();
const nodesets: string[] = [
opcua.nodesets.standard_nodeset_file
];
opcua.generateAddressSpace(addressSpace, nodesets, (err?: Error) => {
const namespace = addressSpace.registerNamespace("PRIVATENAMESPACE");
namespace.index.should.eql(1);
should.exist(addressSpace.getOwnNamespace());
addAggregateSupport(addressSpace);
h1 = createHistorian1(addressSpace);
h2 = createHistorian2(addressSpace);
h3 = createHistorian3(addressSpace);
h4 = createHistorian4(addressSpace);
done(err!);
});
console.log(" server certificate : ", server_certificate_file);
const productUri = argv.applicationName || "NodeOPCUA-Server";
const server_options = {
certificateFile: server_certificate_file,
privateKeyFile: server_certificate_privatekey_file,
port: port,
//xx (not used: causes UAExpert to get confused) resourcePath: "UA/Server",
maxAllowedSessionNumber: maxAllowedSessionNumber,
maxConnectionsPerEndpoint: maxConnectionsPerEndpoint,
nodeset_filename: [
opcua.nodesets.standard_nodeset_file,
opcua.nodesets.di_nodeset_filename
],
serverInfo: {
applicationName: { text: "NodeOPCUA", locale: "en" },
applicationUri: makeApplicationUrn("%FQDN%", productUri),
gatewayServerUri: null,
productUri: productUri,
discoveryProfileUri: null,
discoveryUrls: []
},
buildInfo: {
buildNumber: "1234"
},
serverCapabilities: {
maxBrowseContinuationPoints: 10,
const productUri = argv.applicationName || "NodeOPCUA-Server";
const server_options = {
certificateFile: server_certificate_file,
privateKeyFile: server_certificate_privatekey_file,
port: port,
//xx (not used: causes UAExpert to get confused) resourcePath: "UA/Server",
maxAllowedSessionNumber: maxAllowedSessionNumber,
maxConnectionsPerEndpoint: maxConnectionsPerEndpoint,
nodeset_filename: [
opcua.nodesets.standard_nodeset_file,
opcua.nodesets.di_nodeset_filename
],
serverInfo: {
applicationName: { text: "NodeOPCUA", locale: "en" },
applicationUri: makeApplicationUrn("%FQDN%", productUri),
gatewayServerUri: null,
productUri: productUri,
discoveryProfileUri: null,
discoveryUrls: []
},
buildInfo: {
buildNumber: "1234"
},
serverCapabilities: {
maxBrowseContinuationPoints: 10,
maxHistoryContinuationPoints: 10,