node-opcua-address-space 2.113.0 → 2.113.2

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.
Files changed (53) hide show
  1. package/dist/source/interfaces/alarms_and_conditions/condition_info_i.d.ts +2 -0
  2. package/dist/source/interfaces/alarms_and_conditions/condition_snapshot.d.ts +14 -6
  3. package/dist/source/interfaces/alarms_and_conditions/ua_condition_ex.d.ts +3 -2
  4. package/dist/source/interfaces/data_access/ua_multistate_discrete_ex.d.ts +2 -1
  5. package/dist/source/interfaces/data_access/ua_multistate_value_discrete_ex.d.ts +2 -1
  6. package/dist/source/interfaces/data_access/ua_two_state_discrete_ex.d.ts +2 -1
  7. package/dist/source/interfaces/i_condition_variable_type_setter_options.d.ts +3 -0
  8. package/dist/source/interfaces/i_condition_variable_type_setter_options.js +3 -0
  9. package/dist/source/interfaces/i_condition_variable_type_setter_options.js.map +1 -0
  10. package/dist/source/interfaces/i_set_state_options.d.ts +4 -0
  11. package/dist/source/interfaces/i_set_state_options.js +3 -0
  12. package/dist/source/interfaces/i_set_state_options.js.map +1 -0
  13. package/dist/source/ua_two_state_variable_ex.d.ts +2 -1
  14. package/dist/src/alarms_and_conditions/condition.d.ts +2 -1
  15. package/dist/src/alarms_and_conditions/condition.js +2 -2
  16. package/dist/src/alarms_and_conditions/condition.js.map +1 -1
  17. package/dist/src/alarms_and_conditions/condition_snapshot_impl.d.ts +20 -11
  18. package/dist/src/alarms_and_conditions/condition_snapshot_impl.js +72 -33
  19. package/dist/src/alarms_and_conditions/condition_snapshot_impl.js.map +1 -1
  20. package/dist/src/alarms_and_conditions/ua_condition_impl.d.ts +3 -2
  21. package/dist/src/alarms_and_conditions/ua_condition_impl.js +13 -26
  22. package/dist/src/alarms_and_conditions/ua_condition_impl.js.map +1 -1
  23. package/dist/src/data_access/ua_multistate_discrete_impl.d.ts +3 -2
  24. package/dist/src/data_access/ua_multistate_discrete_impl.js +2 -2
  25. package/dist/src/data_access/ua_multistate_discrete_impl.js.map +1 -1
  26. package/dist/src/data_access/ua_multistate_value_discrete_impl.d.ts +3 -2
  27. package/dist/src/data_access/ua_multistate_value_discrete_impl.js +3 -3
  28. package/dist/src/data_access/ua_multistate_value_discrete_impl.js.map +1 -1
  29. package/dist/src/data_access/ua_two_state_discrete_impl.d.ts +2 -1
  30. package/dist/src/data_access/ua_two_state_discrete_impl.js +3 -3
  31. package/dist/src/data_access/ua_two_state_discrete_impl.js.map +1 -1
  32. package/dist/src/state_machine/ua_two_state_variable.d.ts +2 -1
  33. package/dist/src/state_machine/ua_two_state_variable.js +10 -8
  34. package/dist/src/state_machine/ua_two_state_variable.js.map +1 -1
  35. package/dist/src/ua_reference_type_impl.d.ts +1 -1
  36. package/dist/tsconfig_common.tsbuildinfo +1 -1
  37. package/package.json +2 -2
  38. package/source/interfaces/alarms_and_conditions/condition_info_i.ts +4 -0
  39. package/source/interfaces/alarms_and_conditions/condition_snapshot.ts +13 -8
  40. package/source/interfaces/alarms_and_conditions/ua_condition_ex.ts +4 -2
  41. package/source/interfaces/data_access/ua_multistate_discrete_ex.ts +2 -1
  42. package/source/interfaces/data_access/ua_multistate_value_discrete_ex.ts +2 -1
  43. package/source/interfaces/data_access/ua_two_state_discrete_ex.ts +2 -1
  44. package/source/interfaces/i_condition_variable_type_setter_options.ts +5 -0
  45. package/source/interfaces/i_set_state_options.ts +4 -0
  46. package/source/ua_two_state_variable_ex.ts +2 -1
  47. package/src/alarms_and_conditions/condition.ts +4 -2
  48. package/src/alarms_and_conditions/condition_snapshot_impl.ts +75 -38
  49. package/src/alarms_and_conditions/ua_condition_impl.ts +14 -27
  50. package/src/data_access/ua_multistate_discrete_impl.ts +5 -3
  51. package/src/data_access/ua_multistate_value_discrete_impl.ts +5 -4
  52. package/src/data_access/ua_two_state_discrete_impl.ts +5 -3
  53. package/src/state_machine/ua_two_state_variable.ts +14 -8
@@ -11,6 +11,8 @@ import { BindVariableOptions, INamespace, UAVariable, UAProperty } from "node-op
11
11
  import { UAMultiStateDiscrete, UAMultiStateDiscrete_Base } from "node-opcua-nodeset-ua";
