<?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[Not able to read analog values from device]]></title><description><![CDATA[<p dir="auto">Not able to read analog values from device<br />
public class Test {<br />
static LocalDevice lDevice;<br />
/<em>static ResourceBundle resource = ResourceBundle<br />
.getBundle("com.serotonin.bacnet4j/bacnet4j");</em>/</p>
<pre><code>public Test() {
}

public static void main(String args[]) {
	initializeDevice();
}

public static void initializeDevice() {
	try {
		System.out.println("Inicializando...");
		IpNetwork ipNetwork = new IpNetwork("172.28.14.255", 47808,	"172.28.14.63");
		Transport transport = new Transport(ipNetwork);
		lDevice = new LocalDevice(9899, transport);
		lDevice.initialize();
		lDevice.getEventHandler().addListener(new Listener());
		lDevice.sendGlobalBroadcast(new WhoIsRequest());
		Thread.sleep(500);
</code></pre>
<p dir="auto">//			RemoteDevice rd = new RemoteDevice(101, new Address(new byte[] { (byte) 1, (byte) 2, 3, (byte) 4 }, 47808), null);<br />
//			lDevice.addRemoteDevice(rd);<br />
//			<br />
@SuppressWarnings("unused")<br />
ReadPropertyRequest read = new ReadPropertyRequest(<br />
new ObjectIdentifier(ObjectType.analogInput, 243),PropertyIdentifier.presentValue);<br />
getObjectList(lDevice, "172.28.14.63", 47808, 17800);<br />
} catch (Exception e) {<br />
System.out.println("Error al inicializar " + e.getMessage());<br />
} finally {<br />
closeDevice();<br />
}<br />
}</p>
<pre><code>public static AcknowledgementService send(LocalDevice d,
		ConfirmedRequestService s) throws Exception {
	Address a = new Address(InetAddrCache.get("localhost", 0xbac1));
	return d.send(a, null, MaxApduLength.UP_TO_1476,	Segmentation.segmentedBoth, s);
}
 
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) {
	for (RemoteDevice d : localDevice.getRemoteDevices()) {
		ObjectIdentifier oid = d.getObjectIdentifier();
</code></pre>
<p dir="auto">//			InetSocketAddress addr = new InetSocketAddress(<br />
//					InetAddress.getByName(ip), port);<br />
//			System.out.println(addr.toString());</p>
<pre><code>		ReadPropertyRequest read = new ReadPropertyRequest(new ObjectIdentifier(ObjectType.device, deviceId),
				PropertyIdentifier.objectList);
</code></pre>
<p dir="auto">//	        ReadPropertyAck ack = (ReadPropertyAck) localDevice.send(d, new ReadPropertyRequest(oid, PropertyIdentifier.presentValue));<br />
//			System.out.println("Value: " + ack.getValue());</p>
<p dir="auto">//			InetSocketAddress addr1 = new InetSocketAddress(InetAddress.getByName(ip), port);<br />
//			System.out.println(addr1.toString());</p>
<p dir="auto">//			networkNumber=0, macAddress=[ac,1c,e,64,ba,c0]<br />
Address  addr = new Address(0, "172.28.14.63");<br />
ReadPropertyAck ack;<br />
try {<br />
ack = (ReadPropertyAck) localDevice.send(addr, null, MaxApduLength.UP_TO_1476, Segmentation.segmentedBoth, read);<br />
System.out.println("Value: " + ack.getValue());<br />
} catch (BACnetException e) {<br />
// TODO Auto-generated catch block<br />
e.printStackTrace();<br />
}</p>
<p dir="auto">//			System.out.println(send(lDevice, new ReadPropertyRequest(oid, PropertyIdentifier.objectName, null)));<br />
//	        System.out.println(send(lDevice, new ReadPropertyRequest(created, PropertyIdentifier.presentValue, null)));<br />
//	        System.out.println(send(lDevice, new ReadPropertyRequest(oid, PropertyIdentifier.objectList,<br />
//	                new UnsignedInteger(0))));</p>
<p dir="auto">//			ReadPropertyAck ack = (ReadPropertyAck) localDevice.send(d,<br />
//					new ReadPropertyRequest(oid,<br />
//							PropertyIdentifier.protocolServicesSupported));<br />
//			System.out.println("Value: " + ack.getValue());</p>
<pre><code>	/*	@SuppressWarnings("unchecked")
		SequenceOf&lt;ObjectIdentifier&gt; oids = (SequenceOf&lt;ObjectIdentifier&gt;) ack
				.getValue();
		for (ObjectIdentifier oid1 : oids) {
			System.out.println("    " + oid1.getObjectType());
		}

		PropertyIdentifier pids = (PropertyIdentifier) ack.getValue();
		System.out.println("    " + pids);*/
	}
	
}
</code></pre>
<p dir="auto">}<br />
am getting an exception<br />
com.serotonin.bacnet4j.exception.ErrorAPDUException: ErrorAPDU(choice=12, errorClass=Object, errorCode=Unknown object)<br />
at com.serotonin.bacnet4j.transport.Transport.send(Transport.java:202)<br />
at com.serotonin.bacnet4j.LocalDevice.send(LocalDevice.java:381)<br />
at com.lnt.test.Test.getObjectList(Test.java:99)<br />
at com.lnt.test.Test.initializeDevice(Test.java:55)<br />
at com.lnt.test.Test.main(Test.java:35)<br />
can some one help on this</p>
]]></description><link>https://forum.mango-os.com/topic/1486/not-able-to-read-analog-values-from-device</link><generator>RSS for Node</generator><lastBuildDate>Sat, 17 Oct 2026 02:58:26 GMT</lastBuildDate><atom:link href="https://forum.mango-os.com/topic/1486.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 13 Feb 2014 19:20:36 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Not able to read analog values from device on Thu, 06 Mar 2014 23:39:47 GMT]]></title><description><![CDATA[<p dir="auto">I just realized the new BACNet4j code is located in GitHub here: <a href="https://github.com/mlohbihler/BACnet4J" rel="nofollow ugc">https://github.com/mlohbihler/BACnet4J</a></p>
<p dir="auto">Sorry for the confusion.</p>
]]></description><link>https://forum.mango-os.com/post/8418</link><guid isPermaLink="true">https://forum.mango-os.com/post/8418</guid><dc:creator><![CDATA[terrypacker]]></dc:creator><pubDate>Thu, 06 Mar 2014 23:39:47 GMT</pubDate></item><item><title><![CDATA[Reply to Not able to read analog values from device on Thu, 06 Mar 2014 22:10:04 GMT]]></title><description><![CDATA[<p dir="auto">Sorry I have been very busy lately with other work.  All BACNet4j source is here <a href="http://sourceforge.net/projects/bacnet4j/" rel="nofollow ugc">http://sourceforge.net/projects/bacnet4j/</a></p>
<p dir="auto">Also, the code you posted isn't complete, you have not provided the source for the Listener class so I was unable to run the code you posted.</p>
]]></description><link>https://forum.mango-os.com/post/8417</link><guid isPermaLink="true">https://forum.mango-os.com/post/8417</guid><dc:creator><![CDATA[terrypacker]]></dc:creator><pubDate>Thu, 06 Mar 2014 22:10:04 GMT</pubDate></item><item><title><![CDATA[Reply to Not able to read analog values from device on Tue, 18 Feb 2014 14:53:31 GMT]]></title><description><![CDATA[<p dir="auto">can u send the  code for ReadRangeRequest, and ReadRangeAck</p>
]]></description><link>https://forum.mango-os.com/post/8358</link><guid isPermaLink="true">https://forum.mango-os.com/post/8358</guid><dc:creator><![CDATA[manjunathm]]></dc:creator><pubDate>Tue, 18 Feb 2014 14:53:31 GMT</pubDate></item><item><title><![CDATA[Reply to Not able to read analog values from device on Tue, 18 Feb 2014 10:36:39 GMT]]></title><description><![CDATA[<p dir="auto">can u please replay ,,</p>
<p dir="auto">can u please see my code where am going wrong????</p>
]]></description><link>https://forum.mango-os.com/post/8356</link><guid isPermaLink="true">https://forum.mango-os.com/post/8356</guid><dc:creator><![CDATA[manjunathm]]></dc:creator><pubDate>Tue, 18 Feb 2014 10:36:39 GMT</pubDate></item><item><title><![CDATA[Reply to Not able to read analog values from device on Mon, 17 Feb 2014 19:19:06 GMT]]></title><description><![CDATA[<p dir="auto">Thanks a lot for your replay !!!<br />
ya i tried in your way am ...please see this code<br />
now my source code is ...</p>
<p dir="auto">package com.lnt.TestApp;</p>
<p dir="auto">import java.util.List;</p>
<p dir="auto">import com.serotonin.bacnet4j.LocalDevice;<br />
import com.serotonin.bacnet4j.RemoteDevice;<br />
import com.serotonin.bacnet4j.enums.MaxApduLength;<br />
import com.serotonin.bacnet4j.npdu.ip.IpNetwork;<br />
import com.serotonin.bacnet4j.service.acknowledgement.AcknowledgementService;<br />
import com.serotonin.bacnet4j.service.acknowledgement.ReadPropertyAck;<br />
import com.serotonin.bacnet4j.service.confirmed.ConfirmedRequestService;<br />
import com.serotonin.bacnet4j.service.confirmed.ReadPropertyRequest;<br />
import com.serotonin.bacnet4j.service.unconfirmed.WhoIsRequest;<br />
import com.serotonin.bacnet4j.transport.Transport;<br />
import com.serotonin.bacnet4j.type.constructed.Address;<br />
import com.serotonin.bacnet4j.type.constructed.SequenceOf;<br />
import com.serotonin.bacnet4j.type.enumerated.PropertyIdentifier;<br />
import com.serotonin.bacnet4j.type.enumerated.Segmentation;<br />
import com.serotonin.bacnet4j.type.primitive.ObjectIdentifier;<br />
import com.serotonin.bacnet4j.util.RequestUtils;</p>
<p dir="auto">public class Test {<br />
static LocalDevice lDevice;<br />
static Address  addr = new Address(0, "172.28.14.100");</p>
<pre><code>public Test() {
}

public static void main(String args[]) {
	initializeDevice();
}

public static void initializeDevice() {
	try {
		System.out.println("Initializing...");
		IpNetwork ipNetwork = new IpNetwork("172.28.14.255", 47808,	"172.28.14.63");
		Transport transport = new Transport(ipNetwork);
		lDevice = new LocalDevice(9899, transport);
		lDevice.initialize();
		lDevice.getEventHandler().addListener(new Listener());
		lDevice.sendGlobalBroadcast(new WhoIsRequest());
		Thread.sleep(500);

		getObjectList(lDevice, "172.28.14.100",	47808, 0);
	} catch (Exception e) {
		System.out.println("Error : " + e.getMessage());
	} finally {
		closeDevice();
	}
}

public static AcknowledgementService send(LocalDevice d,
		ConfirmedRequestService s) throws Exception {
</code></pre>
<p dir="auto">//		Address a = new Address(InetAddrCache.get("localhost", 0xbac1));<br />
return d.send(addr, null, MaxApduLength.UP_TO_1476, Segmentation.segmentedBoth, s);<br />
}</p>
<pre><code>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 {
	for (RemoteDevice d : localDevice.getRemoteDevices()) {
</code></pre>
<p dir="auto">//			ObjectIdentifier oid = d.getObjectIdentifier();<br />
@SuppressWarnings("unchecked")<br />
List&lt;ObjectIdentifier&gt; oids = ((SequenceOf&lt;ObjectIdentifier&gt;) RequestUtils<br />
.sendReadPropertyAllowNull(localDevice, d,	d.getObjectIdentifier(),PropertyIdentifier.objectList)).getValues();</p>
<pre><code>		for (int i = 0; i &lt; oids.size(); i++) {
			System.out.println("OBjectIdentifier"+oids);
		}
		
		for (ObjectIdentifier oid : oids) {
			
			ReadPropertyRequest read = new ReadPropertyRequest(oid,	PropertyIdentifier.deviceAddressBinding);
			ReadPropertyAck ack = (ReadPropertyAck) localDevice.send(d, read); 
			
			System.out.println("Value: " + ack.getValue());
			

		}
		
	}
}
</code></pre>
<p dir="auto">}</p>
<p dir="auto">and my optpuit is<br />
Segmentation: both<br />
OBjectIdentifier[Device 9899]<br />
Value: []<br />
OBjectIdentifier[Device 0, Analog Value 1, Analog Value 2, Trend Log 1, Trend Log 2, File 0]<br />
OBjectIdentifier[Device 0, Analog Value 1, Analog Value 2, Trend Log 1, Trend Log 2, File 0]<br />
OBjectIdentifier[Device 0, Analog Value 1, Analog Value 2, Trend Log 1, Trend Log 2, File 0]<br />
OBjectIdentifier[Device 0, Analog Value 1, Analog Value 2, Trend Log 1, Trend Log 2, File 0]<br />
OBjectIdentifier[Device 0, Analog Value 1, Analog Value 2, Trend Log 1, Trend Log 2, File 0]<br />
OBjectIdentifier[Device 0, Analog Value 1, Analog Value 2, Trend Log 1, Trend Log 2, File 0]<br />
but i want analog values form that any hint ???</p>
]]></description><link>https://forum.mango-os.com/post/8348</link><guid isPermaLink="true">https://forum.mango-os.com/post/8348</guid><dc:creator><![CDATA[manjunathm]]></dc:creator><pubDate>Mon, 17 Feb 2014 19:19:06 GMT</pubDate></item><item><title><![CDATA[Reply to Not able to read analog values from device on Fri, 14 Feb 2014 00:55:02 GMT]]></title><description><![CDATA[<p dir="auto">Hi there I think I may be able to point you in the right direction.</p>
<p dir="auto">In your method getObjectList(localDevice, ip, port, deviceId) you may be using the wrong Object Identifier.  You are hard coding the deviceId to 17800 but you are requesting the object list for all remote devices that have been discovered.  I was able to get your code to work on my test platform by changing the following:</p>
<pre><code>ReadPropertyRequest read = new ReadPropertyRequest(new ObjectIdentifier(ObjectType.device, deviceId), PropertyIdentifier.objectList);
</code></pre>
<p dir="auto">to:</p>
<pre><code>ReadPropertyRequest read = new ReadPropertyRequest(oid,PropertyIdentifier.objectList);
</code></pre>
<p dir="auto">This change ensures that you are using the ObjectIdentifier for the remote devices that have been discovered.</p>
]]></description><link>https://forum.mango-os.com/post/8330</link><guid isPermaLink="true">https://forum.mango-os.com/post/8330</guid><dc:creator><![CDATA[terrypacker]]></dc:creator><pubDate>Fri, 14 Feb 2014 00:55:02 GMT</pubDate></item></channel></rss>