• 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

    BACnet4J 3.2 and BBMD/Foreign Device Support

    BACnet4J general discussion
    2
    4
    3.0k
    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.
    • W
      Wingnut2.0
      last edited by

      Can this additional functionality be accessed by manually making entries in either the BDT or FDT tables? If so, can this be accomplished via dashboard or scripting Data Source?

      How could I accomplish registration using this function via the UI?

      public void registerAsForeignDevice(final InetSocketAddress addr, final int timeToLive) throws BACnetException {
              if (timeToLive < 1)
                  throw new IllegalArgumentException("timeToLive cannot be less than 1");
              if (getTransport() == null || getTransport().getLocalDevice() == null)
                  throw new IllegalArgumentException(...........
      

      The BACnet network I am working with requires Foreign Devices to register with the BBMD in order to route broadcasts.

      Thank you

      1 Reply Last reply Reply Quote 0
      • phildunlapP
        phildunlap
        last edited by

        Hi Wingnutz, great question!

        I wonder if we should be offering this as optional settings on any local device.

        Yes you can call it, but I'm not sure the timing will be ideal... you may need to send a broadcast manually afterward.

        I think what you'll want to do is something like....

        if(RuntimeManager.isDataSourceEnabled("DS_BAC_xid") && !this.initialized) { //ensure the data source has started, so that it has created the local device
          var localDeviceConfig = com.serotonin.ma.bacnet.device.LocalDeviceDwr.getLocalDevice( "12345678-abcd-1234-94ba-9301406140aa" ); //get this by exporting your BACnet source or local devices, the local device id
          var localDevice = com.serotonin.ma.bacnet.device.LocalDeviceFactory.getLocalDevice(localDeviceConfig, null);
          var ipNetwork = localDevice.getNetwork();
          try {
            ipNetwork.registerAsForeignDevice( new java.net.InetSocketAddress("192.168.1.123", 0xBAC0), 60 );
            //You may want to do a broadcast? new com.serotonin.ma.bacnet.BACnetDiscovery(com.serotonin.m2m2.Common.getTranslations(), "local_device_id");
            this.initialized = true;
          } catch(e) {
              this.initialized = false;
              //print(e.getMessage());
          } finally {
            com.serotonin.ma.bacnet.device.LocalDeviceFactory.releaseLocalDevice(localDevice, null);
          }
        } else {
          this.initialized = false; //should the data source be restarted, this script would have to observe it off for a poll to register again. 
          //If this were a problem, you could use a binary point on the script to reinitialize the bacnet data source, 
          //  RuntimeManager.disableDataSource(xid), sleep at least one poll period of the bacnet DS, 
          //  or wait on com.serotonin.m2m2.Common.runtimeManager.isDataSourceRunning(dsid) but you'll need the data source's ID.
        }
        
        1 Reply Last reply Reply Quote 0
        • W
          Wingnut2.0
          last edited by joeamiraglia

          Phil, thank you very much.
          I added your suggested code to a scripting DS, saved, and was successfully registered after only clicking on the script validation icon. No additional interaction required so far.

          Registration request was sent -

          0_1511296630199_7e10a1a2-054c-4101-9ca7-241310bff311-image.png

          and success response returned.

          0_1511296660583_e418dbda-e2a8-4145-9898-1ed7893298c4-image.png

          I will continue to watch and provide updates if anything changes. Thanks again!!

          1 Reply Last reply Reply Quote 0
          • phildunlapP
            phildunlap
            last edited by phildunlap

            Great! Hope that does what you need.

            Pretty much any time the script is going through Java code to do something, it'll happen during validation or actual runtime the same. Things like the RuntimeManager, JsonEmport or calling the set() function will only actually change things if running, since they're going through mechanisms particular to the scripts.

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