node-opcua-client 2.113.0 → 2.114.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/alarms_and_conditions/client_alarm.js +4 -17
- package/dist/alarms_and_conditions/client_alarm.js.map +1 -1
- package/dist/alarms_and_conditions/client_alarm_tools.js +95 -109
- package/dist/alarms_and_conditions/client_alarm_tools.js.map +1 -1
- package/dist/alarms_and_conditions/client_alarm_tools_acknowledge_all_conditions.js +127 -146
- package/dist/alarms_and_conditions/client_alarm_tools_acknowledge_all_conditions.js.map +1 -1
- package/dist/alarms_and_conditions/client_alarm_tools_dump_event.js +36 -53
- package/dist/alarms_and_conditions/client_alarm_tools_dump_event.js.map +1 -1
- package/dist/alarms_and_conditions/client_alarm_tools_extractConditionFields.js +8 -19
- package/dist/alarms_and_conditions/client_alarm_tools_extractConditionFields.js.map +1 -1
- package/dist/client_monitored_item_toolbox.js +4 -1
- package/dist/client_monitored_item_toolbox.js.map +1 -1
- package/dist/client_session_keepalive_manager.js +60 -71
- package/dist/client_session_keepalive_manager.js.map +1 -1
- package/dist/opcua_client.js +2 -13
- package/dist/opcua_client.js.map +1 -1
- package/dist/private/client_base_impl.js +65 -80
- package/dist/private/client_base_impl.js.map +1 -1
- package/dist/private/client_monitored_item_impl.js +4 -7
- package/dist/private/client_monitored_item_impl.js.map +1 -1
- package/dist/private/client_session_impl.js +21 -41
- package/dist/private/client_session_impl.js.map +1 -1
- package/dist/private/client_subscription_impl.js +3 -1
- package/dist/private/client_subscription_impl.js.map +1 -1
- package/dist/private/opcua_client_impl.js +63 -82
- package/dist/private/opcua_client_impl.js.map +1 -1
- package/dist/reconnection.js +1 -1
- package/dist/reconnection.js.map +1 -1
- package/dist/verify.js +36 -48
- package/dist/verify.js.map +1 -1
- package/package.json +42 -42
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.fieldsToJson = exports.ClientAlarm = void 0;
|
|
13
4
|
const events_1 = require("events");
|
|
@@ -29,15 +20,11 @@ class ClientAlarm extends events_1.EventEmitter {
|
|
|
29
20
|
this.fields = eventFields;
|
|
30
21
|
this.update(eventFields);
|
|
31
22
|
}
|
|
32
|
-
acknowledge(session, comment) {
|
|
33
|
-
return
|
|
34
|
-
return yield session.acknowledgeCondition(this.conditionId, this.eventId, comment);
|
|
35
|
-
});
|
|
23
|
+
async acknowledge(session, comment) {
|
|
24
|
+
return await session.acknowledgeCondition(this.conditionId, this.eventId, comment);
|
|
36
25
|
}
|
|
37
|
-
confirm(session, comment) {
|
|
38
|
-
return
|
|
39
|
-
return yield session.confirmCondition(this.conditionId, this.eventId, comment);
|
|
40
|
-
});
|
|
26
|
+
async confirm(session, comment) {
|
|
27
|
+
return await session.confirmCondition(this.conditionId, this.eventId, comment);
|
|
41
28
|
}
|
|
42
29
|
update(eventFields) {
|
|
43
30
|
(0, node_opcua_assert_1.assert)(this.conditionId.toString() === (0, node_opcua_nodeid_1.resolveNodeId)(eventFields.conditionId.value).toString());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client_alarm.js","sourceRoot":"","sources":["../../source/alarms_and_conditions/client_alarm.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"client_alarm.js","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AE,EAAE;QAChD,MAAM,OAAO,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC;QACnC,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,CAAC;KAC7C;IAED,OAAO,IAAI,CAAC;AAChB,CAAC;AApCD,oCAoCC"}
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.installAlarmMonitoring = exports.uninstallAlarmMonitoring = void 0;
|
|
13
4
|
const node_opcua_data_model_1 = require("node-opcua-data-model");
|
|
@@ -30,19 +21,17 @@ function r(_key, o) {
|
|
|
30
21
|
return o;
|
|
31
22
|
}
|
|
32
23
|
// ------------------------------------------------------------------------------------------------------------------------------
|
|
33
|
-
function uninstallAlarmMonitoring(session) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
if (!_sessionPriv.$clientAlarmList) {
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
const mi = _sessionPriv.$monitoredItemForAlarmList;
|
|
40
|
-
mi.removeAllListeners();
|
|
41
|
-
_sessionPriv.$monitoredItemForAlarmList = null;
|
|
42
|
-
yield _sessionPriv.$subscriptionForAlarmList.terminate();
|
|
43
|
-
_sessionPriv.$clientAlarmList = null;
|
|
24
|
+
async function uninstallAlarmMonitoring(session) {
|
|
25
|
+
const _sessionPriv = session;
|
|
26
|
+
if (!_sessionPriv.$clientAlarmList) {
|
|
44
27
|
return;
|
|
45
|
-
}
|
|
28
|
+
}
|
|
29
|
+
const mi = _sessionPriv.$monitoredItemForAlarmList;
|
|
30
|
+
mi.removeAllListeners();
|
|
31
|
+
_sessionPriv.$monitoredItemForAlarmList = null;
|
|
32
|
+
await _sessionPriv.$subscriptionForAlarmList.terminate();
|
|
33
|
+
_sessionPriv.$clientAlarmList = null;
|
|
34
|
+
return;
|
|
46
35
|
}
|
|
47
36
|
exports.uninstallAlarmMonitoring = uninstallAlarmMonitoring;
|
|
48
37
|
// Release 1.04 8 OPC Unified Architecture, Part 9
|
|
@@ -57,101 +46,98 @@ exports.uninstallAlarmMonitoring = uninstallAlarmMonitoring;
|
|
|
57
46
|
// RefreshEndEvent, the Client removes any remaining suspect Events, since they no longer
|
|
58
47
|
// apply.
|
|
59
48
|
// ------------------------------------------------------------------------------------------------------------------------------
|
|
60
|
-
function installAlarmMonitoring(session) {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
clientAlarmList.update(pojo);
|
|
100
|
-
}
|
|
49
|
+
async function installAlarmMonitoring(session) {
|
|
50
|
+
const _sessionPriv = session;
|
|
51
|
+
// create
|
|
52
|
+
if (_sessionPriv.$clientAlarmList) {
|
|
53
|
+
return _sessionPriv.$clientAlarmList;
|
|
54
|
+
}
|
|
55
|
+
const clientAlarmList = new client_alarm_list_1.ClientAlarmList();
|
|
56
|
+
_sessionPriv.$clientAlarmList = clientAlarmList;
|
|
57
|
+
const request = {
|
|
58
|
+
maxNotificationsPerPublish: 100,
|
|
59
|
+
priority: 6,
|
|
60
|
+
publishingEnabled: true,
|
|
61
|
+
requestedLifetimeCount: 10000,
|
|
62
|
+
requestedMaxKeepAliveCount: 10,
|
|
63
|
+
requestedPublishingInterval: 500
|
|
64
|
+
};
|
|
65
|
+
const subscription = await session.createSubscription2(request);
|
|
66
|
+
_sessionPriv.$subscriptionForAlarmList = subscription;
|
|
67
|
+
const itemToMonitor = {
|
|
68
|
+
attributeId: node_opcua_data_model_1.AttributeIds.EventNotifier,
|
|
69
|
+
nodeId: (0, node_opcua_nodeid_1.resolveNodeId)("Server") // i=2253
|
|
70
|
+
};
|
|
71
|
+
const fields = await (0, client_alarm_tools_extractConditionFields_1.extractConditionFields)(session, "AlarmConditionType");
|
|
72
|
+
const AcknowledgeableConditionType = (0, node_opcua_nodeid_1.resolveNodeId)("AcknowledgeableConditionType");
|
|
73
|
+
const eventFilter = (0, node_opcua_service_filter_1.constructEventFilter)(fields, (0, node_opcua_service_filter_1.ofType)(AcknowledgeableConditionType));
|
|
74
|
+
const monitoringParameters = {
|
|
75
|
+
discardOldest: false,
|
|
76
|
+
filter: eventFilter,
|
|
77
|
+
queueSize: 1000,
|
|
78
|
+
samplingInterval: 0
|
|
79
|
+
};
|
|
80
|
+
// now create a event monitored Item
|
|
81
|
+
const eventMonitoringItem = await subscription.monitor(itemToMonitor, monitoringParameters, node_opcua_service_read_1.TimestampsToReturn.Both);
|
|
82
|
+
const queueEvent = [];
|
|
83
|
+
function flushQueue() {
|
|
84
|
+
const q = [...queueEvent];
|
|
85
|
+
queueEvent.length = 0;
|
|
86
|
+
for (const pojo of q) {
|
|
87
|
+
clientAlarmList.update(pojo);
|
|
101
88
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
}
|
|
117
|
-
queueEvent.push(pojo);
|
|
118
|
-
if (queueEvent.length === 1 && !inInit) {
|
|
119
|
-
setTimeout(() => flushQueue(), 10);
|
|
120
|
-
}
|
|
89
|
+
}
|
|
90
|
+
let inInit = true;
|
|
91
|
+
eventMonitoringItem.on("changed", (eventFields) => {
|
|
92
|
+
const pojo = (0, client_alarm_1.fieldsToJson)(fields, eventFields);
|
|
93
|
+
const { eventType, eventId, conditionId, conditionName } = pojo;
|
|
94
|
+
debugLog("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ---- ALARM RECEIVED " +
|
|
95
|
+
eventType.value.toString() +
|
|
96
|
+
" " +
|
|
97
|
+
eventId.value?.toString("hex"));
|
|
98
|
+
try {
|
|
99
|
+
if (!conditionId || !conditionId.value || conditionId.dataType === node_opcua_variant_1.DataType.Null) {
|
|
100
|
+
// not a acknowledgeable condition
|
|
101
|
+
warningLog(" not acknowledgeable condition ---- " + eventType.value.toString() + " ", conditionId, conditionName?.value, " " + eventId.value?.toString("hex"));
|
|
102
|
+
return;
|
|
121
103
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
104
|
+
queueEvent.push(pojo);
|
|
105
|
+
if (queueEvent.length === 1 && !inInit) {
|
|
106
|
+
setTimeout(() => flushQueue(), 10);
|
|
125
107
|
}
|
|
126
|
-
// Release 1.04 8 OPC Unified Architecture, Part 9
|
|
127
|
-
// 4.5 Condition state synchronization
|
|
128
|
-
// RefreshRequiredEventType
|
|
129
|
-
// Under some circumstances a Server may not be capable of ensuring the Client is fully
|
|
130
|
-
// in sync with the current state of Condition instances. For example, if the underlying
|
|
131
|
-
// system represented by the Server is reset or communications are lost for some period
|
|
132
|
-
// of time the Server may need to resynchronize itself with the underlying system. In
|
|
133
|
-
// these cases, the Server shall send an Event of the RefreshRequiredEventType to
|
|
134
|
-
// advise the Client that a Refresh may be necessary. A Client receiving this special
|
|
135
|
-
// Event should initiate a ConditionRefresh as noted in this clause.
|
|
136
|
-
// TODO
|
|
137
|
-
});
|
|
138
|
-
try {
|
|
139
|
-
yield (0, client_tools_1.callConditionRefresh)(subscription);
|
|
140
108
|
}
|
|
141
109
|
catch (err) {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
}
|
|
145
|
-
else {
|
|
146
|
-
warningLog("Server may not implement condition refresh", err.message);
|
|
147
|
-
}
|
|
110
|
+
warningLog(JSON.stringify(pojo, r, " "));
|
|
111
|
+
warningLog("Error !!", err);
|
|
148
112
|
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
//
|
|
153
|
-
|
|
113
|
+
// Release 1.04 8 OPC Unified Architecture, Part 9
|
|
114
|
+
// 4.5 Condition state synchronization
|
|
115
|
+
// RefreshRequiredEventType
|
|
116
|
+
// Under some circumstances a Server may not be capable of ensuring the Client is fully
|
|
117
|
+
// in sync with the current state of Condition instances. For example, if the underlying
|
|
118
|
+
// system represented by the Server is reset or communications are lost for some period
|
|
119
|
+
// of time the Server may need to resynchronize itself with the underlying system. In
|
|
120
|
+
// these cases, the Server shall send an Event of the RefreshRequiredEventType to
|
|
121
|
+
// advise the Client that a Refresh may be necessary. A Client receiving this special
|
|
122
|
+
// Event should initiate a ConditionRefresh as noted in this clause.
|
|
123
|
+
// TODO
|
|
154
124
|
});
|
|
125
|
+
try {
|
|
126
|
+
await (0, client_tools_1.callConditionRefresh)(subscription);
|
|
127
|
+
}
|
|
128
|
+
catch (err) {
|
|
129
|
+
if (err.message.match(/BadNothingToDo/)) {
|
|
130
|
+
/** fine! nothing to do */
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
warningLog("Server may not implement condition refresh", err.message);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
_sessionPriv.$monitoredItemForAlarmList = eventMonitoringItem;
|
|
137
|
+
setTimeout(() => flushQueue(), 10);
|
|
138
|
+
inInit = false;
|
|
139
|
+
// also request updates
|
|
140
|
+
return clientAlarmList;
|
|
155
141
|
}
|
|
156
142
|
exports.installAlarmMonitoring = installAlarmMonitoring;
|
|
157
143
|
//# sourceMappingURL=client_alarm_tools.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client_alarm_tools.js","sourceRoot":"","sources":["../../source/alarms_and_conditions/client_alarm_tools.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"client_alarm_tools.js","sourceRoot":"","sources":["../../source/alarms_and_conditions/client_alarm_tools.ts"],"names":[],"mappings":";;;AAAA,iEAAqD;AACrD,yDAAkD;AAClD,yEAAyE;AACzE,qEAAiF;AAEjF,2DAAuD;AACvD,uDAAkF;AAKlF,iDAA0D;AAC1D,2DAAsD;AACtD,2GAAqF;AACrF,iDAAsD;AAEtD,MAAM,OAAO,GAAG,IAAA,iCAAc,EAAC,KAAK,CAAC,CAAC;AACtC,MAAM,QAAQ,GAAG,IAAA,gCAAa,EAAC,KAAK,CAAC,CAAC;AACtC,MAAM,UAAU,GAAG,IAAA,kCAAe,EAAC,KAAK,CAAC,CAAC;AAE1C,SAAS,CAAC,CAAC,IAAY,EAAE,CAA0C;IAC/D,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,KAAK,MAAM,EAAE;QAC5B,OAAO,SAAS,CAAC;KACpB;IACD,OAAO,CAAC,CAAC;AACb,CAAC;AAMD,iIAAiI;AAC1H,KAAK,UAAU,wBAAwB,CAAC,OAAsB;IACjE,MAAM,YAAY,GAAG,OAA4B,CAAC;IAClD,IAAI,CAAC,YAAY,CAAC,gBAAgB,EAAE;QAChC,OAAO;KACV;IAED,MAAM,EAAE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AC3B,CAAC;AA/GD,wDA+GC"}
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.confirmAllConditions = exports.acknowledgeAllConditions = exports.findActiveConditions = exports.confirmCondition = exports.acknowledgeCondition = void 0;
|
|
13
4
|
const node_opcua_nodeid_1 = require("node-opcua-nodeid");
|
|
@@ -28,167 +19,157 @@ const errorLog = (0, node_opcua_debug_1.make_errorLog)(__filename);
|
|
|
28
19
|
* @param eventStuff
|
|
29
20
|
* @param comment
|
|
30
21
|
*/
|
|
31
|
-
function acknowledgeCondition(session, eventStuff, comment) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
});
|
|
22
|
+
async function acknowledgeCondition(session, eventStuff, comment) {
|
|
23
|
+
try {
|
|
24
|
+
const conditionId = eventStuff.conditionId.value;
|
|
25
|
+
const eventId = eventStuff.eventId.value;
|
|
26
|
+
return await session.acknowledgeCondition(conditionId, eventId, comment);
|
|
27
|
+
}
|
|
28
|
+
catch (err) {
|
|
29
|
+
errorLog("Acknowledging alarm has failed !", err);
|
|
30
|
+
return node_opcua_status_code_1.StatusCodes.BadInternalError;
|
|
31
|
+
}
|
|
43
32
|
}
|
|
44
33
|
exports.acknowledgeCondition = acknowledgeCondition;
|
|
45
|
-
function confirmCondition(session, eventStuff, comment) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
});
|
|
34
|
+
async function confirmCondition(session, eventStuff, comment) {
|
|
35
|
+
try {
|
|
36
|
+
const conditionId = eventStuff.conditionId.value;
|
|
37
|
+
const eventId = eventStuff.eventId.value;
|
|
38
|
+
return await session.confirmCondition(conditionId, eventId, comment);
|
|
39
|
+
}
|
|
40
|
+
catch (err) {
|
|
41
|
+
errorLog("Acknowledging alarm has failed !", err);
|
|
42
|
+
return node_opcua_status_code_1.StatusCodes.BadInternalError;
|
|
43
|
+
}
|
|
57
44
|
}
|
|
58
45
|
exports.confirmCondition = confirmCondition;
|
|
59
46
|
/**
|
|
60
47
|
* Enumerate all events
|
|
61
48
|
* @param session
|
|
62
49
|
*/
|
|
63
|
-
function findActiveConditions(session) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
if (
|
|
106
|
-
|
|
107
|
-
refreshStartEventHasBeenReceived = true;
|
|
108
|
-
}
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
if (pojo.eventType.value.toString() === RefreshEndEventType) {
|
|
112
|
-
RefreshEndEventHasBeenReceived = true;
|
|
113
|
-
resolve();
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
116
|
-
if (!pojo.conditionId.value) {
|
|
117
|
-
// not a Acknowledgeable condition
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
if (pojo.ackedState.id.dataType === node_opcua_variant_1.DataType.Boolean) {
|
|
121
|
-
acknowledgeableConditions.push(pojo);
|
|
50
|
+
async function findActiveConditions(session) {
|
|
51
|
+
const request = {
|
|
52
|
+
maxNotificationsPerPublish: 10000,
|
|
53
|
+
priority: 6,
|
|
54
|
+
publishingEnabled: true,
|
|
55
|
+
requestedLifetimeCount: 1000,
|
|
56
|
+
requestedMaxKeepAliveCount: 100,
|
|
57
|
+
requestedPublishingInterval: 100
|
|
58
|
+
};
|
|
59
|
+
const subscription = await session.createSubscription2(request);
|
|
60
|
+
const itemToMonitor = {
|
|
61
|
+
attributeId: node_opcua_service_read_1.AttributeIds.EventNotifier,
|
|
62
|
+
nodeId: (0, node_opcua_nodeid_1.resolveNodeId)("Server") // i=2253
|
|
63
|
+
};
|
|
64
|
+
const fields = await (0, client_alarm_tools_extractConditionFields_1.extractConditionFields)(session, "AcknowledgeableConditionType");
|
|
65
|
+
// note: we may want to have this select clause
|
|
66
|
+
// Or(OfType("AcknowledgeableConditionType"), OfType("RefreshStartEventType"), OfType("RefreshEndEventType"))
|
|
67
|
+
const eventFilter = (0, node_opcua_service_filter_1.constructEventFilter)(fields);
|
|
68
|
+
const monitoringParameters = {
|
|
69
|
+
discardOldest: false,
|
|
70
|
+
filter: eventFilter,
|
|
71
|
+
queueSize: 100,
|
|
72
|
+
samplingInterval: 0
|
|
73
|
+
};
|
|
74
|
+
const event_monitoringItem = await subscription.monitor(itemToMonitor, monitoringParameters, node_opcua_service_read_1.TimestampsToReturn.Both);
|
|
75
|
+
const acknowledgeableConditions = [];
|
|
76
|
+
let refreshStartEventHasBeenReceived = false;
|
|
77
|
+
let RefreshEndEventHasBeenReceived = false;
|
|
78
|
+
const RefreshStartEventType = (0, node_opcua_nodeid_1.resolveNodeId)("RefreshStartEventType").toString();
|
|
79
|
+
const RefreshEndEventType = (0, node_opcua_nodeid_1.resolveNodeId)("RefreshEndEventType").toString();
|
|
80
|
+
const promise = new Promise((resolve, reject) => {
|
|
81
|
+
// now create a event monitored Item
|
|
82
|
+
event_monitoringItem.on("changed", (_eventFields) => {
|
|
83
|
+
const eventFields = _eventFields;
|
|
84
|
+
try {
|
|
85
|
+
if (RefreshEndEventHasBeenReceived) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
// dumpEvent(session, fields, eventFields);
|
|
89
|
+
const pojo = (0, client_alarm_1.fieldsToJson)(fields, eventFields);
|
|
90
|
+
// make sure we only start recording event after the RefreshStartEvent has been received
|
|
91
|
+
if (!refreshStartEventHasBeenReceived) {
|
|
92
|
+
if (pojo.eventType.value.toString() === RefreshStartEventType) {
|
|
93
|
+
refreshStartEventHasBeenReceived = true;
|
|
122
94
|
}
|
|
95
|
+
return;
|
|
123
96
|
}
|
|
124
|
-
|
|
125
|
-
|
|
97
|
+
if (pojo.eventType.value.toString() === RefreshEndEventType) {
|
|
98
|
+
RefreshEndEventHasBeenReceived = true;
|
|
99
|
+
resolve();
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
if (!pojo.conditionId.value) {
|
|
103
|
+
// not a Acknowledgeable condition
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
if (pojo.ackedState.id.dataType === node_opcua_variant_1.DataType.Boolean) {
|
|
107
|
+
acknowledgeableConditions.push(pojo);
|
|
126
108
|
}
|
|
127
|
-
});
|
|
128
|
-
// async call without waiting !
|
|
129
|
-
try {
|
|
130
|
-
(0, client_tools_1.callConditionRefresh)(subscription);
|
|
131
109
|
}
|
|
132
110
|
catch (err) {
|
|
133
|
-
|
|
134
|
-
debugLog("Server may not implement conditionRefresh", err);
|
|
111
|
+
errorLog("Error !!", err);
|
|
135
112
|
}
|
|
136
113
|
});
|
|
137
|
-
|
|
138
|
-
// now shut down subscription
|
|
139
|
-
yield subscription.terminate();
|
|
140
|
-
return acknowledgeableConditions;
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
exports.findActiveConditions = findActiveConditions;
|
|
144
|
-
function acknowledgeAllConditions(session, message) {
|
|
145
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
114
|
+
// async call without waiting !
|
|
146
115
|
try {
|
|
147
|
-
|
|
148
|
-
if (conditions.length === 0) {
|
|
149
|
-
debugLog("Warning: cannot find conditions ");
|
|
150
|
-
}
|
|
151
|
-
// filter acknowledgeable conditions (no acked yet)
|
|
152
|
-
conditions = conditions.filter((pojo) => pojo.ackedState.id.value === false);
|
|
153
|
-
const promises = [];
|
|
154
|
-
for (const eventStuff of conditions) {
|
|
155
|
-
promises.push(acknowledgeCondition(session, eventStuff, message));
|
|
156
|
-
}
|
|
157
|
-
const result = yield Promise.all(promises);
|
|
158
|
-
// istanbul ignore next
|
|
159
|
-
if (doDebug) {
|
|
160
|
-
debugLog("Acked all results: ", result.map((e) => e.toString()).join(" "));
|
|
161
|
-
}
|
|
116
|
+
(0, client_tools_1.callConditionRefresh)(subscription);
|
|
162
117
|
}
|
|
163
118
|
catch (err) {
|
|
164
|
-
|
|
119
|
+
// it is possible that server do not implement conditionRefresh ...
|
|
120
|
+
debugLog("Server may not implement conditionRefresh", err);
|
|
165
121
|
}
|
|
166
122
|
});
|
|
123
|
+
await promise;
|
|
124
|
+
// now shut down subscription
|
|
125
|
+
await subscription.terminate();
|
|
126
|
+
return acknowledgeableConditions;
|
|
127
|
+
}
|
|
128
|
+
exports.findActiveConditions = findActiveConditions;
|
|
129
|
+
async function acknowledgeAllConditions(session, message) {
|
|
130
|
+
try {
|
|
131
|
+
let conditions = await findActiveConditions(session);
|
|
132
|
+
if (conditions.length === 0) {
|
|
133
|
+
debugLog("Warning: cannot find conditions ");
|
|
134
|
+
}
|
|
135
|
+
// filter acknowledgeable conditions (no acked yet)
|
|
136
|
+
conditions = conditions.filter((pojo) => pojo.ackedState.id.value === false);
|
|
137
|
+
const promises = [];
|
|
138
|
+
for (const eventStuff of conditions) {
|
|
139
|
+
promises.push(acknowledgeCondition(session, eventStuff, message));
|
|
140
|
+
}
|
|
141
|
+
const result = await Promise.all(promises);
|
|
142
|
+
// istanbul ignore next
|
|
143
|
+
if (doDebug) {
|
|
144
|
+
debugLog("Acked all results: ", result.map((e) => e.toString()).join(" "));
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
catch (err) {
|
|
148
|
+
errorLog("Error", err);
|
|
149
|
+
}
|
|
167
150
|
}
|
|
168
151
|
exports.acknowledgeAllConditions = acknowledgeAllConditions;
|
|
169
|
-
function confirmAllConditions(session, message) {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
debugLog("Warning: cannot find conditions ");
|
|
175
|
-
}
|
|
176
|
-
// filter acknowledgeable conditions (no acked yet)
|
|
177
|
-
conditions = conditions.filter((pojo) => pojo.confirmedState.id.value === false);
|
|
178
|
-
const promises = [];
|
|
179
|
-
for (const eventStuff of conditions) {
|
|
180
|
-
promises.push(confirmCondition(session, eventStuff, message));
|
|
181
|
-
}
|
|
182
|
-
const result = yield Promise.all(promises);
|
|
183
|
-
// istanbul ignore next
|
|
184
|
-
if (doDebug) {
|
|
185
|
-
debugLog("Confirm all results: ", result.map((e) => e.toString()).join(" "));
|
|
186
|
-
}
|
|
152
|
+
async function confirmAllConditions(session, message) {
|
|
153
|
+
try {
|
|
154
|
+
let conditions = await findActiveConditions(session);
|
|
155
|
+
if (conditions.length === 0) {
|
|
156
|
+
debugLog("Warning: cannot find conditions ");
|
|
187
157
|
}
|
|
188
|
-
|
|
189
|
-
|
|
158
|
+
// filter acknowledgeable conditions (no acked yet)
|
|
159
|
+
conditions = conditions.filter((pojo) => pojo.confirmedState.id.value === false);
|
|
160
|
+
const promises = [];
|
|
161
|
+
for (const eventStuff of conditions) {
|
|
162
|
+
promises.push(confirmCondition(session, eventStuff, message));
|
|
190
163
|
}
|
|
191
|
-
|
|
164
|
+
const result = await Promise.all(promises);
|
|
165
|
+
// istanbul ignore next
|
|
166
|
+
if (doDebug) {
|
|
167
|
+
debugLog("Confirm all results: ", result.map((e) => e.toString()).join(" "));
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
catch (err) {
|
|
171
|
+
errorLog("Error", err);
|
|
172
|
+
}
|
|
192
173
|
}
|
|
193
174
|
exports.confirmAllConditions = confirmAllConditions;
|
|
194
175
|
//# sourceMappingURL=client_alarm_tools_acknowledge_all_conditions.js.map
|