• Recent
    • Tags
    • Popular
    • Register
    • Login

    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

    Correct destination network behaviour

    BACnet4J general discussion
    2
    3
    3.2k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • R
      robert bouwens
      last edited by

      a device should only respond to messages (who is service) where the destination bacnet network matches.
      currently the stack does not know anything about bacnet networks.
      adding the needed information is simple:

      
         public LocalDevice(int deviceId, String broadcastAddress, String localBindAddress, int localBACnetwork) {
              messageControl = new IpMessageControl(localBACnetwork);
      ...
      /code] 
      
      and the class IpMessageControl needs a new member variable:
      [code]
          private static int localBACnetwork;
      
          /**
           * constructor with configured bacnet network number
           * 
           * @param localBACnetwork
           */
          public IpMessageControl(int localBACnetwork)
          {
          	IpMessageControl.localBACnetwork = localBACnetwork;
          }
      
      
      

      the check is simple, in the function parsAPDU the destination network has to be verified.
      after:

      
                  // Network layer protocol control information. See 6.2.2
                  NPCI npci = new NPCI(queue);
                  if (npci.getVersion() != 1)
                      throw new MessageValidationAssertionException("Invalid protocol version: " + npci.getVersion());
                  if (npci.isNetworkMessage())
                      return null; // throw new MessageValidationAssertionException("Network messages are not supported");
      
      

      add the following check:

      
                  // detect the 'correct' bacnet work and do not respond to foreign networks requests
                  if (npci.hasDestinationInfo())
                  {
                      int bacNet = npci.getDestinationNetwork();
                      if (localBACnetwork > 0 && localBACnetwork != bacNet && bacNet != 65535 && bacNet > 0 )
                      {
                      	return null;
                      }
                  }
      
      

      now you are able to pass a few more btl tests.
      and the upper code has been tested.

      robert

      1 Reply Last reply Reply Quote 0
      • M
        mlohbihler
        last edited by

        Looks fine to me. I checked in changes that reflect your code.

        Best regards,
        Matthew

        1 Reply Last reply Reply Quote 0
        • First post
          Last post