-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
42 lines (34 loc) · 1.39 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
var opcua = require("node-opcua");
var weatherAS = require("./Weatheer/Weather1/Weather_object");
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,06,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,
"oxigenDeltaTime": 1000
}
weatherAS.construct_my_address_space(server, TimingSharedProperties);
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);