• Recent
    • Tags
    • Popular
    • Register
    • Login
    1. Home
    2. DolphinsGrin
    3. Topics

    Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to support@radixiot.com.

    Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website Mango 5 Documentation Website
    D
    • Profile
    • Following 0
    • Followers 0
    • Topics 3
    • Posts 10
    • Best 0
    • Controversial 0
    • Groups 0

    Topics created by DolphinsGrin

    • D

      Foreign Device Registry Answer

      BACnet4J general discussion
      • • • DolphinsGrin
      2
      0
      Votes
      2
      Posts
      1.7k
      Views

      D

      The APDU frame length of a Foreign Device Registry Answer message is six bytes long. The IncomingRequestParser.parseApdu() immediately sends all messages to the NPCI constructor, regardless of length checks, which subsequently chokes (array out of bounds) due to queue.size() being zero. I've inserted a couple changes to the source code to address this:

      First, in IpNetwork.parseFrame():

      if (function != 0xa && function != 0xb && function != 0x4 && function != 0x0 && function != 0x5) throw new MessageValidationAssertionException("Function is not unicast, broadcast, forward" + " or foreign device reg answer (0xa, 0xb, 0x4, 0x0, or 0x5)");

      "function != 0x05" is missing from the original method, and prematurely chokes the method.

      Secondly, I enclosed all of the lines in IncomingRequestParser.parseApdu() in the following if-statement:

      if (queue.size() > 6)

      With a "return null;" to satisfy the return type.

      This is logically avoiding all exceptions I've been experiencing while doing a device discovery across sub-nets. Because I'm not wholly aware of what else uses these methods, I cannot be certain if I have not broken something else yet. Anyone with any more familiarity, please advise!

      The Dolphin's Grin

      Edit: Realized that checking queue.size() >6 was more effective than setting and referencing an "isForeignDevMsg" flag.

    • D

      Updated JavaDoc for BACnet4J Version 1.3

      BACnet4J general discussion
      • • • DolphinsGrin
      3
      0
      Votes
      3
      Posts
      2.4k
      Views

      B

      Thanks, that's quite helpful.

    • D

      Device Discovery Across Subnets

      BACnet4J general discussion
      • • • DolphinsGrin
      7
      0
      Votes
      7
      Posts
      3.9k
      Views

      D

      So, I successfully fired off a "Register Foreign Device" broadcast, resulting in a fireworks-display of exceptions being thrown, but all subsequent sendGlobalRequest() return perfectly. Here is my call:

      network.sendRegisterForeignDeviceMessage(network.getLocalBroadcastAddress().getMacAddress().getInetSocketAddress(),1000);

      Where network is an instance of IpNetwork with all default values. The "Register-Foreign-Device" function code is 0x05, which the frame parser throws a hissy-fit about:

      com.serotonin.bacnet4j.npdu.MessageValidationAssertionException: Function is not unicast, broadcast, forward or foreign device reg anwser (0xa, 0xb, 0x4 or 0x0) at com.serotonin.bacnet4j.npdu.ip.IpNetwork$IncomingMessageExecutor.parseFrame(IpNetwork.java:275) at com.serotonin.bacnet4j.npdu.IncomingRequestParser.run(IncomingRequestParser.java:37) at com.serotonin.bacnet4j.npdu.ip.IpNetwork.run(IpNetwork.java:242) at java.lang.Thread.run(Unknown Source) Foreign device registration not successful! result: 48 java.lang.ArrayIndexOutOfBoundsException: -1 at com.serotonin.util.queue.ByteQueue.pop(ByteQueue.java:221) at com.serotonin.util.queue.ByteQueue.popU1B(ByteQueue.java:236) at com.serotonin.bacnet4j.npdu.NPCI.<init>(NPCI.java:105) at com.serotonin.bacnet4j.npdu.IncomingRequestParser.parseApdu(IncomingRequestParser.java:64) at com.serotonin.bacnet4j.npdu.IncomingRequestParser.run(IncomingRequestParser.java:40) at com.serotonin.bacnet4j.npdu.ip.IpNetwork.run(IpNetwork.java:242) at java.lang.Thread.run(Unknown Source) Foreign device registration not successful! result: 48

      Any insight as to how to do this cleaner would be appreciated. I can't shake the feeling I'm breaking something when so much red floods my screen. Thanks again!

      Always Monday!

      Dolphin's Grin

      P.S. After passing this foreign device message, the foreign devices (devices on other subnets) address BOTH my machine's specific IP address, and its local subnet broadcast.