node-opcua-address-space 2.131.0 → 2.133.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/helpers/argument_list.d.ts +1 -6
- package/dist/source/helpers/argument_list.js +1 -6
- package/dist/source/helpers/argument_list.js.map +1 -1
- package/dist/source/helpers/dump_tools.d.ts +0 -4
- package/dist/source/helpers/dump_tools.js +0 -4
- package/dist/source/helpers/dump_tools.js.map +1 -1
- package/dist/source/interfaces/alarms_and_conditions/condition_snapshot.d.ts +4 -53
- package/dist/source/interfaces/state_machine/ua_shelved_state_machine_ex.d.ts +1 -1
- package/dist/source/loader/generateAddressSpaceRaw.js +1 -1
- package/dist/source/loader/generateAddressSpaceRaw.js.map +1 -1
- package/dist/source/loader/load_nodeset2.js +0 -3
- package/dist/source/loader/load_nodeset2.js.map +1 -1
- package/dist/source/session_context.d.ts +0 -4
- package/dist/source/session_context.js +0 -4
- package/dist/source/session_context.js.map +1 -1
- package/dist/src/address_space.d.ts +0 -27
- package/dist/src/address_space.js +0 -29
- package/dist/src/address_space.js.map +1 -1
- package/dist/src/alarms_and_conditions/condition.js +14 -13
- package/dist/src/alarms_and_conditions/condition.js.map +1 -1
- package/dist/src/alarms_and_conditions/condition_info_impl.d.ts +2 -10
- package/dist/src/alarms_and_conditions/condition_info_impl.js +2 -10
- package/dist/src/alarms_and_conditions/condition_info_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/condition_snapshot_impl.d.ts +132 -77
- package/dist/src/alarms_and_conditions/condition_snapshot_impl.js +121 -128
- package/dist/src/alarms_and_conditions/condition_snapshot_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_acknowledgeable_condition_impl.d.ts +1 -10
- package/dist/src/alarms_and_conditions/ua_acknowledgeable_condition_impl.js +1 -10
- package/dist/src/alarms_and_conditions/ua_acknowledgeable_condition_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_alarm_condition_impl.d.ts +3 -15
- package/dist/src/alarms_and_conditions/ua_alarm_condition_impl.js +3 -15
- package/dist/src/alarms_and_conditions/ua_alarm_condition_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_base_event_impl.d.ts +1 -7
- package/dist/src/alarms_and_conditions/ua_base_event_impl.js +1 -7
- package/dist/src/alarms_and_conditions/ua_base_event_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_certificate_expiration_alarm_impl.js +4 -4
- package/dist/src/alarms_and_conditions/ua_certificate_expiration_alarm_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_condition_impl.d.ts +0 -28
- package/dist/src/alarms_and_conditions/ua_condition_impl.js +2 -33
- package/dist/src/alarms_and_conditions/ua_condition_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_exclusive_limit_alarm_impl.d.ts +0 -1
- package/dist/src/alarms_and_conditions/ua_exclusive_limit_alarm_impl.js +0 -1
- package/dist/src/alarms_and_conditions/ua_exclusive_limit_alarm_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_limit_alarm_impl.d.ts +0 -28
- package/dist/src/alarms_and_conditions/ua_limit_alarm_impl.js +0 -28
- package/dist/src/alarms_and_conditions/ua_limit_alarm_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_off_normal_alarm_impl.d.ts +0 -3
- package/dist/src/alarms_and_conditions/ua_off_normal_alarm_impl.js +0 -3
- package/dist/src/alarms_and_conditions/ua_off_normal_alarm_impl.js.map +1 -1
- package/dist/src/base_node_impl.d.ts +2 -6
- package/dist/src/base_node_impl.js +3 -7
- package/dist/src/base_node_impl.js.map +1 -1
- package/dist/src/base_node_private.d.ts +1 -1
- package/dist/src/base_node_private.js +1 -1
- package/dist/src/event_data.d.ts +0 -3
- package/dist/src/event_data.js +0 -3
- package/dist/src/event_data.js.map +1 -1
- package/dist/src/extension_object_array_node.d.ts +1 -1
- package/dist/src/extension_object_array_node.js +1 -1
- package/dist/src/historical_access/address_space_historical_data_node.d.ts +0 -5
- package/dist/src/historical_access/address_space_historical_data_node.js +0 -5
- package/dist/src/historical_access/address_space_historical_data_node.js.map +1 -1
- package/dist/src/namespace_impl.d.ts +21 -28
- package/dist/src/namespace_impl.js +22 -29
- package/dist/src/namespace_impl.js.map +1 -1
- package/dist/src/nodeset_tools/nodeset_to_xml.js +1 -1
- package/dist/src/nodeset_tools/nodeset_to_xml.js.map +1 -1
- package/dist/src/reference_impl.d.ts +1 -1
- package/dist/src/reference_impl.js +1 -1
- package/dist/src/state_machine/finite_state_machine.d.ts +0 -5
- package/dist/src/state_machine/finite_state_machine.js +0 -8
- package/dist/src/state_machine/finite_state_machine.js.map +1 -1
- package/dist/src/state_machine/ua_shelving_state_machine_ex.d.ts +1 -1
- package/dist/src/state_machine/ua_shelving_state_machine_ex.js +7 -7
- package/dist/src/state_machine/ua_shelving_state_machine_ex.js.map +1 -1
- package/dist/src/state_machine/ua_two_state_variable.d.ts +0 -8
- package/dist/src/state_machine/ua_two_state_variable.js +0 -8
- package/dist/src/state_machine/ua_two_state_variable.js.map +1 -1
- package/dist/src/ua_object_type_impl.d.ts +1 -1
- package/dist/src/ua_object_type_impl.js +1 -1
- package/dist/src/ua_variable_impl.d.ts +4 -4
- package/dist/src/ua_variable_impl.js +3 -3
- package/dist/src/ua_variable_impl_ext_obj.js +0 -2
- package/dist/src/ua_variable_impl_ext_obj.js.map +1 -1
- package/dist/src/ua_variable_type_impl.js +1 -1
- package/dist/tsconfig_common.tsbuildinfo +1 -1
- package/distHelpers/assertHasMatchingReference.d.ts +1 -1
- package/distHelpers/assertHasMatchingReference.js +1 -1
- package/package.json +36 -36
- package/source/helpers/argument_list.ts +1 -6
- package/source/helpers/dump_tools.ts +0 -4
- package/source/interfaces/alarms_and_conditions/condition_snapshot.ts +4 -53
- package/source/interfaces/state_machine/ua_shelved_state_machine_ex.ts +1 -1
- package/source/loader/generateAddressSpaceRaw.ts +2 -2
- package/source/loader/load_nodeset2.ts +0 -3
- package/source/session_context.ts +0 -4
- package/src/address_space.ts +0 -29
- package/src/alarms_and_conditions/condition.ts +15 -14
- package/src/alarms_and_conditions/condition_info_impl.ts +2 -10
- package/src/alarms_and_conditions/condition_snapshot_impl.ts +122 -126
- package/src/alarms_and_conditions/ua_acknowledgeable_condition_impl.ts +1 -10
- package/src/alarms_and_conditions/ua_alarm_condition_impl.ts +3 -15
- package/src/alarms_and_conditions/ua_base_event_impl.ts +1 -7
- package/src/alarms_and_conditions/ua_certificate_expiration_alarm_impl.ts +5 -5
- package/src/alarms_and_conditions/ua_condition_impl.ts +3 -34
- package/src/alarms_and_conditions/ua_exclusive_limit_alarm_impl.ts +0 -1
- package/src/alarms_and_conditions/ua_limit_alarm_impl.ts +0 -28
- package/src/alarms_and_conditions/ua_off_normal_alarm_impl.ts +0 -3
- package/src/base_node_impl.ts +3 -7
- package/src/base_node_private.ts +1 -1
- package/src/event_data.ts +2 -3
- package/src/extension_object_array_node.ts +1 -1
- package/src/historical_access/address_space_historical_data_node.ts +0 -5
- package/src/namespace_impl.ts +22 -29
- package/src/nodeset_tools/nodeset_to_xml.ts +5 -6
- package/src/reference_impl.ts +1 -1
- package/src/state_machine/finite_state_machine.ts +0 -8
- package/src/state_machine/ua_shelving_state_machine_ex.ts +8 -8
- package/src/state_machine/ua_two_state_variable.ts +0 -8
- package/src/ua_object_type_impl.ts +1 -1
- package/src/ua_variable_impl.ts +4 -4
- package/src/ua_variable_impl_ext_obj.ts +0 -2
- package/src/ua_variable_type_impl.ts +1 -1
|
@@ -158,11 +158,6 @@ export class ConditionSnapshotImpl extends EventEmitter implements ConditionSnap
|
|
|
158
158
|
private _node_index: Record<FullBrowsePath, UAVariable> = {};
|
|
159
159
|
|
|
160
160
|
/**
|
|
161
|
-
* @class ConditionSnapshot
|
|
162
|
-
* @extends EventEmitter
|
|
163
|
-
* @param condition
|
|
164
|
-
* @param branchId
|
|
165
|
-
* @constructor
|
|
166
161
|
*/
|
|
167
162
|
constructor(condition: BaseNode, branchId: NodeId) {
|
|
168
163
|
super();
|
|
@@ -222,6 +217,9 @@ export class ConditionSnapshotImpl extends EventEmitter implements ConditionSnap
|
|
|
222
217
|
// return variant;
|
|
223
218
|
// }
|
|
224
219
|
|
|
220
|
+
/**
|
|
221
|
+
* @internal
|
|
222
|
+
*/
|
|
225
223
|
public _get_var(varName: string): any {
|
|
226
224
|
const c = this.condition as UAConditionImpl;
|
|
227
225
|
if (!c.getEnabledState() && !Object.prototype.hasOwnProperty.call(_varTable, varName)) {
|
|
@@ -237,6 +235,9 @@ export class ConditionSnapshotImpl extends EventEmitter implements ConditionSnap
|
|
|
237
235
|
return variant.value;
|
|
238
236
|
}
|
|
239
237
|
|
|
238
|
+
/**
|
|
239
|
+
* @internal
|
|
240
|
+
*/
|
|
240
241
|
public _set_var(varName: string, dataType: DataType, value: unknown, options?: IConditionVariableTypeSetterOptions): void {
|
|
241
242
|
const key = normalizeName(varName);
|
|
242
243
|
// istanbul ignore next
|
|
@@ -281,24 +282,21 @@ export class ConditionSnapshotImpl extends EventEmitter implements ConditionSnap
|
|
|
281
282
|
}
|
|
282
283
|
|
|
283
284
|
/**
|
|
284
|
-
*
|
|
285
|
-
* @return {NodeId}
|
|
285
|
+
*
|
|
286
286
|
*/
|
|
287
287
|
public getBranchId(): NodeId {
|
|
288
288
|
return this._get_var("BranchId") as NodeId;
|
|
289
289
|
}
|
|
290
290
|
|
|
291
291
|
/**
|
|
292
|
-
*
|
|
293
|
-
* @return {ByteString}
|
|
292
|
+
*
|
|
294
293
|
*/
|
|
295
294
|
public getEventId(): Buffer {
|
|
296
295
|
return this._get_var("EventId") as Buffer;
|
|
297
296
|
}
|
|
298
297
|
|
|
299
298
|
/**
|
|
300
|
-
*
|
|
301
|
-
* @return {Boolean}
|
|
299
|
+
*
|
|
302
300
|
*/
|
|
303
301
|
public getRetain(): boolean {
|
|
304
302
|
return this._get_var("Retain") as boolean;
|
|
@@ -306,8 +304,6 @@ export class ConditionSnapshotImpl extends EventEmitter implements ConditionSnap
|
|
|
306
304
|
|
|
307
305
|
/**
|
|
308
306
|
*
|
|
309
|
-
* @method setRetain
|
|
310
|
-
* @param retainFlag {Boolean}
|
|
311
307
|
*/
|
|
312
308
|
public setRetain(retainFlag: boolean): void {
|
|
313
309
|
retainFlag = !!retainFlag;
|
|
@@ -315,7 +311,6 @@ export class ConditionSnapshotImpl extends EventEmitter implements ConditionSnap
|
|
|
315
311
|
}
|
|
316
312
|
|
|
317
313
|
/**
|
|
318
|
-
* @method renewEventId
|
|
319
314
|
*
|
|
320
315
|
*/
|
|
321
316
|
public renewEventId(): void {
|
|
@@ -328,33 +323,28 @@ export class ConditionSnapshotImpl extends EventEmitter implements ConditionSnap
|
|
|
328
323
|
}
|
|
329
324
|
|
|
330
325
|
/**
|
|
331
|
-
*
|
|
332
|
-
* @return {Boolean}
|
|
326
|
+
*
|
|
333
327
|
*/
|
|
334
328
|
public getEnabledState(): boolean {
|
|
335
329
|
return this._get_twoStateVariable("EnabledState");
|
|
336
330
|
}
|
|
337
331
|
|
|
338
332
|
/**
|
|
339
|
-
*
|
|
340
|
-
* @param value {Boolean}
|
|
341
|
-
* @return void
|
|
333
|
+
*
|
|
342
334
|
*/
|
|
343
335
|
public setEnabledState(value: boolean, options?: ISetStateOptions): void {
|
|
344
336
|
return this._set_twoStateVariable("EnabledState", value, options);
|
|
345
337
|
}
|
|
346
338
|
|
|
347
339
|
/**
|
|
348
|
-
*
|
|
349
|
-
* @return {String}
|
|
340
|
+
*
|
|
350
341
|
*/
|
|
351
342
|
public getEnabledStateAsString(): string {
|
|
352
343
|
return this._get_var("EnabledState").text;
|
|
353
344
|
}
|
|
354
345
|
|
|
355
346
|
/**
|
|
356
|
-
*
|
|
357
|
-
* @return {LocalizedText}
|
|
347
|
+
*
|
|
358
348
|
*/
|
|
359
349
|
public getComment(): LocalizedText {
|
|
360
350
|
return this._get_var("Comment");
|
|
@@ -369,8 +359,6 @@ export class ConditionSnapshotImpl extends EventEmitter implements ConditionSnap
|
|
|
369
359
|
* a Method provides as an option the ability to set a Comment, then the value of this Variable is
|
|
370
360
|
* reset to null if an optional comment is not provided.
|
|
371
361
|
*
|
|
372
|
-
* @method setComment
|
|
373
|
-
* @param txtMessage {LocalizedText}
|
|
374
362
|
*/
|
|
375
363
|
public setComment(txtMessage: LocalizedTextLike, options?: IConditionVariableTypeSetterOptions): void {
|
|
376
364
|
const txtMessage1 = coerceLocalizedText(txtMessage);
|
|
@@ -378,9 +366,7 @@ export class ConditionSnapshotImpl extends EventEmitter implements ConditionSnap
|
|
|
378
366
|
}
|
|
379
367
|
|
|
380
368
|
/**
|
|
381
|
-
*
|
|
382
|
-
* @method setMessage
|
|
383
|
-
* @param txtMessage {LocalizedText}
|
|
369
|
+
* set the condition message (localized text)
|
|
384
370
|
*/
|
|
385
371
|
public setMessage(txtMessage: LocalizedTextLike | LocalizedText): void {
|
|
386
372
|
const txtMessage1 = coerceLocalizedText(txtMessage);
|
|
@@ -388,88 +374,111 @@ export class ConditionSnapshotImpl extends EventEmitter implements ConditionSnap
|
|
|
388
374
|
}
|
|
389
375
|
|
|
390
376
|
/**
|
|
391
|
-
*
|
|
392
|
-
* @param userIdentity {String}
|
|
377
|
+
*
|
|
393
378
|
*/
|
|
394
379
|
public setClientUserId(userIdentity: string): void {
|
|
395
380
|
return this._set_var("ClientUserId", DataType.String, userIdentity.toString());
|
|
396
381
|
}
|
|
397
382
|
|
|
398
383
|
/*
|
|
384
|
+
*
|
|
385
|
+
*/
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* set the condition quality
|
|
399
389
|
*
|
|
400
390
|
*
|
|
401
391
|
* as per spec 1.0.3 - Part 9
|
|
402
392
|
*
|
|
403
|
-
* Quality reveals the status of process values or other resources that this Condition
|
|
404
|
-
* based upon.
|
|
405
|
-
*
|
|
406
|
-
*
|
|
407
|
-
*
|
|
408
|
-
*
|
|
409
|
-
*
|
|
393
|
+
* Quality reveals the status of process values or other resources that this Condition
|
|
394
|
+
* instance is based upon.
|
|
395
|
+
*
|
|
396
|
+
* If, for example, a process value is “Uncertain”, the associated “LevelAlarm”
|
|
397
|
+
* Condition is also questionable.
|
|
398
|
+
*
|
|
399
|
+
* Values for the Quality can be any of the OPC StatusCodes defined in Part 8
|
|
400
|
+
* as well as Good, Uncertain and Bad as defined in Part 4.
|
|
401
|
+
*
|
|
402
|
+
* These StatusCodes are similar to but slightly more generic than the description
|
|
403
|
+
* of data quality in the various field bus specifications.
|
|
404
|
+
*
|
|
405
|
+
* It is the responsibility of the Server to map internal status information to these codes.
|
|
406
|
+
*
|
|
407
|
+
* A Server which supports no quality information shall return Good.
|
|
408
|
+
*
|
|
410
409
|
* This quality can also reflect the communication status associated with the system that this
|
|
411
410
|
* value or resource is based on and from which this Alarm was received. For communication
|
|
412
|
-
* errors to the underlying system, especially those that result in some unavailable
|
|
413
|
-
* the quality shall be BadNoCommunication error.
|
|
414
|
-
*
|
|
415
|
-
* Quality refers to the quality of the data value(s) upon which this Condition is based.
|
|
416
|
-
*
|
|
417
|
-
*
|
|
418
|
-
*
|
|
419
|
-
*
|
|
420
|
-
*
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
* set the condition quality
|
|
425
|
-
* @method setQuality
|
|
426
|
-
* @param quality {StatusCode}
|
|
411
|
+
* errors to the underlying system, especially those that result in some unavailable
|
|
412
|
+
* Event fields, the quality shall be BadNoCommunication error.
|
|
413
|
+
*
|
|
414
|
+
* Quality refers to the quality of the data value(s) upon which this Condition is based.
|
|
415
|
+
*
|
|
416
|
+
* Since a Condition is usually based on one or more Variables, the Condition inherits
|
|
417
|
+
* the quality of these Variables. E.g., if the process value is “Uncertain”,
|
|
418
|
+
* the “LevelAlarm” Condition is also questionable.
|
|
419
|
+
*
|
|
420
|
+
* If more than one variable is represented by a given condition or if the condition
|
|
421
|
+
* is from an underlining system and no direct mapping to a variable is available,
|
|
422
|
+
* it is up to the application to determine what quality is displayed as part of the condition.
|
|
427
423
|
*/
|
|
428
424
|
public setQuality(quality: StatusCode, options?: IConditionVariableTypeSetterOptions): void {
|
|
429
425
|
this._set_var("Quality", DataType.StatusCode, quality, options);
|
|
430
426
|
}
|
|
431
427
|
|
|
432
428
|
/**
|
|
433
|
-
*
|
|
434
|
-
* @return {StatusCode}
|
|
429
|
+
*
|
|
435
430
|
*/
|
|
436
431
|
public getQuality(): StatusCode {
|
|
437
432
|
return this._get_var("Quality") as StatusCode;
|
|
438
433
|
}
|
|
439
434
|
|
|
440
|
-
|
|
441
|
-
* as per spec 1.0.3 - Part 9
|
|
435
|
+
/**
|
|
436
|
+
* **as per spec 1.0.3 - Part 9**
|
|
437
|
+
*
|
|
442
438
|
* The Severity of a Condition is inherited from the base Event model defined in Part 5. It
|
|
443
439
|
* indicates the urgency of the Condition and is also commonly called ‘priority’, especially in
|
|
444
440
|
* relation to Alarms in the ProcessConditionClass.
|
|
445
441
|
*
|
|
446
|
-
* as per spec 1.0.3 -
|
|
447
|
-
*
|
|
448
|
-
*
|
|
449
|
-
*
|
|
450
|
-
*
|
|
451
|
-
*
|
|
452
|
-
*
|
|
453
|
-
*
|
|
454
|
-
*
|
|
455
|
-
*
|
|
456
|
-
*
|
|
442
|
+
* **as per spec 1.0.3 - Part 5**
|
|
443
|
+
*
|
|
444
|
+
* Severity is an indication of the urgency of the Event. This is also commonly
|
|
445
|
+
* called “priority”.
|
|
446
|
+
*
|
|
447
|
+
* Values will range from 1 to 1 000, with 1 being the lowest severity and 1 000
|
|
448
|
+
* being the highest.
|
|
449
|
+
*
|
|
450
|
+
* Typically, a severity of 1 would indicate an Event which is informational in nature,
|
|
451
|
+
* while a value of 1 000 would indicate an Event of catastrophic nature, which could
|
|
452
|
+
* potentially result in severe financial loss or loss of life.
|
|
453
|
+
*
|
|
454
|
+
* It is expected that very few Server implementations will support 1 000 distinct
|
|
455
|
+
* severity levels.
|
|
456
|
+
*
|
|
457
|
+
* Therefore, Server developers are responsible for distributing their severity levels
|
|
458
|
+
* across the 1 to 1 000 range in such a manner that clients can assume a linear
|
|
459
|
+
* distribution.
|
|
460
|
+
*
|
|
461
|
+
*
|
|
462
|
+
* For example, a client wishing to present five severity levels to a user should be
|
|
463
|
+
* able to do the following mapping:
|
|
464
|
+
*
|
|
465
|
+
*
|
|
457
466
|
* Client Severity OPC Severity
|
|
458
467
|
* HIGH 801 – 1 000
|
|
459
468
|
* MEDIUM HIGH 601 – 800
|
|
460
469
|
* MEDIUM 401 – 600
|
|
461
470
|
* MEDIUM LOW 201 – 400
|
|
462
471
|
* LOW 1 – 200
|
|
463
|
-
*
|
|
464
|
-
*
|
|
465
|
-
*
|
|
466
|
-
*
|
|
467
|
-
*
|
|
468
|
-
*
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
*
|
|
472
|
-
*
|
|
472
|
+
*
|
|
473
|
+
* In many cases a strict linear mapping of underlying source severities to the OPC
|
|
474
|
+
* Severity range is not appropriate. The Server developer will instead intelligently
|
|
475
|
+
* map the underlying source severities to the 1 to 1 000 OPC Severity range in some
|
|
476
|
+
* other fashion.
|
|
477
|
+
*
|
|
478
|
+
* In particular, it it recommended that Server developers map Events of high urgency
|
|
479
|
+
* into the OPC severity range of 667 to 1 000, Events of medium urgency into the
|
|
480
|
+
* OPC severity range of 334 to 666 and Events of low urgency into OPC severities
|
|
481
|
+
* of 1 to 333.
|
|
473
482
|
*/
|
|
474
483
|
public setSeverity(severity: UInt16, options?: IConditionVariableTypeSetterOptions): void {
|
|
475
484
|
assert(isFinite(severity), "expecting a UInt16");
|
|
@@ -483,8 +492,6 @@ export class ConditionSnapshotImpl extends EventEmitter implements ConditionSnap
|
|
|
483
492
|
}
|
|
484
493
|
|
|
485
494
|
/**
|
|
486
|
-
* @method getSeverity
|
|
487
|
-
* @return {UInt16}
|
|
488
495
|
*/
|
|
489
496
|
public getSeverity(): UInt16 {
|
|
490
497
|
const c = this.condition as UAConditionImpl;
|
|
@@ -497,25 +504,24 @@ export class ConditionSnapshotImpl extends EventEmitter implements ConditionSnap
|
|
|
497
504
|
return c.severity.readValue().sourceTimestamp || new Date();
|
|
498
505
|
}
|
|
499
506
|
|
|
500
|
-
|
|
501
|
-
*
|
|
502
|
-
*
|
|
503
|
-
*
|
|
507
|
+
/**
|
|
508
|
+
* LastSeverity provides the previous severity of the ConditionBranch.
|
|
509
|
+
*
|
|
510
|
+
* **as per spec 1.0.3 - part 9**
|
|
511
|
+
*
|
|
512
|
+
*
|
|
513
|
+
* Initially this Variable contains a zero value;
|
|
514
|
+
* it will return a value only after a severity change. The new severity is
|
|
504
515
|
* supplied via the Severity Property which is inherited from the BaseEventType.
|
|
505
516
|
*
|
|
506
517
|
*/
|
|
507
|
-
/**
|
|
508
|
-
* @method setLastSeverity
|
|
509
|
-
* @param severity {UInt16}
|
|
510
|
-
*/
|
|
511
518
|
public setLastSeverity(severity: UInt16, options?: IConditionVariableTypeSetterOptions): void {
|
|
512
519
|
severity = +severity;
|
|
513
520
|
return this._set_var("LastSeverity", DataType.UInt16, severity, options);
|
|
514
521
|
}
|
|
515
522
|
|
|
516
523
|
/**
|
|
517
|
-
*
|
|
518
|
-
* @return {UInt16}
|
|
524
|
+
*
|
|
519
525
|
*/
|
|
520
526
|
public getLastSeverity(): UInt16 {
|
|
521
527
|
const value = this._get_var("LastSeverity");
|
|
@@ -525,7 +531,7 @@ export class ConditionSnapshotImpl extends EventEmitter implements ConditionSnap
|
|
|
525
531
|
/**
|
|
526
532
|
* setReceiveTime
|
|
527
533
|
*
|
|
528
|
-
*
|
|
534
|
+
* **as per OPCUA 1.0.3 part 5**:
|
|
529
535
|
*
|
|
530
536
|
* ReceiveTime provides the time the OPC UA Server received the Event from the underlying
|
|
531
537
|
* device of another Server.
|
|
@@ -538,36 +544,39 @@ export class ConditionSnapshotImpl extends EventEmitter implements ConditionSnap
|
|
|
538
544
|
* The ReceiveTime shall always be returned as value and the Server is not allowed to return a
|
|
539
545
|
* StatusCode for the ReceiveTime indicating an error.
|
|
540
546
|
*
|
|
541
|
-
* @method setReceiveTime
|
|
542
|
-
* @param time {Date} : UTCTime
|
|
543
547
|
*/
|
|
544
548
|
public setReceiveTime(time: UtcTime): void {
|
|
545
|
-
|
|
546
|
-
return this._set_var("ReceiveTime", DataType.DateTime, time, { sourceTimestamp: time });
|
|
549
|
+
return this._set_var("ReceiveTime", DataType.DateTime, time, { sourceTimestamp: time || undefined });
|
|
547
550
|
}
|
|
548
551
|
|
|
549
552
|
/**
|
|
550
|
-
*
|
|
551
|
-
*
|
|
552
|
-
*
|
|
553
|
-
*
|
|
553
|
+
* Time provides the time the Event occurred.
|
|
554
|
+
*
|
|
555
|
+
* **as per OPCUA 1.0.3 part 5**:
|
|
556
|
+
*
|
|
557
|
+
* This value is set as close to the event generator as
|
|
558
|
+
* possible. It often comes from the underlying system or device.
|
|
559
|
+
*
|
|
560
|
+
* Once set, intermediate OPC UA Servers shall not alter the value.
|
|
554
561
|
*
|
|
555
|
-
* @method setTime
|
|
556
|
-
* @param time {Date}
|
|
557
562
|
*/
|
|
558
563
|
public setTime(time: Date): void {
|
|
559
564
|
return this._set_var("Time", DataType.DateTime, time, { sourceTimestamp: time });
|
|
560
565
|
}
|
|
561
566
|
|
|
562
567
|
/**
|
|
563
|
-
* LocalTime is a structure containing the Offset and the DaylightSavingInOffset flag.
|
|
564
|
-
*
|
|
565
|
-
*
|
|
566
|
-
*
|
|
567
|
-
*
|
|
568
|
+
* LocalTime is a structure containing the Offset and the DaylightSavingInOffset flag.
|
|
569
|
+
*
|
|
570
|
+
* The Offset specifies the time difference (in minutes) between the Time Property
|
|
571
|
+
* and the time at the location in which the event was issued.
|
|
572
|
+
*
|
|
573
|
+
*
|
|
574
|
+
* If DaylightSavingInOffset is TRUE, then Standard/Daylight savings time (DST) at
|
|
575
|
+
* the originating location is in effect and Offset includes the DST correction.
|
|
576
|
+
*
|
|
577
|
+
* If `false` then the Offset does not include DST correction and DST may or may not have been
|
|
568
578
|
* in effect.
|
|
569
|
-
*
|
|
570
|
-
* @param localTime {TimeZone}
|
|
579
|
+
*
|
|
571
580
|
*/
|
|
572
581
|
public setLocalTime(localTime: TimeZoneDataType): void {
|
|
573
582
|
assert(localTime instanceof TimeZoneDataType);
|
|
@@ -580,16 +589,14 @@ export class ConditionSnapshotImpl extends EventEmitter implements ConditionSnap
|
|
|
580
589
|
}
|
|
581
590
|
|
|
582
591
|
/**
|
|
583
|
-
*
|
|
584
|
-
* return {NodeId}
|
|
592
|
+
*
|
|
585
593
|
*/
|
|
586
594
|
public getSourceNode(): NodeId {
|
|
587
595
|
return this._get_var("SourceNode");
|
|
588
596
|
}
|
|
589
597
|
|
|
590
598
|
/**
|
|
591
|
-
*
|
|
592
|
-
* return {NodeId}
|
|
599
|
+
*
|
|
593
600
|
*/
|
|
594
601
|
public getEventType(): NodeId {
|
|
595
602
|
return this._get_var("EventType");
|
|
@@ -649,21 +656,10 @@ export class ConditionSnapshotImpl extends EventEmitter implements ConditionSnap
|
|
|
649
656
|
}
|
|
650
657
|
|
|
651
658
|
// ---- Shelving
|
|
652
|
-
/**
|
|
653
|
-
* @class ConditionSnapshot
|
|
654
|
-
*/
|
|
655
|
-
/**
|
|
656
|
-
* @method getSuppressedState
|
|
657
|
-
* @return {Boolean}
|
|
658
|
-
*/
|
|
659
659
|
public getSuppressedState(): boolean {
|
|
660
660
|
return this._get_twoStateVariable("SuppressedState");
|
|
661
661
|
}
|
|
662
662
|
|
|
663
|
-
/**
|
|
664
|
-
* @method setSuppressedState
|
|
665
|
-
* @param suppressed {Boolean}
|
|
666
|
-
*/
|
|
667
663
|
public setSuppressedState(suppressed: boolean, options?: ISetStateOptions): void {
|
|
668
664
|
suppressed = !!suppressed;
|
|
669
665
|
this._set_twoStateVariable("SuppressedState", suppressed, options);
|
|
@@ -735,10 +731,7 @@ export class ConditionSnapshotImpl extends EventEmitter implements ConditionSnap
|
|
|
735
731
|
);
|
|
736
732
|
}
|
|
737
733
|
/**
|
|
738
|
-
* @
|
|
739
|
-
* @param varName
|
|
740
|
-
* @param value
|
|
741
|
-
* @private
|
|
734
|
+
* @internal
|
|
742
735
|
*/
|
|
743
736
|
public _set_twoStateVariable(varName: string, value: boolean, options?: ISetStateOptions): void {
|
|
744
737
|
value = !!value;
|
|
@@ -775,6 +768,9 @@ export class ConditionSnapshotImpl extends EventEmitter implements ConditionSnap
|
|
|
775
768
|
this.emit("valueChanged", node, variant, { sourceTimestamp });
|
|
776
769
|
}
|
|
777
770
|
|
|
771
|
+
/**
|
|
772
|
+
* @internal
|
|
773
|
+
*/
|
|
778
774
|
protected _get_twoStateVariable(varName: string): any {
|
|
779
775
|
const key = ConditionSnapshotImpl.normalizeName(varName) + ".Id";
|
|
780
776
|
const variant = this._map[key];
|
|
@@ -208,11 +208,7 @@ export class UAAcknowledgeableConditionImpl extends UAConditionImpl implements U
|
|
|
208
208
|
}
|
|
209
209
|
|
|
210
210
|
/**
|
|
211
|
-
* @method _confirm_branch
|
|
212
211
|
* @param conditionEventId The ConditionEventId field shall contain the id of the Event that was conformed
|
|
213
|
-
* @param comment
|
|
214
|
-
* @param branch
|
|
215
|
-
* @param message
|
|
216
212
|
* @private
|
|
217
213
|
*/
|
|
218
214
|
public _confirm_branch(
|
|
@@ -248,9 +244,6 @@ export class UAAcknowledgeableConditionImpl extends UAConditionImpl implements U
|
|
|
248
244
|
}
|
|
249
245
|
|
|
250
246
|
/**
|
|
251
|
-
* @method autoConfirmBranch
|
|
252
|
-
* @param branch
|
|
253
|
-
* @param comment
|
|
254
247
|
*/
|
|
255
248
|
public autoConfirmBranch(branch: ConditionSnapshot, comment: LocalizedTextLike): void {
|
|
256
249
|
assert(branch instanceof ConditionSnapshotImpl);
|
|
@@ -267,9 +260,7 @@ export class UAAcknowledgeableConditionImpl extends UAConditionImpl implements U
|
|
|
267
260
|
}
|
|
268
261
|
|
|
269
262
|
/**
|
|
270
|
-
*
|
|
271
|
-
* @param branch {ConditionSnapshot}
|
|
272
|
-
* @param comment {String|LocalizedText}
|
|
263
|
+
*
|
|
273
264
|
*/
|
|
274
265
|
public acknowledgeAndAutoConfirmBranch(branch: ConditionSnapshot, comment: string | LocalizedTextLike | LocalizedText): void {
|
|
275
266
|
comment = LocalizedText.coerce(comment)!;
|
|
@@ -265,7 +265,7 @@ export class UAAlarmConditionImpl extends UAAcknowledgeableConditionImpl impleme
|
|
|
265
265
|
}
|
|
266
266
|
|
|
267
267
|
/**
|
|
268
|
-
|
|
268
|
+
|
|
269
269
|
* @return {BaseNode} return the node in the address space pointed by the inputNode value
|
|
270
270
|
*
|
|
271
271
|
* Note: please note the difference between alarm.inputNode
|
|
@@ -280,8 +280,7 @@ export class UAAlarmConditionImpl extends UAAcknowledgeableConditionImpl impleme
|
|
|
280
280
|
return this.addressSpace.findNode(nodeId) as UAVariable | null;
|
|
281
281
|
}
|
|
282
282
|
/**
|
|
283
|
-
*
|
|
284
|
-
* @return {*}
|
|
283
|
+
*
|
|
285
284
|
*/
|
|
286
285
|
public getInputNodeValue(): any | null {
|
|
287
286
|
const node = this.getInputNodeNode();
|
|
@@ -303,9 +302,8 @@ export class UAAlarmConditionImpl extends UAAcknowledgeableConditionImpl impleme
|
|
|
303
302
|
}
|
|
304
303
|
|
|
305
304
|
/**
|
|
306
|
-
* @method installInputNodeMonitoring
|
|
307
305
|
* install mechanism that listen to input node datavalue changes so that alarm status
|
|
308
|
-
* can be automatically updated
|
|
306
|
+
* can be automatically updated appropriately.
|
|
309
307
|
* @param inputNode {BaseNode}
|
|
310
308
|
* @return {void}
|
|
311
309
|
* @protected
|
|
@@ -379,16 +377,6 @@ export class UAAlarmConditionImpl extends UAAcknowledgeableConditionImpl impleme
|
|
|
379
377
|
}
|
|
380
378
|
|
|
381
379
|
/***
|
|
382
|
-
* @method _calculateConditionInfo
|
|
383
|
-
* @param stateData {Object} the new calculated state of the alarm
|
|
384
|
-
* @param isActive {Boolean}
|
|
385
|
-
* @param value {Number} the new value of the limit alarm
|
|
386
|
-
* @param oldCondition {ConditionInfo} given for information purpose
|
|
387
|
-
* @param oldCondition.severity
|
|
388
|
-
* @param oldCondition.quality
|
|
389
|
-
* @param oldCondition.message
|
|
390
|
-
* @param oldCondition.retain
|
|
391
|
-
* @return {ConditionInfo} the new condition info
|
|
392
380
|
*
|
|
393
381
|
* this method need to be overridden by the instantiate to allow custom message and severity
|
|
394
382
|
* to be set based on specific context of the alarm.
|
|
@@ -14,14 +14,10 @@ export interface UABaseEventEx extends UABaseEvent_Base, UABaseEventHelper {}
|
|
|
14
14
|
export declare interface UABaseEventImpl extends UABaseEventEx {}
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
|
-
* @
|
|
18
|
-
* @class UAObject
|
|
19
|
-
* @constructor
|
|
17
|
+
* @internal
|
|
20
18
|
*/
|
|
21
19
|
export class UABaseEventImpl extends UAObjectImpl implements UABaseEventEx {
|
|
22
20
|
/**
|
|
23
|
-
* @method setSourceName
|
|
24
|
-
* @param name
|
|
25
21
|
*/
|
|
26
22
|
public setSourceName(name: string): void {
|
|
27
23
|
assert(typeof name === "string");
|
|
@@ -34,8 +30,6 @@ export class UABaseEventImpl extends UAObjectImpl implements UABaseEventEx {
|
|
|
34
30
|
}
|
|
35
31
|
|
|
36
32
|
/**
|
|
37
|
-
* @method setSourceNode
|
|
38
|
-
* @param node {NodeId|UAObject}
|
|
39
33
|
*/
|
|
40
34
|
public setSourceNode(node: NodeId | BaseNode): void {
|
|
41
35
|
this.sourceNode.setValueFromSource(
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @module node-opcua-address-space.AlarmsAndConditions
|
|
3
3
|
*/
|
|
4
4
|
import { Certificate, exploreCertificate, makeSHA1Thumbprint } from "node-opcua-crypto";
|
|
5
|
-
import { DateTime,
|
|
5
|
+
import { DateTime, getMinOPCUADate, isMinDate, StatusCodes } from "node-opcua-basic-types";
|
|
6
6
|
import { make_warningLog } from "node-opcua-debug";
|
|
7
7
|
import { NodeId } from "node-opcua-nodeid";
|
|
8
8
|
import { DataType, Variant, VariantOptions } from "node-opcua-variant";
|
|
@@ -97,7 +97,7 @@ class UACertificateExpirationAlarmImpl extends UASystemOffNormalAlarmImpl implem
|
|
|
97
97
|
|
|
98
98
|
const certificate = this.getCertificate();
|
|
99
99
|
|
|
100
|
-
if (!expirationDate || (expirationDate
|
|
100
|
+
if (!expirationDate || (isMinDate(expirationDate) && !certificate)) {
|
|
101
101
|
if (!this.currentBranch() || this.currentBranch().getActiveState()) {
|
|
102
102
|
this.updateAlarmState2(true, 255, "certificate is missing");
|
|
103
103
|
}
|
|
@@ -163,13 +163,13 @@ class UACertificateExpirationAlarmImpl extends UASystemOffNormalAlarmImpl implem
|
|
|
163
163
|
private _extractAndSetExpiryDate(certificate: Certificate | null): void {
|
|
164
164
|
if (certificate && certificate.length > 0) {
|
|
165
165
|
const info = exploreCertificate(certificate);
|
|
166
|
-
if (info.tbsCertificate.validity.notAfter
|
|
166
|
+
if (info.tbsCertificate.validity.notAfter) {
|
|
167
167
|
this.setExpirationDate(info.tbsCertificate.validity.notAfter);
|
|
168
168
|
} else {
|
|
169
|
-
this.setExpirationDate(
|
|
169
|
+
this.setExpirationDate(getMinOPCUADate());
|
|
170
170
|
}
|
|
171
171
|
} else {
|
|
172
|
-
this.setExpirationDate(
|
|
172
|
+
this.setExpirationDate(getMinOPCUADate());
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
175
|
|