@halsystems/red-bacnet 1.1.1 → 1.1.3
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
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.1.3]
|
|
4
|
+
### Change
|
|
5
|
+
- ReadPoint and WritePoint input schema to strip unknown properties instead of rejecting them
|
|
6
|
+
|
|
7
|
+
## [1.1.2]
|
|
8
|
+
### Change
|
|
9
|
+
- WritePoint to not fail if point not found in points config, only raise error
|
|
10
|
+
|
|
3
11
|
## [1.1.1]
|
|
4
12
|
### Added
|
|
5
13
|
- Unit test for BACnet string points
|
package/common/bacnet.js
CHANGED
package/common/job/read_point.js
CHANGED
|
@@ -96,7 +96,11 @@ module.exports = {
|
|
|
96
96
|
|
|
97
97
|
this.devices.forEach(d => {
|
|
98
98
|
// validate device schema
|
|
99
|
-
const { error } = bacnetDeviceSchema.validate(
|
|
99
|
+
const { error } = bacnetDeviceSchema.validate(
|
|
100
|
+
d,
|
|
101
|
+
{ stripUnknown: true }
|
|
102
|
+
);
|
|
103
|
+
|
|
100
104
|
if (error) {
|
|
101
105
|
deviceSchemaErrList.push(error);
|
|
102
106
|
return
|
|
@@ -132,7 +136,10 @@ module.exports = {
|
|
|
132
136
|
const dupPointNames = [];
|
|
133
137
|
this.points.forEach(p => {
|
|
134
138
|
// validate point schema
|
|
135
|
-
const { error } = bacnetPointSchema.validate(
|
|
139
|
+
const { error } = bacnetPointSchema.validate(
|
|
140
|
+
p,
|
|
141
|
+
{ stripUnknown: true }
|
|
142
|
+
);
|
|
136
143
|
if (error) {
|
|
137
144
|
pointSchemaErrList.push(error);
|
|
138
145
|
return
|
|
@@ -221,7 +228,7 @@ module.exports = {
|
|
|
221
228
|
task: async () => {
|
|
222
229
|
return await smartReadProperty(
|
|
223
230
|
this.client, v.device, v.points, this.readMethod,
|
|
224
|
-
this.maxConcurrentSinglePointRead,
|
|
231
|
+
this.maxConcurrentSinglePointRead, 10, this.concurrentTaskDelay
|
|
225
232
|
);
|
|
226
233
|
}
|
|
227
234
|
}));
|
|
@@ -116,7 +116,10 @@ module.exports = {
|
|
|
116
116
|
const dupDeviceNames = [];
|
|
117
117
|
this.devices.forEach(d => {
|
|
118
118
|
// validate device schema
|
|
119
|
-
const { error } = bacnetDeviceSchema.validate(
|
|
119
|
+
const { error } = bacnetDeviceSchema.validate(
|
|
120
|
+
d,
|
|
121
|
+
{ stripUnknown: true }
|
|
122
|
+
);
|
|
120
123
|
if (error) {
|
|
121
124
|
deviceSchemaErrList.push(error);
|
|
122
125
|
return
|
|
@@ -152,7 +155,10 @@ module.exports = {
|
|
|
152
155
|
const dupPointNames = [];
|
|
153
156
|
this.points.forEach(p => {
|
|
154
157
|
// validate point schema
|
|
155
|
-
const { error } = bacnetPointSchema.validate(
|
|
158
|
+
const { error } = bacnetPointSchema.validate(
|
|
159
|
+
p,
|
|
160
|
+
{ stripUnknown: true }
|
|
161
|
+
);
|
|
156
162
|
if (error) {
|
|
157
163
|
pointSchemaErrList.push(error);
|
|
158
164
|
return
|
|
@@ -233,10 +239,14 @@ module.exports = {
|
|
|
233
239
|
});
|
|
234
240
|
|
|
235
241
|
if (missingPoints.length > 0) {
|
|
242
|
+
// do not fail writing, just log the missing points and remove them from writePoints
|
|
236
243
|
this.eventEmitter.emit(EVENT_ERROR, errMsg(
|
|
237
244
|
this.name, ERR_WRITE_POINT_NOT_FOUND, missingPoints
|
|
238
245
|
))
|
|
239
|
-
|
|
246
|
+
|
|
247
|
+
missingPoints.forEach(point => {
|
|
248
|
+
delete this.writePointDetails[point];
|
|
249
|
+
});
|
|
240
250
|
}
|
|
241
251
|
|
|
242
252
|
if (priorityErrList.length > 0) {
|
|
@@ -304,4 +314,4 @@ module.exports = {
|
|
|
304
314
|
}
|
|
305
315
|
|
|
306
316
|
}
|
|
307
|
-
}
|
|
317
|
+
}
|
|
@@ -46,6 +46,7 @@ const decode = (buffer, offset) => {
|
|
|
46
46
|
if (isValidIp && isValidPort && !isBroadcast && !isMulticast && !isZero) {
|
|
47
47
|
const ip = ipParts.join(".");
|
|
48
48
|
linkAddress = (port === 47808) ? ip : `${ip}:${port}`;
|
|
49
|
+
// linkAddress = `${ip}:${port}`;
|
|
49
50
|
}
|
|
50
51
|
}
|
|
51
52
|
break;
|
|
@@ -14,6 +14,7 @@ class Transport extends events_1.EventEmitter {
|
|
|
14
14
|
this._server.on('message', (msg, rinfo) => {
|
|
15
15
|
// NOTE HAL modified
|
|
16
16
|
const port = rinfo.port || DEFAULT_BACNET_PORT;
|
|
17
|
+
// this.emit('message', msg, `${rinfo.address}:${port}`);
|
|
17
18
|
if (port === DEFAULT_BACNET_PORT)
|
|
18
19
|
this.emit('message', msg, rinfo.address);
|
|
19
20
|
else
|