<?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[Read BACnet ObjectValues]]></title><description><![CDATA[<p dir="auto">Hello everyone!<br />
I am beginning with BACnet4j project. I think it is a great project, so i am very glad with it.<br />
I am trying to read BACnet object values from my computer with a Java project. My code is:</p>
<pre><code>
public class BACnetNetwork {
	static LocalDevice lDevice;
	static ResourceBundle resource = ResourceBundle.getBundle("resources/bacnet4j");
	
	public BACnetNetwork(){}
	
	public static void main(String args[]){
		initializeDevice();
	}
	
	public static void initializeDevice(){
		try{
			System.out.println("Inicializando...");
			lDevice = new LocalDevice(17800, resource.getString("localDeviceIP"));
			lDevice.getEventHandler().addListener(new Listener());

			lDevice.initialize();
			//System.out.println("Remote Devices..."+lDevice.get);
			
			@SuppressWarnings("unused")
			ReadPropertyRequest read = new ReadPropertyRequest(new ObjectIdentifier(ObjectType.analogInput, 243), PropertyIdentifier.presentValue);
	        getObjectList(lDevice, resource.getString("deviceIP"), Integer.valueOf(resource.getString("port")), 17800);  
		}catch(Exception e){
			System.out.println("Error al inicializar "+e.getMessage());
		}finally{
			closeDevice();
		}
	}
	
	public static void closeDevice(){
		try{
			lDevice.terminate();
		}catch(Exception e){
			System.out.println(e.getMessage());
		}
	}
	
	private static void getObjectList(LocalDevice localDevice, String ip, int port, int deviceId) throws Exception {  
        InetSocketAddress addr = new InetSocketAddress(InetAddress.getByName(ip), port);
        System.out.println(addr.toString());
       
        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);

        @SuppressWarnings("unchecked")
		SequenceOf&lt;ObjectIdentifier&gt; oids = (SequenceOf&lt;ObjectIdentifier&gt;) ack.getValue();  
        for (ObjectIdentifier oid : oids) {
            System.out.println("    " + oid.getObjectType());  
        }  
        
		PropertyIdentifier pids = (PropertyIdentifier) ack.getValue();  
        System.out.println("    " + pids);    
    } 
	
	static class Listener extends DefaultDeviceEventListener {  
        @Override  
        public void iAmReceived(RemoteDevice d) {  
            System.out.println("I am received" + d);  
        }  
    } 
</code></pre>
<p dir="auto">However, when I run, the output shows:</p>
<pre><code>
P: 192.168.107.247
    Device 17800
    Analog Input 0
    Multi-state Input 0
    Analog Input 1
    Trend Log 1
    Trend Log 2
    Trend Log 3
    File 0

</code></pre>
<p dir="auto">I have been studying a BACnet frame from Wireshark, but I do not see any value.</p>
<p dir="auto">How could I read values from a device?<br />
Thank you very much!!<br />
Regards!</p>
<p dir="auto">Attachment: <a href="http://archive.infiniteautomation.com/forum/posts/downloadAttach/135.page" rel="nofollow ugc">download link</a></p>
]]></description><link>https://forum.mango-os.com/topic/960/read-bacnet-objectvalues</link><generator>RSS for Node</generator><lastBuildDate>Mon, 20 Apr 2026 07:20:38 GMT</lastBuildDate><atom:link href="https://forum.mango-os.com/topic/960.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 21 Feb 2012 18:18:49 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Read BACnet ObjectValues on Tue, 22 May 2012 19:59:53 GMT]]></title><description><![CDATA[<p dir="auto">Hello, I am trying to figure out how to use bacnet4j and this thread is helpful however I am still stuck on the various IP addresses and ports used?  Can you explain the difference between resource.getString("localDeviceIP"), resource.getString("deviceIP") and resource.getString("port")?  Thanks in advance.</p>
]]></description><link>https://forum.mango-os.com/post/6383</link><guid isPermaLink="true">https://forum.mango-os.com/post/6383</guid><dc:creator><![CDATA[djrosu]]></dc:creator><pubDate>Tue, 22 May 2012 19:59:53 GMT</pubDate></item><item><title><![CDATA[Reply to Read BACnet ObjectValues on Thu, 23 Feb 2012 18:51:28 GMT]]></title><description><![CDATA[<p dir="auto">Using the "all" identifier will often result in an exception because the content is too much to put into a single response. BACnet4J will try to compensate in come cases, but it doesn't always work out.</p>
<p dir="auto">You can ask for multiple properties with a ReadPropertyMultiple request, as long as your equipment supports it.</p>
]]></description><link>https://forum.mango-os.com/post/6221</link><guid isPermaLink="true">https://forum.mango-os.com/post/6221</guid><dc:creator><![CDATA[mlohbihler]]></dc:creator><pubDate>Thu, 23 Feb 2012 18:51:28 GMT</pubDate></item><item><title><![CDATA[Reply to Read BACnet ObjectValues on Thu, 23 Feb 2012 13:10:20 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mlohbihler" aria-label="Profile: mlohbihler">@<bdi>mlohbihler</bdi></a> said:</p>
<blockquote>
<p dir="auto">The only property that you are reading is objectList.</p>
</blockquote>
<p dir="auto">Ok!! Thank you very much!! I solve the problem. So, do I need send a ReadPropertyRequest and a ReadPropertyAck for each property? I have tried with PropertyIdentifier.all, however it throws an Exception. If I send a request for each property I can see that property, but I think it could be a lot of load in BAcnet network...<br />
Regards!</p>
]]></description><link>https://forum.mango-os.com/post/6220</link><guid isPermaLink="true">https://forum.mango-os.com/post/6220</guid><dc:creator><![CDATA[josher]]></dc:creator><pubDate>Thu, 23 Feb 2012 13:10:20 GMT</pubDate></item><item><title><![CDATA[Reply to Read BACnet ObjectValues on Wed, 22 Feb 2012 19:37:44 GMT]]></title><description><![CDATA[<p dir="auto">The only property that you are reading is objectList.</p>
]]></description><link>https://forum.mango-os.com/post/6218</link><guid isPermaLink="true">https://forum.mango-os.com/post/6218</guid><dc:creator><![CDATA[mlohbihler]]></dc:creator><pubDate>Wed, 22 Feb 2012 19:37:44 GMT</pubDate></item><item><title><![CDATA[Reply to Read BACnet ObjectValues on Wed, 22 Feb 2012 12:05:30 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mlohbihler" aria-label="Profile: mlohbihler">@<bdi>mlohbihler</bdi></a> said:</p>
<blockquote>
<p dir="auto">BACnet4J does not store present values for objects. You need to request them using ReadProperty or ReadPropertyMultiple requests, asking objects for their present value property.</p>
</blockquote>
<p dir="auto">But in my code I am already using "ReadPropertyRequest". Another option is "ReadPropertyMultipleRequest"<br />
Thanks!</p>
]]></description><link>https://forum.mango-os.com/post/6216</link><guid isPermaLink="true">https://forum.mango-os.com/post/6216</guid><dc:creator><![CDATA[josher]]></dc:creator><pubDate>Wed, 22 Feb 2012 12:05:30 GMT</pubDate></item><item><title><![CDATA[Reply to Read BACnet ObjectValues on Tue, 21 Feb 2012 19:30:37 GMT]]></title><description><![CDATA[<p dir="auto">BACnet4J does not store present values for objects. You need to request them using ReadProperty or ReadPropertyMultiple requests, asking objects for their present value property.</p>
]]></description><link>https://forum.mango-os.com/post/6213</link><guid isPermaLink="true">https://forum.mango-os.com/post/6213</guid><dc:creator><![CDATA[mlohbihler]]></dc:creator><pubDate>Tue, 21 Feb 2012 19:30:37 GMT</pubDate></item></channel></rss>