-
Notifications
You must be signed in to change notification settings - Fork 0
/
ComTest.js
39 lines (33 loc) · 1.19 KB
/
ComTest.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
// ComTest.js
function init(myscada) {
console.log("[ComTest.js] Init function called");
// Export the static value in an object
exports.messageComTest = { value1: 7, value2: "Test Value from ComTest.js" };
console.log("[ComTest.js] Exported messageComTest:", exports.messageComTest);
// Read initial tags
myscada.readTagsSymbolic("ComTest", (err, data) => {
if (!err) {
var word = data['word'] ? data['word'].value : null;
console.log("[ComTest.js] Read initial tags:", data);
} else {
console.error("[ComTest.js] Error reading initial tags:", err);
}
});
// Write tags for tag group ComTest
var options = {
name: "ComTest",
values: {
'word': 7,
'message': "Test Value from ComTest.js"
}
};
console.log("[ComTest.js] Writing tags with options:", options);
myscada.writeTags(options, (err, data) => {
if (err) {
console.error("[ComTest.js] Error writing tags:", err);
} else {
console.log("[ComTest.js] Successfully wrote to tags:", data);
}
});
}
exports.init = init;