MangoAutomation / BACnet4J

BACnet/IP stack written in Java. Forked from http://sourceforge.net/projects/bacnet4j/
GNU General Public License v3.0
183 stars 110 forks source link

BACnet error:invalid data-type #81

Open Pandacli opened 1 year ago

Pandacli commented 1 year ago

Hi,all . I use writePropertyRequest to write a new presentValue , but unfortunately it response a wrong code

invalid data-type. could you give us any advise? thanks

there is my code ` WritePropertyRequest writePropertyRequest = new WritePropertyRequest( objectList.get(i), PropertyIdentifier.presentValue, null, new Real(setVal), new UnsignedInteger(BaConfig.priority)); ObjectType objectType = writePropertyRequest.getObjectIdentifier().getObjectType(); ServiceFuture send = localDevice.send(remoteDevice, writePropertyRequest);

            ReadPropertyAck ack = localDevice.send(remoteDevice, writePropertyRequest)
                    .get();`

【project details 】 setValue = 1; priority is 9 ;

Device detail like this image

kishorevenki commented 1 year ago

HI, Based on your above information, I noticed couple of points:

  1. Since the Present_Value is not of array datatype, this value can be omitted. Mentioning Null is not correct.
  2. Since the Object Type is Binary Value, the datatype of PV is not Real, but BinaryPV. Hence the value can be new BinaryPV(1).

Regards, Kishore

Pandacli commented 1 year ago

Hi Kishore ,thanks for your advise and we fix it to change the BinaryPV ,not a Real.

HI, Based on your above information, I noticed couple of points:

  1. Since the Present_Value is not of array datatype, this value can be omitted. Mentioning Null is not correct.
  2. Since the Object Type is Binary Value, the datatype of PV is not Real, but BinaryPV. Hence the value can be new BinaryPV(1).

Regards, Kishore

kishorevenki commented 1 year ago

Hope you will remove Null field as well.

WritePropertyRequest writePropertyRequest = new WritePropertyRequest( objectList.get(i), PropertyIdentifier.presentValue, new BinaryPV(setVal), new UnsignedInteger(BaConfig.priority));

Pandacli commented 1 year ago

Hope you will remove Null field as well.

WritePropertyRequest writePropertyRequest = new WritePropertyRequest( objectList.get(i), PropertyIdentifier.presentValue, new BinaryPV(setVal), new UnsignedInteger(BaConfig.priority));

Yes,it work . I should use BinaryPV.active to control Bacnet device . thank you so much