fh1ch/node-bacstack

Device instance, AI/DI reading issues

q-bird opened this issue · 3 comments

Hi @fh1ch

Computer 1: I'm running node-bacstack as a client
Computer 2: I'm using Bacnet Device Simulator as a server

  1. I can receive I-Am message from Computer 2 when I send Who-is message from Computer 1
  2. In Computer 2, my device is 1, instance 1. But when I try to run your example, I cannot run with instance = 1, it just works with instance = 4194303 as below (while my device is 1)
var requestArray = [{
  objectIdentifier: {type: 8, instance: 4194303},
  propertyReferences: [{propertyIdentifier: 8}]
}];

And I cannot read the object-list of my device, when I change instance to 1, and propertyIdentifier to 76, computer 2 responds something but not provide the object-list
...

  1. I cannot read the properties of Analog Input, Computer 2 responds an error message when I try to read Analog Input
var requestArray = [{
  objectIdentifier: {type: 0, instance: 0},
  propertyReferences: [{propertyIdentifier: 8}] //or present value --> 85
}];

How can I read the present value of Analog/Binary Input?

There are many things else but please help me to clear those points first.

Many thanks.

When I traced the message of Computer 1 by wireshark, I saw the NPDU didn't have enough data
Then I traced on file bacnet-npdu.js and I saw this code:

module.exports.encode = function(buffer, funct, destination, source, hopCount, networkMsgType, vendorId) {
  var i;
  var hasDestination = destination && destination.net > 0;
...

Based on your example, the destination is '192.168.1.43'
When it goes to that function --> destination = '192.168.1.43'. But it cannot recognize destination.net
Meaning destination.net = undefined
Similarly, it cannot recognize destination.adr or destination.adr.length
So the following code cannot work properly and cannot add the necessary data to buffer I think that.

What do you think? and can you please give me your advices how to fix it?

Thank you

fh1ch commented

Hi @q-bird

Thanks filing a bug report.

To be able to support on this topic, I need some more information from your side:

  • What version of node-bacstack are you using?
  • What do you mean with I cannot run with instance = 1? What error message do you receive? I need to have the content of the error object to analyze the problem further.

Regarding your observation with the NPDU layer: this is not related to the issue your facing. I'm simply not done yet implementing routed telegrams in the NPDU layer, so this specific check will always fail, however the BACNET telegram is totally valid, since additional parameters in the NPDU header is optional.

Cheers

fh1ch commented

Since there has been no answer to the question above, I'm assume the issue has been resolved in the meanwhile. I'm therefore going to close this issue.