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

Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website

  • Hi everyone,
    i'm trying BACNet4J, and i have to say great job!

    I ran from 'test' package, and everything was fine, but now i'm trying to get and set value from my device, so i'm trying to run but with no sucess .
    Here is my code:

    Could someone help me ?

    Thanks for you attention.

    Best regards,
    Valter Henrique.

  • Is this the same problem as your previous post?

  • I think it is.

    I really need to know how to write some value in my object, could anyone help me with that ?

    I'm trying a lot of example but nothing works for me.

    Could anyone, please, help me ?

    Best regards,
    Valter Henrique.

  • The simulation environment to work Bacnet4j without real Device

    Hi all,

    I am vey new bacnet. I want to learn basic needs to work or develop custom application by using bacnet4j. I have not a bacnet device yet but I will develop a application by using bacnet4j. Can we tell how to make a test environment with VTS (Virtual Test Shell), create these devices which is defined in VTS and connect to them by using bacnet4j ? I only want to learn how it can be possible to work on bacnet4j library if you have not real bacnet device ?

    we will be appreciated if you reply this.

  • You can use VTS in the way you describe, yes. You could also have two or mroe instances of BACnet4J communicating with each other. There is code in the test source that should indicate how this can be done.

  • Thanks for your reply..

    My custom application has such a scenario like this.. We are getting alarms info from a software by using its web services..We will take alarms info by using web services and send this information to bacnet device..Is this possible to make a application for a such scenario..

  • There is a issue in VTS..I defined a device with port and I push send button but VTS is shut down..When I click its icon again, it is opening and closing immediately...Could you help me about this?


  • I found the issue what it is..The issue is MCAFEE antivirus program..?t is blocking bacnet package and closing VTS ..

    I need help to use bacnet4j library ...Could you help anyone ? My application should listen bacnet packet and read/write values to bacnet device ? I really appricated if you help me..

    Thank you..

  • @Guven_Ulu said:

    I found the issue what it is..The issue is MCAFEE antivirus program..?t is blocking bacnet package and closing VTS ..

    I need help to use bacnet4j library ...Could you help anyone ? My application should listen bacnet packet and read/write values to bacnet device ? I really appricated if you help me..

    Thank you..
    I create this class dude, maybe this help you:

     * To change this template, choose Tools | Templates
     * and open the template in the editor.
    package com.autolife.devices;
    import com.serotonin.bacnet4j.LocalDevice;
    import com.serotonin.bacnet4j.service.acknowledgement.ReadPropertyAck;
    import com.serotonin.bacnet4j.service.confirmed.ReadPropertyRequest;
    import com.serotonin.bacnet4j.service.confirmed.WritePropertyRequest;
    import com.serotonin.bacnet4j.type.Encodable;
    import com.serotonin.bacnet4j.type.constructed.SequenceOf;
    import com.serotonin.bacnet4j.type.enumerated.ObjectType;
    import com.serotonin.bacnet4j.type.enumerated.PropertyIdentifier;
    import com.serotonin.bacnet4j.type.enumerated.Segmentation;
    import com.serotonin.bacnet4j.type.primitive.ObjectIdentifier;
    import com.serotonin.bacnet4j.type.primitive.UnsignedInteger;
     * @author Valter
    public class Light {
        private static LocalDevice localDevice;
        private boolean state;
        public boolean getState() {
            return state;
        public void setState(boolean state) {
            this.state = state;
        public void active(){
            localDevice = new LocalDevice(101, "");
            try {
                // Find the device
                if (localDevice.getRemoteDevices().isEmpty()) {
                    System.out.println("No remote devices responded");
                getObjectList(localDevice, "", 0xBAC0, 101, state);
            } catch (IOException ex) {
            } catch (Exception ex) {
        private static void getObjectList(LocalDevice localDevice, String ip, int port, int deviceId, boolean state) throws Exception {
            InetSocketAddress addr = new InetSocketAddress(InetAddress.getByName(ip), port);
            ReadPropertyRequest read = new ReadPropertyRequest(new ObjectIdentifier(ObjectType.device, deviceId), PropertyIdentifier.objectList);
            ReadPropertyAck ack = (ReadPropertyAck) localDevice.send(addr, null, 1476, Segmentation.segmentedBoth, read);
            System.out.println("IP: " + ip);
            SequenceOf<ObjectIdentifier> oids = (SequenceOf<ObjectIdentifier>) ack.getValue();
            int i = 0;
            for (ObjectIdentifier oid : oids) {
                System.out.println("--------  " + oid.getInstanceNumber());
                //1 : not allow to write
                //2 : allow to write
                //3 : not allow to write
                //4 : allow to write
                if (i == 4) {
                    for (int k = 1; k <= 16; k++) {
                        setPresentValue(addr, read, oid, new com.serotonin.bacnet4j.type.primitive.Boolean(state), k);
        private static void setPresentValue(InetSocketAddress addr, ReadPropertyRequest read, ObjectIdentifier objectIdentifier, Encodable value, int priority) throws Exception {
            WritePropertyRequest wpr = new WritePropertyRequest(objectIdentifier, PropertyIdentifier.presentValue, null, value, new UnsignedInteger(priority));
            localDevice.send(addr, null, 1476, Segmentation.segmentedBoth, wpr);

  • Thanks for your code

    Actually I need to understand the classes of Bacnet4j..

    I am seeing bacnet packages in Wireshark when I sent bacnet packets from Virtual Test Shell. ..

    What must I write the argument of LocalDevice class to capture these package in Bacnet4j lib in java? WireShark and VTS is in my local computer so do I must write localhost in LocalDevice as a argument?

    All I want is to manage and control the bacnet device from Bacnet4j lib ...

    I am beginner of these library and there is no document to study on, so I need to understand and learn what it is going on..