node-red-contrib-lorawan-bacnet-server 1.2.2 → 1.2.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/node-red-contrib-lorawan-bacnet-server-1.2.2-bundle.tgz +0 -0
- package/node-red-contrib-lorawan-bacnet-server-1.2.2.tgz +0 -0
- package/nodes/bacnet-server/bacnet-server.js +27 -26
- package/package.json +1 -1
- package/bacnet-scanner.tgz +0 -0
- package/node-red-contrib-lorawan-bacnet-server-1.2.1-bundle.tgz +0 -0
- package/node-red-contrib-lorawan-bacnet-server-1.2.1.tgz +0 -0
|
Binary file
|
|
Binary file
|
|
@@ -168,22 +168,22 @@ module.exports = function (RED) {
|
|
|
168
168
|
node.vendorId
|
|
169
169
|
);
|
|
170
170
|
|
|
171
|
-
node.debug(`Responded to Who-Is from ${data.address}`);
|
|
171
|
+
node.debug(`Responded to Who-Is from ${data.header?.sender?.address || 'broadcast'}`);
|
|
172
172
|
}
|
|
173
173
|
};
|
|
174
174
|
|
|
175
175
|
// Handle Read Property requests
|
|
176
176
|
node.handleReadProperty = function (data) {
|
|
177
|
-
const objectId = data.
|
|
178
|
-
const propertyId = data.
|
|
179
|
-
const arrayIndex = data.
|
|
177
|
+
const objectId = data.payload.objectId;
|
|
178
|
+
const propertyId = data.payload.property.id;
|
|
179
|
+
const arrayIndex = data.payload.property.index;
|
|
180
180
|
|
|
181
181
|
try {
|
|
182
182
|
const value = node.getPropertyValue(objectId, propertyId, arrayIndex);
|
|
183
183
|
|
|
184
184
|
if (value !== null && value !== undefined) {
|
|
185
185
|
node.client.readPropertyResponse(
|
|
186
|
-
data.
|
|
186
|
+
data.header.sender,
|
|
187
187
|
data.invokeId,
|
|
188
188
|
objectId,
|
|
189
189
|
{ id: propertyId, index: arrayIndex },
|
|
@@ -197,7 +197,7 @@ module.exports = function (RED) {
|
|
|
197
197
|
}
|
|
198
198
|
} else {
|
|
199
199
|
node.client.errorResponse(
|
|
200
|
-
data.
|
|
200
|
+
data.header.sender,
|
|
201
201
|
bacnet.enum.ConfirmedService.READ_PROPERTY,
|
|
202
202
|
data.invokeId,
|
|
203
203
|
bacnet.enum.ErrorClass.PROPERTY,
|
|
@@ -207,7 +207,7 @@ module.exports = function (RED) {
|
|
|
207
207
|
} catch (err) {
|
|
208
208
|
node.error(`Read Property error: ${err.message}`);
|
|
209
209
|
node.client.errorResponse(
|
|
210
|
-
data.
|
|
210
|
+
data.header.sender,
|
|
211
211
|
bacnet.enum.ConfirmedService.READ_PROPERTY,
|
|
212
212
|
data.invokeId,
|
|
213
213
|
bacnet.enum.ErrorClass.OBJECT,
|
|
@@ -218,17 +218,17 @@ module.exports = function (RED) {
|
|
|
218
218
|
|
|
219
219
|
// Handle Write Property requests
|
|
220
220
|
node.handleWriteProperty = function (data) {
|
|
221
|
-
const objectId = data.
|
|
222
|
-
const propertyId = data.
|
|
223
|
-
const priority = data.
|
|
224
|
-
const value = data.
|
|
221
|
+
const objectId = data.payload.objectId;
|
|
222
|
+
const propertyId = data.payload.property.id;
|
|
223
|
+
const priority = data.payload.priority || 16;
|
|
224
|
+
const value = data.payload.value;
|
|
225
225
|
|
|
226
226
|
try {
|
|
227
227
|
const result = node.setPropertyValue(objectId, propertyId, value, priority);
|
|
228
228
|
|
|
229
229
|
if (result.success) {
|
|
230
230
|
node.client.simpleAckResponse(
|
|
231
|
-
data.
|
|
231
|
+
data.header.sender,
|
|
232
232
|
bacnet.enum.ConfirmedService.WRITE_PROPERTY,
|
|
233
233
|
data.invokeId
|
|
234
234
|
);
|
|
@@ -236,14 +236,14 @@ module.exports = function (RED) {
|
|
|
236
236
|
// Notify point node
|
|
237
237
|
const pointNode = node.getPointNode(objectId);
|
|
238
238
|
if (pointNode) {
|
|
239
|
-
pointNode.emitWriteEvent(result.value, priority, data.address);
|
|
239
|
+
pointNode.emitWriteEvent(result.value, priority, data.header.sender.address);
|
|
240
240
|
}
|
|
241
241
|
|
|
242
242
|
// Check COV notifications
|
|
243
243
|
node.checkCovNotifications(objectId);
|
|
244
244
|
} else {
|
|
245
245
|
node.client.errorResponse(
|
|
246
|
-
data.
|
|
246
|
+
data.header.sender,
|
|
247
247
|
bacnet.enum.ConfirmedService.WRITE_PROPERTY,
|
|
248
248
|
data.invokeId,
|
|
249
249
|
bacnet.enum.ErrorClass.PROPERTY,
|
|
@@ -253,7 +253,7 @@ module.exports = function (RED) {
|
|
|
253
253
|
} catch (err) {
|
|
254
254
|
node.error(`Write Property error: ${err.message}`);
|
|
255
255
|
node.client.errorResponse(
|
|
256
|
-
data.
|
|
256
|
+
data.header.sender,
|
|
257
257
|
bacnet.enum.ConfirmedService.WRITE_PROPERTY,
|
|
258
258
|
data.invokeId,
|
|
259
259
|
bacnet.enum.ErrorClass.OBJECT,
|
|
@@ -264,7 +264,7 @@ module.exports = function (RED) {
|
|
|
264
264
|
|
|
265
265
|
// Handle Read Property Multiple requests
|
|
266
266
|
node.handleReadPropertyMultiple = function (data) {
|
|
267
|
-
const properties = data.
|
|
267
|
+
const properties = data.payload.properties;
|
|
268
268
|
const results = [];
|
|
269
269
|
|
|
270
270
|
for (const prop of properties) {
|
|
@@ -310,7 +310,7 @@ module.exports = function (RED) {
|
|
|
310
310
|
}
|
|
311
311
|
|
|
312
312
|
node.client.readPropertyMultipleResponse(
|
|
313
|
-
data.
|
|
313
|
+
data.header.sender,
|
|
314
314
|
data.invokeId,
|
|
315
315
|
results
|
|
316
316
|
);
|
|
@@ -318,17 +318,17 @@ module.exports = function (RED) {
|
|
|
318
318
|
|
|
319
319
|
// Handle Subscribe COV requests
|
|
320
320
|
node.handleSubscribeCov = function (data) {
|
|
321
|
-
const subscriberProcessId = data.
|
|
322
|
-
const objectId = data.
|
|
323
|
-
const issueConfirmedNotifications = data.
|
|
324
|
-
const lifetime = data.
|
|
321
|
+
const subscriberProcessId = data.payload.subscriberProcessId;
|
|
322
|
+
const objectId = data.payload.monitoredObjectId;
|
|
323
|
+
const issueConfirmedNotifications = data.payload.issueConfirmedNotifications;
|
|
324
|
+
const lifetime = data.payload.lifetime || 0;
|
|
325
325
|
|
|
326
326
|
const objectKey = `${objectId.type}:${objectId.instance}`;
|
|
327
327
|
const obj = node.objects.get(objectKey);
|
|
328
328
|
|
|
329
329
|
if (!obj) {
|
|
330
330
|
node.client.errorResponse(
|
|
331
|
-
data.
|
|
331
|
+
data.header.sender,
|
|
332
332
|
bacnet.enum.ConfirmedService.SUBSCRIBE_COV,
|
|
333
333
|
data.invokeId,
|
|
334
334
|
bacnet.enum.ErrorClass.OBJECT,
|
|
@@ -337,16 +337,17 @@ module.exports = function (RED) {
|
|
|
337
337
|
return;
|
|
338
338
|
}
|
|
339
339
|
|
|
340
|
-
const
|
|
340
|
+
const senderAddress = data.header?.sender?.address || 'unknown';
|
|
341
|
+
const subscriptionKey = `${senderAddress}:${subscriberProcessId}:${objectKey}`;
|
|
341
342
|
|
|
342
|
-
if (lifetime === 0 && data.
|
|
343
|
+
if (lifetime === 0 && data.payload.cancellationRequest) {
|
|
343
344
|
// Cancel subscription
|
|
344
345
|
node.covSubscriptions.delete(subscriptionKey);
|
|
345
346
|
node.debug(`COV subscription cancelled: ${subscriptionKey}`);
|
|
346
347
|
} else {
|
|
347
348
|
// Create/update subscription
|
|
348
349
|
node.covSubscriptions.set(subscriptionKey, {
|
|
349
|
-
address: data.
|
|
350
|
+
address: data.header.sender,
|
|
350
351
|
processId: subscriberProcessId,
|
|
351
352
|
objectId: objectId,
|
|
352
353
|
confirmed: issueConfirmedNotifications,
|
|
@@ -358,7 +359,7 @@ module.exports = function (RED) {
|
|
|
358
359
|
}
|
|
359
360
|
|
|
360
361
|
node.client.simpleAckResponse(
|
|
361
|
-
data.
|
|
362
|
+
data.header.sender,
|
|
362
363
|
bacnet.enum.ConfirmedService.SUBSCRIBE_COV,
|
|
363
364
|
data.invokeId
|
|
364
365
|
);
|
package/package.json
CHANGED
package/bacnet-scanner.tgz
DELETED
|
Binary file
|
|
Binary file
|
|
Binary file
|