• 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

    How communicate to a remote device ?

    BACnet4J general discussion
    3
    10
    5.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.
    • V
      Valter Henrique
      last edited by

      Hi,
      I made a local device communicate with my application.
      But how do I make to communicate to a remote device ?

      Is possible to do this using ip or dns ? (because the ip changes sometimes).

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

        Hi Valter,

        What do you mean by remote? I suspect you mean a device with which you cannot exchange a WhoIs/IAm, but please confirm.

        If this is the case, you will need to manually instantiate a RemoteDevice by explicitly providing the IP, port, and instance id. Then, you will be able to send messages to it.

        Regarding using a domain name, BACnet only deals with IP addresses, so you will need to handle domain name resolution yourself.

        Best regards,
        Matthew

        1 Reply Last reply Reply Quote 0
        • V
          Valter Henrique
          last edited by

          @mlohbihler said:

          Hi Valter,

          What do you mean by remote? I suspect you mean a device with which you cannot exchange a WhoIs/IAm, but please confirm.

          If this is the case, you will need to manually instantiate a RemoteDevice by explicitly providing the IP, port, and instance id. Then, you will be able to send messages to it.

          Regarding using a domain name, BACnet only deals with IP addresses, so you will need to handle domain name resolution yourself.

          I mean, a device that is not in my network.
          There's some example in the test folder that could use for that ?

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

            I don't think so, but it's not hard. The only trick is that you need to know the instance id of the device.

            RemoteDevice rd = new RemoteDevice(...);
            localDevice.addRemoteDevice(rd); // This may not actually be necessary
            localDevice.send(rd, myRequest);
            

            Where "myRequest" is, say, a read property with pid of objectList. If your setting are correct, you should get the object list of the remote device.

            Best regards,
            Matthew

            1 Reply Last reply Reply Quote 0
            • V
              Valter Henrique
              last edited by

              @mlohbihler said:

              I don't think so, but it's not hard. The only trick is that you need to know the instance id of the device.

              RemoteDevice rd = new RemoteDevice(...);
              localDevice.addRemoteDevice(rd); // This may not actually be necessary
              localDevice.send(rd, myRequest);
              

              Where "myRequest" is, say, a read property with pid of objectList. If your setting are correct, you should get the object list of the remote device.

              I found the id of my device, it's 101, but I have some doubts about it :

                  public static void main(String[] args) throws Exception {
                      // How to initialize the LocalDevice ?
                      LocalDevice ld = new LocalDevice (???);
              
                      // let's say my ip is : 1.2.3.4, is this correct ?
                  	RemoteDevice rd = new RemoteDevice(101, new Address(new byte[] { (byte) 1, (byte) 2, 3, (byte) 4 }, 47808), null);
                      ld.addRemoteDevice(rd);
              
                      // now I have the remote device, in the localDevice, now I should be able to use the method 'getObjectList()' ?
                     
                      // how to use this 'myRequest' (I don't understand what you said about it ) ?
                      localDevice.send(rd, myRequest);
                      ...
              }
              
              
              1 Reply Last reply Reply Quote 0
              • M
                mlohbihler
                last edited by

                Ok, now i'm wondering what you meant when you said:

                I made a local device communicate with my application.

                Anyway, a request is a key component of BACnet. It's how all communication is done with BACnet peers (aka RemoteDevices). Have a look at LocalDevice.findRemoteDevice (and ignore the code that i provided previously). You should be able to see what is going on.

                Best regards,
                Matthew

                1 Reply Last reply Reply Quote 0
                • R
                  R-GiGgS84
                  last edited by

                  @Valter Henrique said:

                  @mlohbihler said:
                  I don't think so, but it's not hard. The only trick is that you need to know the instance id of the device.

                  RemoteDevice rd = new RemoteDevice(...);
                  localDevice.addRemoteDevice(rd); // This may not actually be necessary
                  localDevice.send(rd, myRequest);
                  

                  Where "myRequest" is, say, a read property with pid of objectList. If your setting are correct, you should get the object list of the remote device.

                  I found the id of my device, it's 101, but I have some doubts about it :

                     public static void main(String[] args) throws Exception {
                         // How to initialize the LocalDevice ?
                         LocalDevice ld = new LocalDevice (???);
                  
                         // let's say my ip is : 1.2.3.4, is this correct ?
                     	RemoteDevice rd = new RemoteDevice(101, new Address(new byte[] { (byte) 1, (byte) 2, 3, (byte) 4 }, 47808), null);
                         ld.addRemoteDevice(rd);
                  
                         // now I have the remote device, in the localDevice, now I should be able to use the method 'getObjectList()' ?
                        
                         // how to use this 'myRequest' (I don't understand what you said about it ) ?
                         localDevice.send(rd, myRequest);
                         ...
                  }
                  
                  

                  Hi mlohbihler ,

                  Can u give an example of how u instantiate myRequest?

                  Regards,
                  WenJun

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

                    Anyway, a request is a key component of BACnet. It's how all communication is done with BACnet peers (aka RemoteDevices). Have a look at LocalDevice.findRemoteDevice (and ignore the code that i provided previously). You should be able to see what is going on.

                    Best regards,
                    Matthew

                    1 Reply Last reply Reply Quote 0
                    • V
                      Valter Henrique
                      last edited by

                      In the end I created a server (which runs in the computer that's locally placed in my network) and then communicate via socket.

                      Until I found out how implement a RemoteDevice that you said, thanks mlohbihler.

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