node-opcua-address-space 2.56.2 → 2.60.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/LICENSE +20 -20
- package/dist/source/address_space_ts.d.ts +0 -2
- package/dist/source/helpers/argument_list.js +12 -1
- package/dist/source/helpers/argument_list.js.map +1 -1
- package/dist/source/loader/load_nodeset2.js +76 -67
- package/dist/source/loader/load_nodeset2.js.map +1 -1
- package/dist/source/session_context.js +2 -2
- package/dist/source/session_context.js.map +1 -1
- package/dist/source/set_namespace_meta_data.js +1 -1
- package/dist/src/address_space.d.ts +2 -3
- package/dist/src/address_space.js +9 -6
- package/dist/src/address_space.js.map +1 -1
- package/dist/src/address_space_private.d.ts +2 -3
- package/dist/src/alarms_and_conditions/condition_snapshot.js +3 -3
- package/dist/src/alarms_and_conditions/condition_snapshot.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_acknowledgeable_condition_impl.js +2 -1
- 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 +1 -1
- package/dist/src/alarms_and_conditions/ua_alarm_condition_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_condition_impl.js +8 -6
- package/dist/src/alarms_and_conditions/ua_condition_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_off_normal_alarm_impl.js +1 -1
- package/dist/src/alarms_and_conditions/ua_off_normal_alarm_impl.js.map +1 -1
- package/dist/src/base_node_private.js +2 -2
- package/dist/src/base_node_private.js.map +1 -1
- package/dist/src/event_data.js +1 -1
- package/dist/src/event_data.js.map +1 -1
- package/dist/src/namespace_impl.d.ts +2 -2
- package/dist/src/namespace_impl.js +9 -9
- package/dist/src/namespace_impl.js.map +1 -1
- package/dist/src/nodeset_tools/nodeset_to_xml.js +16 -10
- package/dist/src/nodeset_tools/nodeset_to_xml.js.map +1 -1
- package/dist/src/nodeset_tools/typedictionary_to_xml.js +17 -10
- package/dist/src/nodeset_tools/typedictionary_to_xml.js.map +1 -1
- package/dist/src/reference_impl.js +1 -1
- package/dist/src/reference_impl.js.map +1 -1
- package/dist/src/state_machine/ua_shelving_state_machine_ex.js +20 -13
- package/dist/src/state_machine/ua_shelving_state_machine_ex.js.map +1 -1
- package/dist/src/ua_data_type_impl.d.ts +15 -5
- package/dist/src/ua_data_type_impl.js +129 -51
- package/dist/src/ua_data_type_impl.js.map +1 -1
- package/dist/src/ua_method_impl.d.ts +3 -2
- package/dist/src/ua_method_impl.js +5 -0
- package/dist/src/ua_method_impl.js.map +1 -1
- package/dist/src/ua_variable_impl.d.ts +6 -6
- package/dist/src/ua_variable_impl.js +236 -188
- package/dist/src/ua_variable_impl.js.map +1 -1
- package/dist/src/ua_variable_type_impl.d.ts +3 -4
- package/dist/src/ua_variable_type_impl.js +13 -18
- package/dist/src/ua_variable_type_impl.js.map +1 -1
- package/distHelpers/add_event_generator_object.js.map +1 -1
- package/distHelpers/mock_session.js +1 -1
- package/distHelpers/mock_session.js.map +1 -1
- package/generate.js +1 -1
- package/nodeJS.d.ts +1 -1
- package/package.json +36 -36
- package/source/address_space_ts.ts +0 -1
- package/source/helpers/argument_list.ts +13 -3
- package/source/loader/load_nodeset2.ts +99 -79
- package/source/session_context.ts +1 -1
- package/source/set_namespace_meta_data.ts +1 -1
- package/source_nodejs/index.ts +1 -1
- package/src/address_space.ts +21 -14
- package/src/address_space_private.ts +3 -3
- package/src/alarms_and_conditions/condition_snapshot.ts +4 -4
- package/src/alarms_and_conditions/ua_acknowledgeable_condition_impl.ts +7 -6
- package/src/alarms_and_conditions/ua_alarm_condition_impl.ts +2 -2
- package/src/alarms_and_conditions/ua_condition_impl.ts +29 -15
- package/src/alarms_and_conditions/ua_off_normal_alarm_impl.ts +1 -1
- package/src/base_node_private.ts +6 -2
- package/src/event_data.ts +1 -1
- package/src/namespace_impl.ts +9 -9
- package/src/nodeset_tools/nodeset_to_xml.ts +22 -12
- package/src/nodeset_tools/typedictionary_to_xml.ts +17 -7
- package/src/reference_impl.ts +3 -3
- package/src/state_machine/ua_shelving_state_machine_ex.ts +32 -19
- package/src/ua_data_type_impl.ts +168 -61
- package/src/ua_method_impl.ts +11 -5
- package/src/ua_variable_impl.ts +290 -218
- package/src/ua_variable_type_impl.ts +9 -15
- package/testHelpers.d.ts +1 -1
- package/test_helpers/add_event_generator_object.ts +4 -3
- package/test_helpers/mock_session.ts +1 -1
- package/test_helpers/test_fixtures/dataType_in_separateNamespace.xml +150 -150
- package/test_helpers/test_fixtures/dataType_in_separateNamespace_basic.xml +57 -57
- package/test_helpers/test_fixtures/dataType_in_separateNamespace_mix.xml +135 -135
- package/test_helpers/test_fixtures/dataType_withEnumeration.xml +82 -82
- package/test_helpers/test_fixtures/dataType_with_isOptionSet.xml +194 -194
- package/test_helpers/test_fixtures/dataType_with_union.xml +1 -1
- package/test_helpers/test_fixtures/fixture_empty_nodeset2.xml +106 -106
- package/test_helpers/test_fixtures/fixture_simple_statemachine_nodeset2.xml +1312 -1303
- package/test_helpers/test_fixtures/fixuture_nodeset_objects_with_some_methods.xml +362 -362
- package/test_helpers/test_fixtures/issue_846.xml +3172 -3172
- package/test_helpers/test_fixtures/issue_899_variable_with_nodeid_value.xml +32 -32
- package/test_helpers/test_fixtures/mini.Node.Set2.xml +14 -0
- package/test_helpers/test_fixtures/mini.nodeset.withVariousVariables.xml +194 -194
- package/test_helpers/test_fixtures/minimalist_nodeset_with_models.xml +8 -8
- package/test_helpers/test_fixtures/minimalist_nodeset_with_models_more_complex.xml +16 -16
- package/test_helpers/test_fixtures/nodeset_with_analog_items.xml +45 -45
- package/dist/source/interfaces/alarms_and_conditions/ua_condition_base_i.d.ts +0 -23
- package/dist/source/interfaces/alarms_and_conditions/ua_condition_base_i.js +0 -3
- package/dist/source/interfaces/alarms_and_conditions/ua_condition_base_i.js.map +0 -1
- package/dist/source/interfaces/data_access/ua_discrete_item.d.ts +0 -6
- package/dist/source/interfaces/data_access/ua_discrete_item.js +0 -3
- package/dist/source/interfaces/data_access/ua_discrete_item.js.map +0 -1
- package/dist/source/interfaces/data_access/ua_multistate_discrete.d.ts +0 -25
- package/dist/source/interfaces/data_access/ua_multistate_discrete.js +0 -3
- package/dist/source/interfaces/data_access/ua_multistate_discrete.js.map +0 -1
- package/dist/source/interfaces/data_access/ua_multistate_value_discrete.d.ts +0 -27
- package/dist/source/interfaces/data_access/ua_multistate_value_discrete.js +0 -3
- package/dist/source/interfaces/data_access/ua_multistate_value_discrete.js.map +0 -1
- package/dist/source/interfaces/data_access/ua_two_state_discrete.d.ts +0 -17
- package/dist/source/interfaces/data_access/ua_two_state_discrete.js +0 -3
- package/dist/source/interfaces/data_access/ua_two_state_discrete.js.map +0 -1
- package/dist/source/interfaces/data_access/ua_y_array_item.d.ts +0 -19
- package/dist/source/interfaces/data_access/ua_y_array_item.js +0 -3
- package/dist/source/interfaces/data_access/ua_y_array_item.js.map +0 -1
- package/dist/source/interfaces/state_machine/exclusive_limit_state_machine.d.ts +0 -11
- package/dist/source/interfaces/state_machine/exclusive_limit_state_machine.js +0 -3
- package/dist/source/interfaces/state_machine/exclusive_limit_state_machine.js.map +0 -1
- package/dist/source/interfaces/state_machine/finite_state_machine.d.ts +0 -70
- package/dist/source/interfaces/state_machine/finite_state_machine.js +0 -3
- package/dist/source/interfaces/state_machine/finite_state_machine.js.map +0 -1
- package/dist/source/interfaces/state_machine/program_finite_state_machine.d.ts +0 -74
- package/dist/source/interfaces/state_machine/program_finite_state_machine.js +0 -3
- package/dist/source/interfaces/state_machine/program_finite_state_machine.js.map +0 -1
- package/dist/source/interfaces/state_machine/state_machine.d.ts +0 -342
- package/dist/source/interfaces/state_machine/state_machine.js +0 -3
- package/dist/source/interfaces/state_machine/state_machine.js.map +0 -1
- package/dist/source/interfaces/state_machine/ua_finite_state_variable.d.ts +0 -18
- package/dist/source/interfaces/state_machine/ua_finite_state_variable.js +0 -3
- package/dist/source/interfaces/state_machine/ua_finite_state_variable.js.map +0 -1
- package/dist/source/interfaces/state_machine/ua_state_variable.d.ts +0 -29
- package/dist/source/interfaces/state_machine/ua_state_variable.js +0 -3
- package/dist/source/interfaces/state_machine/ua_state_variable.js.map +0 -1
- package/dist/source/interfaces/state_machine/ua_two_state_variable.d.ts +0 -26
- package/dist/source/interfaces/state_machine/ua_two_state_variable.js +0 -3
- package/dist/source/interfaces/state_machine/ua_two_state_variable.js.map +0 -1
- package/dist/source/interfaces/subscription_diagnostics_variable.d.ts +0 -41
- package/dist/source/interfaces/subscription_diagnostics_variable.js +0 -3
- package/dist/source/interfaces/subscription_diagnostics_variable.js.map +0 -1
- package/dist/src/alarms_and_conditions/base_event_type.d.ts +0 -26
- package/dist/src/alarms_and_conditions/base_event_type.js +0 -41
- package/dist/src/alarms_and_conditions/base_event_type.js.map +0 -1
- package/dist/src/alarms_and_conditions/shelving_state_machine.d.ts +0 -22
- package/dist/src/alarms_and_conditions/shelving_state_machine.js +0 -241
- package/dist/src/alarms_and_conditions/shelving_state_machine.js.map +0 -1
- package/dist/src/alarms_and_conditions/trip_alarm.d.ts +0 -16
- package/dist/src/alarms_and_conditions/trip_alarm.js +0 -21
- package/dist/src/alarms_and_conditions/trip_alarm.js.map +0 -1
- package/dist/src/alarms_and_conditions/ua_acknowledgeable_condition_base.d.ts +0 -54
- package/dist/src/alarms_and_conditions/ua_acknowledgeable_condition_base.js +0 -255
- package/dist/src/alarms_and_conditions/ua_acknowledgeable_condition_base.js.map +0 -1
- package/dist/src/alarms_and_conditions/ua_alarm_condition_base.d.ts +0 -138
- package/dist/src/alarms_and_conditions/ua_alarm_condition_base.js +0 -460
- package/dist/src/alarms_and_conditions/ua_alarm_condition_base.js.map +0 -1
- package/dist/src/alarms_and_conditions/ua_certificate_expiration_alarm.d.ts +0 -35
- package/dist/src/alarms_and_conditions/ua_certificate_expiration_alarm.js +0 -32
- package/dist/src/alarms_and_conditions/ua_certificate_expiration_alarm.js.map +0 -1
- package/dist/src/alarms_and_conditions/ua_condition_base.d.ts +0 -191
- package/dist/src/alarms_and_conditions/ua_condition_base.js +0 -1029
- package/dist/src/alarms_and_conditions/ua_condition_base.js.map +0 -1
- package/dist/src/alarms_and_conditions/ua_discrete_alarm.d.ts +0 -11
- package/dist/src/alarms_and_conditions/ua_discrete_alarm.js +0 -58
- package/dist/src/alarms_and_conditions/ua_discrete_alarm.js.map +0 -1
- package/dist/src/alarms_and_conditions/ua_exclusive_deviation_alarm.d.ts +0 -24
- package/dist/src/alarms_and_conditions/ua_exclusive_deviation_alarm.js +0 -59
- package/dist/src/alarms_and_conditions/ua_exclusive_deviation_alarm.js.map +0 -1
- package/dist/src/alarms_and_conditions/ua_exclusive_level_alarm.d.ts +0 -14
- package/dist/src/alarms_and_conditions/ua_exclusive_level_alarm.js +0 -17
- package/dist/src/alarms_and_conditions/ua_exclusive_level_alarm.js.map +0 -1
- package/dist/src/alarms_and_conditions/ua_exclusive_limit_alarm.d.ts +0 -22
- package/dist/src/alarms_and_conditions/ua_exclusive_limit_alarm.js +0 -87
- package/dist/src/alarms_and_conditions/ua_exclusive_limit_alarm.js.map +0 -1
- package/dist/src/alarms_and_conditions/ua_exclusive_rate_of_change_alarm.d.ts +0 -6
- package/dist/src/alarms_and_conditions/ua_exclusive_rate_of_change_alarm.js +0 -11
- package/dist/src/alarms_and_conditions/ua_exclusive_rate_of_change_alarm.js.map +0 -1
- package/dist/src/alarms_and_conditions/ua_limit_alarm.d.ts +0 -76
- package/dist/src/alarms_and_conditions/ua_limit_alarm.js +0 -237
- package/dist/src/alarms_and_conditions/ua_limit_alarm.js.map +0 -1
- package/dist/src/alarms_and_conditions/ua_non_exclusive_deviation_alarm.d.ts +0 -27
- package/dist/src/alarms_and_conditions/ua_non_exclusive_deviation_alarm.js +0 -62
- package/dist/src/alarms_and_conditions/ua_non_exclusive_deviation_alarm.js.map +0 -1
- package/dist/src/alarms_and_conditions/ua_non_exclusive_limit_alarm.d.ts +0 -49
- package/dist/src/alarms_and_conditions/ua_non_exclusive_limit_alarm.js +0 -176
- package/dist/src/alarms_and_conditions/ua_non_exclusive_limit_alarm.js.map +0 -1
- package/dist/src/alarms_and_conditions/ua_off_normal_alarm.d.ts +0 -47
- package/dist/src/alarms_and_conditions/ua_off_normal_alarm.js +0 -151
- package/dist/src/alarms_and_conditions/ua_off_normal_alarm.js.map +0 -1
- package/dist/src/alarms_and_conditions/ua_system_off_normal_alarm.d.ts +0 -16
- package/dist/src/alarms_and_conditions/ua_system_off_normal_alarm.js +0 -18
- package/dist/src/alarms_and_conditions/ua_system_off_normal_alarm.js.map +0 -1
- package/dist/src/base_node.d.ts +0 -289
- package/dist/src/base_node.js +0 -1345
- package/dist/src/base_node.js.map +0 -1
- package/dist/src/data_access/ua_analog_item.d.ts +0 -13
- package/dist/src/data_access/ua_analog_item.js +0 -37
- package/dist/src/data_access/ua_analog_item.js.map +0 -1
- package/dist/src/data_access/ua_data_item.d.ts +0 -16
- package/dist/src/data_access/ua_data_item.js +0 -66
- package/dist/src/data_access/ua_data_item.js.map +0 -1
- package/dist/src/data_access/ua_multistate_discrete.d.ts +0 -24
- package/dist/src/data_access/ua_multistate_discrete.js +0 -132
- package/dist/src/data_access/ua_multistate_discrete.js.map +0 -1
- package/dist/src/namespace.d.ts +0 -472
- package/dist/src/namespace.js +0 -1751
- package/dist/src/namespace.js.map +0 -1
- package/dist/src/reference.d.ts +0 -43
- package/dist/src/reference.js +0 -138
- package/dist/src/reference.js.map +0 -1
- package/dist/src/session_context.d.ts +0 -4
- package/dist/src/session_context.js +0 -9
- package/dist/src/session_context.js.map +0 -1
- package/dist/src/ua_data_type.d.ts +0 -83
- package/dist/src/ua_data_type.js +0 -289
- package/dist/src/ua_data_type.js.map +0 -1
- package/dist/src/ua_method.d.ts +0 -41
- package/dist/src/ua_method.js +0 -202
- package/dist/src/ua_method.js.map +0 -1
- package/dist/src/ua_object.d.ts +0 -28
- package/dist/src/ua_object.js +0 -153
- package/dist/src/ua_object.js.map +0 -1
- package/dist/src/ua_object_type.d.ts +0 -49
- package/dist/src/ua_object_type.js +0 -123
- package/dist/src/ua_object_type.js.map +0 -1
- package/dist/src/ua_reference_type.d.ts +0 -42
- package/dist/src/ua_reference_type.js +0 -138
- package/dist/src/ua_reference_type.js.map +0 -1
- package/dist/src/ua_variable.d.ts +0 -339
- package/dist/src/ua_variable.js +0 -1706
- package/dist/src/ua_variable.js.map +0 -1
- package/dist/src/ua_variable_type.d.ts +0 -57
- package/dist/src/ua_variable_type.js +0 -530
- package/dist/src/ua_variable_type.js.map +0 -1
- package/dist/src/ua_view.d.ts +0 -16
- package/dist/src/ua_view.js +0 -42
- package/dist/src/ua_view.js.map +0 -1
|
@@ -5,9 +5,10 @@ import { UAAcknowledgeableCondition_Base, UAAcknowledgeableCondition, UAConditio
|
|
|
5
5
|
import { assert } from "node-opcua-assert";
|
|
6
6
|
import { LocalizedText, LocalizedTextLike } from "node-opcua-data-model";
|
|
7
7
|
import { NodeId } from "node-opcua-nodeid";
|
|
8
|
-
import { StatusCode, StatusCodes } from "node-opcua-status-code";
|
|
8
|
+
import { CallbackT, StatusCode, StatusCodes } from "node-opcua-status-code";
|
|
9
9
|
import { DataType, VariantLike } from "node-opcua-variant";
|
|
10
10
|
import { INamespace, RaiseEventData, ISessionContext, UAEventType, UAMethod } from "node-opcua-address-space-base";
|
|
11
|
+
import { CallMethodResultOptions } from "node-opcua-service-call";
|
|
11
12
|
|
|
12
13
|
import { UATwoStateVariableEx } from "../../source/ua_two_state_variable_ex";
|
|
13
14
|
import { AddressSpacePrivate } from "../address_space_private";
|
|
@@ -106,10 +107,10 @@ export class UAAcknowledgeableConditionImpl extends UAConditionImpl implements U
|
|
|
106
107
|
}
|
|
107
108
|
|
|
108
109
|
public static install_method_handle_on_type(addressSpace: AddressSpacePrivate): void {
|
|
109
|
-
const acknowledgeableConditionType = addressSpace.findEventType("AcknowledgeableConditionType");
|
|
110
|
+
const acknowledgeableConditionType = addressSpace.findEventType("AcknowledgeableConditionType") as unknown as UAAcknowledgeableCondition_Base;
|
|
110
111
|
assert(acknowledgeableConditionType !== null);
|
|
111
|
-
|
|
112
|
-
|
|
112
|
+
acknowledgeableConditionType.acknowledge.bindMethod(_acknowledge_method);
|
|
113
|
+
acknowledgeableConditionType.confirm?.bindMethod(_confirm_method);
|
|
113
114
|
}
|
|
114
115
|
|
|
115
116
|
public _raiseAuditConditionAcknowledgeEvent(branch: ConditionSnapshot): void {
|
|
@@ -296,7 +297,7 @@ export class UAAcknowledgeableConditionImpl extends UAConditionImpl implements U
|
|
|
296
297
|
}
|
|
297
298
|
}
|
|
298
299
|
|
|
299
|
-
function _acknowledge_method(inputArguments: VariantLike[], context: ISessionContext, callback:
|
|
300
|
+
function _acknowledge_method(inputArguments: VariantLike[], context: ISessionContext, callback: CallbackT<CallMethodResultOptions>) {
|
|
300
301
|
UAConditionImpl.with_condition_method(
|
|
301
302
|
inputArguments,
|
|
302
303
|
context,
|
|
@@ -321,7 +322,7 @@ function _acknowledge_method(inputArguments: VariantLike[], context: ISessionCon
|
|
|
321
322
|
*
|
|
322
323
|
* @private
|
|
323
324
|
*/
|
|
324
|
-
function _confirm_method(inputArguments: VariantLike[], context: ISessionContext,
|
|
325
|
+
function _confirm_method(inputArguments: VariantLike[], context: ISessionContext, callback: CallbackT<CallMethodResultOptions>) {
|
|
325
326
|
UAConditionImpl.with_condition_method(
|
|
326
327
|
inputArguments,
|
|
327
328
|
context,
|
|
@@ -6,7 +6,7 @@ import { isEqual } from "lodash";
|
|
|
6
6
|
import { assert } from "node-opcua-assert";
|
|
7
7
|
import { NodeClass } from "node-opcua-data-model";
|
|
8
8
|
import { DataValue } from "node-opcua-data-value";
|
|
9
|
-
import { NodeId } from "node-opcua-nodeid";
|
|
9
|
+
import { NodeId, sameNodeId } from "node-opcua-nodeid";
|
|
10
10
|
import { StatusCodes } from "node-opcua-status-code";
|
|
11
11
|
import { DataType } from "node-opcua-variant";
|
|
12
12
|
import { UAAlarmCondition_Base } from "node-opcua-nodeset-ua";
|
|
@@ -498,7 +498,7 @@ export class UAAlarmConditionImpl extends UAAcknowledgeableConditionImpl impleme
|
|
|
498
498
|
if (this.currentBranch().getRetain()) {
|
|
499
499
|
// we need to create a new branch so the previous state could be acknowledged
|
|
500
500
|
const newBranch = this.createBranch();
|
|
501
|
-
assert(newBranch.getBranchId()
|
|
501
|
+
assert(!sameNodeId(newBranch.getBranchId(), NodeId.nullNodeId));
|
|
502
502
|
// also raised a new Event for the new branch as branchId has changed
|
|
503
503
|
this.raiseNewBranchState(newBranch);
|
|
504
504
|
}
|
|
@@ -21,8 +21,8 @@ import { DataValue } from "node-opcua-data-value";
|
|
|
21
21
|
import { checkDebugFlag, make_debugLog, make_errorLog } from "node-opcua-debug";
|
|
22
22
|
import { minDate } from "node-opcua-factory";
|
|
23
23
|
import { coerceNodeId, makeNodeId, NodeId, resolveNodeId, sameNodeId } from "node-opcua-nodeid";
|
|
24
|
-
import { StatusCode, StatusCodes } from "node-opcua-status-code";
|
|
25
|
-
import { TimeZoneDataType } from "node-opcua-types";
|
|
24
|
+
import { CallbackT, StatusCode, StatusCodes } from "node-opcua-status-code";
|
|
25
|
+
import { CallMethodResultOptions, TimeZoneDataType } from "node-opcua-types";
|
|
26
26
|
import { DataType, Variant, VariantLike } from "node-opcua-variant";
|
|
27
27
|
import { UAVariable, INamespace, ISessionContext, UAEventType, BaseNode, UAObject } from "node-opcua-address-space-base";
|
|
28
28
|
import { UACondition_Base, UAConditionVariable, UACondition } from "node-opcua-nodeset-ua";
|
|
@@ -238,7 +238,7 @@ export class UAConditionImpl extends UABaseEventImpl implements UAConditionEx {
|
|
|
238
238
|
*/
|
|
239
239
|
public post_initialize(): void {
|
|
240
240
|
assert(!this._branch0);
|
|
241
|
-
this._branch0 = new ConditionSnapshot(this, NodeId
|
|
241
|
+
this._branch0 = new ConditionSnapshot(this, new NodeId());
|
|
242
242
|
|
|
243
243
|
// the condition OPCUA object alway reflects the default branch states
|
|
244
244
|
// so we set a mechanism that automatically keeps self in sync
|
|
@@ -258,13 +258,13 @@ export class UAConditionImpl extends UABaseEventImpl implements UAConditionEx {
|
|
|
258
258
|
}
|
|
259
259
|
|
|
260
260
|
public getBranches(): ConditionSnapshot[] {
|
|
261
|
-
return Object.keys(this._branches).map((x
|
|
261
|
+
return Object.keys(this._branches).map((x) => {
|
|
262
262
|
return this._branches[x];
|
|
263
263
|
});
|
|
264
264
|
}
|
|
265
265
|
|
|
266
266
|
public getBranchIds(): NodeId[] {
|
|
267
|
-
return this.getBranches().map((b
|
|
267
|
+
return this.getBranches().map((b) => b.getBranchId());
|
|
268
268
|
}
|
|
269
269
|
|
|
270
270
|
/**
|
|
@@ -284,7 +284,7 @@ export class UAConditionImpl extends UABaseEventImpl implements UAConditionEx {
|
|
|
284
284
|
*/
|
|
285
285
|
public deleteBranch(branch: ConditionSnapshot): void {
|
|
286
286
|
const key = branch.getBranchId().toString();
|
|
287
|
-
assert(branch.getBranchId()
|
|
287
|
+
assert(!sameNodeId(branch.getBranchId(), NodeId.nullNodeId), "cannot delete branch zero");
|
|
288
288
|
assert(Object.prototype.hasOwnProperty.call(this._branches, key));
|
|
289
289
|
delete this._branches[key];
|
|
290
290
|
this.emit("branch_deleted", key);
|
|
@@ -560,7 +560,7 @@ export class UAConditionImpl extends UABaseEventImpl implements UAConditionEx {
|
|
|
560
560
|
public raiseNewBranchState(branch: ConditionSnapshot): void {
|
|
561
561
|
this.raiseConditionEvent(branch, true);
|
|
562
562
|
|
|
563
|
-
if (branch.getBranchId()
|
|
563
|
+
if (!sameNodeId(branch.getBranchId(), NodeId.nullNodeId) && !branch.getRetain()) {
|
|
564
564
|
// xx console.log(" Deleting not longer needed branch ", branch.getBranchId().toString());
|
|
565
565
|
// branch can be deleted
|
|
566
566
|
this.deleteBranch(branch);
|
|
@@ -789,7 +789,7 @@ function UACondition_instantiate(
|
|
|
789
789
|
// install initial branch ID (null NodeId);
|
|
790
790
|
conditionNode.branchId.setValueFromSource({
|
|
791
791
|
dataType: DataType.NodeId,
|
|
792
|
-
value: NodeId
|
|
792
|
+
value: new NodeId()
|
|
793
793
|
});
|
|
794
794
|
|
|
795
795
|
// install 'Comment' condition variable
|
|
@@ -920,7 +920,9 @@ function UACondition_instantiate(
|
|
|
920
920
|
conditionNode.sourceNode.setValueFromSource(conditionSourceNode.readAttribute(null, AttributeIds.NodeId).value);
|
|
921
921
|
|
|
922
922
|
// set source Name (defined in UABaseEventType)
|
|
923
|
-
|
|
923
|
+
const displayName: LocalizedText = conditionSourceNode.readAttribute(null, AttributeIds.DisplayName).value
|
|
924
|
+
.value as LocalizedText;
|
|
925
|
+
conditionNode.sourceName.setValueFromSource({ dataType: DataType.String, value: displayName.text });
|
|
924
926
|
}
|
|
925
927
|
}
|
|
926
928
|
|
|
@@ -953,7 +955,7 @@ function UACondition_instantiate(
|
|
|
953
955
|
*/
|
|
954
956
|
const baseConditionClassType = addressSpace.findObjectType("ProcessConditionClassType");
|
|
955
957
|
// assert(baseConditionClassType,"Expecting BaseConditionClassType to be in addressSpace");
|
|
956
|
-
let conditionClassId = baseConditionClassType ? baseConditionClassType.nodeId : NodeId
|
|
958
|
+
let conditionClassId = baseConditionClassType ? baseConditionClassType.nodeId : new NodeId();
|
|
957
959
|
let conditionClassName = baseConditionClassType ? baseConditionClassType.displayName[0] : "";
|
|
958
960
|
if (options.conditionClass) {
|
|
959
961
|
if (typeof options.conditionClass === "string") {
|
|
@@ -1028,7 +1030,7 @@ function UACondition_instantiate(
|
|
|
1028
1030
|
return conditionNode;
|
|
1029
1031
|
}
|
|
1030
1032
|
|
|
1031
|
-
function _disable_method(inputArguments: VariantLike[], context: ISessionContext, callback:
|
|
1033
|
+
function _disable_method(inputArguments: VariantLike[], context: ISessionContext, callback: CallbackT<CallMethodResultOptions>) {
|
|
1032
1034
|
assert(inputArguments.length === 0);
|
|
1033
1035
|
|
|
1034
1036
|
const conditionNode = context.object;
|
|
@@ -1047,7 +1049,7 @@ function _disable_method(inputArguments: VariantLike[], context: ISessionContext
|
|
|
1047
1049
|
});
|
|
1048
1050
|
}
|
|
1049
1051
|
|
|
1050
|
-
function _enable_method(inputArguments: VariantLike[], context: ISessionContext, callback:
|
|
1052
|
+
function _enable_method(inputArguments: VariantLike[], context: ISessionContext, callback: CallbackT<CallMethodResultOptions>) {
|
|
1051
1053
|
assert(inputArguments.length === 0);
|
|
1052
1054
|
const conditionNode = context.object;
|
|
1053
1055
|
assert(conditionNode);
|
|
@@ -1063,7 +1065,11 @@ function _enable_method(inputArguments: VariantLike[], context: ISessionContext,
|
|
|
1063
1065
|
});
|
|
1064
1066
|
}
|
|
1065
1067
|
|
|
1066
|
-
function _condition_refresh_method(
|
|
1068
|
+
function _condition_refresh_method(
|
|
1069
|
+
inputArguments: VariantLike[],
|
|
1070
|
+
context: ISessionContext,
|
|
1071
|
+
callback: CallbackT<CallMethodResultOptions>
|
|
1072
|
+
) {
|
|
1067
1073
|
// arguments : IntegerId SubscriptionId
|
|
1068
1074
|
assert(inputArguments.length === 1);
|
|
1069
1075
|
const addressSpace = context.object!.addressSpace as AddressSpacePrivate;
|
|
@@ -1119,7 +1125,11 @@ function _perform_condition_refresh(addressSpace: AddressSpacePrivate, inputArgu
|
|
|
1119
1125
|
return StatusCodes.Good;
|
|
1120
1126
|
}
|
|
1121
1127
|
|
|
1122
|
-
function _condition_refresh2_method(
|
|
1128
|
+
function _condition_refresh2_method(
|
|
1129
|
+
inputArguments: VariantLike[],
|
|
1130
|
+
context: ISessionContext,
|
|
1131
|
+
callback: CallbackT<CallMethodResultOptions>
|
|
1132
|
+
) {
|
|
1123
1133
|
// arguments : IntegerId SubscriptionId
|
|
1124
1134
|
// arguments : IntegerId MonitoredItemId
|
|
1125
1135
|
assert(inputArguments.length === 2);
|
|
@@ -1142,7 +1152,11 @@ function _condition_refresh2_method(inputArguments: VariantLike[], context: ISes
|
|
|
1142
1152
|
});
|
|
1143
1153
|
}
|
|
1144
1154
|
|
|
1145
|
-
function _add_comment_method(
|
|
1155
|
+
function _add_comment_method(
|
|
1156
|
+
inputArguments: VariantLike[],
|
|
1157
|
+
context: ISessionContext,
|
|
1158
|
+
callback: CallbackT<CallMethodResultOptions>
|
|
1159
|
+
) {
|
|
1146
1160
|
//
|
|
1147
1161
|
// The AddComment Method is used to apply a comment to a specific state of a Condition
|
|
1148
1162
|
// instance. Normally, the NodeId of the object instance as the ObjectId is passed to the Call
|
|
@@ -79,7 +79,7 @@ export class UAOffNormalAlarmImpl extends UADiscreteAlarmImpl implements UAOffNo
|
|
|
79
79
|
const normalState = addressSpace._coerceNode(options.normalState)! as UAVariable;
|
|
80
80
|
// assert(normalState, "Expecting a valid normalState node");
|
|
81
81
|
|
|
82
|
-
const normalStateNodeId = normalState ? normalState.nodeId : NodeId
|
|
82
|
+
const normalStateNodeId = normalState ? normalState.nodeId : new NodeId();
|
|
83
83
|
alarmNode.normalState.setValueFromSource({ dataType: DataType.NodeId, value: normalStateNodeId });
|
|
84
84
|
|
|
85
85
|
if (inputNode) {
|
package/src/base_node_private.ts
CHANGED
|
@@ -343,6 +343,10 @@ function AccessLevelFlags_toString(this: UAVariable, options: ToStringOption) {
|
|
|
343
343
|
);
|
|
344
344
|
}
|
|
345
345
|
}
|
|
346
|
+
|
|
347
|
+
interface WithDataValue {
|
|
348
|
+
$dataValue?: DataValue;
|
|
349
|
+
}
|
|
346
350
|
export function VariableOrVariableType_toString(this: UAVariableType | UAVariable, options: ToStringOption): void {
|
|
347
351
|
assert(options);
|
|
348
352
|
if (this.dataType) {
|
|
@@ -352,7 +356,7 @@ export function VariableOrVariableType_toString(this: UAVariableType | UAVariabl
|
|
|
352
356
|
options.add(options.padding + chalk.yellow(" dataType : ") + this.dataType + " " + n);
|
|
353
357
|
}
|
|
354
358
|
if (this.nodeClass === NodeClass.Variable) {
|
|
355
|
-
const _dataValue = (<
|
|
359
|
+
const _dataValue = (<WithDataValue>this).$dataValue as DataValue | undefined;
|
|
356
360
|
if (_dataValue) {
|
|
357
361
|
options.add(
|
|
358
362
|
options.padding +
|
|
@@ -622,7 +626,7 @@ function _makeReferenceDescription(addressSpace: IAddressSpace, reference: UARef
|
|
|
622
626
|
};
|
|
623
627
|
}
|
|
624
628
|
if (data.typeDefinition === null) {
|
|
625
|
-
data.typeDefinition = NodeId
|
|
629
|
+
data.typeDefinition = new NodeId();
|
|
626
630
|
}
|
|
627
631
|
const referenceDescription = new ReferenceDescription(data);
|
|
628
632
|
return referenceDescription;
|
package/src/event_data.ts
CHANGED
package/src/namespace_impl.ts
CHANGED
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
RolePermissionTypeOptions
|
|
29
29
|
} from "node-opcua-types";
|
|
30
30
|
import * as utils from "node-opcua-utils";
|
|
31
|
-
import { DataType, Variant, VariantArrayType } from "node-opcua-variant";
|
|
31
|
+
import { DataType, Variant, VariantArrayType, verifyRankAndDimensions } from "node-opcua-variant";
|
|
32
32
|
import {
|
|
33
33
|
AddBaseNodeOptions,
|
|
34
34
|
AddEnumerationTypeOptions,
|
|
@@ -100,7 +100,7 @@ import { _install_TwoStateVariable_machinery, _addTwoStateVariable } from "./sta
|
|
|
100
100
|
//
|
|
101
101
|
import { NamespacePrivate, UANamespace_process_modelling_rule } from "./namespace_private";
|
|
102
102
|
import { BaseNodeImpl } from "./base_node_impl";
|
|
103
|
-
import { UAVariableImpl
|
|
103
|
+
import { UAVariableImpl } from "./ua_variable_impl";
|
|
104
104
|
|
|
105
105
|
import { ConstructNodeIdOptions, NodeIdManager } from "./nodeid_manager";
|
|
106
106
|
import { _addTwoStateDiscrete } from "./data_access/ua_two_state_discrete";
|
|
@@ -194,7 +194,7 @@ function detachNode(node: BaseNode) {
|
|
|
194
194
|
* @params options.publicationDate="" {Date}
|
|
195
195
|
*
|
|
196
196
|
*/
|
|
197
|
-
export class
|
|
197
|
+
export class NamespaceImpl implements NamespacePrivate {
|
|
198
198
|
public static _handle_hierarchy_parent = _handle_hierarchy_parent;
|
|
199
199
|
public static isNonEmptyQualifiedName = isNonEmptyQualifiedName;
|
|
200
200
|
|
|
@@ -237,8 +237,8 @@ export class UANamespace implements NamespacePrivate {
|
|
|
237
237
|
this._nodeIdManager = new NodeIdManager(this.index, this.addressSpace);
|
|
238
238
|
}
|
|
239
239
|
|
|
240
|
-
public getDefaultNamespace():
|
|
241
|
-
return this.index === 0 ? this :
|
|
240
|
+
public getDefaultNamespace(): NamespacePrivate {
|
|
241
|
+
return this.index === 0 ? this : this.addressSpace.getDefaultNamespace();
|
|
242
242
|
}
|
|
243
243
|
|
|
244
244
|
public dispose(): void {
|
|
@@ -656,7 +656,7 @@ export class UANamespace implements NamespacePrivate {
|
|
|
656
656
|
*/
|
|
657
657
|
public deleteNode(nodeOrNodeId: NodeId | BaseNode): void {
|
|
658
658
|
let node: BaseNode | null = null;
|
|
659
|
-
let nodeId: NodeId = NodeId
|
|
659
|
+
let nodeId: NodeId = new NodeId();
|
|
660
660
|
if (nodeOrNodeId instanceof NodeId) {
|
|
661
661
|
nodeId = nodeOrNodeId;
|
|
662
662
|
node = this.findNode(nodeId);
|
|
@@ -1337,7 +1337,7 @@ export class UANamespace implements NamespacePrivate {
|
|
|
1337
1337
|
// or OptionSet DataType. It is derived from the DataType EnumValueType. If used for an
|
|
1338
1338
|
// OptionSet, the corresponding Value in the base type contains the number of the bit associated
|
|
1339
1339
|
// with the field. The EnumField is formally defined in Table 37.
|
|
1340
|
-
(enumType as any).$
|
|
1340
|
+
(enumType as any).$fullDefinition = new EnumDefinition({
|
|
1341
1341
|
fields: enumeration.map(
|
|
1342
1342
|
(x: string, index: number) =>
|
|
1343
1343
|
new EnumField({
|
|
@@ -1376,7 +1376,7 @@ export class UANamespace implements NamespacePrivate {
|
|
|
1376
1376
|
});
|
|
1377
1377
|
assert(enumValues.browseName.toString() === "EnumValues");
|
|
1378
1378
|
|
|
1379
|
-
(enumType as any).$
|
|
1379
|
+
(enumType as any).$fullDefinition = new EnumDefinition({
|
|
1380
1380
|
fields: enumeration.map(
|
|
1381
1381
|
(x: EnumerationItem, index: number) =>
|
|
1382
1382
|
new EnumField({
|
|
@@ -1814,7 +1814,7 @@ export class UANamespace implements NamespacePrivate {
|
|
|
1814
1814
|
}
|
|
1815
1815
|
const references: UAReference[] = [];
|
|
1816
1816
|
|
|
1817
|
-
function process_subtypeOf_options(this:
|
|
1817
|
+
function process_subtypeOf_options(this: NamespaceImpl, options2: any, references1: AddReferenceOpts[]) {
|
|
1818
1818
|
// check common misspelling mistake
|
|
1819
1819
|
assert(!options2.subTypeOf, "misspell error : it should be 'subtypeOf' instead");
|
|
1820
1820
|
if (Object.prototype.hasOwnProperty.call(options2, "hasTypeDefinition")) {
|
|
@@ -51,7 +51,7 @@ import { UAReferenceTypeImpl } from "../ua_reference_type_impl";
|
|
|
51
51
|
import { UAObjectTypeImpl } from "../ua_object_type_impl";
|
|
52
52
|
import { UAVariableImpl } from "../ua_variable_impl";
|
|
53
53
|
import { UAObjectImpl } from "../ua_object_impl";
|
|
54
|
-
import {
|
|
54
|
+
import { NamespaceImpl } from "../namespace_impl";
|
|
55
55
|
import { UAMethodImpl } from "../ua_method_impl";
|
|
56
56
|
import { UADataTypeImpl } from "../ua_data_type_impl";
|
|
57
57
|
import { UAVariableTypeImpl } from "../ua_variable_type_impl";
|
|
@@ -592,7 +592,7 @@ function _dumpValue(xw: XmlWriter, node: UAVariable | UAVariableType, value: Var
|
|
|
592
592
|
|
|
593
593
|
function _dumpArrayDimensionsAttribute(xw: XmlWriter, node: UAVariableType | UAVariable) {
|
|
594
594
|
if (node.arrayDimensions) {
|
|
595
|
-
if (node.arrayDimensions.length === 1 && node.arrayDimensions[0] === 0) {
|
|
595
|
+
if (node.valueRank === -1 || (node.arrayDimensions.length === 1 && node.arrayDimensions[0] === 0)) {
|
|
596
596
|
return;
|
|
597
597
|
}
|
|
598
598
|
xw.writeAttribute("ArrayDimensions", node.arrayDimensions.join(","));
|
|
@@ -749,7 +749,11 @@ function _dumpEnumDefinition(xw: XmlWriter, enumDefinition: EnumDefinition) {
|
|
|
749
749
|
xw.endElement();
|
|
750
750
|
}
|
|
751
751
|
}
|
|
752
|
-
function _dumpStructureDefinition(
|
|
752
|
+
function _dumpStructureDefinition(
|
|
753
|
+
xw: XmlWriter,
|
|
754
|
+
structureDefinition: StructureDefinition,
|
|
755
|
+
baseStructureDefinition: StructureDefinition | null | undefined
|
|
756
|
+
) {
|
|
753
757
|
/*
|
|
754
758
|
* note: baseDataType and defaultEncodingId are implicit and not stored in the XML file ??
|
|
755
759
|
*
|
|
@@ -757,8 +761,12 @@ function _dumpStructureDefinition(xw: XmlWriter, structureDefinition: StructureD
|
|
|
757
761
|
const baseDataType = structureDefinition.baseDataType;
|
|
758
762
|
const defaultEncodingId = structureDefinition.defaultEncodingId;
|
|
759
763
|
|
|
760
|
-
|
|
761
|
-
|
|
764
|
+
// do not repeat elements that are already defined in base structure in the xml ouput!
|
|
765
|
+
const fields = structureDefinition.fields || [];
|
|
766
|
+
const nbFieldsInBase: number = baseStructureDefinition ? baseStructureDefinition.fields?.length || 0 : 0;
|
|
767
|
+
|
|
768
|
+
for(let index = nbFieldsInBase; index <fields.length; index++ ) {
|
|
769
|
+
const defItem = fields[index];
|
|
762
770
|
xw.startElement("Field");
|
|
763
771
|
xw.writeAttribute("Name", defItem.name!);
|
|
764
772
|
|
|
@@ -788,27 +796,29 @@ function _dumpStructureDefinition(xw: XmlWriter, structureDefinition: StructureD
|
|
|
788
796
|
xw.endElement();
|
|
789
797
|
}
|
|
790
798
|
}
|
|
791
|
-
function _dumpUADataTypeDefinition(xw: XmlWriter,
|
|
799
|
+
function _dumpUADataTypeDefinition(xw: XmlWriter, uaDataType: UADataType) {
|
|
792
800
|
// to do remove DataType from base class
|
|
793
|
-
|
|
794
|
-
const definition =
|
|
801
|
+
const uaDataTypeBase = uaDataType.subtypeOfObj;
|
|
802
|
+
const definition = uaDataType.getDefinition();
|
|
795
803
|
if (!definition) {
|
|
796
804
|
return;
|
|
797
805
|
}
|
|
798
806
|
if (definition instanceof EnumDefinition) {
|
|
799
807
|
xw.startElement("Definition");
|
|
800
|
-
xw.writeAttribute("Name",
|
|
808
|
+
xw.writeAttribute("Name", uaDataType.browseName.name!);
|
|
801
809
|
_dumpEnumDefinition(xw, definition);
|
|
802
810
|
xw.endElement();
|
|
803
811
|
return;
|
|
804
812
|
}
|
|
805
813
|
if (definition instanceof StructureDefinition) {
|
|
814
|
+
const baseDefinition = uaDataTypeBase ? (uaDataTypeBase.getDefinition() as StructureDefinition | null) : null;
|
|
815
|
+
|
|
806
816
|
xw.startElement("Definition");
|
|
807
|
-
xw.writeAttribute("Name",
|
|
817
|
+
xw.writeAttribute("Name", uaDataType.browseName.name!);
|
|
808
818
|
if (definition.structureType === StructureType.Union) {
|
|
809
819
|
xw.writeAttribute("IsUnion", "true");
|
|
810
820
|
}
|
|
811
|
-
_dumpStructureDefinition(xw, definition);
|
|
821
|
+
_dumpStructureDefinition(xw, definition, baseDefinition);
|
|
812
822
|
xw.endElement();
|
|
813
823
|
return;
|
|
814
824
|
}
|
|
@@ -1199,7 +1209,7 @@ UADataTypeImpl.prototype.dumpXML = function (xw: XmlWriter) {
|
|
|
1199
1209
|
dumpUADataType(xw, this);
|
|
1200
1210
|
};
|
|
1201
1211
|
|
|
1202
|
-
|
|
1212
|
+
NamespaceImpl.prototype.toNodeset2XML = function (this: NamespaceImpl) {
|
|
1203
1213
|
const dependency = constructNamespaceDependency(this);
|
|
1204
1214
|
const translationTable = constructNamespaceTranslationTable(dependency);
|
|
1205
1215
|
|
|
@@ -44,6 +44,7 @@ function dumpDataTypeStructure(
|
|
|
44
44
|
addressSpace: IAddressSpace,
|
|
45
45
|
map: { [key: number]: string },
|
|
46
46
|
structureDefinition: StructureDefinition,
|
|
47
|
+
structureDefinitionBase: StructureDefinition | undefined| null,
|
|
47
48
|
name: string,
|
|
48
49
|
doc?: string
|
|
49
50
|
): void {
|
|
@@ -56,8 +57,14 @@ function dumpDataTypeStructure(
|
|
|
56
57
|
xw.text(doc);
|
|
57
58
|
xw.endElement();
|
|
58
59
|
}
|
|
60
|
+
|
|
61
|
+
const fields = structureDefinition.fields || [];
|
|
62
|
+
// get base class
|
|
63
|
+
const nbFieldsInBase = structureDefinitionBase? structureDefinitionBase.fields?.length || 0 : 0;
|
|
64
|
+
|
|
59
65
|
let optionalsCount = 0;
|
|
60
|
-
for (
|
|
66
|
+
for (let index = nbFieldsInBase; index < fields.length; index ++) {
|
|
67
|
+
const f= fields [index];
|
|
61
68
|
if (f.isOptional) {
|
|
62
69
|
xw.startElement("opc:Field");
|
|
63
70
|
xw.writeAttribute("Name", f.name + "Specified");
|
|
@@ -90,7 +97,9 @@ function dumpDataTypeStructure(
|
|
|
90
97
|
xw.endElement();
|
|
91
98
|
}
|
|
92
99
|
}
|
|
93
|
-
for (
|
|
100
|
+
for (let index = nbFieldsInBase; index < fields.length; index ++) {
|
|
101
|
+
const f= fields [index];
|
|
102
|
+
|
|
94
103
|
const isArray = f.valueRank > 0 && f.arrayDimensions?.length;
|
|
95
104
|
|
|
96
105
|
if (isArray) {
|
|
@@ -124,12 +133,13 @@ function dumpDataTypeToBSD(xw: XmlWriter, dataType: UADataType, map: { [key: num
|
|
|
124
133
|
|
|
125
134
|
const name: string = dataType.browseName.name!;
|
|
126
135
|
|
|
127
|
-
const
|
|
128
|
-
if (
|
|
129
|
-
|
|
136
|
+
const definition = dataType.getDefinition();
|
|
137
|
+
if (definition instanceof StructureDefinition) {
|
|
138
|
+
const structureDefinitionBase = dataType.subtypeOfObj?.getStructureDefinition();
|
|
139
|
+
dumpDataTypeStructure(xw, addressSpace, map, definition, structureDefinitionBase, name);
|
|
130
140
|
}
|
|
131
|
-
if (
|
|
132
|
-
dumpEnumeratedType(xw,
|
|
141
|
+
if (definition instanceof EnumDefinition) {
|
|
142
|
+
dumpEnumeratedType(xw, definition, name);
|
|
133
143
|
}
|
|
134
144
|
}
|
|
135
145
|
|
package/src/reference_impl.ts
CHANGED
|
@@ -53,9 +53,9 @@ function _w(str: string, width: number): string {
|
|
|
53
53
|
return (str + " ").substr(0, width);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
function _localCoerceToNodeID(nodeIdLike: string |
|
|
57
|
-
if ((nodeIdLike
|
|
58
|
-
return (nodeIdLike as
|
|
56
|
+
function _localCoerceToNodeID(nodeIdLike: string | NodeIdLike | { nodeId: NodeId }): NodeId {
|
|
57
|
+
if (Object.prototype.hasOwnProperty.call(nodeIdLike, "nodeId")) {
|
|
58
|
+
return (nodeIdLike as { nodeId: NodeId }).nodeId;
|
|
59
59
|
}
|
|
60
60
|
return coerceNodeId(nodeIdLike);
|
|
61
61
|
}
|
|
@@ -7,12 +7,14 @@
|
|
|
7
7
|
// --------------------------------------------------------------------------------------------------
|
|
8
8
|
|
|
9
9
|
import { assert } from "node-opcua-assert";
|
|
10
|
-
import { StatusCodes } from "node-opcua-status-code";
|
|
10
|
+
import { Callback, CallbackT, StatusCodes } from "node-opcua-status-code";
|
|
11
11
|
import { DataType, Variant, VariantLike } from "node-opcua-variant";
|
|
12
12
|
|
|
13
|
-
import { UAProperty,
|
|
13
|
+
import { UAProperty, ISessionContext, UAMethod, UAObject } from "node-opcua-address-space-base";
|
|
14
14
|
import { checkDebugFlag, make_debugLog } from "node-opcua-debug";
|
|
15
15
|
import { UAShelvedStateMachine_Base, UAState } from "node-opcua-nodeset-ua";
|
|
16
|
+
import { CallMethodResultOptions } from "node-opcua-service-call";
|
|
17
|
+
import { DataValue } from "node-opcua-data-value";
|
|
16
18
|
|
|
17
19
|
import { UAAlarmConditionImpl } from "../alarms_and_conditions/ua_alarm_condition_impl";
|
|
18
20
|
import { UATransitionEx } from "../../source/interfaces/state_machine/ua_transition_ex";
|
|
@@ -75,7 +77,7 @@ export class UAShelvedStateMachineEx extends UAStateMachineImpl implements UAShe
|
|
|
75
77
|
shelvingState.unshelveTime.minimumSamplingInterval = 500;
|
|
76
78
|
shelvingState.unshelveTime.bindVariable(
|
|
77
79
|
{
|
|
78
|
-
|
|
80
|
+
timestamped_get: _unShelveTimeFunc.bind(null, shelvingState)
|
|
79
81
|
},
|
|
80
82
|
true
|
|
81
83
|
);
|
|
@@ -93,7 +95,7 @@ export class UAShelvedStateMachineEx extends UAStateMachineImpl implements UAShe
|
|
|
93
95
|
// specifying ConditionId as the ObjectId. The Method cannot be called with an ObjectId of the
|
|
94
96
|
// ShelvedStateMachineType Node.
|
|
95
97
|
// output => BadConditionNotShelved
|
|
96
|
-
function _unshelve_method(inputArguments: VariantLike[], context: ISessionContext, callback:
|
|
98
|
+
function _unshelve_method(inputArguments: VariantLike[], context: ISessionContext, callback: CallbackT<CallMethodResultOptions>) {
|
|
97
99
|
assert(inputArguments.length === 0);
|
|
98
100
|
// var alarmNode = context.object.parent;
|
|
99
101
|
// if (!(alarmNode instanceof UAAlarmConditionImpl)) {
|
|
@@ -188,7 +190,11 @@ function _start_timer_for_automatic_unshelve(shelvingState: UAShelvedStateMachin
|
|
|
188
190
|
// a reset of the shelved timer.
|
|
189
191
|
// BadShelvingTimeOutOfRange
|
|
190
192
|
|
|
191
|
-
function _timedShelve_method(
|
|
193
|
+
function _timedShelve_method(
|
|
194
|
+
inputArguments: VariantLike[],
|
|
195
|
+
context: ISessionContext,
|
|
196
|
+
callback: CallbackT<CallMethodResultOptions>
|
|
197
|
+
) {
|
|
192
198
|
assert(inputArguments.length === 1);
|
|
193
199
|
if (!context.object) {
|
|
194
200
|
return;
|
|
@@ -250,7 +256,7 @@ function _oneShotShelve_method(
|
|
|
250
256
|
this: UAMethod,
|
|
251
257
|
inputArguments: Variant[],
|
|
252
258
|
context: ISessionContext,
|
|
253
|
-
callback:
|
|
259
|
+
callback: CallbackT<CallMethodResultOptions>
|
|
254
260
|
) {
|
|
255
261
|
assert(inputArguments.length === 0);
|
|
256
262
|
const shelvingState = context.object! as UAShelvedStateMachineEx;
|
|
@@ -290,24 +296,27 @@ function _oneShotShelve_method(
|
|
|
290
296
|
// TimedShelve Method call.
|
|
291
297
|
// * For the OneShotShelved state the UnshelveTime will be a constant set to the maximum Duration
|
|
292
298
|
// except if a MaxTimeShelved Property is provided.
|
|
293
|
-
function _unShelveTimeFunc(shelvingState: UAShelvedStateMachineEx) {
|
|
299
|
+
function _unShelveTimeFunc(shelvingState: UAShelvedStateMachineEx): DataValue {
|
|
294
300
|
if (shelvingState.getCurrentState() === "Unshelved") {
|
|
295
|
-
return new
|
|
296
|
-
|
|
297
|
-
value:
|
|
301
|
+
return new DataValue({
|
|
302
|
+
statusCode: StatusCodes.BadConditionNotShelved,
|
|
303
|
+
value: { dataType: DataType.Double, value: 0 }
|
|
298
304
|
});
|
|
299
305
|
}
|
|
300
306
|
|
|
301
307
|
if (!shelvingState._sheveldTime) {
|
|
302
|
-
return new
|
|
303
|
-
|
|
304
|
-
value:
|
|
308
|
+
return new DataValue({
|
|
309
|
+
statusCode: StatusCodes.BadConditionNotShelved,
|
|
310
|
+
value: { dataType: DataType.Double, value: 0 }
|
|
305
311
|
});
|
|
306
312
|
}
|
|
307
313
|
if (shelvingState.getCurrentState() === "OneShotShelved" && shelvingState._duration === UAAlarmConditionImpl.MaxDuration) {
|
|
308
|
-
return new
|
|
309
|
-
|
|
310
|
-
value:
|
|
314
|
+
return new DataValue({
|
|
315
|
+
statusCode: StatusCodes.Good,
|
|
316
|
+
value: {
|
|
317
|
+
dataType: DataType.Double,
|
|
318
|
+
value: UAAlarmConditionImpl.MaxDuration
|
|
319
|
+
}
|
|
311
320
|
});
|
|
312
321
|
}
|
|
313
322
|
const now = new Date();
|
|
@@ -316,8 +325,12 @@ function _unShelveTimeFunc(shelvingState: UAShelvedStateMachineEx) {
|
|
|
316
325
|
|
|
317
326
|
// timeToAutomaticUnshelvedState should always be greater than (or equal) zero
|
|
318
327
|
timeToAutomaticUnshelvedState = Math.max(timeToAutomaticUnshelvedState, 0);
|
|
319
|
-
return new
|
|
320
|
-
|
|
321
|
-
value:
|
|
328
|
+
return new DataValue({
|
|
329
|
+
statusCode: StatusCodes.Good,
|
|
330
|
+
value: {
|
|
331
|
+
dataType: DataType.Double, // duration
|
|
332
|
+
value: timeToAutomaticUnshelvedState
|
|
333
|
+
}
|
|
322
334
|
});
|
|
323
335
|
}
|
|
336
|
+
|