-
Notifications
You must be signed in to change notification settings - Fork 6
/
index.js
45 lines (37 loc) · 1.46 KB
/
index.js
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
44
45
var opcua = require("node-opcua");
var carAS = require("./Car/Car1/Car_object");
var os = require("os");
var hostname = os.hostname();
const config = require('./config');
// Let's create an instance of OPCUAServer
// 2.0 resourcePath must start with '/'
var server = new opcua.OPCUAServer({
port: parseInt(config.port), // the port of the listening socket of the server
resourcePath: config.resourcePath, // this path will be added to the endpoint resource name
buildInfo : {
productName: config.productName,
buildNumber: "30620",
buildDate: new Date(2020,6,30)
},
serverCertificateManager: new opcua.OPCUACertificateManager({
automaticallyAcceptUnknownCertificate: true,
rootFolder: "node_modules/node-opcua-server-discovery/certificates"
})
});
function post_initialize() {
console.log("initialized");
var TimingSharedProperties = {
"accelerationDeltaTime": 1000,
"temperatureDeltaTime": 1000,
"pressuresDeltaTime": 1000,
"oxigenDeltaTime": 1000
}
carAS.construct_my_address_space(server, TimingSharedProperties);
server.start(function() {
console.log("Server is now listening ... (press CTRL+C to stop)");
const url = "opc.tcp://" + hostname + ":" + server.options.port + server.options.resourcePath;
console.log("Primary server endpoint URL is ", url)
console.log("\nServer options:\n", server.options);
});
}
server.initialize(post_initialize);