• Recent
    • Tags
    • Popular
    • Register
    • Login
    1. Home
    2. manjunathm

    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
    M
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 9
    • Best 0
    • Controversial 0
    • Groups 0

    manjunathm

    @manjunathm

    0
    Reputation
    781
    Profile views
    9
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    manjunathm Unfollow Follow

    Latest posts made by manjunathm

    • RE: Reading trendlog data

      HI can any one please help me on this ....

      package com.lnt.TestApp;

      import java.util.ArrayList;
      import java.util.Iterator;
      import java.util.List;

      import com.serotonin.bacnet4j.LocalDevice;
      import com.serotonin.bacnet4j.RemoteDevice;
      import com.serotonin.bacnet4j.enums.MaxApduLength;
      import com.serotonin.bacnet4j.exception.BACnetException;
      import com.serotonin.bacnet4j.npdu.ip.IpNetwork;
      import com.serotonin.bacnet4j.service.acknowledgement.AcknowledgementService;
      import com.serotonin.bacnet4j.service.acknowledgement.ReadPropertyAck;
      import com.serotonin.bacnet4j.service.acknowledgement.ReadRangeAck;
      import com.serotonin.bacnet4j.service.confirmed.ConfirmedRequestService;
      import com.serotonin.bacnet4j.service.confirmed.ReadPropertyRequest;
      import com.serotonin.bacnet4j.service.confirmed.ReadRangeRequest;
      import com.serotonin.bacnet4j.service.confirmed.ReadRangeRequest.BySequenceNumber;
      import com.serotonin.bacnet4j.service.unconfirmed.WhoIsRequest;
      import com.serotonin.bacnet4j.transport.Transport;
      import com.serotonin.bacnet4j.type.Encodable;
      import com.serotonin.bacnet4j.type.constructed.Address;
      import com.serotonin.bacnet4j.type.constructed.LogRecord;
      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.OctetString;
      import com.serotonin.bacnet4j.type.primitive.SignedInteger;
      import com.serotonin.bacnet4j.type.primitive.UnsignedInteger;
      import com.serotonin.bacnet4j.util.PropertyReferences;
      import com.serotonin.bacnet4j.util.PropertyValues;
      import com.serotonin.bacnet4j.util.RequestUtils;

      public class Test {
      static LocalDevice lDevice;
      static Address addr = new Address(0, "172.28.14.100");

      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 {
      	// Address a = new Address(InetAddrCache.get("localhost", 0xbac1));
      	return d.send(addr, 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) {
      	RemoteDevice fileDev = null;
      	ObjectIdentifier file = null;
      	ReadPropertyRequest readPropertyRequest;
      	ReadPropertyAck reaPropertyAck;
      	UnsignedInteger referenceIndex = null;
      	SignedInteger signedInteger = null;
      	Address address[] = lDevice.getAllLocalAddresses();
      	OctetString octetString = new OctetString("172.28.14.63", 47808);
      	RemoteDevice dev3400 = null;
      	
      	//try {
      		//dev3400 = lDevice.findRemoteDevice(address[0], octetString, 0);
      	  dev3400 = lDevice.getRemoteDevice(address[0]);
      	//} catch (BACnetException e1) {
      		// TODO Auto-generated catch block
      	//	e1.printStackTrace();
      	//}
      
      	
      	for (RemoteDevice d : localDevice.getRemoteDevices()) {
      		// ObjectIdentifier oid = d.getObjectIdentifier();
      
      		RemoteDevice rd = new RemoteDevice(123,	localDevice.getAllLocalAddresses()[0], octetString);
      
      		@SuppressWarnings("unchecked")
      		List<ObjectIdentifier> oids;
      		try {
      			oids = ((SequenceOf<ObjectIdentifier>) RequestUtils	.sendReadPropertyAllowNull(localDevice, d,	d.getObjectIdentifier(),
      							PropertyIdentifier.objectList)).getValues();
      
      			for (ObjectIdentifier oid : oids) {
      				readPropertyRequest = new ReadPropertyRequest(oid, PropertyIdentifier.objectName);
      				reaPropertyAck = (ReadPropertyAck) localDevice.send(d,readPropertyRequest);
      				System.out.println("Value: " + reaPropertyAck.getValue());
      
      				
      				if (oid.getObjectType().equals(ObjectType.trendLog)) {
      
      					readPropertyRequest = new ReadPropertyRequest(oid,	PropertyIdentifier.objectName);
      					reaPropertyAck = (ReadPropertyAck) localDevice.send(d,	readPropertyRequest);
      
      					System.out.println("ObjectName: "+ reaPropertyAck.getValue());
      
      					readPropertyRequest = new ReadPropertyRequest(oid,PropertyIdentifier.bufferSize);
      					reaPropertyAck = (ReadPropertyAck) localDevice.send(d,readPropertyRequest);
      					System.out.println("BufferSize: "+ reaPropertyAck.getValue());
      
      					readPropertyRequest = new ReadPropertyRequest(oid,	PropertyIdentifier.totalRecordCount);
      					reaPropertyAck = (ReadPropertyAck) localDevice.send(d, readPropertyRequest);
      					System.out.println("totalRecordCount: "	+ reaPropertyAck.getValue());
      					// Encodable totalRecordCount =	// reaPropertyAck.getValue();
      
      					readPropertyRequest = new ReadPropertyRequest(oid, PropertyIdentifier.recordCount);
      					reaPropertyAck = (ReadPropertyAck) localDevice.send(d, readPropertyRequest);
      					System.out.println("RecordCount: "+ reaPropertyAck.getValue());
      					// Encodable recordCount = reaPropertyAck.getValue();
      
      					readPropertyRequest = new ReadPropertyRequest(oid, PropertyIdentifier.eventState);
      					reaPropertyAck = (ReadPropertyAck) localDevice.send(d, readPropertyRequest);
      					System.out.println("eventState: " + reaPropertyAck.getValue());
      
      					readPropertyRequest = new ReadPropertyRequest(oid,PropertyIdentifier.totalRecordCount);
      					reaPropertyAck = (ReadPropertyAck) lDevice.send(d,readPropertyRequest);
      					System.out.println("TotalRecordCount: "+ reaPropertyAck.getValue());
      					UnsignedInteger totalRecordCount = (UnsignedInteger) reaPropertyAck.getValue();
      
      					readPropertyRequest = new ReadPropertyRequest(oid, PropertyIdentifier.recordCount);
      					reaPropertyAck = (ReadPropertyAck) lDevice.send(d, readPropertyRequest);
      					System.out.println("RecordCount: "+ reaPropertyAck.getValue());
      					UnsignedInteger recordCount = (UnsignedInteger) reaPropertyAck.getValue();
      					signedInteger = new SignedInteger(recordCount.bigIntegerValue());
      
      					referenceIndex = new UnsignedInteger(totalRecordCount.longValue() - signedInteger.longValue() - 1);
      					
      					ReadRangeRequest rrr = new ReadRangeRequest(new ObjectIdentifier(ObjectType.trendLogMultiple, 11),
      							PropertyIdentifier.logBuffer, null,	new BySequenceNumber(referenceIndex,signedInteger));
      					//lDevice.send(d, rrr);
      					ReadRangeAck rra = (ReadRangeAck)lDevice.send(d, rrr);  
      
      					System.out.println(rra.getItemCount());   
      				    System.out.println(rra.getFirstSequenceNumber());   
      		            System.out.println(rra.getItemData());   
      		            Iterator<?> it = (Iterator<?>)rra.getItemData().iterator();   
      		            while (it.hasNext())   
      					{   
      			                Encodable e = (Encodable)it.next();   
      			                if (e instanceof LogRecord)   
      			                {   
      			                    LogRecord lr = (LogRecord)e;   
      			                    //System.out.println(lr.getBaseType());   
      			                    System.out.println(lr.getChoiceType());   
      			                }   
      			        }  
      				}
      			
      			}
      		} catch (BACnetException e) {
      			// TODO Auto-generated catch block
      			e.printStackTrace();
      		}
      	}
      }
      

      }
      I am able to read bacnet objets, but i want to read trendlog contentes in my code when the flo comes ReadRangeRequest and ReadRangeAc am getting bacnet timeout exception can u please see the code and guid me on this...

      posted in BACnet4J general discussion
      M
      manjunathm
    • RE: Not able to read analog values from device

      can u send the code for ReadRangeRequest, and ReadRangeAck

      posted in Development general discussion
      M
      manjunathm
    • RE: Not able to read analog values from device

      can u please replay ,,

      can u please see my code where am going wrong????

      posted in Development general discussion
      M
      manjunathm
    • RE: How to integrate BACnet Change Of Value (COV) using BACnet4J

      No i have server running in my premisis,,,,

      i can see the list of devices also.... if u see my output you can see objects

      and the link u shared, am not able to open bcz restriction,,, can u please share the code??

      posted in BACnet4J general discussion
      M
      manjunathm
    • RE: How to integrate BACnet Change Of Value (COV) using BACnet4J

      Can u please share the code to read (Request and response sorce code for analog values)

      am trying some what like this ,, but am getting timeout exception

      package com.lnt.TestApp;

      import java.util.List;

      import com.serotonin.bacnet4j.LocalDevice;
      import com.serotonin.bacnet4j.RemoteDevice;
      import com.serotonin.bacnet4j.enums.MaxApduLength;
      import com.serotonin.bacnet4j.npdu.ip.IpNetwork;
      import com.serotonin.bacnet4j.service.acknowledgement.AcknowledgementService;
      import com.serotonin.bacnet4j.service.acknowledgement.AtomicReadFileAck;
      import com.serotonin.bacnet4j.service.acknowledgement.ReadPropertyAck;
      import com.serotonin.bacnet4j.service.confirmed.AtomicReadFileRequest;
      import com.serotonin.bacnet4j.service.confirmed.ConfirmedRequestService;
      import com.serotonin.bacnet4j.service.confirmed.ReadPropertyRequest;
      import com.serotonin.bacnet4j.service.unconfirmed.WhoIsRequest;
      import com.serotonin.bacnet4j.transport.Transport;
      import com.serotonin.bacnet4j.type.Encodable;
      import com.serotonin.bacnet4j.type.constructed.Address;
      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.OctetString;
      import com.serotonin.bacnet4j.util.RequestUtils;

      public class Test {
      static LocalDevice lDevice;
      static Address addr = new Address(0, "IP");

      public Test() {
      }
      
      public static void main(String args[]) {
      	initializeDevice();
      }
      
      public static void initializeDevice() {
      	try {
      		System.out.println("Initializing...");
      		IpNetwork ipNetwork = new IpNetwork("Ip", 47808,"Ip");
      		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, "Ip",	47808, 0);
      	} catch (Exception e) {
      		System.out.println("Error : " + e.getMessage());
      	} finally {
      		closeDevice();
      	}
      }
      
      public static AcknowledgementService send(LocalDevice d,
      		ConfirmedRequestService s) throws Exception {
      

      // Address a = new Address(InetAddrCache.get("localhost", 0xbac1));
      return d.send(addr, 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) throws Exception {
      	RemoteDevice fileDev = null;
      	ObjectIdentifier file = null;
      	ReadPropertyRequest readPropertyRequest;
      	ReadPropertyAck reaPropertyAck;
      	
      	
      	for (RemoteDevice d : localDevice.getRemoteDevices()) {
      

      // ObjectIdentifier oid = d.getObjectIdentifier();
      @SuppressWarnings("unchecked")
      List<ObjectIdentifier> oids = ((SequenceOf<ObjectIdentifier>) RequestUtils
      .sendReadPropertyAllowNull(localDevice, d, d.getObjectIdentifier(),PropertyIdentifier.objectList)).getValues();

      		Address address[] = lDevice.getAllLocalAddresses();
      		OctetString octetString = new OctetString("Ip", 47808);
      		
      		for (int i = 0; i < oids.size(); i++) {
      			System.out.println("OBjectIdentifier"+oids);
      		}
      		
      		for (ObjectIdentifier oid : oids) {
      			readPropertyRequest = new ReadPropertyRequest(oid,	PropertyIdentifier.objectName);
      			reaPropertyAck = (ReadPropertyAck) localDevice.send(d, readPropertyRequest); 
      			System.out.println("Value: " + reaPropertyAck.getValue());
      			
      			if (oid.getObjectType().equals(ObjectType.file)) {
      				fileDev = d;
      				file = oid;
      				AtomicReadFileRequest request = new AtomicReadFileRequest(file, false, 0, 1412);
      				AtomicReadFileAck response = (AtomicReadFileAck) localDevice.send(fileDev, request);
      				System.out.println("eof: " + response.getEndOfFile());
      				System.out.println("start: "+ response.getFileStartPosition());
      				System.out.println("data: "	+ new String(response.getFileData().getBytes()));
      				System.out.println("length: "+ response.getFileData().getBytes().length);
      			}
      			
      			if (oid.getObjectType().equals(ObjectType.analogValue)) {
      				fileDev = d;
      				file = oid;
      				readPropertyRequest = new ReadPropertyRequest(new ObjectIdentifier(ObjectType.analogValue, 243), PropertyIdentifier.clientCovIncrement);
      				reaPropertyAck = (ReadPropertyAck) localDevice.send(d, readPropertyRequest); 
      				System.out.println(reaPropertyAck.getValue());
      			}
        		}
      	}
      }
      

      }

      am getting timke exception for reading analog values

      posted in BACnet4J general discussion
      M
      manjunathm
    • RE: How to integrate BACnet Change Of Value (COV) using BACnet4J

      Hi This Taresh,

      can u please send me code to read analog values,

      as it is urgently required for our project

      posted in BACnet4J general discussion
      M
      manjunathm
    • RE: Not able to read analog values from device

      Thanks a lot for your replay !!!
      ya i tried in your way am ...please see this code
      now my source code is ...

      package com.lnt.TestApp;

      import java.util.List;

      import com.serotonin.bacnet4j.LocalDevice;
      import com.serotonin.bacnet4j.RemoteDevice;
      import com.serotonin.bacnet4j.enums.MaxApduLength;
      import com.serotonin.bacnet4j.npdu.ip.IpNetwork;
      import com.serotonin.bacnet4j.service.acknowledgement.AcknowledgementService;
      import com.serotonin.bacnet4j.service.acknowledgement.ReadPropertyAck;
      import com.serotonin.bacnet4j.service.confirmed.ConfirmedRequestService;
      import com.serotonin.bacnet4j.service.confirmed.ReadPropertyRequest;
      import com.serotonin.bacnet4j.service.unconfirmed.WhoIsRequest;
      import com.serotonin.bacnet4j.transport.Transport;
      import com.serotonin.bacnet4j.type.constructed.Address;
      import com.serotonin.bacnet4j.type.constructed.SequenceOf;
      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.util.RequestUtils;

      public class Test {
      static LocalDevice lDevice;
      static Address addr = new Address(0, "172.28.14.100");

      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 {
      

      // Address a = new Address(InetAddrCache.get("localhost", 0xbac1));
      return d.send(addr, 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) throws Exception {
      	for (RemoteDevice d : localDevice.getRemoteDevices()) {
      

      // ObjectIdentifier oid = d.getObjectIdentifier();
      @SuppressWarnings("unchecked")
      List<ObjectIdentifier> oids = ((SequenceOf<ObjectIdentifier>) RequestUtils
      .sendReadPropertyAllowNull(localDevice, d, d.getObjectIdentifier(),PropertyIdentifier.objectList)).getValues();

      		for (int i = 0; i < 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());
      			
      
      		}
      		
      	}
      }
      

      }

      and my optpuit is
      Segmentation: both
      OBjectIdentifier[Device 9899]
      Value: []
      OBjectIdentifier[Device 0, Analog Value 1, Analog Value 2, Trend Log 1, Trend Log 2, File 0]
      OBjectIdentifier[Device 0, Analog Value 1, Analog Value 2, Trend Log 1, Trend Log 2, File 0]
      OBjectIdentifier[Device 0, Analog Value 1, Analog Value 2, Trend Log 1, Trend Log 2, File 0]
      OBjectIdentifier[Device 0, Analog Value 1, Analog Value 2, Trend Log 1, Trend Log 2, File 0]
      OBjectIdentifier[Device 0, Analog Value 1, Analog Value 2, Trend Log 1, Trend Log 2, File 0]
      OBjectIdentifier[Device 0, Analog Value 1, Analog Value 2, Trend Log 1, Trend Log 2, File 0]
      but i want analog values form that any hint ???

      posted in Development general discussion
      M
      manjunathm
    • Not able to read analog values from device

      Not able to read analog values from device
      public class Test {
      static LocalDevice lDevice;
      /static ResourceBundle resource = ResourceBundle
      .getBundle("com.serotonin.bacnet4j/bacnet4j");
      /

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

      // RemoteDevice rd = new RemoteDevice(101, new Address(new byte[] { (byte) 1, (byte) 2, 3, (byte) 4 }, 47808), null);
      // lDevice.addRemoteDevice(rd);
      //
      @SuppressWarnings("unused")
      ReadPropertyRequest read = new ReadPropertyRequest(
      new ObjectIdentifier(ObjectType.analogInput, 243),PropertyIdentifier.presentValue);
      getObjectList(lDevice, "172.28.14.63", 47808, 17800);
      } catch (Exception e) {
      System.out.println("Error al inicializar " + e.getMessage());
      } finally {
      closeDevice();
      }
      }

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

      // 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(d, new ReadPropertyRequest(oid, PropertyIdentifier.presentValue));
      // System.out.println("Value: " + ack.getValue());

      // InetSocketAddress addr1 = new InetSocketAddress(InetAddress.getByName(ip), port);
      // System.out.println(addr1.toString());

      // networkNumber=0, macAddress=[ac,1c,e,64,ba,c0]
      Address addr = new Address(0, "172.28.14.63");
      ReadPropertyAck ack;
      try {
      ack = (ReadPropertyAck) localDevice.send(addr, null, MaxApduLength.UP_TO_1476, Segmentation.segmentedBoth, read);
      System.out.println("Value: " + ack.getValue());
      } catch (BACnetException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      }

      // System.out.println(send(lDevice, new ReadPropertyRequest(oid, PropertyIdentifier.objectName, null)));
      // System.out.println(send(lDevice, new ReadPropertyRequest(created, PropertyIdentifier.presentValue, null)));
      // System.out.println(send(lDevice, new ReadPropertyRequest(oid, PropertyIdentifier.objectList,
      // new UnsignedInteger(0))));

      // ReadPropertyAck ack = (ReadPropertyAck) localDevice.send(d,
      // new ReadPropertyRequest(oid,
      // PropertyIdentifier.protocolServicesSupported));
      // System.out.println("Value: " + ack.getValue());

      	/*	@SuppressWarnings("unchecked")
      		SequenceOf<ObjectIdentifier> oids = (SequenceOf<ObjectIdentifier>) ack
      				.getValue();
      		for (ObjectIdentifier oid1 : oids) {
      			System.out.println("    " + oid1.getObjectType());
      		}
      
      		PropertyIdentifier pids = (PropertyIdentifier) ack.getValue();
      		System.out.println("    " + pids);*/
      	}
      	
      }
      

      }
      am getting an exception
      com.serotonin.bacnet4j.exception.ErrorAPDUException: ErrorAPDU(choice=12, errorClass=Object, errorCode=Unknown object)
      at com.serotonin.bacnet4j.transport.Transport.send(Transport.java:202)
      at com.serotonin.bacnet4j.LocalDevice.send(LocalDevice.java:381)
      at com.lnt.test.Test.getObjectList(Test.java:99)
      at com.lnt.test.Test.initializeDevice(Test.java:55)
      at com.lnt.test.Test.main(Test.java:35)
      can some one help on this

      posted in Development general discussion
      M
      manjunathm
    • RE: Not able to read analog values from device

      Not able to read analog values from device
      public class Test {
      static LocalDevice lDevice;
      /static ResourceBundle resource = ResourceBundle
      .getBundle("com.serotonin.bacnet4j/bacnet4j");
      /

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

      // RemoteDevice rd = new RemoteDevice(101, new Address(new byte[] { (byte) 1, (byte) 2, 3, (byte) 4 }, 47808), null);
      // lDevice.addRemoteDevice(rd);
      //
      @SuppressWarnings("unused")
      ReadPropertyRequest read = new ReadPropertyRequest(
      new ObjectIdentifier(ObjectType.analogInput, 243),PropertyIdentifier.presentValue);
      getObjectList(lDevice, "172.28.14.63", 47808, 17800);
      } catch (Exception e) {
      System.out.println("Error al inicializar " + e.getMessage());
      } finally {
      closeDevice();
      }
      }

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

      // 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(d, new ReadPropertyRequest(oid, PropertyIdentifier.presentValue));
      // System.out.println("Value: " + ack.getValue());

      // InetSocketAddress addr1 = new InetSocketAddress(InetAddress.getByName(ip), port);
      // System.out.println(addr1.toString());

      // networkNumber=0, macAddress=[ac,1c,e,64,ba,c0]
      Address addr = new Address(0, "172.28.14.63");
      ReadPropertyAck ack;
      try {
      ack = (ReadPropertyAck) localDevice.send(addr, null, MaxApduLength.UP_TO_1476, Segmentation.segmentedBoth, read);
      System.out.println("Value: " + ack.getValue());
      } catch (BACnetException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      }

      // System.out.println(send(lDevice, new ReadPropertyRequest(oid, PropertyIdentifier.objectName, null)));
      // System.out.println(send(lDevice, new ReadPropertyRequest(created, PropertyIdentifier.presentValue, null)));
      // System.out.println(send(lDevice, new ReadPropertyRequest(oid, PropertyIdentifier.objectList,
      // new UnsignedInteger(0))));

      // ReadPropertyAck ack = (ReadPropertyAck) localDevice.send(d,
      // new ReadPropertyRequest(oid,
      // PropertyIdentifier.protocolServicesSupported));
      // System.out.println("Value: " + ack.getValue());

      	/*	@SuppressWarnings("unchecked")
      		SequenceOf<ObjectIdentifier> oids = (SequenceOf<ObjectIdentifier>) ack
      				.getValue();
      		for (ObjectIdentifier oid1 : oids) {
      			System.out.println("    " + oid1.getObjectType());
      		}
      
      		PropertyIdentifier pids = (PropertyIdentifier) ack.getValue();
      		System.out.println("    " + pids);*/
      	}
      	
      }
      

      }
      am getting an exception
      com.serotonin.bacnet4j.exception.ErrorAPDUException: ErrorAPDU(choice=12, errorClass=Object, errorCode=Unknown object)
      at com.serotonin.bacnet4j.transport.Transport.send(Transport.java:202)
      at com.serotonin.bacnet4j.LocalDevice.send(LocalDevice.java:381)
      at com.lnt.test.Test.getObjectList(Test.java:99)
      at com.lnt.test.Test.initializeDevice(Test.java:55)
      at com.lnt.test.Test.main(Test.java:35)
      can some one help on this

      posted in Development general discussion
      M
      manjunathm