node-opcua-address-space 2.111.0 → 2.113.0
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/source/loader/decode_xml_extension_object.js +0 -2
- package/dist/source/loader/decode_xml_extension_object.js.map +1 -1
- package/dist/source/loader/load_nodeset2.js +4 -2
- package/dist/source/loader/load_nodeset2.js.map +1 -1
- package/dist/source/loader/make_xml_extension_object_parser.js +1 -3
- package/dist/source/loader/make_xml_extension_object_parser.js.map +1 -1
- package/dist/source/loader/namespace_post_step.js +1 -0
- package/dist/source/loader/namespace_post_step.js.map +1 -1
- package/dist/src/address_space.js +6 -14
- package/dist/src/address_space.js.map +1 -1
- package/dist/src/alarms_and_conditions/condition_snapshot_impl.js +2 -5
- package/dist/src/alarms_and_conditions/condition_snapshot_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_acknowledgeable_condition_impl.js +6 -2
- package/dist/src/alarms_and_conditions/ua_acknowledgeable_condition_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_alarm_condition_impl.js +5 -5
- package/dist/src/alarms_and_conditions/ua_alarm_condition_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_certificate_expiration_alarm_impl.js +0 -1
- package/dist/src/alarms_and_conditions/ua_certificate_expiration_alarm_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_condition_impl.js +3 -7
- package/dist/src/alarms_and_conditions/ua_condition_impl.js.map +1 -1
- package/dist/src/base_node_impl.js +9 -19
- package/dist/src/base_node_impl.js.map +1 -1
- package/dist/src/namespace_impl.js +5 -6
- package/dist/src/namespace_impl.js.map +1 -1
- package/dist/src/nodeset_tools/construct_namespace_dependency.js +11 -6
- package/dist/src/nodeset_tools/construct_namespace_dependency.js.map +1 -1
- package/dist/src/nodeset_tools/nodeset_to_xml.js +8 -9
- package/dist/src/nodeset_tools/nodeset_to_xml.js.map +1 -1
- package/dist/src/reference_impl.js +4 -1
- package/dist/src/reference_impl.js.map +1 -1
- package/dist/src/state_machine/finite_state_machine.js +2 -3
- package/dist/src/state_machine/finite_state_machine.js.map +1 -1
- package/dist/src/state_machine/ua_shelving_state_machine_ex.js +2 -2
- package/dist/src/state_machine/ua_shelving_state_machine_ex.js.map +1 -1
- package/dist/src/state_machine/ua_two_state_variable.js +0 -1
- package/dist/src/state_machine/ua_two_state_variable.js.map +1 -1
- package/dist/src/ua_data_type_impl.js +0 -23
- package/dist/src/ua_data_type_impl.js.map +1 -1
- package/dist/src/ua_reference_type_impl.d.ts +1 -1
- package/dist/src/ua_variable_impl_ext_obj.js +15 -8
- package/dist/src/ua_variable_impl_ext_obj.js.map +1 -1
- package/dist/tsconfig_common.tsbuildinfo +1 -1
- package/distHelpers/add_event_generator_object.js +0 -4
- package/distHelpers/add_event_generator_object.js.map +1 -1
- package/package.json +31 -31
- package/source/loader/decode_xml_extension_object.ts +0 -2
- package/source/loader/load_nodeset2.ts +4 -2
- package/source/loader/make_xml_extension_object_parser.ts +1 -4
- package/source/loader/namespace_post_step.ts +1 -0
- package/src/address_space.ts +7 -15
- package/src/alarms_and_conditions/condition_snapshot_impl.ts +2 -6
- package/src/alarms_and_conditions/ua_acknowledgeable_condition_impl.ts +6 -3
- package/src/alarms_and_conditions/ua_alarm_condition_impl.ts +6 -6
- package/src/alarms_and_conditions/ua_certificate_expiration_alarm_impl.ts +0 -1
- package/src/alarms_and_conditions/ua_condition_impl.ts +3 -7
- package/src/base_node_impl.ts +12 -20
- package/src/namespace_impl.ts +5 -6
- package/src/nodeset_tools/construct_namespace_dependency.ts +12 -7
- package/src/nodeset_tools/nodeset_to_xml.ts +8 -9
- package/src/reference_impl.ts +5 -1
- package/src/state_machine/finite_state_machine.ts +3 -4
- package/src/state_machine/ua_shelving_state_machine_ex.ts +2 -3
- package/src/state_machine/ua_two_state_variable.ts +0 -1
- package/src/ua_data_type_impl.ts +0 -24
- package/src/ua_variable_impl_ext_obj.ts +110 -82
|
@@ -70,7 +70,12 @@ function _extensionObjectFieldGetter(getVariable: () => UAVariable | null, targe
|
|
|
70
70
|
}
|
|
71
71
|
return target[key];
|
|
72
72
|
}
|
|
73
|
-
function _extensionObjectFieldSetter(
|
|
73
|
+
function _extensionObjectFieldSetter(
|
|
74
|
+
getVariable: () => UAVariable | null,
|
|
75
|
+
target: any,
|
|
76
|
+
key: string,
|
|
77
|
+
value: any /*, receiver*/
|
|
78
|
+
): boolean {
|
|
74
79
|
target[key] = value;
|
|
75
80
|
if (isProxy(target)) {
|
|
76
81
|
return true;
|
|
@@ -132,7 +137,6 @@ export function propagateTouchValueDownward(self: UAVariableImpl, now: PreciseCl
|
|
|
132
137
|
const property = self.getChildByName(field.name!) as UAVariableImpl;
|
|
133
138
|
|
|
134
139
|
if (property) {
|
|
135
|
-
|
|
136
140
|
if (cache) {
|
|
137
141
|
if (cache.has(property)) {
|
|
138
142
|
continue;
|
|
@@ -146,9 +150,7 @@ export function propagateTouchValueDownward(self: UAVariableImpl, now: PreciseCl
|
|
|
146
150
|
}
|
|
147
151
|
}
|
|
148
152
|
|
|
149
|
-
|
|
150
153
|
export function setExtensionObjectPartialValue(node: UAVariableImpl, partialObject: any, sourceTimestamp?: PreciseClock) {
|
|
151
|
-
|
|
152
154
|
const variablesToUpdate: Set<UAVariableImpl> = new Set();
|
|
153
155
|
|
|
154
156
|
const extensionObject = node.$extensionObject;
|
|
@@ -162,7 +164,6 @@ export function setExtensionObjectPartialValue(node: UAVariableImpl, partialObje
|
|
|
162
164
|
if (extObject[prop] instanceof Object) {
|
|
163
165
|
_update_extension_object(extObject[prop], partialObject1[prop]);
|
|
164
166
|
} else {
|
|
165
|
-
|
|
166
167
|
if (isProxy(extObject)) {
|
|
167
168
|
// collect element we have to update
|
|
168
169
|
const target = getProxyTarget(extObject);
|
|
@@ -242,8 +243,10 @@ function prepareVariantValue(dataType: DataType, value: VariantLike): VariantLik
|
|
|
242
243
|
|
|
243
244
|
function installExt(uaVariable: UAVariableImpl, ext: ExtensionObject) {
|
|
244
245
|
ext = unProxy(ext);
|
|
245
|
-
uaVariable.$extensionObject = new Proxy(
|
|
246
|
-
|
|
246
|
+
uaVariable.$extensionObject = new Proxy(
|
|
247
|
+
ext,
|
|
248
|
+
makeHandler(() => uaVariable)
|
|
249
|
+
);
|
|
247
250
|
|
|
248
251
|
const addressSpace = uaVariable.addressSpace;
|
|
249
252
|
const definition = uaVariable.dataTypeObj.getStructureDefinition();
|
|
@@ -258,9 +261,12 @@ function installExt(uaVariable: UAVariableImpl, ext: ExtensionObject) {
|
|
|
258
261
|
|
|
259
262
|
const subExtObj = uaVariable.$extensionObject[camelCaseName];
|
|
260
263
|
if (subExtObj) {
|
|
261
|
-
uaVariable.$extensionObject[camelCaseName] = new Proxy(
|
|
262
|
-
|
|
263
|
-
|
|
264
|
+
uaVariable.$extensionObject[camelCaseName] = new Proxy(
|
|
265
|
+
subExtObj,
|
|
266
|
+
makeHandler(() => {
|
|
267
|
+
return uaVariable.getComponentByName(field.name!) as UAVariable | null;
|
|
268
|
+
})
|
|
269
|
+
);
|
|
264
270
|
} else {
|
|
265
271
|
doDebug && warningLog("extension object is null");
|
|
266
272
|
}
|
|
@@ -269,11 +275,7 @@ function installExt(uaVariable: UAVariableImpl, ext: ExtensionObject) {
|
|
|
269
275
|
}
|
|
270
276
|
}
|
|
271
277
|
|
|
272
|
-
export function _installExtensionObjectBindingOnProperties(
|
|
273
|
-
uaVariable: UAVariableImpl,
|
|
274
|
-
options?: BindExtensionObjectOptions
|
|
275
|
-
): void {
|
|
276
|
-
|
|
278
|
+
export function _installExtensionObjectBindingOnProperties(uaVariable: UAVariableImpl, options?: BindExtensionObjectOptions): void {
|
|
277
279
|
// may be extension object mechanism has alreday been install
|
|
278
280
|
// in this case we just need to rebind the properties...
|
|
279
281
|
if (uaVariable.$extensionObject) {
|
|
@@ -292,7 +294,6 @@ export function _installExtensionObjectBindingOnProperties(
|
|
|
292
294
|
if (extObj instanceof ExtensionObject) {
|
|
293
295
|
uaVariable.bindExtensionObject(extObj, { createMissingProp: true, force: true });
|
|
294
296
|
} else if (extObj instanceof Array) {
|
|
295
|
-
|
|
296
297
|
// istanbul ignore else
|
|
297
298
|
if (dataValue.value.arrayType === VariantArrayType.Array || dataValue.value.arrayType === VariantArrayType.Matrix) {
|
|
298
299
|
_bindExtensionObjectArrayOrMatrix(uaVariable, extObj, { createMissingProp: true, force: true });
|
|
@@ -302,17 +303,22 @@ export function _installExtensionObjectBindingOnProperties(
|
|
|
302
303
|
}
|
|
303
304
|
}
|
|
304
305
|
|
|
305
|
-
function _installFields2(
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
306
|
+
function _installFields2(
|
|
307
|
+
uaVariable: UAVariableImpl,
|
|
308
|
+
{
|
|
309
|
+
get,
|
|
310
|
+
set
|
|
311
|
+
}: {
|
|
312
|
+
get: (fieldName: string) => any;
|
|
313
|
+
set: (fieldName: string, value: any, sourceTime: PreciseClock) => void;
|
|
314
|
+
},
|
|
315
|
+
options?: BindExtensionObjectOptions
|
|
316
|
+
) {
|
|
310
317
|
options = options || { createMissingProp: false };
|
|
311
318
|
const dt = uaVariable.getDataTypeNode();
|
|
312
319
|
const definition = dt.getStructureDefinition();
|
|
313
320
|
|
|
314
321
|
for (const field of definition.fields || []) {
|
|
315
|
-
|
|
316
322
|
if (NodeId.sameNodeId(NodeId.nullNodeId, field.dataType)) {
|
|
317
323
|
warningLog("field.dataType is null ! ", field.name, NodeId.nullNodeId.toString());
|
|
318
324
|
warningLog(field.toString());
|
|
@@ -332,7 +338,12 @@ function _installFields2(uaVariable: UAVariableImpl, { get, set }: {
|
|
|
332
338
|
propertyNode.$dataValue.serverTimestamp = uaVariable.$dataValue.serverTimestamp;
|
|
333
339
|
propertyNode.$dataValue.serverPicoseconds = uaVariable.$dataValue.serverPicoseconds;
|
|
334
340
|
propertyNode.$dataValue.value.dataType = propertyNode.dataTypeObj.basicDataType;
|
|
335
|
-
propertyNode.$dataValue.value.arrayType =
|
|
341
|
+
propertyNode.$dataValue.value.arrayType =
|
|
342
|
+
propertyNode.valueRank === -1
|
|
343
|
+
? VariantArrayType.Scalar
|
|
344
|
+
: propertyNode.valueRank === 1
|
|
345
|
+
? VariantArrayType.Array
|
|
346
|
+
: VariantArrayType.Matrix;
|
|
336
347
|
propertyNode.$dataValue.value.dimensions = propertyNode.valueRank > 1 ? propertyNode.arrayDimensions : null;
|
|
337
348
|
|
|
338
349
|
const fieldName = field.name!;
|
|
@@ -344,19 +355,23 @@ function _installFields2(uaVariable: UAVariableImpl, { get, set }: {
|
|
|
344
355
|
const value = dataValue.value.value;
|
|
345
356
|
set(field.name!, value, sourceTime);
|
|
346
357
|
propertyNode.touchValue(sourceTime);
|
|
347
|
-
}
|
|
358
|
+
};
|
|
348
359
|
|
|
349
360
|
if (propertyNode.dataTypeObj.basicDataType === DataType.ExtensionObject) {
|
|
350
|
-
_installFields2(
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
361
|
+
_installFields2(
|
|
362
|
+
propertyNode,
|
|
363
|
+
{
|
|
364
|
+
get: (fieldName: string) => {
|
|
365
|
+
const mainFieldName = field.name!;
|
|
366
|
+
return get(mainFieldName)[lowerFirstLetter(fieldName)];
|
|
367
|
+
},
|
|
368
|
+
set: (fieldName: string, value: any, sourceTime: PreciseClock) => {
|
|
369
|
+
const mainFieldName = field.name!;
|
|
370
|
+
get(mainFieldName)[lowerFirstLetter(fieldName)] = value;
|
|
371
|
+
}
|
|
354
372
|
},
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
get(mainFieldName)[lowerFirstLetter(fieldName)] = value;
|
|
358
|
-
}
|
|
359
|
-
}, options);
|
|
373
|
+
options
|
|
374
|
+
);
|
|
360
375
|
}
|
|
361
376
|
}
|
|
362
377
|
}
|
|
@@ -393,15 +408,19 @@ function isVariableContainingExtensionObject(uaVariable: UAVariableImpl): boolea
|
|
|
393
408
|
return true;
|
|
394
409
|
}
|
|
395
410
|
|
|
396
|
-
function _innerBindExtensionObjectScalar(
|
|
397
|
-
|
|
411
|
+
function _innerBindExtensionObjectScalar(
|
|
412
|
+
uaVariable: UAVariableImpl,
|
|
413
|
+
{
|
|
414
|
+
get,
|
|
415
|
+
set,
|
|
416
|
+
setField
|
|
417
|
+
}: {
|
|
398
418
|
get: () => ExtensionObject;
|
|
399
419
|
set: (value: ExtensionObject, sourceTimestamp: PreciseClock, cache: Set<UAVariableImpl>) => void;
|
|
400
420
|
setField: (fieldName: string, value: any, sourceTimestamp: PreciseClock, cache?: Set<UAVariableImpl>) => void;
|
|
401
421
|
},
|
|
402
422
|
options?: BindExtensionObjectOptions
|
|
403
423
|
) {
|
|
404
|
-
|
|
405
424
|
uaVariable.$dataValue.statusCode = StatusCodes.Good;
|
|
406
425
|
uaVariable.$dataValue.value.dataType = DataType.ExtensionObject;
|
|
407
426
|
uaVariable.$dataValue.value.arrayType = VariantArrayType.Scalar;
|
|
@@ -413,19 +432,21 @@ function _innerBindExtensionObjectScalar(uaVariable: UAVariableImpl,
|
|
|
413
432
|
installDataValueGetter(uaVariable, get);
|
|
414
433
|
uaVariable.$set_ExtensionObject = set;
|
|
415
434
|
|
|
416
|
-
_installFields2(
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
435
|
+
_installFields2(
|
|
436
|
+
uaVariable,
|
|
437
|
+
{
|
|
438
|
+
get: (fieldName: string) => {
|
|
439
|
+
const extObj = get() as any;
|
|
440
|
+
return extObj[lowerFirstLetter(fieldName)];
|
|
441
|
+
},
|
|
442
|
+
set: (fieldName: string, value: any, sourceTime: PreciseClock) => {
|
|
443
|
+
setField(fieldName, value, sourceTime);
|
|
444
|
+
}
|
|
420
445
|
},
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
}
|
|
424
|
-
}, options);
|
|
425
|
-
|
|
446
|
+
options
|
|
447
|
+
);
|
|
426
448
|
}
|
|
427
449
|
|
|
428
|
-
|
|
429
450
|
// eslint-disable-next-line complexity
|
|
430
451
|
export function _bindExtensionObject(
|
|
431
452
|
uaVariable: UAVariableImpl,
|
|
@@ -441,7 +462,10 @@ export function _bindExtensionObject(
|
|
|
441
462
|
|
|
442
463
|
// istanbul ignore next
|
|
443
464
|
if (optionalExtensionObject && uaVariable.valueRank === 0) {
|
|
444
|
-
warningLog(
|
|
465
|
+
warningLog(
|
|
466
|
+
uaVariable.browseName.toString() +
|
|
467
|
+
": valueRank was zero but needed to be adjusted to -1 (Scalar) in bindExtensionObject"
|
|
468
|
+
);
|
|
445
469
|
uaVariable.valueRank = -1;
|
|
446
470
|
}
|
|
447
471
|
const addressSpace = uaVariable.addressSpace;
|
|
@@ -491,9 +515,9 @@ export function _bindExtensionObject(
|
|
|
491
515
|
warningLog(uaVariable.$extensionObject?.toString());
|
|
492
516
|
throw new Error(
|
|
493
517
|
"bindExtensionObject: $extensionObject is incorrect: we are expecting a " +
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
518
|
+
uaVariable.dataType.toString({ addressSpace: uaVariable.addressSpace }) +
|
|
519
|
+
" but we got a " +
|
|
520
|
+
uaVariable.$extensionObject?.schema.name
|
|
497
521
|
);
|
|
498
522
|
}
|
|
499
523
|
return uaVariable.$extensionObject;
|
|
@@ -516,14 +540,14 @@ export function _bindExtensionObject(
|
|
|
516
540
|
return uaVariable.$extensionObject;
|
|
517
541
|
|
|
518
542
|
function innerBindExtensionObject() {
|
|
519
|
-
|
|
520
543
|
if (s.value && (s.value.dataType === DataType.Null || (s.value.dataType === DataType.ExtensionObject && !s.value.value))) {
|
|
521
544
|
if (uaVariable.valueRank === -1 /** Scalar */) {
|
|
522
545
|
extensionObject_ = optionalExtensionObject || addressSpace.constructExtensionObject(uaVariable.dataType, {});
|
|
523
546
|
|
|
524
547
|
installExt(uaVariable, extensionObject_);
|
|
525
548
|
|
|
526
|
-
_innerBindExtensionObjectScalar(
|
|
549
|
+
_innerBindExtensionObjectScalar(
|
|
550
|
+
uaVariable,
|
|
527
551
|
{
|
|
528
552
|
get: () => uaVariable.$extensionObject,
|
|
529
553
|
set: (value: ExtensionObject) => installExt(uaVariable, value),
|
|
@@ -531,8 +555,9 @@ export function _bindExtensionObject(
|
|
|
531
555
|
const extObj = uaVariable.$extensionObject;
|
|
532
556
|
getProxyTarget(extObj)[lowerFirstLetter(fieldName)] = value;
|
|
533
557
|
}
|
|
534
|
-
|
|
535
|
-
|
|
558
|
+
},
|
|
559
|
+
options
|
|
560
|
+
);
|
|
536
561
|
return;
|
|
537
562
|
} else if (uaVariable.valueRank === 1 /** Array */) {
|
|
538
563
|
throw new Error("Should not get there ! Please fix me");
|
|
@@ -544,7 +569,8 @@ export function _bindExtensionObject(
|
|
|
544
569
|
// verify that variant has the correct type
|
|
545
570
|
assert(s.value.dataType === DataType.ExtensionObject);
|
|
546
571
|
installExt(uaVariable, s.value.value);
|
|
547
|
-
_innerBindExtensionObjectScalar(
|
|
572
|
+
_innerBindExtensionObjectScalar(
|
|
573
|
+
uaVariable,
|
|
548
574
|
{
|
|
549
575
|
get: () => uaVariable.$extensionObject,
|
|
550
576
|
set: (value: ExtensionObject) => installExt(uaVariable, value),
|
|
@@ -552,26 +578,26 @@ export function _bindExtensionObject(
|
|
|
552
578
|
const extObj = uaVariable.$extensionObject;
|
|
553
579
|
getProxyTarget(extObj)[lowerFirstLetter(fieldName)] = value;
|
|
554
580
|
}
|
|
555
|
-
},
|
|
581
|
+
},
|
|
582
|
+
options
|
|
583
|
+
);
|
|
556
584
|
}
|
|
557
585
|
}
|
|
558
586
|
}
|
|
559
587
|
|
|
560
588
|
const getIndexAsText = (index: number | number[]): string => {
|
|
561
|
-
if (typeof index === "number")
|
|
562
|
-
return `${index}`;
|
|
589
|
+
if (typeof index === "number") return `${index}`;
|
|
563
590
|
return `${index.map((a) => a.toString()).join(",")}`;
|
|
564
|
-
}
|
|
591
|
+
};
|
|
565
592
|
const composeBrowseNameAndNodeId = (uaVariable: UAVariable, indexes: number[]) => {
|
|
566
593
|
const iAsText = getIndexAsText(indexes);
|
|
567
594
|
const browseName = coerceQualifiedName(iAsText);
|
|
568
595
|
let nodeId: NodeId | undefined;
|
|
569
596
|
if (uaVariable.nodeId.identifierType === NodeIdType.STRING) {
|
|
570
|
-
nodeId = new NodeId(NodeIdType.STRING, uaVariable.nodeId.value as string + `[${iAsText}]`, uaVariable.nodeId.namespace);
|
|
597
|
+
nodeId = new NodeId(NodeIdType.STRING, (uaVariable.nodeId.value as string) + `[${iAsText}]`, uaVariable.nodeId.namespace);
|
|
571
598
|
}
|
|
572
599
|
return { browseName, nodeId };
|
|
573
|
-
}
|
|
574
|
-
|
|
600
|
+
};
|
|
575
601
|
|
|
576
602
|
// eslint-disable-next-line max-statements, complexity
|
|
577
603
|
export function _bindExtensionObjectArrayOrMatrix(
|
|
@@ -579,7 +605,6 @@ export function _bindExtensionObjectArrayOrMatrix(
|
|
|
579
605
|
optionalExtensionObjectArray?: ExtensionObject[],
|
|
580
606
|
options?: BindExtensionObjectOptions
|
|
581
607
|
): ExtensionObject[] {
|
|
582
|
-
|
|
583
608
|
options = options || { createMissingProp: false };
|
|
584
609
|
options.createMissingProp = options.createMissingProp || false;
|
|
585
610
|
|
|
@@ -598,7 +623,10 @@ export function _bindExtensionObjectArrayOrMatrix(
|
|
|
598
623
|
optionalExtensionObjectArray = uaVariable.$dataValue.value.value;
|
|
599
624
|
}
|
|
600
625
|
|
|
601
|
-
if (
|
|
626
|
+
if (
|
|
627
|
+
(arrayDimensions.length === 0 || (arrayDimensions.length === 1 && arrayDimensions[0] === 0)) &&
|
|
628
|
+
optionalExtensionObjectArray
|
|
629
|
+
) {
|
|
602
630
|
arrayDimensions[0] = optionalExtensionObjectArray.length;
|
|
603
631
|
}
|
|
604
632
|
|
|
@@ -616,16 +644,15 @@ export function _bindExtensionObjectArrayOrMatrix(
|
|
|
616
644
|
if (!optionalExtensionObjectArray) {
|
|
617
645
|
optionalExtensionObjectArray = [];
|
|
618
646
|
for (let i = 0; i < totalLength; i++) {
|
|
619
|
-
optionalExtensionObjectArray[i] = addressSpace.constructExtensionObject(uaVariable.dataType, {})
|
|
647
|
+
optionalExtensionObjectArray[i] = addressSpace.constructExtensionObject(uaVariable.dataType, {});
|
|
620
648
|
}
|
|
621
649
|
}
|
|
622
650
|
uaVariable.$$extensionObjectArray = optionalExtensionObjectArray;
|
|
623
651
|
uaVariable.$dataValue.value.arrayType = uaVariable.valueRank === 1 ? VariantArrayType.Array : VariantArrayType.Matrix;
|
|
624
|
-
uaVariable.$dataValue.value.dimensions = uaVariable.valueRank === 1 ? null :
|
|
652
|
+
uaVariable.$dataValue.value.dimensions = uaVariable.valueRank === 1 ? null : uaVariable.arrayDimensions || [];
|
|
625
653
|
uaVariable.$dataValue.value.dataType = DataType.ExtensionObject;
|
|
626
654
|
uaVariable.$dataValue.value.value = uaVariable.$$extensionObjectArray;
|
|
627
655
|
|
|
628
|
-
|
|
629
656
|
// make sure uaVariable.$dataValue cannot be inadvertantly changed from this point onward
|
|
630
657
|
const $dataValue = uaVariable.$dataValue;
|
|
631
658
|
Object.defineProperty(uaVariable, "$dataValue", {
|
|
@@ -637,25 +664,25 @@ export function _bindExtensionObjectArrayOrMatrix(
|
|
|
637
664
|
},
|
|
638
665
|
// writable: true,
|
|
639
666
|
enumerable: true,
|
|
640
|
-
configurable: true
|
|
667
|
+
configurable: true
|
|
641
668
|
});
|
|
642
669
|
|
|
643
|
-
uaVariable.bindVariable(
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
670
|
+
uaVariable.bindVariable(
|
|
671
|
+
{
|
|
672
|
+
get: () => uaVariable.$dataValue.value
|
|
673
|
+
},
|
|
674
|
+
true
|
|
675
|
+
);
|
|
647
676
|
|
|
648
677
|
const namespace = uaVariable.namespace;
|
|
649
678
|
const indexIterator = new IndexIterator(arrayDimensions);
|
|
650
679
|
for (let i = 0; i < totalLength; i++) {
|
|
651
|
-
|
|
652
680
|
const index = indexIterator.next();
|
|
653
681
|
|
|
654
682
|
const { browseName, nodeId } = composeBrowseNameAndNodeId(uaVariable, index);
|
|
655
683
|
|
|
656
684
|
let uaElement = uaVariable.getComponentByName(browseName) as UAVariableImpl | null;
|
|
657
685
|
if (!uaElement) {
|
|
658
|
-
|
|
659
686
|
if (!options.createMissingProp) {
|
|
660
687
|
continue;
|
|
661
688
|
}
|
|
@@ -681,15 +708,17 @@ export function _bindExtensionObjectArrayOrMatrix(
|
|
|
681
708
|
{
|
|
682
709
|
const capturedIndex = i;
|
|
683
710
|
const capturedUaElement = uaElement as UAVariableImpl;
|
|
684
|
-
_innerBindExtensionObjectScalar(
|
|
711
|
+
_innerBindExtensionObjectScalar(
|
|
712
|
+
uaElement,
|
|
685
713
|
{
|
|
686
714
|
get: () => uaVariable.$$extensionObjectArray[capturedIndex],
|
|
687
715
|
set: (newValue: ExtensionObject, sourceTimestamp: PreciseClock, cache: Set<UAVariableImpl>) => {
|
|
688
716
|
assert(!isProxy(uaVariable.$$extensionObjectArray[capturedIndex]));
|
|
689
717
|
uaVariable.$$extensionObjectArray[capturedIndex] = newValue;
|
|
718
|
+
// istanbul ignore next
|
|
690
719
|
if (uaVariable.$$extensionObjectArray !== uaVariable.$dataValue.value.value) {
|
|
691
|
-
|
|
692
|
-
|
|
720
|
+
warningLog("uaVariable", uaVariable.nodeId.toString());
|
|
721
|
+
warningLog("Houston! We have a problem ");
|
|
693
722
|
}
|
|
694
723
|
propagateTouchValueDownward(capturedUaElement, sourceTimestamp, cache);
|
|
695
724
|
propagateTouchValueUpward(capturedUaElement, sourceTimestamp, cache);
|
|
@@ -700,8 +729,9 @@ export function _bindExtensionObjectArrayOrMatrix(
|
|
|
700
729
|
(isProxy(extObj) ? getProxyTarget(extObj) : extObj)[lowerFirstLetter(fieldName)] = newValue;
|
|
701
730
|
propagateTouchValueUpward(capturedUaElement, sourceTimestamp, cache);
|
|
702
731
|
}
|
|
703
|
-
},
|
|
704
|
-
|
|
732
|
+
},
|
|
733
|
+
{ ...options, force: true }
|
|
734
|
+
);
|
|
705
735
|
}
|
|
706
736
|
}
|
|
707
737
|
return uaVariable.$$extensionObjectArray;
|
|
@@ -764,14 +794,12 @@ export function extractPartialData(path: string | string[], extensionObject: Ext
|
|
|
764
794
|
}
|
|
765
795
|
|
|
766
796
|
export function propagateTouchValueDownwardArray(uaVariable: UAVariableImpl, now: PreciseClock, cache: Set<UAVariable>) {
|
|
767
|
-
|
|
768
797
|
if (!uaVariable.$$extensionObjectArray) return;
|
|
769
798
|
const arrayDimensions = uaVariable.arrayDimensions || [];
|
|
770
799
|
const totalLength = uaVariable.$$extensionObjectArray.length;
|
|
771
800
|
|
|
772
801
|
const indexIterator = new IndexIterator(arrayDimensions);
|
|
773
802
|
for (let i = 0; i < totalLength; i++) {
|
|
774
|
-
|
|
775
803
|
const index = indexIterator.next();
|
|
776
804
|
|
|
777
805
|
const { browseName, nodeId } = composeBrowseNameAndNodeId(uaVariable, index);
|
|
@@ -781,4 +809,4 @@ export function propagateTouchValueDownwardArray(uaVariable: UAVariableImpl, now
|
|
|
781
809
|
propagateTouchValueDownward(uaElement, now, cache);
|
|
782
810
|
}
|
|
783
811
|
}
|
|
784
|
-
}
|
|
812
|
+
}
|