node-opcua-data-model 2.97.0 → 2.98.1

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.
@@ -1,329 +1,329 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.decodeDiagnosticInfo = exports.encodeDiagnosticInfo = exports.DiagnosticInfo_EncodingByte = exports.filterDiagnosticServiceLevel = exports.filterDiagnosticOperationLevel = exports.filterDiagnosticInfoLevel = exports.RESPONSE_DIAGNOSTICS_MASK_ALL = exports.DiagnosticInfo_OperationLevelMask = exports.DiagnosticInfo_ServiceLevelMask = exports.DiagnosticInfo = exports.schemaDiagnosticInfo = void 0;
4
- /**
5
- * @module node-opcua-data-model
6
- */
7
- const node_opcua_assert_1 = require("node-opcua-assert");
8
- const node_opcua_factory_1 = require("node-opcua-factory");
9
- const node_opcua_status_code_1 = require("node-opcua-status-code");
10
- const node_opcua_basic_types_1 = require("node-opcua-basic-types");
11
- const node_opcua_factory_2 = require("node-opcua-factory");
12
- // --------------------------------------------------------------------------------------------
13
- exports.schemaDiagnosticInfo = (0, node_opcua_factory_1.buildStructuredType)({
14
- name: "DiagnosticInfo",
15
- baseType: "BaseUAObject",
16
- fields: [
17
- {
18
- name: "namespaceUri",
19
- fieldType: "Int32",
20
- defaultValue: -1,
21
- documentation: "The symbolicId is defined within the context of a namespace."
22
- },
23
- {
24
- name: "symbolicId",
25
- fieldType: "Int32",
26
- defaultValue: -1,
27
- documentation: "The symbolicId shall be used to identify a vendor-specific error or condition"
28
- },
29
- {
30
- name: "locale",
31
- fieldType: "Int32",
32
- defaultValue: -1,
33
- documentation: "The locale part of the vendor-specific localized text describing the symbolic id."
34
- },
35
- { name: "localizedText", fieldType: "Int32", defaultValue: -1 },
36
- {
37
- name: "additionalInfo",
38
- fieldType: "String",
39
- defaultValue: null,
40
- documentation: "Vendor-specific diagnostic information."
41
- },
42
- {
43
- name: "innerStatusCode",
44
- fieldType: "StatusCode",
45
- defaultValue: node_opcua_status_code_1.StatusCodes.Good,
46
- documentation: "The StatusCode from the inner operation."
47
- },
48
- {
49
- name: "innerDiagnosticInfo",
50
- fieldType: "DiagnosticInfo",
51
- category: node_opcua_factory_1.FieldCategory.basic,
52
- defaultValue: null,
53
- documentation: "The diagnostic info associated with the inner StatusCode."
54
- }
55
- ]
56
- });
57
- class DiagnosticInfo extends node_opcua_factory_1.BaseUAObject {
58
- /**
59
- *
60
- * @class DiagnosticInfo
61
- * @constructor
62
- * @extends BaseUAObject
63
- * @param options {Object}
64
- */
65
- constructor(options = {}) {
66
- super();
67
- const schema = exports.schemaDiagnosticInfo;
68
- /* istanbul ignore next */
69
- if (node_opcua_factory_1.parameters.debugSchemaHelper) {
70
- (0, node_opcua_factory_2.check_options_correctness_against_schema)(this, schema, options);
71
- }
72
- this.symbolicId = (0, node_opcua_factory_2.initialize_field)(schema.fields[0], options.symbolicId);
73
- this.namespaceURI = (0, node_opcua_factory_2.initialize_field)(schema.fields[1], options.namespaceURI);
74
- this.locale = (0, node_opcua_factory_2.initialize_field)(schema.fields[2], options.locale);
75
- this.localizedText = (0, node_opcua_factory_2.initialize_field)(schema.fields[3], options.localizedText);
76
- this.additionalInfo = (0, node_opcua_factory_2.initialize_field)(schema.fields[4], options.additionalInfo);
77
- this.innerStatusCode = (0, node_opcua_factory_2.initialize_field)(schema.fields[5], options.innerStatusCode);
78
- this.innerDiagnosticInfo = (0, node_opcua_factory_2.initialize_field)(schema.fields[6], options.innerDiagnosticInfo);
79
- }
80
- encode(stream) {
81
- encode_DiagnosticInfo(this, stream);
82
- }
83
- decode(stream) {
84
- decode_DiagnosticInfo(this, stream);
85
- }
86
- decodeDebug(stream, options) {
87
- decodeDebug_DiagnosticInfo(this, stream, options);
88
- }
89
- static filterForResponse(diagnostic, requestedDiagnostics, diagnosticInfoMask) {
90
- const options = {
91
- symbolicId: (requestedDiagnostics & diagnosticInfoMask.SymbolicId) ? diagnostic.symbolicId : undefined,
92
- localizedText: (requestedDiagnostics & diagnosticInfoMask.LocalizedText) ? diagnostic.localizedText : undefined,
93
- additionalInfo: (requestedDiagnostics & diagnosticInfoMask.AdditionalInfo) ? diagnostic.additionalInfo : undefined,
94
- innerStatusCode: (requestedDiagnostics & diagnosticInfoMask.InnerStatusCode) ? diagnostic.innerStatusCode : undefined,
95
- innerDiagnosticInfo: (requestedDiagnostics & diagnosticInfoMask.InnerDiagnostics) ? diagnostic.innerDiagnosticInfo : (diagnostic.innerDiagnosticInfo ? DiagnosticInfo.filterForResponse(diagnostic.innerDiagnosticInfo, requestedDiagnostics, diagnosticInfoMask) : undefined),
96
- };
97
- return new DiagnosticInfo(options);
98
- }
99
- }
100
- exports.DiagnosticInfo = DiagnosticInfo;
101
- DiagnosticInfo.schema = exports.schemaDiagnosticInfo;
102
- DiagnosticInfo.possibleFields = [
103
- "symbolicId",
104
- "namespaceURI",
105
- "locale",
106
- "localizedText",
107
- "additionalInfo",
108
- "innerStatusCode",
109
- "innerDiagnosticInfo"
110
- ];
111
- DiagnosticInfo.prototype.schema = DiagnosticInfo.schema;
112
- DiagnosticInfo.schema.fields[6].schema = DiagnosticInfo.schema;
113
- var DiagnosticInfo_ServiceLevelMask;
114
- (function (DiagnosticInfo_ServiceLevelMask) {
115
- DiagnosticInfo_ServiceLevelMask[DiagnosticInfo_ServiceLevelMask["None"] = 0] = "None";
116
- DiagnosticInfo_ServiceLevelMask[DiagnosticInfo_ServiceLevelMask["SymbolicId"] = 1] = "SymbolicId";
117
- DiagnosticInfo_ServiceLevelMask[DiagnosticInfo_ServiceLevelMask["LocalizedText"] = 2] = "LocalizedText";
118
- DiagnosticInfo_ServiceLevelMask[DiagnosticInfo_ServiceLevelMask["AdditionalInfo"] = 4] = "AdditionalInfo";
119
- DiagnosticInfo_ServiceLevelMask[DiagnosticInfo_ServiceLevelMask["InnerStatusCode"] = 8] = "InnerStatusCode";
120
- DiagnosticInfo_ServiceLevelMask[DiagnosticInfo_ServiceLevelMask["InnerDiagnostics"] = 16] = "InnerDiagnostics";
121
- })(DiagnosticInfo_ServiceLevelMask = exports.DiagnosticInfo_ServiceLevelMask || (exports.DiagnosticInfo_ServiceLevelMask = {}));
122
- var DiagnosticInfo_OperationLevelMask;
123
- (function (DiagnosticInfo_OperationLevelMask) {
124
- DiagnosticInfo_OperationLevelMask[DiagnosticInfo_OperationLevelMask["SymbolicId"] = 32] = "SymbolicId";
125
- DiagnosticInfo_OperationLevelMask[DiagnosticInfo_OperationLevelMask["LocalizedText"] = 64] = "LocalizedText";
126
- DiagnosticInfo_OperationLevelMask[DiagnosticInfo_OperationLevelMask["AdditionalInfo"] = 128] = "AdditionalInfo";
127
- DiagnosticInfo_OperationLevelMask[DiagnosticInfo_OperationLevelMask["InnerStatusCode"] = 256] = "InnerStatusCode";
128
- DiagnosticInfo_OperationLevelMask[DiagnosticInfo_OperationLevelMask["InnerDiagnostics"] = 512] = "InnerDiagnostics";
129
- })(DiagnosticInfo_OperationLevelMask = exports.DiagnosticInfo_OperationLevelMask || (exports.DiagnosticInfo_OperationLevelMask = {}));
130
- exports.RESPONSE_DIAGNOSTICS_MASK_ALL = 0x3FF;
131
- function filterDiagnosticInfoLevel(returnDiagnostics, diagnostic, diagnosticInfoMask) {
132
- if (!diagnostic) {
133
- return null;
134
- }
135
- return DiagnosticInfo.filterForResponse(diagnostic, returnDiagnostics, diagnosticInfoMask);
136
- }
137
- exports.filterDiagnosticInfoLevel = filterDiagnosticInfoLevel;
138
- function filterDiagnosticOperationLevel(returnDiagnostics, diagnostic) {
139
- return filterDiagnosticInfoLevel(returnDiagnostics, diagnostic, DiagnosticInfo_OperationLevelMask);
140
- }
141
- exports.filterDiagnosticOperationLevel = filterDiagnosticOperationLevel;
142
- function filterDiagnosticServiceLevel(returnDiagnostics, diagnostic) {
143
- return filterDiagnosticInfoLevel(returnDiagnostics, diagnostic, DiagnosticInfo_ServiceLevelMask);
144
- }
145
- exports.filterDiagnosticServiceLevel = filterDiagnosticServiceLevel;
146
- var DiagnosticInfo_EncodingByte;
147
- (function (DiagnosticInfo_EncodingByte) {
148
- DiagnosticInfo_EncodingByte[DiagnosticInfo_EncodingByte["SymbolicId"] = 1] = "SymbolicId";
149
- DiagnosticInfo_EncodingByte[DiagnosticInfo_EncodingByte["NamespaceURI"] = 2] = "NamespaceURI";
150
- DiagnosticInfo_EncodingByte[DiagnosticInfo_EncodingByte["LocalizedText"] = 4] = "LocalizedText";
151
- DiagnosticInfo_EncodingByte[DiagnosticInfo_EncodingByte["Locale"] = 8] = "Locale";
152
- DiagnosticInfo_EncodingByte[DiagnosticInfo_EncodingByte["AdditionalInfo"] = 16] = "AdditionalInfo";
153
- DiagnosticInfo_EncodingByte[DiagnosticInfo_EncodingByte["InnerStatusCode"] = 32] = "InnerStatusCode";
154
- DiagnosticInfo_EncodingByte[DiagnosticInfo_EncodingByte["InnerDiagnosticInfo"] = 64] = "InnerDiagnosticInfo";
155
- })(DiagnosticInfo_EncodingByte = exports.DiagnosticInfo_EncodingByte || (exports.DiagnosticInfo_EncodingByte = {}));
156
- // tslint:disable:no-bitwise
157
- function getDiagnosticInfoEncodingByte(diagnosticInfo) {
158
- (0, node_opcua_assert_1.assert)(diagnosticInfo);
159
- let encodingMask = 0;
160
- if (diagnosticInfo.symbolicId >= 0) {
161
- encodingMask |= DiagnosticInfo_EncodingByte.SymbolicId;
162
- }
163
- if (diagnosticInfo.namespaceURI >= 0) {
164
- encodingMask |= DiagnosticInfo_EncodingByte.NamespaceURI;
165
- }
166
- if (diagnosticInfo.localizedText >= 0) {
167
- encodingMask |= DiagnosticInfo_EncodingByte.LocalizedText;
168
- }
169
- if (diagnosticInfo.locale >= 0) {
170
- encodingMask |= DiagnosticInfo_EncodingByte.Locale;
171
- }
172
- if (diagnosticInfo.additionalInfo) {
173
- encodingMask |= DiagnosticInfo_EncodingByte.AdditionalInfo;
174
- }
175
- if (diagnosticInfo.innerStatusCode && diagnosticInfo.innerStatusCode !== node_opcua_status_code_1.StatusCodes.Good) {
176
- encodingMask |= DiagnosticInfo_EncodingByte.InnerStatusCode;
177
- }
178
- if (diagnosticInfo.innerDiagnosticInfo) {
179
- encodingMask |= DiagnosticInfo_EncodingByte.InnerDiagnosticInfo;
180
- }
181
- return encodingMask;
182
- }
183
- function encode_DiagnosticInfo(diagnosticInfo, stream) {
184
- const encodingMask = getDiagnosticInfoEncodingByte(diagnosticInfo);
185
- // write encoding byte
186
- (0, node_opcua_basic_types_1.encodeByte)(encodingMask, stream);
187
- // write symbolic id
188
- if (encodingMask & DiagnosticInfo_EncodingByte.SymbolicId) {
189
- (0, node_opcua_basic_types_1.encodeInt32)(diagnosticInfo.symbolicId, stream);
190
- }
191
- // write namespace uri
192
- if (encodingMask & DiagnosticInfo_EncodingByte.NamespaceURI) {
193
- (0, node_opcua_basic_types_1.encodeInt32)(diagnosticInfo.namespaceURI, stream);
194
- }
195
- // write locale
196
- if (encodingMask & DiagnosticInfo_EncodingByte.Locale) {
197
- (0, node_opcua_basic_types_1.encodeInt32)(diagnosticInfo.locale, stream);
198
- }
199
- // write localized text
200
- if (encodingMask & DiagnosticInfo_EncodingByte.LocalizedText) {
201
- (0, node_opcua_basic_types_1.encodeInt32)(diagnosticInfo.localizedText, stream);
202
- }
203
- // write additional info
204
- if (encodingMask & DiagnosticInfo_EncodingByte.AdditionalInfo) {
205
- (0, node_opcua_basic_types_1.encodeString)(diagnosticInfo.additionalInfo, stream);
206
- }
207
- // write inner status code
208
- if (encodingMask & DiagnosticInfo_EncodingByte.InnerStatusCode) {
209
- (0, node_opcua_basic_types_1.encodeStatusCode)(diagnosticInfo.innerStatusCode, stream);
210
- }
211
- // write innerDiagnosticInfo
212
- if (encodingMask & DiagnosticInfo_EncodingByte.InnerDiagnosticInfo) {
213
- (0, node_opcua_assert_1.assert)(diagnosticInfo.innerDiagnosticInfo !== null, "missing innerDiagnosticInfo");
214
- if (diagnosticInfo.innerDiagnosticInfo) {
215
- encode_DiagnosticInfo(diagnosticInfo.innerDiagnosticInfo, stream);
216
- }
217
- }
218
- }
219
- function decodeDebug_DiagnosticInfo(diagnosticInfo, stream, options) {
220
- const tracer = options.tracer;
221
- tracer.trace("start", options.name + "(" + "DiagnosticInfo" + ")", stream.length, stream.length);
222
- let cursorBefore = stream.length;
223
- const encodingMask = (0, node_opcua_basic_types_1.decodeByte)(stream);
224
- tracer.trace("member", "encodingByte", "0x" + encodingMask.toString(16), cursorBefore, stream.length, "Mask");
225
- tracer.encoding_byte(encodingMask, DiagnosticInfo_EncodingByte, cursorBefore, stream.length);
226
- cursorBefore = stream.length;
227
- // read symbolic id
228
- if (encodingMask & DiagnosticInfo_EncodingByte.SymbolicId) {
229
- diagnosticInfo.symbolicId = (0, node_opcua_basic_types_1.decodeInt32)(stream);
230
- tracer.trace("member", "symbolicId", diagnosticInfo.symbolicId, cursorBefore, stream.length, "Int32");
231
- cursorBefore = stream.length;
232
- }
233
- // read namespace uri
234
- if (encodingMask & DiagnosticInfo_EncodingByte.NamespaceURI) {
235
- diagnosticInfo.namespaceURI = (0, node_opcua_basic_types_1.decodeInt32)(stream);
236
- tracer.trace("member", "symbolicId", diagnosticInfo.namespaceURI, cursorBefore, stream.length, "Int32");
237
- cursorBefore = stream.length;
238
- }
239
- // read locale
240
- if (encodingMask & DiagnosticInfo_EncodingByte.Locale) {
241
- diagnosticInfo.locale = (0, node_opcua_basic_types_1.decodeInt32)(stream);
242
- tracer.trace("member", "locale", diagnosticInfo.locale, cursorBefore, stream.length, "Int32");
243
- cursorBefore = stream.length;
244
- }
245
- // read localized text
246
- if (encodingMask & DiagnosticInfo_EncodingByte.LocalizedText) {
247
- diagnosticInfo.localizedText = (0, node_opcua_basic_types_1.decodeInt32)(stream);
248
- tracer.trace("member", "localizedText", diagnosticInfo.localizedText, cursorBefore, stream.length, "Int32");
249
- cursorBefore = stream.length;
250
- }
251
- // read additional info
252
- if (encodingMask & DiagnosticInfo_EncodingByte.AdditionalInfo) {
253
- diagnosticInfo.additionalInfo = (0, node_opcua_basic_types_1.decodeString)(stream);
254
- tracer.trace("member", "additionalInfo", diagnosticInfo.additionalInfo, cursorBefore, stream.length, "String");
255
- cursorBefore = stream.length;
256
- }
257
- // read inner status code
258
- if (encodingMask & DiagnosticInfo_EncodingByte.InnerStatusCode) {
259
- diagnosticInfo.innerStatusCode = (0, node_opcua_basic_types_1.decodeStatusCode)(stream);
260
- tracer.trace("member", "innerStatusCode", diagnosticInfo.innerStatusCode, cursorBefore, stream.length, "StatusCode");
261
- cursorBefore = stream.length;
262
- }
263
- // read inner status code
264
- if (encodingMask & DiagnosticInfo_EncodingByte.InnerDiagnosticInfo) {
265
- diagnosticInfo.innerDiagnosticInfo = new DiagnosticInfo({});
266
- if (diagnosticInfo.innerDiagnosticInfo) {
267
- diagnosticInfo.innerDiagnosticInfo.decodeDebug(stream, options);
268
- }
269
- tracer.trace("member", "innerDiagnosticInfo", diagnosticInfo.innerDiagnosticInfo, cursorBefore, stream.length, "DiagnosticInfo");
270
- }
271
- tracer.trace("end", options.name, stream.length, stream.length);
272
- }
273
- function decode_DiagnosticInfo(diagnosticInfo, stream) {
274
- const encodingMask = (0, node_opcua_basic_types_1.decodeByte)(stream);
275
- // read symbolic id
276
- if (encodingMask & DiagnosticInfo_EncodingByte.SymbolicId) {
277
- diagnosticInfo.symbolicId = (0, node_opcua_basic_types_1.decodeInt32)(stream);
278
- }
279
- // read namespace uri
280
- if (encodingMask & DiagnosticInfo_EncodingByte.NamespaceURI) {
281
- diagnosticInfo.namespaceURI = (0, node_opcua_basic_types_1.decodeInt32)(stream);
282
- }
283
- // read locale
284
- if (encodingMask & DiagnosticInfo_EncodingByte.Locale) {
285
- diagnosticInfo.locale = (0, node_opcua_basic_types_1.decodeInt32)(stream);
286
- }
287
- // read localized text
288
- if (encodingMask & DiagnosticInfo_EncodingByte.LocalizedText) {
289
- diagnosticInfo.localizedText = (0, node_opcua_basic_types_1.decodeInt32)(stream);
290
- }
291
- // read additional info
292
- if (encodingMask & DiagnosticInfo_EncodingByte.AdditionalInfo) {
293
- diagnosticInfo.additionalInfo = (0, node_opcua_basic_types_1.decodeString)(stream);
294
- }
295
- // read inner status code
296
- if (encodingMask & DiagnosticInfo_EncodingByte.InnerStatusCode) {
297
- diagnosticInfo.innerStatusCode = (0, node_opcua_basic_types_1.decodeStatusCode)(stream);
298
- }
299
- // read inner status code
300
- if (encodingMask & DiagnosticInfo_EncodingByte.InnerDiagnosticInfo) {
301
- diagnosticInfo.innerDiagnosticInfo = new DiagnosticInfo({});
302
- if (diagnosticInfo.innerDiagnosticInfo) {
303
- diagnosticInfo.innerDiagnosticInfo.decode(stream);
304
- }
305
- }
306
- }
307
- const emptyDiagnosticInfo = new DiagnosticInfo({});
308
- function encodeDiagnosticInfo(value, stream) {
309
- if (value === null) {
310
- emptyDiagnosticInfo.encode(stream);
311
- }
312
- else {
313
- value.encode(stream);
314
- }
315
- }
316
- exports.encodeDiagnosticInfo = encodeDiagnosticInfo;
317
- function decodeDiagnosticInfo(stream, _value) {
318
- const value = _value || new DiagnosticInfo();
319
- value.decode(stream);
320
- return value;
321
- }
322
- exports.decodeDiagnosticInfo = decodeDiagnosticInfo;
323
- // Note:
324
- // the SymbolicId, NamespaceURI, LocalizedText and Locale fields are indexes in a string table which is returned
325
- // in the response header. Only the index of the corresponding string in the string table is encoded. An index
326
- // of −1 indicates that there is no value for the string.
327
- //
328
- (0, node_opcua_factory_1.registerSpecialVariantEncoder)(DiagnosticInfo);
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.decodeDiagnosticInfo = exports.encodeDiagnosticInfo = exports.DiagnosticInfo_EncodingByte = exports.filterDiagnosticServiceLevel = exports.filterDiagnosticOperationLevel = exports.filterDiagnosticInfoLevel = exports.RESPONSE_DIAGNOSTICS_MASK_ALL = exports.DiagnosticInfo_OperationLevelMask = exports.DiagnosticInfo_ServiceLevelMask = exports.DiagnosticInfo = exports.schemaDiagnosticInfo = void 0;
4
+ /**
5
+ * @module node-opcua-data-model
6
+ */
7
+ const node_opcua_assert_1 = require("node-opcua-assert");
8
+ const node_opcua_factory_1 = require("node-opcua-factory");
9
+ const node_opcua_status_code_1 = require("node-opcua-status-code");
10
+ const node_opcua_basic_types_1 = require("node-opcua-basic-types");
11
+ const node_opcua_factory_2 = require("node-opcua-factory");
12
+ // --------------------------------------------------------------------------------------------
13
+ exports.schemaDiagnosticInfo = (0, node_opcua_factory_1.buildStructuredType)({
14
+ name: "DiagnosticInfo",
15
+ baseType: "BaseUAObject",
16
+ fields: [
17
+ {
18
+ name: "namespaceUri",
19
+ fieldType: "Int32",
20
+ defaultValue: -1,
21
+ documentation: "The symbolicId is defined within the context of a namespace."
22
+ },
23
+ {
24
+ name: "symbolicId",
25
+ fieldType: "Int32",
26
+ defaultValue: -1,
27
+ documentation: "The symbolicId shall be used to identify a vendor-specific error or condition"
28
+ },
29
+ {
30
+ name: "locale",
31
+ fieldType: "Int32",
32
+ defaultValue: -1,
33
+ documentation: "The locale part of the vendor-specific localized text describing the symbolic id."
34
+ },
35
+ { name: "localizedText", fieldType: "Int32", defaultValue: -1 },
36
+ {
37
+ name: "additionalInfo",
38
+ fieldType: "String",
39
+ defaultValue: null,
40
+ documentation: "Vendor-specific diagnostic information."
41
+ },
42
+ {
43
+ name: "innerStatusCode",
44
+ fieldType: "StatusCode",
45
+ defaultValue: node_opcua_status_code_1.StatusCodes.Good,
46
+ documentation: "The StatusCode from the inner operation."
47
+ },
48
+ {
49
+ name: "innerDiagnosticInfo",
50
+ fieldType: "DiagnosticInfo",
51
+ category: node_opcua_factory_1.FieldCategory.basic,
52
+ defaultValue: null,
53
+ documentation: "The diagnostic info associated with the inner StatusCode."
54
+ }
55
+ ]
56
+ });
57
+ class DiagnosticInfo extends node_opcua_factory_1.BaseUAObject {
58
+ /**
59
+ *
60
+ * @class DiagnosticInfo
61
+ * @constructor
62
+ * @extends BaseUAObject
63
+ * @param options {Object}
64
+ */
65
+ constructor(options = {}) {
66
+ super();
67
+ const schema = exports.schemaDiagnosticInfo;
68
+ /* istanbul ignore next */
69
+ if (node_opcua_factory_1.parameters.debugSchemaHelper) {
70
+ (0, node_opcua_factory_2.check_options_correctness_against_schema)(this, schema, options);
71
+ }
72
+ this.symbolicId = (0, node_opcua_factory_2.initialize_field)(schema.fields[0], options.symbolicId);
73
+ this.namespaceURI = (0, node_opcua_factory_2.initialize_field)(schema.fields[1], options.namespaceURI);
74
+ this.locale = (0, node_opcua_factory_2.initialize_field)(schema.fields[2], options.locale);
75
+ this.localizedText = (0, node_opcua_factory_2.initialize_field)(schema.fields[3], options.localizedText);
76
+ this.additionalInfo = (0, node_opcua_factory_2.initialize_field)(schema.fields[4], options.additionalInfo);
77
+ this.innerStatusCode = (0, node_opcua_factory_2.initialize_field)(schema.fields[5], options.innerStatusCode);
78
+ this.innerDiagnosticInfo = (0, node_opcua_factory_2.initialize_field)(schema.fields[6], options.innerDiagnosticInfo);
79
+ }
80
+ encode(stream) {
81
+ encode_DiagnosticInfo(this, stream);
82
+ }
83
+ decode(stream) {
84
+ decode_DiagnosticInfo(this, stream);
85
+ }
86
+ decodeDebug(stream, options) {
87
+ decodeDebug_DiagnosticInfo(this, stream, options);
88
+ }
89
+ static filterForResponse(diagnostic, requestedDiagnostics, diagnosticInfoMask) {
90
+ const options = {
91
+ symbolicId: (requestedDiagnostics & diagnosticInfoMask.SymbolicId) ? diagnostic.symbolicId : undefined,
92
+ localizedText: (requestedDiagnostics & diagnosticInfoMask.LocalizedText) ? diagnostic.localizedText : undefined,
93
+ additionalInfo: (requestedDiagnostics & diagnosticInfoMask.AdditionalInfo) ? diagnostic.additionalInfo : undefined,
94
+ innerStatusCode: (requestedDiagnostics & diagnosticInfoMask.InnerStatusCode) ? diagnostic.innerStatusCode : undefined,
95
+ innerDiagnosticInfo: (requestedDiagnostics & diagnosticInfoMask.InnerDiagnostics) ? diagnostic.innerDiagnosticInfo : (diagnostic.innerDiagnosticInfo ? DiagnosticInfo.filterForResponse(diagnostic.innerDiagnosticInfo, requestedDiagnostics, diagnosticInfoMask) : undefined),
96
+ };
97
+ return new DiagnosticInfo(options);
98
+ }
99
+ }
100
+ DiagnosticInfo.schema = exports.schemaDiagnosticInfo;
101
+ DiagnosticInfo.possibleFields = [
102
+ "symbolicId",
103
+ "namespaceURI",
104
+ "locale",
105
+ "localizedText",
106
+ "additionalInfo",
107
+ "innerStatusCode",
108
+ "innerDiagnosticInfo"
109
+ ];
110
+ exports.DiagnosticInfo = DiagnosticInfo;
111
+ DiagnosticInfo.prototype.schema = DiagnosticInfo.schema;
112
+ DiagnosticInfo.schema.fields[6].schema = DiagnosticInfo.schema;
113
+ var DiagnosticInfo_ServiceLevelMask;
114
+ (function (DiagnosticInfo_ServiceLevelMask) {
115
+ DiagnosticInfo_ServiceLevelMask[DiagnosticInfo_ServiceLevelMask["None"] = 0] = "None";
116
+ DiagnosticInfo_ServiceLevelMask[DiagnosticInfo_ServiceLevelMask["SymbolicId"] = 1] = "SymbolicId";
117
+ DiagnosticInfo_ServiceLevelMask[DiagnosticInfo_ServiceLevelMask["LocalizedText"] = 2] = "LocalizedText";
118
+ DiagnosticInfo_ServiceLevelMask[DiagnosticInfo_ServiceLevelMask["AdditionalInfo"] = 4] = "AdditionalInfo";
119
+ DiagnosticInfo_ServiceLevelMask[DiagnosticInfo_ServiceLevelMask["InnerStatusCode"] = 8] = "InnerStatusCode";
120
+ DiagnosticInfo_ServiceLevelMask[DiagnosticInfo_ServiceLevelMask["InnerDiagnostics"] = 16] = "InnerDiagnostics";
121
+ })(DiagnosticInfo_ServiceLevelMask = exports.DiagnosticInfo_ServiceLevelMask || (exports.DiagnosticInfo_ServiceLevelMask = {}));
122
+ var DiagnosticInfo_OperationLevelMask;
123
+ (function (DiagnosticInfo_OperationLevelMask) {
124
+ DiagnosticInfo_OperationLevelMask[DiagnosticInfo_OperationLevelMask["SymbolicId"] = 32] = "SymbolicId";
125
+ DiagnosticInfo_OperationLevelMask[DiagnosticInfo_OperationLevelMask["LocalizedText"] = 64] = "LocalizedText";
126
+ DiagnosticInfo_OperationLevelMask[DiagnosticInfo_OperationLevelMask["AdditionalInfo"] = 128] = "AdditionalInfo";
127
+ DiagnosticInfo_OperationLevelMask[DiagnosticInfo_OperationLevelMask["InnerStatusCode"] = 256] = "InnerStatusCode";
128
+ DiagnosticInfo_OperationLevelMask[DiagnosticInfo_OperationLevelMask["InnerDiagnostics"] = 512] = "InnerDiagnostics";
129
+ })(DiagnosticInfo_OperationLevelMask = exports.DiagnosticInfo_OperationLevelMask || (exports.DiagnosticInfo_OperationLevelMask = {}));
130
+ exports.RESPONSE_DIAGNOSTICS_MASK_ALL = 0x3FF;
131
+ function filterDiagnosticInfoLevel(returnDiagnostics, diagnostic, diagnosticInfoMask) {
132
+ if (!diagnostic) {
133
+ return null;
134
+ }
135
+ return DiagnosticInfo.filterForResponse(diagnostic, returnDiagnostics, diagnosticInfoMask);
136
+ }
137
+ exports.filterDiagnosticInfoLevel = filterDiagnosticInfoLevel;
138
+ function filterDiagnosticOperationLevel(returnDiagnostics, diagnostic) {
139
+ return filterDiagnosticInfoLevel(returnDiagnostics, diagnostic, DiagnosticInfo_OperationLevelMask);
140
+ }
141
+ exports.filterDiagnosticOperationLevel = filterDiagnosticOperationLevel;
142
+ function filterDiagnosticServiceLevel(returnDiagnostics, diagnostic) {
143
+ return filterDiagnosticInfoLevel(returnDiagnostics, diagnostic, DiagnosticInfo_ServiceLevelMask);
144
+ }
145
+ exports.filterDiagnosticServiceLevel = filterDiagnosticServiceLevel;
146
+ var DiagnosticInfo_EncodingByte;
147
+ (function (DiagnosticInfo_EncodingByte) {
148
+ DiagnosticInfo_EncodingByte[DiagnosticInfo_EncodingByte["SymbolicId"] = 1] = "SymbolicId";
149
+ DiagnosticInfo_EncodingByte[DiagnosticInfo_EncodingByte["NamespaceURI"] = 2] = "NamespaceURI";
150
+ DiagnosticInfo_EncodingByte[DiagnosticInfo_EncodingByte["LocalizedText"] = 4] = "LocalizedText";
151
+ DiagnosticInfo_EncodingByte[DiagnosticInfo_EncodingByte["Locale"] = 8] = "Locale";
152
+ DiagnosticInfo_EncodingByte[DiagnosticInfo_EncodingByte["AdditionalInfo"] = 16] = "AdditionalInfo";
153
+ DiagnosticInfo_EncodingByte[DiagnosticInfo_EncodingByte["InnerStatusCode"] = 32] = "InnerStatusCode";
154
+ DiagnosticInfo_EncodingByte[DiagnosticInfo_EncodingByte["InnerDiagnosticInfo"] = 64] = "InnerDiagnosticInfo";
155
+ })(DiagnosticInfo_EncodingByte = exports.DiagnosticInfo_EncodingByte || (exports.DiagnosticInfo_EncodingByte = {}));
156
+ // tslint:disable:no-bitwise
157
+ function getDiagnosticInfoEncodingByte(diagnosticInfo) {
158
+ (0, node_opcua_assert_1.assert)(diagnosticInfo);
159
+ let encodingMask = 0;
160
+ if (diagnosticInfo.symbolicId >= 0) {
161
+ encodingMask |= DiagnosticInfo_EncodingByte.SymbolicId;
162
+ }
163
+ if (diagnosticInfo.namespaceURI >= 0) {
164
+ encodingMask |= DiagnosticInfo_EncodingByte.NamespaceURI;
165
+ }
166
+ if (diagnosticInfo.localizedText >= 0) {
167
+ encodingMask |= DiagnosticInfo_EncodingByte.LocalizedText;
168
+ }
169
+ if (diagnosticInfo.locale >= 0) {
170
+ encodingMask |= DiagnosticInfo_EncodingByte.Locale;
171
+ }
172
+ if (diagnosticInfo.additionalInfo) {
173
+ encodingMask |= DiagnosticInfo_EncodingByte.AdditionalInfo;
174
+ }
175
+ if (diagnosticInfo.innerStatusCode && diagnosticInfo.innerStatusCode !== node_opcua_status_code_1.StatusCodes.Good) {
176
+ encodingMask |= DiagnosticInfo_EncodingByte.InnerStatusCode;
177
+ }
178
+ if (diagnosticInfo.innerDiagnosticInfo) {
179
+ encodingMask |= DiagnosticInfo_EncodingByte.InnerDiagnosticInfo;
180
+ }
181
+ return encodingMask;
182
+ }
183
+ function encode_DiagnosticInfo(diagnosticInfo, stream) {
184
+ const encodingMask = getDiagnosticInfoEncodingByte(diagnosticInfo);
185
+ // write encoding byte
186
+ (0, node_opcua_basic_types_1.encodeByte)(encodingMask, stream);
187
+ // write symbolic id
188
+ if (encodingMask & DiagnosticInfo_EncodingByte.SymbolicId) {
189
+ (0, node_opcua_basic_types_1.encodeInt32)(diagnosticInfo.symbolicId, stream);
190
+ }
191
+ // write namespace uri
192
+ if (encodingMask & DiagnosticInfo_EncodingByte.NamespaceURI) {
193
+ (0, node_opcua_basic_types_1.encodeInt32)(diagnosticInfo.namespaceURI, stream);
194
+ }
195
+ // write locale
196
+ if (encodingMask & DiagnosticInfo_EncodingByte.Locale) {
197
+ (0, node_opcua_basic_types_1.encodeInt32)(diagnosticInfo.locale, stream);
198
+ }
199
+ // write localized text
200
+ if (encodingMask & DiagnosticInfo_EncodingByte.LocalizedText) {
201
+ (0, node_opcua_basic_types_1.encodeInt32)(diagnosticInfo.localizedText, stream);
202
+ }
203
+ // write additional info
204
+ if (encodingMask & DiagnosticInfo_EncodingByte.AdditionalInfo) {
205
+ (0, node_opcua_basic_types_1.encodeString)(diagnosticInfo.additionalInfo, stream);
206
+ }
207
+ // write inner status code
208
+ if (encodingMask & DiagnosticInfo_EncodingByte.InnerStatusCode) {
209
+ (0, node_opcua_basic_types_1.encodeStatusCode)(diagnosticInfo.innerStatusCode, stream);
210
+ }
211
+ // write innerDiagnosticInfo
212
+ if (encodingMask & DiagnosticInfo_EncodingByte.InnerDiagnosticInfo) {
213
+ (0, node_opcua_assert_1.assert)(diagnosticInfo.innerDiagnosticInfo !== null, "missing innerDiagnosticInfo");
214
+ if (diagnosticInfo.innerDiagnosticInfo) {
215
+ encode_DiagnosticInfo(diagnosticInfo.innerDiagnosticInfo, stream);
216
+ }
217
+ }
218
+ }
219
+ function decodeDebug_DiagnosticInfo(diagnosticInfo, stream, options) {
220
+ const tracer = options.tracer;
221
+ tracer.trace("start", options.name + "(" + "DiagnosticInfo" + ")", stream.length, stream.length);
222
+ let cursorBefore = stream.length;
223
+ const encodingMask = (0, node_opcua_basic_types_1.decodeByte)(stream);
224
+ tracer.trace("member", "encodingByte", "0x" + encodingMask.toString(16), cursorBefore, stream.length, "Mask");
225
+ tracer.encoding_byte(encodingMask, DiagnosticInfo_EncodingByte, cursorBefore, stream.length);
226
+ cursorBefore = stream.length;
227
+ // read symbolic id
228
+ if (encodingMask & DiagnosticInfo_EncodingByte.SymbolicId) {
229
+ diagnosticInfo.symbolicId = (0, node_opcua_basic_types_1.decodeInt32)(stream);
230
+ tracer.trace("member", "symbolicId", diagnosticInfo.symbolicId, cursorBefore, stream.length, "Int32");
231
+ cursorBefore = stream.length;
232
+ }
233
+ // read namespace uri
234
+ if (encodingMask & DiagnosticInfo_EncodingByte.NamespaceURI) {
235
+ diagnosticInfo.namespaceURI = (0, node_opcua_basic_types_1.decodeInt32)(stream);
236
+ tracer.trace("member", "symbolicId", diagnosticInfo.namespaceURI, cursorBefore, stream.length, "Int32");
237
+ cursorBefore = stream.length;
238
+ }
239
+ // read locale
240
+ if (encodingMask & DiagnosticInfo_EncodingByte.Locale) {
241
+ diagnosticInfo.locale = (0, node_opcua_basic_types_1.decodeInt32)(stream);
242
+ tracer.trace("member", "locale", diagnosticInfo.locale, cursorBefore, stream.length, "Int32");
243
+ cursorBefore = stream.length;
244
+ }
245
+ // read localized text
246
+ if (encodingMask & DiagnosticInfo_EncodingByte.LocalizedText) {
247
+ diagnosticInfo.localizedText = (0, node_opcua_basic_types_1.decodeInt32)(stream);
248
+ tracer.trace("member", "localizedText", diagnosticInfo.localizedText, cursorBefore, stream.length, "Int32");
249
+ cursorBefore = stream.length;
250
+ }
251
+ // read additional info
252
+ if (encodingMask & DiagnosticInfo_EncodingByte.AdditionalInfo) {
253
+ diagnosticInfo.additionalInfo = (0, node_opcua_basic_types_1.decodeString)(stream);
254
+ tracer.trace("member", "additionalInfo", diagnosticInfo.additionalInfo, cursorBefore, stream.length, "String");
255
+ cursorBefore = stream.length;
256
+ }
257
+ // read inner status code
258
+ if (encodingMask & DiagnosticInfo_EncodingByte.InnerStatusCode) {
259
+ diagnosticInfo.innerStatusCode = (0, node_opcua_basic_types_1.decodeStatusCode)(stream);
260
+ tracer.trace("member", "innerStatusCode", diagnosticInfo.innerStatusCode, cursorBefore, stream.length, "StatusCode");
261
+ cursorBefore = stream.length;
262
+ }
263
+ // read inner status code
264
+ if (encodingMask & DiagnosticInfo_EncodingByte.InnerDiagnosticInfo) {
265
+ diagnosticInfo.innerDiagnosticInfo = new DiagnosticInfo({});
266
+ if (diagnosticInfo.innerDiagnosticInfo) {
267
+ diagnosticInfo.innerDiagnosticInfo.decodeDebug(stream, options);
268
+ }
269
+ tracer.trace("member", "innerDiagnosticInfo", diagnosticInfo.innerDiagnosticInfo, cursorBefore, stream.length, "DiagnosticInfo");
270
+ }
271
+ tracer.trace("end", options.name, stream.length, stream.length);
272
+ }
273
+ function decode_DiagnosticInfo(diagnosticInfo, stream) {
274
+ const encodingMask = (0, node_opcua_basic_types_1.decodeByte)(stream);
275
+ // read symbolic id
276
+ if (encodingMask & DiagnosticInfo_EncodingByte.SymbolicId) {
277
+ diagnosticInfo.symbolicId = (0, node_opcua_basic_types_1.decodeInt32)(stream);
278
+ }
279
+ // read namespace uri
280
+ if (encodingMask & DiagnosticInfo_EncodingByte.NamespaceURI) {
281
+ diagnosticInfo.namespaceURI = (0, node_opcua_basic_types_1.decodeInt32)(stream);
282
+ }
283
+ // read locale
284
+ if (encodingMask & DiagnosticInfo_EncodingByte.Locale) {
285
+ diagnosticInfo.locale = (0, node_opcua_basic_types_1.decodeInt32)(stream);
286
+ }
287
+ // read localized text
288
+ if (encodingMask & DiagnosticInfo_EncodingByte.LocalizedText) {
289
+ diagnosticInfo.localizedText = (0, node_opcua_basic_types_1.decodeInt32)(stream);
290
+ }
291
+ // read additional info
292
+ if (encodingMask & DiagnosticInfo_EncodingByte.AdditionalInfo) {
293
+ diagnosticInfo.additionalInfo = (0, node_opcua_basic_types_1.decodeString)(stream);
294
+ }
295
+ // read inner status code
296
+ if (encodingMask & DiagnosticInfo_EncodingByte.InnerStatusCode) {
297
+ diagnosticInfo.innerStatusCode = (0, node_opcua_basic_types_1.decodeStatusCode)(stream);
298
+ }
299
+ // read inner status code
300
+ if (encodingMask & DiagnosticInfo_EncodingByte.InnerDiagnosticInfo) {
301
+ diagnosticInfo.innerDiagnosticInfo = new DiagnosticInfo({});
302
+ if (diagnosticInfo.innerDiagnosticInfo) {
303
+ diagnosticInfo.innerDiagnosticInfo.decode(stream);
304
+ }
305
+ }
306
+ }
307
+ const emptyDiagnosticInfo = new DiagnosticInfo({});
308
+ function encodeDiagnosticInfo(value, stream) {
309
+ if (value === null) {
310
+ emptyDiagnosticInfo.encode(stream);
311
+ }
312
+ else {
313
+ value.encode(stream);
314
+ }
315
+ }
316
+ exports.encodeDiagnosticInfo = encodeDiagnosticInfo;
317
+ function decodeDiagnosticInfo(stream, _value) {
318
+ const value = _value || new DiagnosticInfo();
319
+ value.decode(stream);
320
+ return value;
321
+ }
322
+ exports.decodeDiagnosticInfo = decodeDiagnosticInfo;
323
+ // Note:
324
+ // the SymbolicId, NamespaceURI, LocalizedText and Locale fields are indexes in a string table which is returned
325
+ // in the response header. Only the index of the corresponding string in the string table is encoded. An index
326
+ // of −1 indicates that there is no value for the string.
327
+ //
328
+ (0, node_opcua_factory_1.registerSpecialVariantEncoder)(DiagnosticInfo);
329
329
  //# sourceMappingURL=diagnostic_info.js.map