opcua-snapshot 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/Dumper.js +13 -3
- package/lib/Loader.js +15 -4
- package/package.json +1 -1
package/lib/Dumper.js
CHANGED
|
@@ -80,11 +80,21 @@ module.exports = class extends EventEmitter {
|
|
|
80
80
|
name
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
dst.
|
|
83
|
+
switch (dst.class) {
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
case 'Method':
|
|
86
|
+
const arg = await this.#session.getArgumentDefinition (reference.nodeId)
|
|
87
|
+
for (const k in arg) dst [k] = arg [k]
|
|
88
|
+
break
|
|
86
89
|
|
|
87
|
-
|
|
90
|
+
case 'Variable':
|
|
91
|
+
dst.type = ns0id (nodeClass, typeDefinition)
|
|
92
|
+
vars.push (dst) // no break
|
|
93
|
+
|
|
94
|
+
default:
|
|
95
|
+
await this.loadObject (dst)
|
|
96
|
+
|
|
97
|
+
}
|
|
88
98
|
|
|
89
99
|
{
|
|
90
100
|
|
package/lib/Loader.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
const EventEmitter = require ('node:events')
|
|
2
|
-
const {StatusCodes} = require ('node-opcua')
|
|
3
2
|
|
|
4
3
|
const Snapshot = require('./Snapshot')
|
|
5
4
|
, {nodeId} = Snapshot
|
|
@@ -64,13 +63,13 @@ module.exports = class extends EventEmitter {
|
|
|
64
63
|
|
|
65
64
|
}
|
|
66
65
|
|
|
67
|
-
setValue (nodeOrId, value, date, status
|
|
66
|
+
setValue (nodeOrId, value, date, status) {
|
|
68
67
|
|
|
69
68
|
setValueFromSource (this.getNode (nodeOrId), value, status, date)
|
|
70
69
|
|
|
71
70
|
}
|
|
72
71
|
|
|
73
|
-
setValues (nodeOrId, values, dates, status
|
|
72
|
+
setValues (nodeOrId, values, dates, status) {
|
|
74
73
|
|
|
75
74
|
const node = this.getNode (nodeOrId)
|
|
76
75
|
|
|
@@ -85,7 +84,7 @@ module.exports = class extends EventEmitter {
|
|
|
85
84
|
|
|
86
85
|
let {dataType, value, HasHistoricalConfiguration} = o
|
|
87
86
|
|
|
88
|
-
if (dataType === 0) dataType =
|
|
87
|
+
if (dataType === 0) dataType = 12
|
|
89
88
|
|
|
90
89
|
if (dataType === 13) value = new Date (value)
|
|
91
90
|
|
|
@@ -109,6 +108,14 @@ module.exports = class extends EventEmitter {
|
|
|
109
108
|
|
|
110
109
|
}
|
|
111
110
|
|
|
111
|
+
addMethod (componentOf, o) {
|
|
112
|
+
|
|
113
|
+
const {name: browseName, inputArguments, outputArguments} = o
|
|
114
|
+
|
|
115
|
+
return this.getNs (o).addMethod (componentOf, {nodeId : nodeId (o), browseName, inputArguments, outputArguments})
|
|
116
|
+
|
|
117
|
+
}
|
|
118
|
+
|
|
112
119
|
addObject (organizedBy, o) {
|
|
113
120
|
|
|
114
121
|
const {Organizes, HasComponent} = o
|
|
@@ -123,6 +130,10 @@ module.exports = class extends EventEmitter {
|
|
|
123
130
|
this.emit ('var', this.addVariable (node, i))
|
|
124
131
|
break
|
|
125
132
|
|
|
133
|
+
case 'Method':
|
|
134
|
+
this.emit ('method', this.addMethod (node, i))
|
|
135
|
+
break
|
|
136
|
+
|
|
126
137
|
}
|
|
127
138
|
|
|
128
139
|
}
|