12
12
  import { registerNodePromoter } from "../../source/loader/register_node_promoter";
13
13
  import { UAVariableImpl } from "../ua_variable_impl";
14
+ import { ISetStateOptions } from "../../source/interfaces/i_set_state_options";
15
+
14
16
  import { AddMultiStateDiscreteOptions } from "../../source/address_space_ts";
15
17
  import { add_dataItem_stuff } from "./add_dataItem_stuff";
16
18
 
@@ -21,7 +23,7 @@ export interface UAMultiStateDiscreteEx<T, DT extends DataType> extends UAMultiS
21
23
  getValue(): number;
22
24
  getValueAsString(): string;
23
25
  getIndex(value: string): number;
24
- setValue(value: string | number): void;
26
+ setValue(value: string | number, options?: ISetStateOptions): void;
25
27
  checkVariantCompatibility(value: Variant): StatusCode;
26
28
  }
27
29
 
@@ -50,13 +52,13 @@ export class UAMultiStateDiscreteImpl<T, DT extends DataType> extends UAVariable
50
52
  return index;
51
53
  }
52
54
 
53
- public setValue(value: string | number): void {
55
+ public setValue(value: string | number, options?: ISetStateOptions): void {
54
56
  if (typeof value === "string") {
55
57
  const index = this.getIndex(value);
56
58
  if (index < 0) {
57
59
  throw new Error("UAMultiStateDiscrete#setValue invalid multi state value provided : " + value);
58
60
  }
59
- return this.setValue(index);
61
+ return this.setValue(index, options);
60
62
  }
61
63
  const arrayEnumStrings = this.enumStrings.readValue().value.value;
62
64
  if (value >= arrayEnumStrings.length) {
@@ -17,6 +17,7 @@ import { registerNodePromoter } from "../../source/loader/register_node_promoter
17
17
  import { coerceEnumValues } from "../../source/helpers/coerce_enum_value";
18
18
  import { UAMultiStateValueDiscreteEx } from "../../source/interfaces/data_access/ua_multistate_value_discrete_ex";
19
19
  import { AddMultiStateValueDiscreteOptions } from "../../source/address_space_ts";
20
+ import { ISetStateOptions } from "../../source/interfaces/i_set_state_options";
20
21
  import { UAVariableImpl } from "../ua_variable_impl";
21
22
 
22
23
  import { add_dataItem_stuff } from "./add_dataItem_stuff";
@@ -50,7 +51,7 @@ export class UAMultiStateValueDiscreteImpl<T, DT extends DataType>
50
51
  extends UAVariableImpl
51
52
  implements UAMultiStateValueDiscreteEx<T, DT>
52
53
  {
53
- public setValue(value: string | number | Int64): void {
54
+ public setValue(value: string | number | Int64, options?: ISetStateOptions): void {
54
55
  if (typeof value === "string") {
55
56
  const enumValues = this.enumValues.readValue().value.value;
56
57
  const selected = enumValues.filter((a: any) => a.displayName.text === value)[0];
@@ -60,7 +61,7 @@ export class UAMultiStateValueDiscreteImpl<T, DT extends DataType>
60
61
  throw new Error("cannot find enum string " + value + " in " + enumValues.toString());
61
62
  }
62
63
  } else {
63
- this._setValue(coerceUInt64(value));
64
+ this._setValue(coerceUInt64(value), options);
64
65
  }
65
66
  }
66
67
 
@@ -116,7 +117,7 @@ export class UAMultiStateValueDiscreteImpl<T, DT extends DataType>
116
117
  *
117
118
  * @private
118
119
  */
119
- public _setValue(value: Int64): void {
120
+ public _setValue(value: Int64, options?: ISetStateOptions): void {
120
121
  // check that value is in bound
121
122
  if (!this._isValueInRange(coerceInt32(value))) {
122
123
  throw new Error("UAMultiStateValueDiscrete#_setValue out of range " + value);
@@ -301,4 +302,4 @@ export function validateDataType(dataTypeValue: any): void {
301
302
  if (typeof dataTypeValue !== "number" || validTypes.indexOf(dataTypeValue) < 0) {
302
303
  throw new Error(`Invalid DataType in UAMultiStateValueDiscrete => ${dataTypeValue.toString()}`);
303
304
  }
304
- }
305
+ }
@@ -10,9 +10,11 @@ import { UAVariableImpl } from "../ua_variable_impl";
10
10
  import { registerNodePromoter } from "../../source/loader/register_node_promoter";
11
11
  import { AddTwoStateDiscreteOptions } from "../../source/address_space_ts";
12
12
  import { UATwoStateDiscreteEx } from "../../source/interfaces/data_access/ua_two_state_discrete_ex";
13
+ import { ISetStateOptions } from "../../source/interfaces/i_set_state_options";
13
14
 
14
15
  import { add_dataItem_stuff } from "./add_dataItem_stuff";
15
16
 
17
+
16
18
  export interface UATwoStateDiscreteImpl {
17
19
  falseState: UAProperty<LocalizedText, /*c*/ DataType.LocalizedText>;
18
20
  trueState: UAProperty<LocalizedText, /*c*/ DataType.LocalizedText>;
@@ -58,15 +60,15 @@ export class UATwoStateDiscreteImpl extends UAVariableImpl implements UATwoState
58
60
  );
59
61
  }
60
62
  }
61
- setValue(value: boolean | LocalizedTextLike): void {
63
+ setValue(value: boolean | LocalizedTextLike, options?: ISetStateOptions): void {
62
64
  if (typeof value === "boolean") {
63
65
  this.setValueFromSource({ dataType: DataType.Boolean, value });
64
66
  } else {
65
67
  const text: string = (typeof value === "string" ? value : value.text) || "";
66
68
  if (text === this.getTrueStateAsString()) {
67
- this.setValue(true);
69
+ this.setValue(true, options);
68
70
  } else if (text === this.getFalseStateAsString()) {
69
- this.setValue(false);
71
+ this.setValue(false, options);
70
72
  } else {
71
73
  throw new Error("setValue invalid value " + value);
72
74
  }
@@ -21,6 +21,8 @@ import { AddTwoStateVariableOptions } from "../../source/address_space_ts";
21
21
  import { UATwoStateVariableEx } from "../../source/ua_two_state_variable_ex";
22
22
  // private types
23
23
  import { UAVariableImpl, UAVariableImplT } from "../ua_variable_impl";
24
+ import { ISetStateOptions } from "../../source/interfaces/i_set_state_options";
25
+
24
26
 
25
27
  const hasTrueSubState_ReferenceTypeNodeId = resolveNodeId("HasTrueSubState");
26
28
  const hasFalseSubState_ReferenceTypeNodeId = resolveNodeId("HasFalseSubState");
@@ -54,19 +56,23 @@ const hasFalseSubState_ReferenceTypeNodeId = resolveNodeId("HasFalseSubState");
54
56
  // TwoStateVariableType
55
57
  // <StateIdentifier> Defined in Clause 5.4.3 Optional
56
58
 
57
- function _updateTransitionTime(node: UATwoStateVariableEx, _subState?: UAVariable) {
59
+ function _updateTransitionTime(node: UATwoStateVariableEx, _subState?: UAVariable, options?: ISetStateOptions) {
58
60
  // TransitionTime specifies the time when the current state was entered.
59
61
  if (node.transitionTime) {
60
- node.transitionTime.setValueFromSource({ dataType: DataType.DateTime, value: new Date() });
62
+ const transitionTime = options?.transitionTime || new Date();
63
+ node.transitionTime.setValueFromSource({ dataType: DataType.DateTime, value: transitionTime });
61
64
  }
62
65
  }
63
66
 
64
- function _updateEffectiveTransitionTime(node: UATwoStateVariableImpl) {
67
+ function _updateEffectiveTransitionTime(node: UATwoStateVariableImpl,options?: ISetStateOptions) {
65
68
  if (node.effectiveTransitionTime) {
69
+
70
+ const effectiveTransitionTime = options?.effectiveTransitionTime || new Date();
71
+
66
72
  // because subStateNode ",subStateNode.browseName.toString());
67
73
  node.effectiveTransitionTime.setValueFromSource({
68
74
  dataType: DataType.DateTime,
69
- value: new Date()
75
+ value: effectiveTransitionTime
70
76
  });
71
77
  }
72
78
  }
@@ -308,7 +314,7 @@ export class UATwoStateVariableImpl extends UAVariableImplT<LocalizedText, DataT
308
314
  * @method setValue
309
315
  * @param boolValue {Boolean}
310
316
  */
311
- public setValue(boolValue: boolean): void {
317
+ public setValue(boolValue: boolean, options?: ISetStateOptions): void {
312
318
  assert(typeof boolValue === "boolean");
313
319
  const dataValue = this.id!.readValue();
314
320
  const oldValue = dataValue.value.value;
@@ -317,8 +323,8 @@ export class UATwoStateVariableImpl extends UAVariableImplT<LocalizedText, DataT
317
323
  }
318
324
  //
319
325
  this.id.setValueFromSource(new Variant({ dataType: DataType.Boolean, value: boolValue }));
320
- _updateTransitionTime(this);
321
- _updateEffectiveTransitionTime(this);
326
+ _updateTransitionTime(this, undefined, options);
327
+ _updateEffectiveTransitionTime(this, options);
322
328
  }
323
329
 
324
330
  /**
@@ -369,7 +375,7 @@ export class UATwoStateVariableImpl extends UAVariableImplT<LocalizedText, DataT
369
375
  const addressSpace = this.addressSpace;
370
376
  // add event handle
371
377
  const subState = addressSpace.findNode(reference.nodeId) as UAVariable;
372
- subState.on("value_changed", _updateEffectiveTransitionTime.bind(null, this));
378
+ subState.on("value_changed", _updateEffectiveTransitionTime.bind(null, this, undefined));
373
379
  }
374
380
  }
375
381
  }