<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[How get/set value from my device ?]]></title><description><![CDATA[<p dir="auto">Hi everyone,<br />
i'm trying BACNet4J, and i have to say great job!</p>
<p dir="auto">I ran Test2.java 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 CommandPriority.java but with no sucess .<br />
Here is my code: <a href="http://pastebin.com/Bwp9qbcA" rel="nofollow ugc">http://pastebin.com/Bwp9qbcA</a></p>
<p dir="auto">Could someone help me ?</p>
<p dir="auto">Thanks for you attention.</p>
<p dir="auto">Best regards,<br />
Valter Henrique.</p>
]]></description><link>https://forum.mango-os.com/topic/819/how-get-set-value-from-my-device</link><generator>RSS for Node</generator><lastBuildDate>Sat, 14 Nov 2026 00:12:38 GMT</lastBuildDate><atom:link href="https://forum.mango-os.com/topic/819.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 19 Apr 2011 19:35:10 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How get/set value from my device ? on Wed, 01 Jun 2011 10:35:47 GMT]]></title><description><![CDATA[<p dir="auto">Thanks for your code</p>
<p dir="auto">Actually I need to understand the classes of Bacnet4j..</p>
<p dir="auto">I am seeing bacnet packages in Wireshark when I sent bacnet packets from Virtual Test Shell. ..</p>
<p dir="auto">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?</p>
<p dir="auto">All I want is to manage and control the bacnet device from Bacnet4j lib ...</p>
<p dir="auto">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..</p>
]]></description><link>https://forum.mango-os.com/post/5758</link><guid isPermaLink="true">https://forum.mango-os.com/post/5758</guid><dc:creator><![CDATA[Guven_Ulu]]></dc:creator><pubDate>Wed, 01 Jun 2011 10:35:47 GMT</pubDate></item><item><title><![CDATA[Reply to How get/set value from my device ? on Tue, 31 May 2011 19:57:31 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/guven_ulu" aria-label="Profile: Guven_Ulu">@<bdi>Guven_Ulu</bdi></a> said:</p>
<blockquote>
<p dir="auto">I found the issue what it is..The issue is MCAFEE antivirus program..?t is blocking bacnet package and closing VTS ..</p>
<p dir="auto">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..</p>
<p dir="auto">Thank you..<br />
I create this class dude, maybe this help you:</p>
</blockquote>
<pre><code>
/*
 * 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;
import java.io.IOException;
import java.net.InetAddress;
import java.net.InetSocketAddress;

/**
 *
 * @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, "192.168.1.255");
        localDevice.setPort(47808);
        try {
            localDevice.initialize();

            // Find the device
            if (localDevice.getRemoteDevices().isEmpty()) {
                System.out.println("No remote devices responded");
            }
            getObjectList(localDevice, "192.168.1.149", 0xBAC0, 101, state);

        } catch (IOException ex) {
            
        } catch (Exception ex) {
            
        }

        localDevice.terminate();
    }
    


    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&lt;ObjectIdentifier&gt; oids = (SequenceOf&lt;ObjectIdentifier&gt;) ack.getValue();

        int i = 0;
        for (ObjectIdentifier oid : oids) {
            System.out.println("--------  " + oid.getInstanceNumber());
            //System.out.println();

            //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 &lt;= 16; k++) {
                    setPresentValue(addr, read, oid, new com.serotonin.bacnet4j.type.primitive.Boolean(state), k);
                }
            }
            i++;
        }

    }

    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);
    }
}

</code></pre>
]]></description><link>https://forum.mango-os.com/post/5757</link><guid isPermaLink="true">https://forum.mango-os.com/post/5757</guid><dc:creator><![CDATA[Valter Henrique]]></dc:creator><pubDate>Tue, 31 May 2011 19:57:31 GMT</pubDate></item><item><title><![CDATA[Reply to How get/set value from my device ? on Tue, 31 May 2011 11:56:20 GMT]]></title><description><![CDATA[<p dir="auto">I found the issue what it is..The issue is MCAFEE antivirus program..?t is blocking bacnet package and closing VTS ..</p>
<p dir="auto">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..</p>
<p dir="auto">Thank you..</p>
]]></description><link>https://forum.mango-os.com/post/5756</link><guid isPermaLink="true">https://forum.mango-os.com/post/5756</guid><dc:creator><![CDATA[Guven_Ulu]]></dc:creator><pubDate>Tue, 31 May 2011 11:56:20 GMT</pubDate></item><item><title><![CDATA[Reply to How get/set value from my device ? on Tue, 31 May 2011 10:23:44 GMT]]></title><description><![CDATA[<p dir="auto">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?</p>
<p dir="auto">Thanks</p>
]]></description><link>https://forum.mango-os.com/post/5755</link><guid isPermaLink="true">https://forum.mango-os.com/post/5755</guid><dc:creator><![CDATA[Guven_Ulu]]></dc:creator><pubDate>Tue, 31 May 2011 10:23:44 GMT</pubDate></item><item><title><![CDATA[Reply to How get/set value from my device ? on Fri, 27 May 2011 18:18:31 GMT]]></title><description><![CDATA[<p dir="auto">Thanks for your reply..</p>
<p dir="auto">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..</p>
]]></description><link>https://forum.mango-os.com/post/5753</link><guid isPermaLink="true">https://forum.mango-os.com/post/5753</guid><dc:creator><![CDATA[Guven_Ulu]]></dc:creator><pubDate>Fri, 27 May 2011 18:18:31 GMT</pubDate></item><item><title><![CDATA[Reply to How get/set value from my device ? on Fri, 27 May 2011 17:19:42 GMT]]></title><description><![CDATA[<p dir="auto">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.</p>
]]></description><link>https://forum.mango-os.com/post/5752</link><guid isPermaLink="true">https://forum.mango-os.com/post/5752</guid><dc:creator><![CDATA[mlohbihler]]></dc:creator><pubDate>Fri, 27 May 2011 17:19:42 GMT</pubDate></item><item><title><![CDATA[Reply to How get/set value from my device ? on Fri, 27 May 2011 16:34:01 GMT]]></title><description><![CDATA[<p dir="auto">The simulation environment to work Bacnet4j without real Device</p>
<p dir="auto">Hi all,</p>
<p dir="auto">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 ?</p>
<p dir="auto">we will be appreciated if you reply this.</p>
]]></description><link>https://forum.mango-os.com/post/5750</link><guid isPermaLink="true">https://forum.mango-os.com/post/5750</guid><dc:creator><![CDATA[Guven_Ulu]]></dc:creator><pubDate>Fri, 27 May 2011 16:34:01 GMT</pubDate></item><item><title><![CDATA[Reply to How get/set value from my device ? on Tue, 03 May 2011 01:43:17 GMT]]></title><description><![CDATA[<h2>I think it is.</h2>
<p dir="auto">I really need to know how to write some value in my object, could anyone help me with that ?</p>
<p dir="auto">I'm trying a lot of example but nothing works for me.</p>
<p dir="auto">Could anyone, please, help me ?</p>
<p dir="auto">Best regards,<br />
Valter Henrique.</p>
]]></description><link>https://forum.mango-os.com/post/5726</link><guid isPermaLink="true">https://forum.mango-os.com/post/5726</guid><dc:creator><![CDATA[Valter Henrique]]></dc:creator><pubDate>Tue, 03 May 2011 01:43:17 GMT</pubDate></item><item><title><![CDATA[Reply to How get/set value from my device ? on Thu, 21 Apr 2011 18:55:47 GMT]]></title><description><![CDATA[<p dir="auto">Is this the same problem as your previous post?</p>
]]></description><link>https://forum.mango-os.com/post/5702</link><guid isPermaLink="true">https://forum.mango-os.com/post/5702</guid><dc:creator><![CDATA[mlohbihler]]></dc:creator><pubDate>Thu, 21 Apr 2011 18:55:47 GMT</pubDate></item></channel></rss>