@bitpoolos/edge-bacnet 1.2.8 → 1.3.1
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/CHANGELOG.md +105 -0
- package/README.md +23 -2
- package/bacnet_client.js +843 -803
- package/bacnet_device.js +132 -60
- package/bacnet_gateway.html +92 -76
- package/bacnet_gateway.js +161 -46
- package/bacnet_read.html +1048 -598
- package/bacnet_read.js +68 -84
- package/bacnet_server.js +270 -205
- package/bacnet_write.html +329 -24
- package/common.js +23 -5
- package/package.json +2 -2
- package/resources/bitArray.js +167 -0
- package/resources/node-bacstack-ts/dist/lib/asn1.js +16 -5
- package/resources/node-bacstack-ts/dist/lib/client.js +6 -7
- package/resources/style.css +321 -0
- package/treeBuilder.js +545 -0
package/bacnet_device.js
CHANGED
|
@@ -2,7 +2,7 @@ class BacnetDevice {
|
|
|
2
2
|
constructor(fromImport, config) {
|
|
3
3
|
let that = this;
|
|
4
4
|
|
|
5
|
-
if(fromImport == true) {
|
|
5
|
+
if (fromImport == true) {
|
|
6
6
|
that.address = config.address;
|
|
7
7
|
that.isMstp = config.isMstp;
|
|
8
8
|
that.deviceId = config.deviceId;
|
|
@@ -14,27 +14,31 @@ class BacnetDevice {
|
|
|
14
14
|
that.pointsList = config.pointsList;
|
|
15
15
|
that.pointListUpdateTs = config.pointListUpdateTs;
|
|
16
16
|
that.manualDiscoveryMode = config.manualDiscoveryMode;
|
|
17
|
-
that.mDiscoverInstanceRange = config.mDiscoverInstanceRange;
|
|
18
17
|
that.pointListRetryCount = config.pointListRetryCount;
|
|
19
18
|
that.priorityQueueIsActive = config.priorityQueueIsActive;
|
|
20
19
|
that.priorityQueue = config.priorityQueue;
|
|
21
20
|
that.lastPriorityQueueTS = config.lastPriorityQueueTS;
|
|
22
21
|
|
|
23
|
-
if(config.childDevices) {
|
|
22
|
+
if (config.childDevices) {
|
|
24
23
|
that.childDevices = config.childDevices;
|
|
25
24
|
} else {
|
|
26
25
|
that.childDevices = [];
|
|
27
26
|
}
|
|
28
27
|
|
|
29
|
-
if(config.parentDeviceId) {
|
|
28
|
+
if (config.parentDeviceId) {
|
|
30
29
|
that.parentDeviceId = config.parentDeviceId;
|
|
31
30
|
} else {
|
|
32
31
|
that.parentDeviceId = null;
|
|
33
32
|
}
|
|
34
33
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
that.displayName = config.displayName;
|
|
35
|
+
that.protocolServicesSupported = config.protocolServicesSupported;
|
|
36
|
+
that.isProtocolServicesSet = config.isProtocolServicesSet;
|
|
37
|
+
that.isInitialQuery = config.isInitialQuery;
|
|
38
|
+
|
|
39
|
+
} else if (fromImport == false) {
|
|
40
|
+
if (config.net && config.adr) {
|
|
41
|
+
that.address = { address: config.address, net: config.net, adr: config.adr };
|
|
38
42
|
that.isMstp = true;
|
|
39
43
|
} else {
|
|
40
44
|
that.address = config.address;
|
|
@@ -49,16 +53,28 @@ class BacnetDevice {
|
|
|
49
53
|
that.pointsList = [];
|
|
50
54
|
that.pointListUpdateTs = null;
|
|
51
55
|
that.manualDiscoveryMode = false;
|
|
52
|
-
that.mDiscoverInstanceRange = {start: 0, end: 100};
|
|
53
56
|
that.pointListRetryCount = 0;
|
|
54
57
|
that.priorityQueueIsActive = false;
|
|
55
58
|
that.priorityQueue = [];
|
|
56
59
|
that.lastPriorityQueueTS = null;
|
|
57
60
|
that.childDevices = [];
|
|
58
61
|
that.parentDeviceId = null;
|
|
62
|
+
that.displayName = null;
|
|
63
|
+
that.protocolServicesSupported = [];
|
|
64
|
+
that.protocolServicesSupported = [];
|
|
65
|
+
that.isProtocolServicesSet = false;
|
|
66
|
+
that.isInitialQuery = true;
|
|
59
67
|
}
|
|
60
68
|
}
|
|
61
69
|
|
|
70
|
+
setDisplayName(displayName) {
|
|
71
|
+
this.displayName = displayName;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
getDisplayName() {
|
|
75
|
+
return this.displayName;
|
|
76
|
+
}
|
|
77
|
+
|
|
62
78
|
setParentDeviceId(deviceId) {
|
|
63
79
|
this.parentDeviceId = deviceId;
|
|
64
80
|
}
|
|
@@ -68,9 +84,9 @@ class BacnetDevice {
|
|
|
68
84
|
}
|
|
69
85
|
|
|
70
86
|
hasChildDevices() {
|
|
71
|
-
if(this.childDevices.length > 0) {
|
|
87
|
+
if (this.childDevices.length > 0) {
|
|
72
88
|
return true;
|
|
73
|
-
} else if(this.childDevices.length == 0) {
|
|
89
|
+
} else if (this.childDevices.length == 0) {
|
|
74
90
|
return false;
|
|
75
91
|
}
|
|
76
92
|
}
|
|
@@ -78,7 +94,7 @@ class BacnetDevice {
|
|
|
78
94
|
addChildDevice(deviceId) {
|
|
79
95
|
let foundIndex = this.childDevices.findIndex(ele => ele == deviceId);
|
|
80
96
|
|
|
81
|
-
if(foundIndex == -1) {
|
|
97
|
+
if (foundIndex == -1) {
|
|
82
98
|
this.childDevices.push(deviceId);
|
|
83
99
|
} else {
|
|
84
100
|
this.childDevices[foundIndex] = deviceId
|
|
@@ -88,7 +104,7 @@ class BacnetDevice {
|
|
|
88
104
|
getChildDevice(deviceId) {
|
|
89
105
|
let foundIndex = this.childDevices.findIndex(ele => ele == deviceId);
|
|
90
106
|
|
|
91
|
-
if(foundIndex !== -1) return this.childDevices[foundIndex];
|
|
107
|
+
if (foundIndex !== -1) return this.childDevices[foundIndex];
|
|
92
108
|
|
|
93
109
|
return null;
|
|
94
110
|
}
|
|
@@ -104,7 +120,7 @@ class BacnetDevice {
|
|
|
104
120
|
getLastPriorityQueueTS() {
|
|
105
121
|
return this.lastPriorityQueueTS;
|
|
106
122
|
}
|
|
107
|
-
|
|
123
|
+
|
|
108
124
|
setPriorityQueueIsActive(bool) {
|
|
109
125
|
this.priorityQueueIsActive = bool;
|
|
110
126
|
}
|
|
@@ -115,14 +131,14 @@ class BacnetDevice {
|
|
|
115
131
|
|
|
116
132
|
updatePriorityQueue(point) {
|
|
117
133
|
let foundIndex = this.priorityQueue.findIndex(ele => ele.value.type == point.value.type && ele.value.instance == point.value.instance);
|
|
118
|
-
if(foundIndex == -1
|
|
134
|
+
if (foundIndex == -1) {
|
|
119
135
|
//not found
|
|
120
136
|
this.priorityQueue.push(point);
|
|
121
137
|
}
|
|
122
138
|
|
|
123
|
-
if(this.priorityQueue.length > 0) {
|
|
139
|
+
if (this.priorityQueue.length > 0) {
|
|
124
140
|
this.setPriorityQueueIsActive(true);
|
|
125
|
-
} else if(this.priorityQueue.length == 0) {
|
|
141
|
+
} else if (this.priorityQueue.length == 0) {
|
|
126
142
|
this.setPriorityQueueIsActive(false);
|
|
127
143
|
}
|
|
128
144
|
}
|
|
@@ -130,20 +146,20 @@ class BacnetDevice {
|
|
|
130
146
|
setPriorityQueue(points) {
|
|
131
147
|
let queue = [];
|
|
132
148
|
let keys = Object.keys(points);
|
|
133
|
-
if(keys.length > 0) {
|
|
134
|
-
keys.forEach(function(key) {
|
|
149
|
+
if (keys.length > 0) {
|
|
150
|
+
keys.forEach(function (key) {
|
|
135
151
|
let point = points[key];
|
|
136
|
-
let pointRequestObject = {type: 12, value: point.meta.objectId}
|
|
152
|
+
let pointRequestObject = { type: 12, value: point.meta.objectId }
|
|
137
153
|
queue.push(pointRequestObject);
|
|
138
154
|
});
|
|
139
155
|
this.priorityQueue = queue;
|
|
140
156
|
this.setPriorityQueueIsActive(true);
|
|
141
|
-
} else if(keys.length == 0) {
|
|
157
|
+
} else if (keys.length == 0) {
|
|
142
158
|
this.setPriorityQueueIsActive(false);
|
|
143
159
|
}
|
|
144
160
|
}
|
|
145
161
|
|
|
146
|
-
getPriorityQueue(){
|
|
162
|
+
getPriorityQueue() {
|
|
147
163
|
return this.priorityQueue;
|
|
148
164
|
}
|
|
149
165
|
|
|
@@ -153,17 +169,17 @@ class BacnetDevice {
|
|
|
153
169
|
}
|
|
154
170
|
|
|
155
171
|
updateDeviceConfig(config) {
|
|
156
|
-
if(config.address !== "" && config.address !== null && config.address !== "undefined") {
|
|
157
|
-
if(config.net && config.adr) {
|
|
158
|
-
this.address = {address: config.address, net: config.net, adr: config.adr};
|
|
172
|
+
if (config.address !== "" && config.address !== null && config.address !== "undefined") {
|
|
173
|
+
if (config.net && config.adr) {
|
|
174
|
+
this.address = { address: config.address, net: config.net, adr: config.adr };
|
|
159
175
|
} else {
|
|
160
176
|
this.address = config.address;
|
|
161
177
|
}
|
|
162
178
|
}
|
|
163
|
-
if(Number.isInteger(config.deviceId)) this.deviceId = config.deviceId;
|
|
164
|
-
if(Number.isInteger(config.maxApdu)) this.maxApdu = config.maxApdu;
|
|
165
|
-
if(Number.isInteger(config.segmentation)) this.segmentation = config.segmentation;
|
|
166
|
-
if(Number.isInteger(config.vendorId)) this.vendorId = config.vendorId;
|
|
179
|
+
if (Number.isInteger(config.deviceId)) this.deviceId = config.deviceId;
|
|
180
|
+
if (Number.isInteger(config.maxApdu)) this.maxApdu = config.maxApdu;
|
|
181
|
+
if (Number.isInteger(config.segmentation)) this.segmentation = config.segmentation;
|
|
182
|
+
if (Number.isInteger(config.vendorId)) this.vendorId = config.vendorId;
|
|
167
183
|
}
|
|
168
184
|
|
|
169
185
|
getPointListRetryCount() {
|
|
@@ -178,25 +194,6 @@ class BacnetDevice {
|
|
|
178
194
|
this.pointListRetryCount = 0;
|
|
179
195
|
}
|
|
180
196
|
|
|
181
|
-
getmDiscoverInstanceRange() {
|
|
182
|
-
return this.mDiscoverInstanceRange;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
setmDiscoverInstanceRange(range) {
|
|
186
|
-
this.mDiscoverInstanceRange = range;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
updatemDiscoverInstanceRange(position, value) {
|
|
190
|
-
this.mDiscoverInstanceRange[position] = value;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
shouldBeInManualMode() {
|
|
194
|
-
if(this.mDiscoverInstanceRange.start >= 1000000 || this.mDiscoverInstanceRange.end >= 1000000) {
|
|
195
|
-
return false;
|
|
196
|
-
}
|
|
197
|
-
return true;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
197
|
setManualDiscoveryMode(bool) {
|
|
201
198
|
this.manualDiscoveryMode = bool;
|
|
202
199
|
}
|
|
@@ -218,14 +215,29 @@ class BacnetDevice {
|
|
|
218
215
|
}
|
|
219
216
|
|
|
220
217
|
setPointsList(newPoints) {
|
|
221
|
-
for(let index = 0; index < newPoints.length; index
|
|
218
|
+
for (let index = 0; index < newPoints.length; index++) {
|
|
222
219
|
let newPoint = newPoints[index];
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
220
|
+
if (newPoint) {
|
|
221
|
+
let foundIndex = this.pointsList.findIndex(ele => ele.value.type == newPoint.value.type && ele.value.instance == newPoint.value.instance);
|
|
222
|
+
if (foundIndex == -1) {
|
|
223
|
+
//not found
|
|
224
|
+
this.pointsList.push(newPoint);
|
|
225
|
+
}
|
|
227
226
|
}
|
|
228
227
|
}
|
|
228
|
+
|
|
229
|
+
this.pointsList = this.pointsList.filter((point) =>
|
|
230
|
+
point.value.type == 8 || //DEVICE
|
|
231
|
+
point.value.type == 0 || //AI
|
|
232
|
+
point.value.type == 1 || //AV
|
|
233
|
+
point.value.type == 2 || //AO
|
|
234
|
+
point.value.type == 3 || //BI
|
|
235
|
+
point.value.type == 4 || //BV
|
|
236
|
+
point.value.type == 5 || //BO
|
|
237
|
+
point.value.type == 13 || //MSI
|
|
238
|
+
point.value.type == 14 || //MSO
|
|
239
|
+
point.value.type == 19 //MSV
|
|
240
|
+
);
|
|
229
241
|
}
|
|
230
242
|
|
|
231
243
|
getDevicePoints() {
|
|
@@ -236,7 +248,7 @@ class BacnetDevice {
|
|
|
236
248
|
return this.address;
|
|
237
249
|
}
|
|
238
250
|
|
|
239
|
-
setAddress(address){
|
|
251
|
+
setAddress(address) {
|
|
240
252
|
this.address = address;
|
|
241
253
|
}
|
|
242
254
|
|
|
@@ -244,7 +256,7 @@ class BacnetDevice {
|
|
|
244
256
|
return this.deviceId;
|
|
245
257
|
}
|
|
246
258
|
|
|
247
|
-
setDeviceId(deviceId){
|
|
259
|
+
setDeviceId(deviceId) {
|
|
248
260
|
this.deviceId = deviceId;
|
|
249
261
|
}
|
|
250
262
|
|
|
@@ -252,7 +264,7 @@ class BacnetDevice {
|
|
|
252
264
|
return this.maxApdu;
|
|
253
265
|
}
|
|
254
266
|
|
|
255
|
-
setMaxApdu(maxApdu){
|
|
267
|
+
setMaxApdu(maxApdu) {
|
|
256
268
|
this.maxApdu = maxApdu;
|
|
257
269
|
}
|
|
258
270
|
|
|
@@ -260,7 +272,7 @@ class BacnetDevice {
|
|
|
260
272
|
return this.segmentation;
|
|
261
273
|
}
|
|
262
274
|
|
|
263
|
-
setSegmentation(segmentation){
|
|
275
|
+
setSegmentation(segmentation) {
|
|
264
276
|
this.segmentation = segmentation;
|
|
265
277
|
}
|
|
266
278
|
|
|
@@ -268,7 +280,7 @@ class BacnetDevice {
|
|
|
268
280
|
return this.vendorId;
|
|
269
281
|
}
|
|
270
282
|
|
|
271
|
-
setVendorId(vendorId){
|
|
283
|
+
setVendorId(vendorId) {
|
|
272
284
|
this.vendorId = vendorId;
|
|
273
285
|
}
|
|
274
286
|
|
|
@@ -276,7 +288,7 @@ class BacnetDevice {
|
|
|
276
288
|
return this.lastSeen;
|
|
277
289
|
}
|
|
278
290
|
|
|
279
|
-
setLastSeen(lastSeen){
|
|
291
|
+
setLastSeen(lastSeen) {
|
|
280
292
|
this.lastSeen = lastSeen;
|
|
281
293
|
}
|
|
282
294
|
|
|
@@ -284,14 +296,74 @@ class BacnetDevice {
|
|
|
284
296
|
return this.deviceName;
|
|
285
297
|
}
|
|
286
298
|
|
|
287
|
-
setDeviceName(deviceName){
|
|
299
|
+
setDeviceName(deviceName) {
|
|
288
300
|
this.deviceName = deviceName;
|
|
301
|
+
|
|
302
|
+
if (this.getDisplayName() == null) {
|
|
303
|
+
this.setDisplayName(deviceName);
|
|
304
|
+
}
|
|
289
305
|
}
|
|
290
306
|
|
|
291
|
-
getIsMstpDevice(){
|
|
307
|
+
getIsMstpDevice() {
|
|
292
308
|
return this.isMstp;
|
|
293
309
|
}
|
|
294
310
|
|
|
311
|
+
getIsProtocolServicesSet() {
|
|
312
|
+
return this.isProtocolServicesSet;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
setIsProtocolServicesSet(boolean) {
|
|
316
|
+
this.isProtocolServicesSet = boolean;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
getProtocolServicesSupported() {
|
|
320
|
+
return this.protocolServicesSupported;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
setProtocolServicesSupported(bitArray) {
|
|
324
|
+
let position = 0;
|
|
325
|
+
for (let i = 0; i < bitArray.length; i++) {
|
|
326
|
+
let bitString = bitArray[i];
|
|
327
|
+
for (let x = 0; x < bitString.length; x++) {
|
|
328
|
+
let bit = bitString[x];
|
|
329
|
+
this.protocolServicesSupported[position] = bit;
|
|
330
|
+
position++;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
this.setIsProtocolServicesSet(true);
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
getProtocolServiceSupport(protocol) {
|
|
337
|
+
switch (protocol) {
|
|
338
|
+
case "ReadPropertyMultiple":
|
|
339
|
+
if (this.protocolServicesSupported[14] == '1') {
|
|
340
|
+
return true;
|
|
341
|
+
} else if (this.protocolServicesSupported[14] == '0') {
|
|
342
|
+
return false;
|
|
343
|
+
}
|
|
344
|
+
break;
|
|
345
|
+
|
|
346
|
+
default:
|
|
347
|
+
return false;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
getMstpNetworkNumber() {
|
|
352
|
+
if (this.isMstp) {
|
|
353
|
+
return this.address.net;
|
|
354
|
+
} else {
|
|
355
|
+
return false;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
getIsInitialQuery() {
|
|
360
|
+
return this.isInitialQuery;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
setIsInitialQuery(bool) {
|
|
364
|
+
this.isInitialQuery = bool;
|
|
365
|
+
}
|
|
366
|
+
|
|
295
367
|
}
|
|
296
368
|
|
|
297
369
|
module.exports = { BacnetDevice };
|
package/bacnet_gateway.html
CHANGED
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
// async load as in your code
|
|
53
53
|
function LoadScriptsAsync(_scripts, scripts) {
|
|
54
54
|
for (var i = 0; i < _scripts.length; i++) {
|
|
55
|
-
loadScript(_scripts[i], scripts[i], function () {});
|
|
55
|
+
loadScript(_scripts[i], scripts[i], function () { });
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
|
|
@@ -84,7 +84,57 @@
|
|
|
84
84
|
return fetch("/bitpool-bacnet-data/clearBacnetServerPoints").then((res) => res.json());
|
|
85
85
|
}
|
|
86
86
|
getBacnetServerPoints() {
|
|
87
|
-
|
|
87
|
+
return fetch('/bitpool-bacnet-data/getBacnetServerPoints').then(res => res.json());
|
|
88
|
+
}
|
|
89
|
+
purgeDevice(device) {
|
|
90
|
+
return fetch('/bitpool-bacnet-data/purgeDevice', {
|
|
91
|
+
method: 'POST',
|
|
92
|
+
headers: {
|
|
93
|
+
'Accept': 'application/json',
|
|
94
|
+
'Content-Type': 'application/json'
|
|
95
|
+
},
|
|
96
|
+
body: JSON.stringify({ d: device })
|
|
97
|
+
}).then(res => res.json());
|
|
98
|
+
}
|
|
99
|
+
updatePointsForDevice(device) {
|
|
100
|
+
return fetch('/bitpool-bacnet-data/updatePointsForDevice', {
|
|
101
|
+
method: 'POST',
|
|
102
|
+
headers: {
|
|
103
|
+
'Accept': 'application/json',
|
|
104
|
+
'Content-Type': 'application/json'
|
|
105
|
+
},
|
|
106
|
+
body: JSON.stringify({ d: device })
|
|
107
|
+
}).then(res => res.json());
|
|
108
|
+
}
|
|
109
|
+
setDeviceDisplayName(device, displayName) {
|
|
110
|
+
return fetch('/bitpool-bacnet-data/setDeviceDisplayName', {
|
|
111
|
+
method: 'POST',
|
|
112
|
+
headers: {
|
|
113
|
+
'Accept': 'application/json',
|
|
114
|
+
'Content-Type': 'application/json'
|
|
115
|
+
},
|
|
116
|
+
body: JSON.stringify({ d: device, n: displayName })
|
|
117
|
+
}).then(res => res.json());
|
|
118
|
+
}
|
|
119
|
+
setPointDisplayName(deviceKey, pointName, pointDisplayName) {
|
|
120
|
+
return fetch('/bitpool-bacnet-data/setPointDisplayName', {
|
|
121
|
+
method: 'POST',
|
|
122
|
+
headers: {
|
|
123
|
+
'Accept': 'application/json',
|
|
124
|
+
'Content-Type': 'application/json'
|
|
125
|
+
},
|
|
126
|
+
body: JSON.stringify({ k: deviceKey, p: pointName, n: pointDisplayName })
|
|
127
|
+
}).then(res => res.json());
|
|
128
|
+
}
|
|
129
|
+
importReadList(payload) {
|
|
130
|
+
return fetch('/bitpool-bacnet-data/importReadList', {
|
|
131
|
+
method: 'POST',
|
|
132
|
+
headers: {
|
|
133
|
+
'Accept': 'application/json',
|
|
134
|
+
'Content-Type': 'application/json'
|
|
135
|
+
},
|
|
136
|
+
body: JSON.stringify({ p: payload })
|
|
137
|
+
}).then(res => res.json());
|
|
88
138
|
}
|
|
89
139
|
}
|
|
90
140
|
RED.nodes.registerType("Bacnet-Gateway", {
|
|
@@ -101,23 +151,20 @@
|
|
|
101
151
|
retries: { value: "5", required: true },
|
|
102
152
|
broadCastAddr: { value: "255.255.255.255", required: true },
|
|
103
153
|
toLogIam: { value: false },
|
|
104
|
-
discover_polling_schedule: { value: "
|
|
105
|
-
discover_polling_schedule_value: { value: "
|
|
154
|
+
discover_polling_schedule: { value: "900" },
|
|
155
|
+
discover_polling_schedule_value: { value: "15", required: true },
|
|
106
156
|
discover_polling_schedule_options: { value: "Minutes", required: true },
|
|
107
157
|
deviceId: { value: 817001, required: true },
|
|
108
|
-
manual_instance_range_enabled: { value: false },
|
|
109
|
-
manual_instance_range_start: { value: 0 },
|
|
110
|
-
manual_instance_range_end: { value: 10000 },
|
|
111
158
|
logErrorToConsole: { value: false },
|
|
112
|
-
serverEnabled: { value:
|
|
113
|
-
device_read_schedule: { value: "
|
|
114
|
-
device_read_schedule_value: { value: "
|
|
159
|
+
serverEnabled: { value: true },
|
|
160
|
+
device_read_schedule: { value: "900" },
|
|
161
|
+
device_read_schedule_value: { value: "15", required: true },
|
|
115
162
|
device_read_schedule_options: { value: "Minutes", required: true },
|
|
116
163
|
deviceRangeRegisters: { value: [] },
|
|
117
|
-
cacheFileEnabled: {value: false, required: true},
|
|
118
|
-
sanitise_device_schedule: { value: "60" },
|
|
119
|
-
sanitise_device_schedule_value: { value: "1", required:
|
|
120
|
-
sanitise_device_schedule_options: { value: "Hours", required:
|
|
164
|
+
cacheFileEnabled: { value: false, required: true },
|
|
165
|
+
sanitise_device_schedule: { value: "60", required: false },
|
|
166
|
+
sanitise_device_schedule_value: { value: "1", required: false },
|
|
167
|
+
sanitise_device_schedule_options: { value: "Hours", required: false },
|
|
121
168
|
},
|
|
122
169
|
networkInterfaces: [],
|
|
123
170
|
inputs: 1,
|
|
@@ -190,29 +237,9 @@
|
|
|
190
237
|
|
|
191
238
|
queryAdapters();
|
|
192
239
|
|
|
193
|
-
function setManualInstanceRangeState(state) {
|
|
194
|
-
let deviceIdRangeStart = $("#node-input-manual_instance_range_start");
|
|
195
|
-
let deviceIdRangeEnd = $("#node-input-manual_instance_range_end");
|
|
196
|
-
if (state == true) {
|
|
197
|
-
deviceIdRangeStart.removeAttr("readonly");
|
|
198
|
-
deviceIdRangeEnd.removeAttr("readonly");
|
|
199
|
-
} else if (state == false) {
|
|
200
|
-
deviceIdRangeStart.attr("readonly", true);
|
|
201
|
-
deviceIdRangeEnd.attr("readonly", true);
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
setManualInstanceRangeState(node.manual_instance_range_enabled);
|
|
206
|
-
|
|
207
|
-
$("#node-input-manual_instance_range_enabled").change(function (e) {
|
|
208
|
-
setManualInstanceRangeState(this.checked);
|
|
209
|
-
});
|
|
210
|
-
|
|
211
240
|
if (node.vm1 == undefined) {
|
|
212
241
|
const confirmDialog = document.createElement("p-confirm-dialog");
|
|
213
242
|
document.getElementById("serverParent").appendChild(confirmDialog);
|
|
214
|
-
//document.getElementById("clearServerContainer").appendChild(confirmDialog);
|
|
215
|
-
|
|
216
243
|
}
|
|
217
244
|
|
|
218
245
|
const { createApp, ref, onMounted } = Vue;
|
|
@@ -230,7 +257,7 @@
|
|
|
230
257
|
};
|
|
231
258
|
},
|
|
232
259
|
mounted() {
|
|
233
|
-
|
|
260
|
+
this.getServerObjects();
|
|
234
261
|
},
|
|
235
262
|
methods: {
|
|
236
263
|
confirmAll(event) {
|
|
@@ -242,7 +269,7 @@
|
|
|
242
269
|
acceptClass: "p-button-danger",
|
|
243
270
|
accept: () => {
|
|
244
271
|
//handle accept
|
|
245
|
-
this.nodeService.clearBacnetServerPoints().then(function() {
|
|
272
|
+
this.nodeService.clearBacnetServerPoints().then(function () {
|
|
246
273
|
app.getServerObjects();
|
|
247
274
|
});
|
|
248
275
|
},
|
|
@@ -253,41 +280,41 @@
|
|
|
253
280
|
},
|
|
254
281
|
confirm(json) {
|
|
255
282
|
this.$confirm.require({
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
283
|
+
message: 'Do you want to clear this BACnet server point? This action is not reversible',
|
|
284
|
+
header: 'Delete Confirmation',
|
|
285
|
+
icon: 'pi pi-info-circle',
|
|
286
|
+
acceptClass: 'p-button-danger',
|
|
287
|
+
accept: () => {
|
|
288
|
+
//handle accept
|
|
289
|
+
let app = this;
|
|
290
|
+
$.ajax({
|
|
291
|
+
type: "POST",
|
|
292
|
+
url: '/bitpool-bacnet-data/clearBacnetServerPoint',
|
|
293
|
+
dataType: 'json',
|
|
294
|
+
contentType: 'application/json',
|
|
295
|
+
data: JSON.stringify(json),
|
|
296
|
+
success: function (result) {
|
|
297
|
+
app.getServerObjects();
|
|
298
|
+
},
|
|
299
|
+
timeout: 10000
|
|
300
|
+
});
|
|
301
|
+
},
|
|
302
|
+
reject: () => {
|
|
303
|
+
//handle reject
|
|
304
|
+
}
|
|
278
305
|
});
|
|
279
306
|
},
|
|
280
307
|
getServerObjects() {
|
|
281
308
|
let app = this;
|
|
282
309
|
this.nodeService.getBacnetServerPoints().then(function (result) {
|
|
283
|
-
|
|
310
|
+
app.serverObjects = result;
|
|
284
311
|
})
|
|
285
312
|
},
|
|
286
313
|
formatObjectName(name) {
|
|
287
314
|
//return shortened point name if longer than 50 characters
|
|
288
|
-
if(name.length > 45) {
|
|
315
|
+
if (name.length > 45) {
|
|
289
316
|
return name.slice(0, 45).concat("...");
|
|
290
|
-
}
|
|
317
|
+
}
|
|
291
318
|
return name;
|
|
292
319
|
}
|
|
293
320
|
},
|
|
@@ -319,7 +346,7 @@
|
|
|
319
346
|
dataType: "json",
|
|
320
347
|
contentType: "application/json",
|
|
321
348
|
data: JSON.stringify(jsonPayload),
|
|
322
|
-
success: function (result) {},
|
|
349
|
+
success: function (result) { },
|
|
323
350
|
timeout: 10000,
|
|
324
351
|
});
|
|
325
352
|
};
|
|
@@ -674,7 +701,7 @@
|
|
|
674
701
|
</select>
|
|
675
702
|
</div>
|
|
676
703
|
|
|
677
|
-
<div class="form-row">
|
|
704
|
+
<div class="form-row" style="display: none;">
|
|
678
705
|
<label for="node-input-retries"
|
|
679
706
|
><i class="icon-tag"></i> <span data-i18n="bitpool-bacnet.label.retries"></span>Number of Retries</label
|
|
680
707
|
>
|
|
@@ -713,17 +740,6 @@
|
|
|
713
740
|
</select>
|
|
714
741
|
</div>
|
|
715
742
|
|
|
716
|
-
<div class="form-row deviceIdRange">
|
|
717
|
-
<label for="node-input-device_id_range"
|
|
718
|
-
><i class="icon-tag"></i><span data-i18n="bitpool-bacnet.label.device_id_range"></span>Point Discovery Range
|
|
719
|
-
</label>
|
|
720
|
-
<input type="checkbox" id="node-input-manual_instance_range_enabled" style="width: auto;" />
|
|
721
|
-
<a style="padding-left: 60px;">Start: </a
|
|
722
|
-
><input type="number" id="node-input-manual_instance_range_start" style="width: 125px;" min="0" max="100000" />
|
|
723
|
-
<a style="padding-left: 35px;">End: </a
|
|
724
|
-
><input type="number" id="node-input-manual_instance_range_end" style="width: 125px;" min="1" max="100000" />
|
|
725
|
-
</div>
|
|
726
|
-
|
|
727
743
|
<div class="form-row" style="align-items: center; display: flex;">
|
|
728
744
|
<label for="node-input-device_read_schedule_value"
|
|
729
745
|
><i class="icon-tag"></i> <span data-i18n="bitpool-bacnet.label.device_read_schedule"></span>Object Discover
|
|
@@ -744,7 +760,7 @@
|
|
|
744
760
|
</select>
|
|
745
761
|
</div>
|
|
746
762
|
|
|
747
|
-
<div class="form-row" style="align-items: center; display:
|
|
763
|
+
<div class="form-row" style="align-items: center; display: none;">
|
|
748
764
|
<label for="node-input-sanitise_device_schedule_value"
|
|
749
765
|
><i class="icon-tag"></i> <span data-i18n="bitpool-bacnet.label.sanitise_device_schedule"></span>Device Sanitisation
|
|
750
766
|
Frequency</label
|
|
@@ -900,4 +916,4 @@
|
|
|
900
916
|
<li><a href="https://wiki.bitpool.com/">wiki.bitpool.com</a> - find more documentation.</li>
|
|
901
917
|
<li><a href="https://bacnet.org/">BACnet</a> - find more about the protocol.</li>
|
|
902
918
|
</ul>
|
|
903
|
-
</script>
|
|
919
|
+
</script>
|