node-opcua-address-space 2.75.0 → 2.76.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.
- package/dist/source/interfaces/alarms_and_conditions/ua_certificate_expiration_alarm_ex.d.ts +4 -0
- package/dist/source/loader/namespace_post_step.d.ts +6 -2
- package/dist/source/loader/namespace_post_step.js +15 -1
- package/dist/source/loader/namespace_post_step.js.map +1 -1
- package/dist/source/loader/register_node_promoter.d.ts +2 -3
- package/dist/source/loader/register_node_promoter.js +2 -2
- package/dist/source/loader/register_node_promoter.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_alarm_condition_impl.js +4 -1
- 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.d.ts +12 -4
- package/dist/src/alarms_and_conditions/ua_certificate_expiration_alarm_impl.js +89 -24
- 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 +4 -0
- package/dist/src/alarms_and_conditions/ua_condition_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_exclusive_limit_alarm_impl.js +1 -1
- package/dist/src/alarms_and_conditions/ua_exclusive_limit_alarm_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_non_exclusive_limit_alarm_impl.d.ts +1 -1
- package/dist/src/alarms_and_conditions/ua_non_exclusive_limit_alarm_impl.js +3 -3
- package/dist/src/alarms_and_conditions/ua_non_exclusive_limit_alarm_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_off_normal_alarm_impl.d.ts +10 -10
- package/dist/src/alarms_and_conditions/ua_off_normal_alarm_impl.js.map +1 -1
- package/dist/src/state_machine/ua_two_state_variable.js.map +1 -1
- package/dist/src/ua_reference_type_impl.d.ts +1 -1
- package/distHelpers/add_event_generator_object.js +0 -1
- package/distHelpers/add_event_generator_object.js.map +1 -1
- package/generate.js +1 -1
- package/package.json +39 -39
- package/source/interfaces/alarms_and_conditions/ua_certificate_expiration_alarm_ex.ts +5 -0
- package/source/loader/namespace_post_step.ts +26 -3
- package/source/loader/register_node_promoter.ts +5 -4
- package/src/alarms_and_conditions/ua_alarm_condition_impl.ts +4 -1
- package/src/alarms_and_conditions/ua_certificate_expiration_alarm_impl.ts +106 -49
- package/src/alarms_and_conditions/ua_condition_impl.ts +4 -1
- package/src/alarms_and_conditions/ua_exclusive_limit_alarm_impl.ts +1 -1
- package/src/alarms_and_conditions/ua_non_exclusive_limit_alarm_impl.ts +3 -3
- package/src/alarms_and_conditions/ua_off_normal_alarm_impl.ts +12 -10
- package/src/alarms_and_conditions/ua_system_off_normal_alarm_impl.ts +1 -1
- package/src/state_machine/ua_two_state_variable.ts +1 -2
- package/test_helpers/add_event_generator_object.ts +0 -1
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* @module node-opcua-address-space.AlarmsAndConditions
|
|
3
3
|
*/
|
|
4
4
|
import { Certificate, exploreCertificate, makeSHA1Thumbprint } from "node-opcua-crypto";
|
|
5
|
-
import { DateTime, minOPCUADate } from "node-opcua-basic-types";
|
|
5
|
+
import { DateTime, minOPCUADate, StatusCodes } from "node-opcua-basic-types";
|
|
6
6
|
import { make_warningLog } from "node-opcua-debug";
|
|
7
7
|
import { NodeId } from "node-opcua-nodeid";
|
|
8
|
-
import { DataType, VariantOptions } from "node-opcua-variant";
|
|
8
|
+
import { DataType, Variant, VariantOptions } from "node-opcua-variant";
|
|
9
9
|
import { INamespace, UAObject, UAProperty } from "node-opcua-address-space-base";
|
|
10
10
|
import { ObjectTypeIds } from "node-opcua-constants";
|
|
11
11
|
import { makeAccessLevelExFlag } from "node-opcua-data-model";
|
|
@@ -16,97 +16,136 @@ import { UASystemOffNormalAlarmImpl } from "./ua_system_off_normal_alarm_impl";
|
|
|
16
16
|
|
|
17
17
|
const warningLog = make_warningLog("AlarmsAndConditions");
|
|
18
18
|
|
|
19
|
+
const ellipsis = (arg0: string, arg1 = 4) => {
|
|
20
|
+
arg1 = Math.max(arg1, 4);
|
|
21
|
+
return arg0.length <= arg1 ? arg0 : arg0.slice(0, arg1 / 2) + "..." + arg0.slice(arg0.length - arg1 / 2);
|
|
22
|
+
};
|
|
23
|
+
const d = (d: Date) => {
|
|
24
|
+
return d.toISOString();
|
|
25
|
+
};
|
|
19
26
|
export function instantiateCertificateExpirationAlarm(
|
|
20
27
|
namespace: INamespace,
|
|
21
28
|
alarmType: "CertificateExpirationAlarmType",
|
|
22
|
-
options: InstantiateOffNormalAlarmOptions
|
|
23
|
-
data?: Record<string, VariantOptions>
|
|
24
|
-
|
|
29
|
+
options: InstantiateOffNormalAlarmOptions
|
|
25
30
|
): UACertificateExpirationAlarmEx {
|
|
26
|
-
return UACertificateExpirationAlarmImpl.instantiate(namespace,alarmType, options
|
|
31
|
+
return UACertificateExpirationAlarmImpl.instantiate(namespace, alarmType, options);
|
|
27
32
|
}
|
|
28
33
|
|
|
29
|
-
|
|
30
34
|
interface UACertificateExpirationAlarmImpl {
|
|
31
|
-
expirationDate: UAProperty<Date, /*z*/DataType.DateTime>;
|
|
32
|
-
expirationLimit?: UAProperty<number, /*z*/DataType.Double>;
|
|
33
|
-
certificateType: UAProperty<NodeId, /*z*/DataType.NodeId>;
|
|
34
|
-
certificate: UAProperty<Buffer, /*z*/DataType.ByteString>;
|
|
35
|
+
expirationDate: UAProperty<Date, /*z*/ DataType.DateTime>;
|
|
36
|
+
expirationLimit?: UAProperty<number, /*z*/ DataType.Double>;
|
|
37
|
+
certificateType: UAProperty<NodeId, /*z*/ DataType.NodeId>;
|
|
38
|
+
certificate: UAProperty<Buffer, /*z*/ DataType.ByteString>;
|
|
35
39
|
}
|
|
40
|
+
|
|
41
|
+
// This Simple DataType is a Double that defines an interval of time in milliseconds (fractions can be used to define sub-millisecond values).
|
|
42
|
+
// Negative values are generally invalid but may have special meanings where the Duration is used.
|
|
43
|
+
export const OneDayDuration = 1000 * 60 * 60 * 24;
|
|
44
|
+
export const TwoWeeksDuration = OneDayDuration * 2 * 7;
|
|
45
|
+
|
|
36
46
|
/**
|
|
37
47
|
* This UACertificateExpirationAlarm (SystemOffNormalAlarmType) is raised by the Server when the Server’s
|
|
38
48
|
* Certificate is within the ExpirationLimit
|
|
39
49
|
* of expiration. This alarm automatically returns to normal when the certificate is updated.
|
|
40
50
|
*/
|
|
41
51
|
class UACertificateExpirationAlarmImpl extends UASystemOffNormalAlarmImpl implements UACertificateExpirationAlarmEx {
|
|
42
|
-
|
|
52
|
+
private timer: any;
|
|
43
53
|
|
|
44
54
|
public static instantiate(
|
|
45
55
|
namespace: INamespace,
|
|
46
56
|
alarmType: "CertificateExpirationAlarmType",
|
|
47
|
-
options: InstantiateOffNormalAlarmOptions
|
|
48
|
-
data?: Record<string, VariantOptions>
|
|
57
|
+
options: InstantiateOffNormalAlarmOptions
|
|
58
|
+
// data?: Record<string, VariantOptions>
|
|
49
59
|
): UACertificateExpirationAlarmImpl {
|
|
50
60
|
const alarm = UASystemOffNormalAlarmImpl.instantiate(
|
|
51
61
|
namespace,
|
|
52
62
|
alarmType || "CertificateExpirationAlarmType",
|
|
53
|
-
options
|
|
54
|
-
data
|
|
63
|
+
options
|
|
64
|
+
// data
|
|
55
65
|
) as UACertificateExpirationAlarmImpl;
|
|
56
|
-
|
|
57
|
-
alarm._post_initialize();
|
|
66
|
+
promoteToCertificateExpirationAlarm(alarm);
|
|
58
67
|
return alarm;
|
|
59
68
|
}
|
|
60
69
|
|
|
61
|
-
public getExpirationDate(): DateTime {
|
|
70
|
+
public getExpirationDate(): DateTime | null {
|
|
62
71
|
return this.expirationDate.readValue().value.value;
|
|
63
72
|
}
|
|
64
73
|
|
|
65
|
-
public
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
74
|
+
public updateAlarmState2(isActive: boolean, severity: number, message: string) {
|
|
75
|
+
//xx console.log(`${message} ${severity} ${d(new Date())}`);
|
|
76
|
+
isActive ? this.activateAlarm() : this.deactivateAlarm();
|
|
77
|
+
|
|
78
|
+
this.raiseNewCondition({
|
|
79
|
+
message,
|
|
80
|
+
quality: StatusCodes.Good,
|
|
81
|
+
retain: isActive ? true : false,
|
|
82
|
+
severity
|
|
69
83
|
});
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
public update() {
|
|
87
|
+
this._updateAlarm();
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
private _updateAlarm() {
|
|
91
|
+
const expirationDate = this.getExpirationDate();
|
|
92
|
+
|
|
70
93
|
const now = new Date();
|
|
94
|
+
|
|
71
95
|
const expirationLimit = this.getExpirationLimit();
|
|
72
96
|
|
|
73
97
|
const checkDate = new Date(now.getTime() + +expirationLimit);
|
|
74
98
|
|
|
75
|
-
const
|
|
99
|
+
const certificate = this.getCertificate();
|
|
76
100
|
|
|
77
|
-
if (expirationDate
|
|
78
|
-
if (!this.currentBranch().getActiveState()) {
|
|
79
|
-
|
|
80
|
-
`CertificateExpirationAlarm: becomes active, certificate ${thumbprint} endDate ${expirationDate.toUTCString()} checkDate=${checkDate.toUTCString()} expirationLimit=${expirationLimit}`
|
|
81
|
-
);
|
|
101
|
+
if (!expirationDate || (expirationDate === minOPCUADate && !certificate)) {
|
|
102
|
+
if (!this.currentBranch() || this.currentBranch().getActiveState()) {
|
|
103
|
+
this.updateAlarmState2(true, 255, "certificate is missing");
|
|
82
104
|
}
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const thumbprint = ellipsis(makeSHA1Thumbprint(this.getCertificate() || Buffer.alloc(0)).toString("hex"), 10);
|
|
109
|
+
const info = `| end date: ${d(expirationDate)} | expirationLimit=${expirationLimit}|`;
|
|
110
|
+
//
|
|
111
|
+
|
|
112
|
+
if (expirationDate.getTime() <= checkDate.getTime()) {
|
|
83
113
|
// also raise the event
|
|
84
114
|
if (expirationDate.getTime() <= now.getTime()) {
|
|
85
|
-
this.
|
|
86
|
-
true,
|
|
87
|
-
`certificate ${thumbprint} has expired : end date is ${expirationDate.toUTCString()} checkDate=${checkDate.toUTCString()} expirationLimit=${expirationLimit}`
|
|
88
|
-
);
|
|
115
|
+
this.updateAlarmState2(true, 250, `certificate ${thumbprint} has expired ${info}`);
|
|
89
116
|
} else {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
117
|
+
// check--------------------+
|
|
118
|
+
// expiry---------------+ |
|
|
119
|
+
// today-----+ | |
|
|
120
|
+
// v v v
|
|
121
|
+
// ----------------+----------+---------+----------+
|
|
122
|
+
const t1 = checkDate.getTime() - now.getTime();
|
|
123
|
+
const t2 = checkDate.getTime() - expirationDate.getTime();
|
|
124
|
+
const severity = t1 === 0 ? 255 : Math.floor((t2 / t1) * 100) + 100;
|
|
125
|
+
this.updateAlarmState2(true, severity, `certificate ${thumbprint} is about to expire ${info}`);
|
|
94
126
|
}
|
|
95
127
|
} else {
|
|
96
|
-
|
|
97
|
-
warningLog(
|
|
98
|
-
`CertificateExpirationAlarm: becomes desactivated, certificate ${thumbprint} endDate ${expirationDate.toUTCString()} expirationLimit=${expirationLimit}`
|
|
99
|
-
);
|
|
100
|
-
}
|
|
101
|
-
// also raise the event
|
|
102
|
-
this.updateAlarmState(
|
|
103
|
-
false,
|
|
104
|
-
`certificate ${thumbprint} end date is OK: ${expirationDate.toString()} , expirationLimit=${expirationLimit}`
|
|
105
|
-
);
|
|
128
|
+
this.updateAlarmState2(false, 0, `certificate ${thumbprint} is OK! ${info}`);
|
|
106
129
|
}
|
|
107
130
|
}
|
|
108
131
|
|
|
132
|
+
public setExpirationDate(expirationDate: Date): void {
|
|
133
|
+
this.expirationDate.setValueFromSource({
|
|
134
|
+
dataType: DataType.DateTime,
|
|
135
|
+
value: expirationDate
|
|
136
|
+
});
|
|
137
|
+
this._updateAlarm();
|
|
138
|
+
}
|
|
139
|
+
|
|
109
140
|
public getExpirationLimit(): number {
|
|
141
|
+
// This shall be a positive number. If the property is not provided, a default of 2 weeks shall be used.
|
|
142
|
+
if (!this.expirationLimit) {
|
|
143
|
+
return TwoWeeksDuration;
|
|
144
|
+
}
|
|
145
|
+
const dataValue = this.expirationLimit!.readValue();
|
|
146
|
+
if ((dataValue as any).dataType === DataType.Null) {
|
|
147
|
+
return TwoWeeksDuration;
|
|
148
|
+
}
|
|
110
149
|
return (this.expirationLimit?.readValue().value.value as number) || 0;
|
|
111
150
|
}
|
|
112
151
|
|
|
@@ -115,13 +154,14 @@ class UACertificateExpirationAlarmImpl extends UASystemOffNormalAlarmImpl implem
|
|
|
115
154
|
dataType: DataType.Double,
|
|
116
155
|
value
|
|
117
156
|
});
|
|
157
|
+
this._updateAlarm();
|
|
118
158
|
}
|
|
119
159
|
|
|
120
160
|
public getCertificate(): Certificate | null {
|
|
121
161
|
return (this.certificate.readValue().value.value as Certificate | null) || null;
|
|
122
162
|
}
|
|
123
163
|
|
|
124
|
-
|
|
164
|
+
private _extractAndSetExpiryDate(certificate: Certificate | null): void {
|
|
125
165
|
if (certificate && certificate.length > 0) {
|
|
126
166
|
const info = exploreCertificate(certificate);
|
|
127
167
|
if (info.tbsCertificate.validity.notAfter instanceof Date) {
|
|
@@ -132,12 +172,22 @@ class UACertificateExpirationAlarmImpl extends UASystemOffNormalAlarmImpl implem
|
|
|
132
172
|
} else {
|
|
133
173
|
this.setExpirationDate(minOPCUADate);
|
|
134
174
|
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
public setCertificate(certificate: Certificate | null): void {
|
|
135
178
|
this.certificate.setValueFromSource({
|
|
136
179
|
dataType: DataType.ByteString,
|
|
137
180
|
value: certificate
|
|
138
181
|
});
|
|
182
|
+
this._extractAndSetExpiryDate(certificate);
|
|
139
183
|
}
|
|
140
184
|
|
|
185
|
+
stopTimer() {
|
|
186
|
+
if (this.timer) {
|
|
187
|
+
clearInterval(this.timer);
|
|
188
|
+
this.timer = null;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
141
191
|
_post_initialize() {
|
|
142
192
|
if (this.expirationLimit) {
|
|
143
193
|
this.expirationLimit.accessLevel = makeAccessLevelExFlag("CurrentRead | CurrentWrite");
|
|
@@ -148,6 +198,13 @@ class UACertificateExpirationAlarmImpl extends UASystemOffNormalAlarmImpl implem
|
|
|
148
198
|
this.setCertificate(certificate);
|
|
149
199
|
});
|
|
150
200
|
}
|
|
201
|
+
const certificate = this.getCertificate();
|
|
202
|
+
this._extractAndSetExpiryDate(certificate);
|
|
203
|
+
|
|
204
|
+
this.addressSpace.registerShutdownTask(() => {
|
|
205
|
+
this.stopTimer();
|
|
206
|
+
});
|
|
207
|
+
this.timer = setInterval(() => this.update(), OneDayDuration / 48);
|
|
151
208
|
}
|
|
152
209
|
}
|
|
153
210
|
|
|
@@ -160,4 +217,4 @@ export function promoteToCertificateExpirationAlarm(node: UAObject): UACertifica
|
|
|
160
217
|
_node._post_initialize();
|
|
161
218
|
return _node;
|
|
162
219
|
}
|
|
163
|
-
registerNodePromoter(ObjectTypeIds.CertificateExpirationAlarmType, promoteToCertificateExpirationAlarm);
|
|
220
|
+
registerNodePromoter(ObjectTypeIds.CertificateExpirationAlarmType, promoteToCertificateExpirationAlarm, true);
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
QualifiedName
|
|
19
19
|
} from "node-opcua-data-model";
|
|
20
20
|
import { DataValue } from "node-opcua-data-value";
|
|
21
|
-
import { checkDebugFlag, make_debugLog, make_errorLog } from "node-opcua-debug";
|
|
21
|
+
import { checkDebugFlag, make_debugLog, make_errorLog, make_warningLog } from "node-opcua-debug";
|
|
22
22
|
import { minDate } from "node-opcua-basic-types";
|
|
23
23
|
import { coerceNodeId, makeNodeId, NodeId, resolveNodeId, sameNodeId } from "node-opcua-nodeid";
|
|
24
24
|
import { CallbackT, StatusCode, StatusCodes } from "node-opcua-status-code";
|
|
@@ -52,6 +52,7 @@ import { ConditionSnapshotImpl } from "./condition_snapshot_impl";
|
|
|
52
52
|
const debugLog = make_debugLog(__filename);
|
|
53
53
|
const errorLog = make_errorLog(__filename);
|
|
54
54
|
const doDebug = checkDebugFlag(__filename);
|
|
55
|
+
const warningLog = make_warningLog(__filename);
|
|
55
56
|
|
|
56
57
|
export declare interface UAConditionImpl extends UAConditionEx, UABaseEventImpl {
|
|
57
58
|
on(eventName: string, eventHandler: any): this;
|
|
@@ -450,6 +451,8 @@ export class UAConditionImpl extends UABaseEventImpl implements UAConditionEx {
|
|
|
450
451
|
node._bubble_up_event(eventData);
|
|
451
452
|
}
|
|
452
453
|
}
|
|
454
|
+
} else {
|
|
455
|
+
warningLog("Condition ", this.nodeId.toString(), "is not linked to a Object with a IsConditionOf(reversed(HasCondition))");
|
|
453
456
|
}
|
|
454
457
|
// xx console.log("MMMMMMMM%%%%%%%%%%%%%%%%%%%%% branch " +
|
|
455
458
|
// branch.getBranchId().toString() + " eventId = " + branch.getEventId().toString("hex"));
|
|
@@ -104,7 +104,7 @@ export class UAExclusiveLimitAlarmImpl extends UALimitAlarmImpl implements UAExc
|
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
if (state !== oldState) {
|
|
107
|
-
this._signalNewCondition(state, isActive, value.
|
|
107
|
+
this._signalNewCondition(state, isActive, value.toFixed(3));
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
}
|
|
@@ -106,7 +106,7 @@ export class UANonExclusiveLimitAlarmImpl extends UALimitAlarmImpl implements UA
|
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
public _calculateConditionInfo(
|
|
109
|
-
|
|
109
|
+
state: string | null,
|
|
110
110
|
isActive: boolean,
|
|
111
111
|
value: string,
|
|
112
112
|
oldConditionInfo: ConditionInfo
|
|
@@ -120,7 +120,7 @@ export class UANonExclusiveLimitAlarmImpl extends UALimitAlarmImpl implements UA
|
|
|
120
120
|
});
|
|
121
121
|
} else {
|
|
122
122
|
return new ConditionInfoImpl({
|
|
123
|
-
message: "Condition
|
|
123
|
+
message: "Condition is " + value + " and state is " + state,
|
|
124
124
|
quality: StatusCodes.Good,
|
|
125
125
|
retain: true,
|
|
126
126
|
severity: 150
|
|
@@ -196,7 +196,7 @@ export class UANonExclusiveLimitAlarmImpl extends UALimitAlarmImpl implements UA
|
|
|
196
196
|
});
|
|
197
197
|
|
|
198
198
|
if (count > 0) {
|
|
199
|
-
this._signalNewCondition2(states, isActive, value.
|
|
199
|
+
this._signalNewCondition2(states, isActive, value.toFixed(3));
|
|
200
200
|
}
|
|
201
201
|
}
|
|
202
202
|
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module node-opcua-address-space.AlarmsAndConditions
|
|
3
3
|
*/
|
|
4
|
-
import { INamespace, UAVariable } from "node-opcua-address-space-base";
|
|
4
|
+
import { INamespace, UAVariable, UAVariableT } from "node-opcua-address-space-base";
|
|
5
5
|
import { assert } from "node-opcua-assert";
|
|
6
6
|
import { DataValue } from "node-opcua-data-value";
|
|
7
7
|
import { NodeId, NodeIdLike } from "node-opcua-nodeid";
|
|
8
|
+
|
|
8
9
|
import { UAOffNormalAlarm_Base } from "node-opcua-nodeset-ua";
|
|
10
|
+
import { NumericalRangeInvalid } from "node-opcua-numeric-range";
|
|
9
11
|
import { StatusCodes } from "node-opcua-status-code";
|
|
10
12
|
import * as utils from "node-opcua-utils";
|
|
11
13
|
import { DataType, VariantOptions } from "node-opcua-variant";
|
|
@@ -32,11 +34,11 @@ export declare interface UAOffNormalAlarmEx
|
|
|
32
34
|
| "suppressedState"
|
|
33
35
|
>,
|
|
34
36
|
UADiscreteAlarmEx {
|
|
35
|
-
getNormalStateNode():
|
|
37
|
+
getNormalStateNode(): UAVariableT<NodeId, DataType.NodeId> | null;
|
|
36
38
|
|
|
37
|
-
getNormalStateValue():
|
|
39
|
+
getNormalStateValue(): NodeId | null;
|
|
38
40
|
|
|
39
|
-
setNormalStateValue(value:
|
|
41
|
+
setNormalStateValue(value: NodeIdLike): void;
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
export declare interface UAOffNormalAlarmImpl extends UAOffNormalAlarmEx, UADiscreteAlarmImpl {
|
|
@@ -53,7 +55,7 @@ export class UAOffNormalAlarmImpl extends UADiscreteAlarmImpl implements UAOffNo
|
|
|
53
55
|
* When the value of inputNode doesn't match the normalState node value, then the alarm is raised.
|
|
54
56
|
*
|
|
55
57
|
*/
|
|
56
|
-
public static instantiate(
|
|
58
|
+
public static instantiate<T, DT extends DataType>(
|
|
57
59
|
namespace: INamespace,
|
|
58
60
|
limitAlarmTypeId: string | NodeId,
|
|
59
61
|
options: InstantiateOffNormalAlarmOptions,
|
|
@@ -136,9 +138,9 @@ export class UAOffNormalAlarmImpl extends UADiscreteAlarmImpl implements UAOffNo
|
|
|
136
138
|
// Property the Alarm is Active. If this Variable is not in the AddressSpace, a Null NodeId shall
|
|
137
139
|
// be provided.
|
|
138
140
|
|
|
139
|
-
public getNormalStateNode():
|
|
141
|
+
public getNormalStateNode(): UAVariableT<NodeId, DataType.NodeId> | null {
|
|
140
142
|
const nodeId = this.normalState.readValue().value.value;
|
|
141
|
-
const node = this.addressSpace.findNode(nodeId) as
|
|
143
|
+
const node = this.addressSpace.findNode(nodeId) as UAVariableT<NodeId, DataType.NodeId>;
|
|
142
144
|
if (!node) {
|
|
143
145
|
return null;
|
|
144
146
|
}
|
|
@@ -148,19 +150,19 @@ export class UAOffNormalAlarmImpl extends UADiscreteAlarmImpl implements UAOffNo
|
|
|
148
150
|
/**
|
|
149
151
|
* @method getNormalStateValue
|
|
150
152
|
*/
|
|
151
|
-
public getNormalStateValue():
|
|
153
|
+
public getNormalStateValue(): NodeId | null {
|
|
152
154
|
const normalStateNode = this.getNormalStateNode();
|
|
153
155
|
if (!normalStateNode) {
|
|
154
156
|
return null;
|
|
155
157
|
}
|
|
156
|
-
return normalStateNode.readValue().value.value;
|
|
158
|
+
return normalStateNode.readValue().value.value as NodeId;
|
|
157
159
|
}
|
|
158
160
|
|
|
159
161
|
/**
|
|
160
162
|
* @method setNormalStateValue
|
|
161
163
|
* @param value
|
|
162
164
|
*/
|
|
163
|
-
public setNormalStateValue(value:
|
|
165
|
+
public setNormalStateValue(value: NodeIdLike): void {
|
|
164
166
|
const normalStateNode = this.getNormalStateNode();
|
|
165
167
|
throw new Error("Not Implemented yet");
|
|
166
168
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { INamespace } from "node-opcua-address-space-base";
|
|
5
5
|
import { NodeId } from "node-opcua-nodeid";
|
|
6
|
-
import { VariantOptions } from "node-opcua-variant";
|
|
6
|
+
import { DataType, VariantOptions } from "node-opcua-variant";
|
|
7
7
|
import { InstantiateOffNormalAlarmOptions } from "../../source/interfaces/alarms_and_conditions/instantiate_off_normal_alarm_options";
|
|
8
8
|
import { UAOffNormalAlarmImpl } from "./ua_off_normal_alarm_impl";
|
|
9
9
|
|
|
@@ -5,14 +5,13 @@ import { assert } from "node-opcua-assert";
|
|
|
5
5
|
|
|
6
6
|
import { VariableTypeIds } from "node-opcua-constants";
|
|
7
7
|
import { BrowseDirection, coerceLocalizedText, LocalizedText, LocalizedTextLike } from "node-opcua-data-model";
|
|
8
|
-
import { DataValueT
|
|
8
|
+
import { DataValueT } from "node-opcua-data-value";
|
|
9
9
|
import { NodeId, resolveNodeId } from "node-opcua-nodeid";
|
|
10
10
|
import { sameNodeId } from "node-opcua-nodeid";
|
|
11
11
|
import { StatusCodes, StatusCode, StatusCodeCallback } from "node-opcua-status-code";
|
|
12
12
|
import { Variant, VariantLike, VariantT } from "node-opcua-variant";
|
|
13
13
|
import { DataType } from "node-opcua-variant";
|
|
14
14
|
import { BaseNode, BindVariableOptions, INamespace, UAReference, UAVariable, ISessionContext } from "node-opcua-address-space-base";
|
|
15
|
-
import { UATwoStateVariable } from "node-opcua-nodeset-ua";
|
|
16
15
|
import { NumericRange } from "node-opcua-numeric-range";
|
|
17
16
|
import { QualifiedNameLike } from "node-opcua-data-model";
|
|
18
17
|
|