fh1ch/node-bacstack

processing bacnet device on port 0xBAC1

lunewolf opened this issue · 3 comments

I have a device that uses port 0xBAC1(47809).
I want to working with it, but error is occured.

these code has errors:
client.whoIs(60000, 65000, "192.168.0.90:47809");
client.readProperty("192.168.0.90:47809", bacnet.enum.BacnetObjectTypes.OBJECT_DEVICE, 60512, bacnet.enum.BacnetPropertyIds.PROP_OBJECT_LIST, null, function(err, data) {
console.log(data);
});

Error Message:
Error: getaddrinfo ENOTFOUND 192.168.0.90:47809
at errnoException (dns.js:28:10)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:76:26)

fh1ch commented

Hi @lunewolf

Please see the document (e.g. https://fh1ch.github.io/node-bacstack/bacstack.html#.whoIs). None of the functions accept a port as part of the address parameter.

Please use the port parameter of thebacnet constructor (see https://fh1ch.github.io/node-bacstack/bacstack.html):

var bacnet = require('bacstack');

var client = new bacnet({port: 47809});

client.whoIs(60000, 65000, "192.168.0.90");
client.readProperty("192.168.0.90", bacnet.enum.BacnetObjectTypes.OBJECT_DEVICE, 60512, bacnet.enum.BacnetPropertyIds.PROP_OBJECT_LIST, null, function(err, data) {
  console.log(data);
});

Cheers
Fabio

Your answer is to set the port of the device using bacstack.
And that is not the answer to my question.
What I mean is how to access another device using BAC1 as a port.

whois (10000, 60000, "192.168.0.90");

Above code sends 'Whois' to the BAC0 port of the 192.168.0.90 device.
If the device is using BAC1,
This device does not respond.
If you want a response, you have to specify the port, but bacstack has no way to specify it.

fh1ch commented

Hi @lunewolf

Thanks for your reply.

Well, that's actually not correct, since the logic of having a "device" is not something wich is covered by node-bacstack at all. The port option actually controls both listener and sender port (see here) of node-bacstack, meaning if one is setting it to BAC1, all communication with devices configured to this port is possible.

BACNET is using the different ports to allow having multiple BACNET networks inside one physical, thats why almost all (I can't speak for all) BACNET stack have the port setting globally and do not allow to set a different port per method.

Cheers
Fabio