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

[bug?] writing to a binary/boolean RemoteObject


  • I've created a "virtual" bacnet device with a couple of analog and binary controls. I can read/write the analog object with no problem, but I receive the following error when trying to write boolean to a binary remote object:

    
    com.serotonin.bacnet4j.exception.ErrorAPDUException: ErrorAPDU(choice=127, errorClass=Property, errorCode=Missing required parameter)
    	at com.serotonin.bacnet4j.LocalDevice.send(LocalDevice.java:424)
    	at com.serotonin.bacnet4j.LocalDevice.send(LocalDevice.java:403)
    	at com.serotonin.bacnet4j.LocalDevice.send(LocalDevice.java:396)
    
    

    writing of an unsigned integer = 1 to the binary object does however work.

    bug?

    lastly, is there a facile way of ascertaining the type of a remote object's present value without writing java code that guesses the correct type?

    Also I would like to commit some code+docs for bacnet4j (added code is mainly commons logging at this point) in the near future, please CC or send a message to 'g l y c o s l a v e at g m a i l . c o m' if you're interested.

    cheers,
    matt


  • Hi Matt,

    A "missing required parameter" code is odd. Are you sending null for some value? How are you sure the object is actually a binary? Can you include more code?

    Re present value types, that depends on for what you want to use the value. If you just want to see it, a ".toString()" ought to do. Otherwise, you'll need to provide a bit more.

    I'm always happy to receive code contributions (as well as other kinds). The repo is at sourceforge. I believe your can request to become a member of the project, which, when accepted, will allow you to commit.


  • No it's certainly a class com.serotonin.bacnet4j.type.primitive.Boolean, value=true that's being sent from my end. Here's the relevant code:

    
        public void setPresentValue( RemoteDevice rd, ObjectIdentifier id, Encodable value, int priority ) 
        throws BACnetException 
        {
            log.debug( "setPresentValue: value encoded as " 
                     + value.getClass() 
                     + ", value=" 
                     + value );
            
            localDevice.send( 
                rd, 
                new WritePropertyRequest( 
                    id
                    , PropertyIdentifier.presentValue
                    , null
                    , value
                    , new UnsignedInteger( priority )
                ) 
            );
        }
    
    

    this code prints:

    
    DEBUG: setPresentValue: value encoded as class com.serotonin.bacnet4j.type.primitive.Boolean, value=true (com.buildingiq.io.protocol.bacnet.Bacnet4jUtils.setPresentValue(Bacnet4jUtils.java:582))
    
    

    when run. While we're here, what does 'propertyArrayIndex' refer to? It doesn't seem to affect the writing of other points, such as writing an unsigned int to an analog remote object.


  • The present value of a binary object is a BinaryPV, not a Boolean.


  • That would be a great thing to make known in the class' doco... in what circumstance would one use or find a com.serotonin.bacnet4j.type.primitive.Boolean?

    BTW, I am also getting the same exception + error message when trying to pass a com.serotonin.bacnet4j.type.primitive.Double .


  • That's not a BACnet4J thing. It's a BACnet thing. You can get a copy of the spec here: http://www.bacnet.org/


  • BTW, I am also getting the same exception + error message when trying to pass a com.serotonin.bacnet4j.type.primitive.Double or UnsignedInteger to the same remote object, though I suspect this may be because the analog object will only accept a float/Real value?

    In general will "virtual devices" created by bacnet4j perform any type conversion (narrowing or widening)?


  • Dude, read the spec.