• Recent
    • Tags
    • Popular
    • Register
    • Login
    1. Home
    2. joolz
    3. Topics

    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
    J
    • Profile
    • Following 0
    • Followers 0
    • Topics 18
    • Posts 50
    • Best 1
    • Controversial 0
    • Groups 0

    Topics created by joolz

    • J

      Bug in Destination/DaysOfWeek class

      BACnet4J general discussion
      • • • joolz
      1
      0
      Votes
      1
      Posts
      1.5k
      Views

      No one has replied

    • J

      Issue with the PriorityArray and multiple BACnet objects of the same type

      BACnet4J general discussion
      • • • joolz
      1
      0
      Votes
      1
      Posts
      1.7k
      Views

      No one has replied

    • J

      Creating a Schedule Object in BACnet4j

      BACnet4J general discussion
      • • • joolz
      6
      0
      Votes
      6
      Posts
      6.0k
      Views

      W

      Sorry to answer so lately, I finally found back my login and password for this site.

      Tank you Joolz, your comment helped me buld a schedule object. I'll try to paste a very basic example when I'll figure out how to put my code into code tag.

    • J

      Bug in LogData class

      BACnet4J general discussion
      • • • joolz
      2
      0
      Votes
      2
      Posts
      2.1k
      Views

      J

      According to the standard, BACnetLogData is a choice of log-status, log-data or time-change.

      However, looking at com.serotonin.bacnet4j.type.constructed.LogData.java:```
      public LogData(ByteQueue queue) throws BACnetException {
      logStatus = read(queue, LogStatus.class, 0);
      logData = readSequenceOfChoice(queue, classes, 1);
      timeChange = read(queue, Real.class, 2);
      }

      @Override public void write(ByteQueue queue) { write(queue, logStatus, 0); write(queue, logData, 1); write(queue, timeChange, 2); } By changing public LogData(ByteQueue queue) throws BACnetException { logStatus = read(queue, LogStatus.class, 0); logData = readSequenceOfChoice(queue, classes, 1); timeChange = read(queue, Real.class, 2); } public LogData(ByteQueue queue) throws BACnetException { int tag = peekTagNumber(queue); if (tag == 0) { logStatus = read(queue, LogStatus.class, 0); logData = null; timeChange = null; } else if (tag == 1) { logStatus = null; logData = readSequenceOfChoice(queue, classes, 1); timeChange = null; } else if (tag == 2) { logStatus = null; logData = null; timeChange = read(queue, Real.class, 2); } else { throw new BACnetErrorException(ErrorClass.property, ErrorCode.missingRequiredParameter); } }
    • J

      Reading Trendlog LogBuffer property should return an error

      BACnet4J general discussion
      • • • joolz
      2
      0
      Votes
      2
      Posts
      2.1k
      Views

      J

      The BACnet standard states that any attempt to read the LogBuffer property of a Trendlog or Trendlog Multiple object with a ReadProperty-Request or a ReadPropertyMultiple-Request shall cause a a Result(-) response, with an Error class of PROPERTY, and an Error Code of READ_ACCESS_DENIED.
      Currently BACnet4j does not do this.
      I've created a couple of patches which I believe fix this:

      diff --git a/src/com/serotonin/bacnet4j/service/confirmed/ReadPropertyMultipleRequest.java b/src/com/serotonin/bacnet4j/service/confirmed/ReadPropertyMultipleRequest.java --- a/src/com/serotonin/bacnet4j/service/confirmed/ReadPropertyMultipleRequest.java +++ b/src/com/serotonin/bacnet4j/service/confirmed/ReadPropertyMultipleRequest.java @@ -44,6 +44,8 @@ import com.serotonin.bacnet4j.type.constructed.ReadAccessResult.Result; import com.serotonin.bacnet4j.type.constructed.ReadAccessSpecification; import com.serotonin.bacnet4j.type.constructed.SequenceOf; +import com.serotonin.bacnet4j.type.enumerated.ErrorClass; +import com.serotonin.bacnet4j.type.enumerated.ErrorCode; import com.serotonin.bacnet4j.type.enumerated.PropertyIdentifier; import com.serotonin.bacnet4j.type.primitive.ObjectIdentifier; import com.serotonin.bacnet4j.type.primitive.OctetString; @@ -151,7 +153,10 @@ else { // Get the specified property. try { - results.add(new Result(pid, pin, obj.getPropertyRequired(pid, pin))); + if (pid.equals(PropertyIdentifier.logBuffer)) + results.add(new Result(pid, pin, new BACnetError(ErrorClass.property, ErrorCode.readAccessDenied))); + else + results.add(new Result(pid, pin, obj.getPropertyRequired(pid, pin))); } catch (BACnetServiceException e) { results.add(new Result(pid, pin, new BACnetError(e.getErrorClass(), e.getErrorCode())));

      diff --git a/src/com/serotonin/bacnet4j/service/confirmed/ReadPropertyMultipleRequest.java b/src/com/serotonin/bacnet4j/service/confirmed/ReadPropertyMultipleRequest.java
      --- a/src/com/serotonin/bacnet4j/service/confirmed/ReadPropertyMultipleRequest.java
      +++ b/src/com/serotonin/bacnet4j/service/confirmed/ReadPropertyMultipleRequest.java
      @@ -44,6 +44,8 @@
      import com.serotonin.bacnet4j.type.constructed.ReadAccessResult.Result;
      import com.serotonin.bacnet4j.type.constructed.ReadAccessSpecification;
      import com.serotonin.bacnet4j.type.constructed.SequenceOf;
      +import com.serotonin.bacnet4j.type.enumerated.ErrorClass;
      +import com.serotonin.bacnet4j.type.enumerated.ErrorCode;
      import com.serotonin.bacnet4j.type.enumerated.PropertyIdentifier;
      import com.serotonin.bacnet4j.type.primitive.ObjectIdentifier;
      import com.serotonin.bacnet4j.type.primitive.OctetString;
      @@ -151,7 +153,10 @@
      else {
      // Get the specified property.
      try {

      results.add(new Result(pid, pin, obj.getPropertyRequired(pid, pin))); if (pid.equals(PropertyIdentifier.logBuffer)) results.add(new Result(pid, pin, new BACnetError(ErrorClass.property, ErrorCode.readAccessDenied))); else results.add(new Result(pid, pin, obj.getPropertyRequired(pid, pin))); } catch (BACnetServiceException e) { results.add(new Result(pid, pin, new BACnetError(e.getErrorClass(), e.getErrorCode())));
    • J

      DeviceObjectPropertyReference hashCode function collision

      BACnet4J general discussion
      • • • joolz
      5
      0
      Votes
      5
      Posts
      3.0k
      Views

      M

      You misinterpreted what they said. You had said you didn't know what hashes might be good for, and i provided an answer. You were using them inappropriately: as a unique key, rather than an indexing key, which are two different things. Since a hash is not guaranteed to be unique, you obviously should not use it for such a purpose.

      That said, you need to reconsider what you can use as a unique key, if that is what you need. This is a question for you to decide. I don't know your application, and so can't really help.

    • J

      Issue serializing the AmbiguousValue class

      BACnet4J general discussion
      • • • joolz
      3
      0
      Votes
      3
      Posts
      2.3k
      Views

      M

      I've changed the ByteQueue to a byte[]. This change will be in the next check-in, which will be a major upgrade.

    • J

      Remote device list bug when a device has new network information

      BACnet4J general discussion
      • • • joolz
      4
      0
      Votes
      4
      Posts
      2.7k
      Views

      J

      I am a little taken aback hearing that there are people using the same device instance for multiple devices on a network. They should be shot!

      From what I can see however, with the code as is, even if they were happy to violate (as personally I don't think there is any level of compliance in this department) the standard and have same device instance for multiple devices, it will only ever work with the first device in the list if BACnet4j has to make any sort of request to that device (I could be wrong, but that is my observation). So I'm not really sure how useful the current implementation is to anyone, as it doesn't really handle multiple devices, and it doesn't handle devices that change network details.
      I agree a flag in the localDevice object would be the simplest way to accomodate all parties, so that particular behaviour could be specified.

    • J

      Bug in PropertyStates class

      BACnet4J general discussion
      • • • joolz
      2
      0
      Votes
      2
      Posts
      2.7k
      Views

      J

      In
      com.serotonin.bacnet4j.type.constructed.PropertyStates.java:118

      public PropertyStates(int type, BaseType state) { this.state = new Choice(type, state); }

      I think it should be

      public PropertyStates(int type, Encodable state) { this.state = new Choice(type, state); }

      Most of the possible choices for a PropertyStates object are of Enumerated type, which doesn't extend from BaseType. The Choice constructor takes an Encodable as its parameter, so it should work. In my own testing, it appears to work just fine.

    • J

      ClassCastException in PropertyStates

      BACnet4J general discussion
      • • • joolz
      2
      0
      Votes
      2
      Posts
      2.7k
      Views

      J

      When a com.serotonin.bacnet4j.type.constructed.ProptertyStates object is instantiated via the PropertyStates(int type, BaseType state) constructor, the getState() function will work fine as a BaseType object is required.

      However, when a PropertyStates object is instantiated via the public PropertyStates(ByteQueue queue) constructor, the getState() function can generate ClassCastExceptions if it is not a BaseType.

      In my case, I had a ClassCastException because this.state was a BinaryPV, which isn't a BaseType.

      Changing

      public BaseType getState() { return (BaseType) state.getDatum(); }

      to this

      public Encodable getState() { return state.getDatum(); }

      resolves the problem. Or if getState returned this.state, that should probably work too.

    • J

      Looking up and determining what AmbiguousValue is

      BACnet4J general discussion
      • • • joolz
      6
      0
      Votes
      6
      Posts
      4.0k
      Views

      J

      I've written a function which could be used in conjuction with the convertTo(Class<T>) function to get the Object in its correct form for any Primitive class

      With it, you could then do the following:

      AmbiguousValue av = (AmbiguousValue)schedule.getProperty(PropertyIdentifier.scheduleDefault); Class<? extends Primitive> c = (Class<? extends Primitive>)av.getPrimitiveClass(); Primitive pr = av.convertTo(c);

      What is your preferred way for code submissions? A diff file as an attachment or pasted directly into the body in a code block? Or other?

      Attachment: download link

    • J

      Serialization for APDU classes

      BACnet4J general discussion
      • • • joolz
      4
      0
      Votes
      4
      Posts
      3.7k
      Views

      J

      :D

    • J

      Remote BACnet objects

      BACnet4J general discussion
      • • • joolz
      3
      0
      Votes
      3
      Posts
      3.8k
      Views

      M

      The BACnet object class is meant to represent local objects, so it may not be exactly what you want. The remote object class is, as you said, more what you are after, but it is only meant to be a proxy of the real object in the remote device. The problem with storing properties in the remote object is that they can easily become stale if the real remote object changes.

      If you really want to store remote properties locally (some kind of caching that i assume you will refresh as necessary), you'll be best to create your own class.

    • J

      PropertyValues class

      BACnet4J general discussion
      • • • joolz
      5
      0
      Votes
      5
      Posts
      3.1k
      Views

      J

      Awesome :D

    • J

      RelinquishDefault access

      BACnet4J general discussion
      • • • joolz
      4
      0
      Votes
      4
      Posts
      2.5k
      Views

      J

      No worries and thanks.

    • J

      EventParameter subclasses missing getters?

      BACnet4J general discussion
      • • • joolz
      4
      0
      Votes
      4
      Posts
      2.6k
      Views

      J

      Thanks Matt :D

    • J

      Reading trendlog data

      BACnet4J general discussion
      • • • joolz
      9
      0
      Votes
      9
      Posts
      5.3k
      Views

      M

      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...