opcua-webapi-ts 1.1.26 → 1.1.28
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/dist/cjs/client/utils/UaModelling.js +2 -2
- package/dist/cjs/client/utils/UaNodeBrowser.js +5 -4
- package/dist/cjs/client/utils/UaNodeReader.js +2 -2
- package/dist/cjs/client/utils/UaNodeSerializer.js +1 -1
- package/dist/cjs/common/nodes/UaNode.js +7 -0
- package/dist/cjs/common/nodes/UaVariable.js +1 -1
- package/dist/cjs/common/types/UaVariant.js +83 -0
- package/dist/client/utils/UaModelling.js +2 -2
- package/dist/client/utils/UaNodeBrowser.d.ts +2 -1
- package/dist/client/utils/UaNodeBrowser.js +5 -4
- package/dist/client/utils/UaNodeReader.js +2 -2
- package/dist/client/utils/UaNodeSerializer.js +1 -1
- package/dist/common/nodes/UaNode.d.ts +3 -0
- package/dist/common/nodes/UaNode.js +7 -0
- package/dist/common/nodes/UaVariable.js +1 -1
- package/dist/common/types/UaVariant.d.ts +1 -0
- package/dist/common/types/UaVariant.js +83 -0
- package/package.json +1 -1
|
@@ -98,7 +98,7 @@ class UaModelling {
|
|
|
98
98
|
return null;
|
|
99
99
|
if (objectType.isObjectMemberRead)
|
|
100
100
|
return objectType;
|
|
101
|
-
let typeMemberBrowser = new __1.UaNodeBrowser(this._client, [objectType.nodeId], common_1.UaNodeId.from(common_1.ReferenceTypeIds.Aggregates), opcua_webapi_1.NodeClass.Object);
|
|
101
|
+
let typeMemberBrowser = new __1.UaNodeBrowser(this._client, [objectType.nodeId], common_1.UaNodeId.from(common_1.ReferenceTypeIds.Aggregates), true, opcua_webapi_1.NodeClass.Object);
|
|
102
102
|
yield typeMemberBrowser.browse();
|
|
103
103
|
let browseMemberResults = typeMemberBrowser.results();
|
|
104
104
|
let instanceNodes = new Map();
|
|
@@ -113,7 +113,7 @@ class UaModelling {
|
|
|
113
113
|
for (let node of instanceNodes) {
|
|
114
114
|
memberObjectIds.push(node[1].nodeId);
|
|
115
115
|
}
|
|
116
|
-
let modellingRuleBrowser = new __1.UaNodeBrowser(this._client, memberObjectIds, common_1.UaNodeId.from(common_1.ReferenceTypeIds.HasModellingRule), opcua_webapi_1.NodeClass.Object);
|
|
116
|
+
let modellingRuleBrowser = new __1.UaNodeBrowser(this._client, memberObjectIds, common_1.UaNodeId.from(common_1.ReferenceTypeIds.HasModellingRule), false, opcua_webapi_1.NodeClass.Object);
|
|
117
117
|
yield modellingRuleBrowser.browse();
|
|
118
118
|
let browseModellingRuleResults = modellingRuleBrowser.results();
|
|
119
119
|
for (let item of browseModellingRuleResults) {
|
|
@@ -13,10 +13,11 @@ exports.UaTypeBrowser = exports.UaObjectBrowser = exports.UaNodeBrowser = void 0
|
|
|
13
13
|
const opcua_webapi_1 = require("opcua-webapi");
|
|
14
14
|
const common_1 = require("../../common");
|
|
15
15
|
class UaNodeBrowser {
|
|
16
|
-
constructor(client, nodeIds, referenceType, nodeClassToReturn, maxNodesPerBrowse, maxReferencesPerNode) {
|
|
16
|
+
constructor(client, nodeIds, referenceType, includeSubtypes, nodeClassToReturn, maxNodesPerBrowse, maxReferencesPerNode) {
|
|
17
17
|
this._client = client;
|
|
18
18
|
this._nodesToBrowse = [];
|
|
19
19
|
this._referenceType = referenceType;
|
|
20
|
+
this._includeSubtypes = includeSubtypes;
|
|
20
21
|
this._nodeClassToReturn = nodeClassToReturn;
|
|
21
22
|
this._continuationPointToBrowse = [];
|
|
22
23
|
this._maxNodesPerBrowse = (null == maxNodesPerBrowse || maxNodesPerBrowse <= 0) ? 50 : maxNodesPerBrowse;
|
|
@@ -70,7 +71,7 @@ class UaNodeBrowser {
|
|
|
70
71
|
let nodesToBrowse = this._nodesToBrowse.splice(0, this._maxNodesPerBrowse);
|
|
71
72
|
let browseDescriptions = [];
|
|
72
73
|
for (let item of nodesToBrowse) {
|
|
73
|
-
let browseDescription = new common_1.UaBrowseDescription(item, opcua_webapi_1.BrowseDirection.Forward, this._referenceType,
|
|
74
|
+
let browseDescription = new common_1.UaBrowseDescription(item, opcua_webapi_1.BrowseDirection.Forward, this._referenceType, this._includeSubtypes, this._nodeClassToReturn, 63);
|
|
74
75
|
browseDescriptions.push(browseDescription);
|
|
75
76
|
}
|
|
76
77
|
let results = yield this._client.browse(browseDescriptions, this._maxReferencesPerNode);
|
|
@@ -145,13 +146,13 @@ class UaNodeBrowser {
|
|
|
145
146
|
exports.UaNodeBrowser = UaNodeBrowser;
|
|
146
147
|
class UaObjectBrowser extends UaNodeBrowser {
|
|
147
148
|
constructor(client, nodeIds, referenceType = common_1.UaNodeId.from(common_1.ReferenceTypeIds.HierarchicalReferences)) {
|
|
148
|
-
super(client, nodeIds, referenceType, opcua_webapi_1.NodeClass.Object, 20);
|
|
149
|
+
super(client, nodeIds, referenceType, true, opcua_webapi_1.NodeClass.Object, 20);
|
|
149
150
|
}
|
|
150
151
|
}
|
|
151
152
|
exports.UaObjectBrowser = UaObjectBrowser;
|
|
152
153
|
class UaTypeBrowser extends UaNodeBrowser {
|
|
153
154
|
constructor(client, nodeIds) {
|
|
154
|
-
super(client, nodeIds, common_1.UaNodeId.from(common_1.ReferenceTypeIds.
|
|
155
|
+
super(client, nodeIds, common_1.UaNodeId.from(common_1.ReferenceTypeIds.HasSubtype), false, opcua_webapi_1.NodeClass.ObjectType | opcua_webapi_1.NodeClass.VariableType | opcua_webapi_1.NodeClass.DataType | opcua_webapi_1.NodeClass.ReferenceType, 20);
|
|
155
156
|
}
|
|
156
157
|
}
|
|
157
158
|
exports.UaTypeBrowser = UaTypeBrowser;
|
|
@@ -70,7 +70,7 @@ class UaNodeReader {
|
|
|
70
70
|
nodeIdsToBrowse.push(item.nodeId);
|
|
71
71
|
nodeIdsSet.add(item.nodeId.toString());
|
|
72
72
|
}
|
|
73
|
-
let nodeReferenceBrowser = new UaNodeBrowser_1.UaNodeBrowser(this._client, nodeIdsToBrowse, this._referenceTypeToReturn, this._nodeClassToReturn);
|
|
73
|
+
let nodeReferenceBrowser = new UaNodeBrowser_1.UaNodeBrowser(this._client, nodeIdsToBrowse, this._referenceTypeToReturn, true, this._nodeClassToReturn);
|
|
74
74
|
yield nodeReferenceBrowser.browse();
|
|
75
75
|
let childReferences = nodeReferenceBrowser.results();
|
|
76
76
|
let childNodesToBrowse = [];
|
|
@@ -87,7 +87,7 @@ class UaNodeReader {
|
|
|
87
87
|
}
|
|
88
88
|
let variableReferences = [];
|
|
89
89
|
if (childNodesToBrowse.length != 0) {
|
|
90
|
-
let childReferenceBrowser = new UaNodeBrowser_1.UaNodeBrowser(this._client, childNodesToBrowse, common_1.UaNodeId.from(common_1.ReferenceTypeIds.Aggregates), opcua_webapi_1.NodeClass.Variable);
|
|
90
|
+
let childReferenceBrowser = new UaNodeBrowser_1.UaNodeBrowser(this._client, childNodesToBrowse, common_1.UaNodeId.from(common_1.ReferenceTypeIds.Aggregates), true, opcua_webapi_1.NodeClass.Variable);
|
|
91
91
|
yield childReferenceBrowser.browse();
|
|
92
92
|
variableReferences = childReferenceBrowser.results();
|
|
93
93
|
}
|
|
@@ -18,7 +18,7 @@ class UaObjectSerializer {
|
|
|
18
18
|
let propertyJson = {
|
|
19
19
|
name: variable.browseName,
|
|
20
20
|
displayName: variable.displayName.text,
|
|
21
|
-
value: (variable.value) ? variable.value.
|
|
21
|
+
value: (variable.value) ? variable.value.jsonValue() : null
|
|
22
22
|
};
|
|
23
23
|
properties.push(propertyJson);
|
|
24
24
|
}
|
|
@@ -12,6 +12,7 @@ class UaNode {
|
|
|
12
12
|
this._writeMask = null;
|
|
13
13
|
this._parent = null;
|
|
14
14
|
this._children = [];
|
|
15
|
+
this._customizedData = null;
|
|
15
16
|
}
|
|
16
17
|
get nodeId() {
|
|
17
18
|
return this._nodeId;
|
|
@@ -34,6 +35,12 @@ class UaNode {
|
|
|
34
35
|
set description(description) {
|
|
35
36
|
this._description = description;
|
|
36
37
|
}
|
|
38
|
+
get customizedData() {
|
|
39
|
+
return this._customizedData;
|
|
40
|
+
}
|
|
41
|
+
set customizedData(customizedData) {
|
|
42
|
+
this._customizedData = customizedData;
|
|
43
|
+
}
|
|
37
44
|
}
|
|
38
45
|
exports.UaNode = UaNode;
|
|
39
46
|
class UaDefinitionNode extends UaNode {
|
|
@@ -78,7 +78,7 @@ class UaVariable extends _1.UaInstanceNode {
|
|
|
78
78
|
valueRank: (this._valueRank != 0) ? this._valueRank : undefined,
|
|
79
79
|
accessLevel: this._accessLevel,
|
|
80
80
|
historizing: (this._historizing) ? true : undefined,
|
|
81
|
-
value: this._dataValue ? this._dataValue.value.
|
|
81
|
+
value: this._dataValue ? this._dataValue.value.jsonValue() : undefined,
|
|
82
82
|
members: (members.length != 0) ? members : undefined
|
|
83
83
|
};
|
|
84
84
|
return ret;
|
|
@@ -18,6 +18,89 @@ class UaVariant {
|
|
|
18
18
|
get arrayType() {
|
|
19
19
|
return this._arrayType;
|
|
20
20
|
}
|
|
21
|
+
jsonValue() {
|
|
22
|
+
if (UaVariantType.NodeId == this._type) {
|
|
23
|
+
if (this.isScalar()) {
|
|
24
|
+
return this._value.toString();
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
let nodeIds = this._value;
|
|
28
|
+
let value = [];
|
|
29
|
+
for (let item of nodeIds) {
|
|
30
|
+
value.push(item.toString());
|
|
31
|
+
}
|
|
32
|
+
return value;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
else if (UaVariantType.ExpandedNodeId == this._type) {
|
|
36
|
+
if (this.isScalar()) {
|
|
37
|
+
return this._value.toString();
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
let nodeIds = this._value;
|
|
41
|
+
let value = [];
|
|
42
|
+
for (let item of nodeIds) {
|
|
43
|
+
value.push(item.toString());
|
|
44
|
+
}
|
|
45
|
+
return value;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
else if (UaVariantType.DateTime == this._type) {
|
|
49
|
+
if (this.isScalar()) {
|
|
50
|
+
return this._value.toISOString();
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
let dateTimes = this._value;
|
|
54
|
+
let value = [];
|
|
55
|
+
for (let item of dateTimes) {
|
|
56
|
+
value.push(item.toISOString());
|
|
57
|
+
}
|
|
58
|
+
return value;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
else if (UaVariantType.LocalizedText == this._type) {
|
|
62
|
+
if (this.isScalar()) {
|
|
63
|
+
return this._value.text;
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
let localizedTexts = this._value;
|
|
67
|
+
let value = [];
|
|
68
|
+
for (let item of localizedTexts) {
|
|
69
|
+
value.push(item.text);
|
|
70
|
+
}
|
|
71
|
+
return value;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
else if (UaVariantType.StatusCode == this._type) {
|
|
75
|
+
if (this.isScalar()) {
|
|
76
|
+
return this._value.toString();
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
let statusCodes = this._value;
|
|
80
|
+
let value = [];
|
|
81
|
+
for (let item of statusCodes) {
|
|
82
|
+
value.push(item.toString());
|
|
83
|
+
}
|
|
84
|
+
return value;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
else if (UaVariantType.ExtensionObject == this._type) {
|
|
88
|
+
if (this.isScalar()) {
|
|
89
|
+
return this._value.body;
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
let extensionObjects = this._value;
|
|
93
|
+
let value = [];
|
|
94
|
+
for (let item of extensionObjects) {
|
|
95
|
+
value.push(item.body);
|
|
96
|
+
}
|
|
97
|
+
return value;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
return this._value;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
21
104
|
isScalar() {
|
|
22
105
|
return (UaArrayType.Scalar == this._arrayType) ? true : false;
|
|
23
106
|
}
|
|
@@ -98,7 +98,7 @@ class UaModelling {
|
|
|
98
98
|
return null;
|
|
99
99
|
if (objectType.isObjectMemberRead)
|
|
100
100
|
return objectType;
|
|
101
|
-
let typeMemberBrowser = new __1.UaNodeBrowser(this._client, [objectType.nodeId], common_1.UaNodeId.from(common_1.ReferenceTypeIds.Aggregates), opcua_webapi_1.NodeClass.Object);
|
|
101
|
+
let typeMemberBrowser = new __1.UaNodeBrowser(this._client, [objectType.nodeId], common_1.UaNodeId.from(common_1.ReferenceTypeIds.Aggregates), true, opcua_webapi_1.NodeClass.Object);
|
|
102
102
|
yield typeMemberBrowser.browse();
|
|
103
103
|
let browseMemberResults = typeMemberBrowser.results();
|
|
104
104
|
let instanceNodes = new Map();
|
|
@@ -113,7 +113,7 @@ class UaModelling {
|
|
|
113
113
|
for (let node of instanceNodes) {
|
|
114
114
|
memberObjectIds.push(node[1].nodeId);
|
|
115
115
|
}
|
|
116
|
-
let modellingRuleBrowser = new __1.UaNodeBrowser(this._client, memberObjectIds, common_1.UaNodeId.from(common_1.ReferenceTypeIds.HasModellingRule), opcua_webapi_1.NodeClass.Object);
|
|
116
|
+
let modellingRuleBrowser = new __1.UaNodeBrowser(this._client, memberObjectIds, common_1.UaNodeId.from(common_1.ReferenceTypeIds.HasModellingRule), false, opcua_webapi_1.NodeClass.Object);
|
|
117
117
|
yield modellingRuleBrowser.browse();
|
|
118
118
|
let browseModellingRuleResults = modellingRuleBrowser.results();
|
|
119
119
|
for (let item of browseModellingRuleResults) {
|
|
@@ -9,11 +9,12 @@ export declare class UaNodeBrowser {
|
|
|
9
9
|
private _nodesToBrowse;
|
|
10
10
|
private _continuationPointToBrowse;
|
|
11
11
|
private _referenceType;
|
|
12
|
+
private _includeSubtypes;
|
|
12
13
|
private _nodeClassToReturn;
|
|
13
14
|
private _maxNodesPerBrowse;
|
|
14
15
|
private _maxReferencesPerNode;
|
|
15
16
|
private _readResults;
|
|
16
|
-
constructor(client: UaWebClient, nodeIds: Array<UaNodeId>, referenceType: UaNodeId, nodeClassToReturn: number, maxNodesPerBrowse?: number | null, maxReferencesPerNode?: number | null);
|
|
17
|
+
constructor(client: UaWebClient, nodeIds: Array<UaNodeId>, referenceType: UaNodeId, includeSubtypes: boolean, nodeClassToReturn: number, maxNodesPerBrowse?: number | null, maxReferencesPerNode?: number | null);
|
|
17
18
|
browse(): Promise<void>;
|
|
18
19
|
browseOnce(): Promise<void>;
|
|
19
20
|
results(): Array<BrowseReferenceResult>;
|
|
@@ -13,10 +13,11 @@ exports.UaTypeBrowser = exports.UaObjectBrowser = exports.UaNodeBrowser = void 0
|
|
|
13
13
|
const opcua_webapi_1 = require("opcua-webapi");
|
|
14
14
|
const common_1 = require("../../common");
|
|
15
15
|
class UaNodeBrowser {
|
|
16
|
-
constructor(client, nodeIds, referenceType, nodeClassToReturn, maxNodesPerBrowse, maxReferencesPerNode) {
|
|
16
|
+
constructor(client, nodeIds, referenceType, includeSubtypes, nodeClassToReturn, maxNodesPerBrowse, maxReferencesPerNode) {
|
|
17
17
|
this._client = client;
|
|
18
18
|
this._nodesToBrowse = [];
|
|
19
19
|
this._referenceType = referenceType;
|
|
20
|
+
this._includeSubtypes = includeSubtypes;
|
|
20
21
|
this._nodeClassToReturn = nodeClassToReturn;
|
|
21
22
|
this._continuationPointToBrowse = [];
|
|
22
23
|
this._maxNodesPerBrowse = (null == maxNodesPerBrowse || maxNodesPerBrowse <= 0) ? 50 : maxNodesPerBrowse;
|
|
@@ -70,7 +71,7 @@ class UaNodeBrowser {
|
|
|
70
71
|
let nodesToBrowse = this._nodesToBrowse.splice(0, this._maxNodesPerBrowse);
|
|
71
72
|
let browseDescriptions = [];
|
|
72
73
|
for (let item of nodesToBrowse) {
|
|
73
|
-
let browseDescription = new common_1.UaBrowseDescription(item, opcua_webapi_1.BrowseDirection.Forward, this._referenceType,
|
|
74
|
+
let browseDescription = new common_1.UaBrowseDescription(item, opcua_webapi_1.BrowseDirection.Forward, this._referenceType, this._includeSubtypes, this._nodeClassToReturn, 63);
|
|
74
75
|
browseDescriptions.push(browseDescription);
|
|
75
76
|
}
|
|
76
77
|
let results = yield this._client.browse(browseDescriptions, this._maxReferencesPerNode);
|
|
@@ -145,13 +146,13 @@ class UaNodeBrowser {
|
|
|
145
146
|
exports.UaNodeBrowser = UaNodeBrowser;
|
|
146
147
|
class UaObjectBrowser extends UaNodeBrowser {
|
|
147
148
|
constructor(client, nodeIds, referenceType = common_1.UaNodeId.from(common_1.ReferenceTypeIds.HierarchicalReferences)) {
|
|
148
|
-
super(client, nodeIds, referenceType, opcua_webapi_1.NodeClass.Object, 20);
|
|
149
|
+
super(client, nodeIds, referenceType, true, opcua_webapi_1.NodeClass.Object, 20);
|
|
149
150
|
}
|
|
150
151
|
}
|
|
151
152
|
exports.UaObjectBrowser = UaObjectBrowser;
|
|
152
153
|
class UaTypeBrowser extends UaNodeBrowser {
|
|
153
154
|
constructor(client, nodeIds) {
|
|
154
|
-
super(client, nodeIds, common_1.UaNodeId.from(common_1.ReferenceTypeIds.
|
|
155
|
+
super(client, nodeIds, common_1.UaNodeId.from(common_1.ReferenceTypeIds.HasSubtype), false, opcua_webapi_1.NodeClass.ObjectType | opcua_webapi_1.NodeClass.VariableType | opcua_webapi_1.NodeClass.DataType | opcua_webapi_1.NodeClass.ReferenceType, 20);
|
|
155
156
|
}
|
|
156
157
|
}
|
|
157
158
|
exports.UaTypeBrowser = UaTypeBrowser;
|
|
@@ -70,7 +70,7 @@ class UaNodeReader {
|
|
|
70
70
|
nodeIdsToBrowse.push(item.nodeId);
|
|
71
71
|
nodeIdsSet.add(item.nodeId.toString());
|
|
72
72
|
}
|
|
73
|
-
let nodeReferenceBrowser = new UaNodeBrowser_1.UaNodeBrowser(this._client, nodeIdsToBrowse, this._referenceTypeToReturn, this._nodeClassToReturn);
|
|
73
|
+
let nodeReferenceBrowser = new UaNodeBrowser_1.UaNodeBrowser(this._client, nodeIdsToBrowse, this._referenceTypeToReturn, true, this._nodeClassToReturn);
|
|
74
74
|
yield nodeReferenceBrowser.browse();
|
|
75
75
|
let childReferences = nodeReferenceBrowser.results();
|
|
76
76
|
let childNodesToBrowse = [];
|
|
@@ -87,7 +87,7 @@ class UaNodeReader {
|
|
|
87
87
|
}
|
|
88
88
|
let variableReferences = [];
|
|
89
89
|
if (childNodesToBrowse.length != 0) {
|
|
90
|
-
let childReferenceBrowser = new UaNodeBrowser_1.UaNodeBrowser(this._client, childNodesToBrowse, common_1.UaNodeId.from(common_1.ReferenceTypeIds.Aggregates), opcua_webapi_1.NodeClass.Variable);
|
|
90
|
+
let childReferenceBrowser = new UaNodeBrowser_1.UaNodeBrowser(this._client, childNodesToBrowse, common_1.UaNodeId.from(common_1.ReferenceTypeIds.Aggregates), true, opcua_webapi_1.NodeClass.Variable);
|
|
91
91
|
yield childReferenceBrowser.browse();
|
|
92
92
|
variableReferences = childReferenceBrowser.results();
|
|
93
93
|
}
|
|
@@ -18,7 +18,7 @@ class UaObjectSerializer {
|
|
|
18
18
|
let propertyJson = {
|
|
19
19
|
name: variable.browseName,
|
|
20
20
|
displayName: variable.displayName.text,
|
|
21
|
-
value: (variable.value) ? variable.value.
|
|
21
|
+
value: (variable.value) ? variable.value.jsonValue() : null
|
|
22
22
|
};
|
|
23
23
|
properties.push(propertyJson);
|
|
24
24
|
}
|
|
@@ -8,6 +8,7 @@ export declare abstract class UaNode {
|
|
|
8
8
|
protected _writeMask: number | null;
|
|
9
9
|
protected _parent: UaNode | null;
|
|
10
10
|
protected _children: Array<UaNode>;
|
|
11
|
+
private _customizedData;
|
|
11
12
|
constructor(nodeId: UaNodeId, browseName: string, displayName: UaLocalizedText);
|
|
12
13
|
abstract get nodeClass(): NodeClass;
|
|
13
14
|
get nodeId(): UaNodeId;
|
|
@@ -17,6 +18,8 @@ export declare abstract class UaNode {
|
|
|
17
18
|
set writeMask(writeMask: number);
|
|
18
19
|
get description(): UaLocalizedText | null;
|
|
19
20
|
set description(description: UaLocalizedText | null);
|
|
21
|
+
get customizedData(): any | null;
|
|
22
|
+
set customizedData(customizedData: any | null);
|
|
20
23
|
abstract toJson(): any;
|
|
21
24
|
}
|
|
22
25
|
export declare abstract class UaDefinitionNode extends UaNode {
|
|
@@ -12,6 +12,7 @@ class UaNode {
|
|
|
12
12
|
this._writeMask = null;
|
|
13
13
|
this._parent = null;
|
|
14
14
|
this._children = [];
|
|
15
|
+
this._customizedData = null;
|
|
15
16
|
}
|
|
16
17
|
get nodeId() {
|
|
17
18
|
return this._nodeId;
|
|
@@ -34,6 +35,12 @@ class UaNode {
|
|
|
34
35
|
set description(description) {
|
|
35
36
|
this._description = description;
|
|
36
37
|
}
|
|
38
|
+
get customizedData() {
|
|
39
|
+
return this._customizedData;
|
|
40
|
+
}
|
|
41
|
+
set customizedData(customizedData) {
|
|
42
|
+
this._customizedData = customizedData;
|
|
43
|
+
}
|
|
37
44
|
}
|
|
38
45
|
exports.UaNode = UaNode;
|
|
39
46
|
class UaDefinitionNode extends UaNode {
|
|
@@ -78,7 +78,7 @@ class UaVariable extends _1.UaInstanceNode {
|
|
|
78
78
|
valueRank: (this._valueRank != 0) ? this._valueRank : undefined,
|
|
79
79
|
accessLevel: this._accessLevel,
|
|
80
80
|
historizing: (this._historizing) ? true : undefined,
|
|
81
|
-
value: this._dataValue ? this._dataValue.value.
|
|
81
|
+
value: this._dataValue ? this._dataValue.value.jsonValue() : undefined,
|
|
82
82
|
members: (members.length != 0) ? members : undefined
|
|
83
83
|
};
|
|
84
84
|
return ret;
|
|
@@ -18,6 +18,89 @@ class UaVariant {
|
|
|
18
18
|
get arrayType() {
|
|
19
19
|
return this._arrayType;
|
|
20
20
|
}
|
|
21
|
+
jsonValue() {
|
|
22
|
+
if (UaVariantType.NodeId == this._type) {
|
|
23
|
+
if (this.isScalar()) {
|
|
24
|
+
return this._value.toString();
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
let nodeIds = this._value;
|
|
28
|
+
let value = [];
|
|
29
|
+
for (let item of nodeIds) {
|
|
30
|
+
value.push(item.toString());
|
|
31
|
+
}
|
|
32
|
+
return value;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
else if (UaVariantType.ExpandedNodeId == this._type) {
|
|
36
|
+
if (this.isScalar()) {
|
|
37
|
+
return this._value.toString();
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
let nodeIds = this._value;
|
|
41
|
+
let value = [];
|
|
42
|
+
for (let item of nodeIds) {
|
|
43
|
+
value.push(item.toString());
|
|
44
|
+
}
|
|
45
|
+
return value;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
else if (UaVariantType.DateTime == this._type) {
|
|
49
|
+
if (this.isScalar()) {
|
|
50
|
+
return this._value.toISOString();
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
let dateTimes = this._value;
|
|
54
|
+
let value = [];
|
|
55
|
+
for (let item of dateTimes) {
|
|
56
|
+
value.push(item.toISOString());
|
|
57
|
+
}
|
|
58
|
+
return value;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
else if (UaVariantType.LocalizedText == this._type) {
|
|
62
|
+
if (this.isScalar()) {
|
|
63
|
+
return this._value.text;
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
let localizedTexts = this._value;
|
|
67
|
+
let value = [];
|
|
68
|
+
for (let item of localizedTexts) {
|
|
69
|
+
value.push(item.text);
|
|
70
|
+
}
|
|
71
|
+
return value;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
else if (UaVariantType.StatusCode == this._type) {
|
|
75
|
+
if (this.isScalar()) {
|
|
76
|
+
return this._value.toString();
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
let statusCodes = this._value;
|
|
80
|
+
let value = [];
|
|
81
|
+
for (let item of statusCodes) {
|
|
82
|
+
value.push(item.toString());
|
|
83
|
+
}
|
|
84
|
+
return value;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
else if (UaVariantType.ExtensionObject == this._type) {
|
|
88
|
+
if (this.isScalar()) {
|
|
89
|
+
return this._value.body;
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
let extensionObjects = this._value;
|
|
93
|
+
let value = [];
|
|
94
|
+
for (let item of extensionObjects) {
|
|
95
|
+
value.push(item.body);
|
|
96
|
+
}
|
|
97
|
+
return value;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
return this._value;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
21
104
|
isScalar() {
|
|
22
105
|
return (UaArrayType.Scalar == this._arrayType) ? true : false;
|
|
23
106
|
}
|