All files / node-opcua-isa95/demo demo_isa95_server.js

0% Statements 0/14
100% Branches 0/0
0% Functions 0/2
0% Lines 0/14

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43                                                                                     
/*global require,setInterval,console */
 
var opcua = require("node-opcua");
 
// let's add the ISA95 server extensions
require("node-opcua-isa95")(opcua);
 
var xmlFiles = [
    opcua.standard_nodeset_file,
    opcua.ISA95.nodeset_file
];
 
 
// Let's create an instance of OPCUAServer
var server = new opcua.OPCUAServer({
 
    port: 4334, // the port of the listening socket of the server
 
    nodeset_filename: xmlFiles,
    resourcePath: "UA/MyLittleISA95Server", // this path will be added to the endpoint resource name
    buildInfo : {
        productName: "MySampleServerISA95"
    }
});
 
 
function post_initialize() {
    console.log("initialized");
 
    var instantiateSampleISA95Model = require("../test/helpers/isa95_demo_address_space").instantiateSampleISA95Model;
    var addressSpace = server.engine.addressSpace;
    instantiateSampleISA95Model(addressSpace);
 
    server.start(function() {
        console.log("Server is now listening ... ( press CTRL+C to stop)");
        console.log("port ", server.endpoints[0].port);
        var endpointUrl = server.endpoints[0].endpointDescriptions()[0].endpointUrl;
        console.log(" the primary server endpoint url is ", endpointUrl );
    });
}
 
server.initialize(post_initialize);