BACNet4J: How get and set values?

3.4k views Asked by At

i'm working with bacnet through java, bacnet4j project. I could realize how get the values of my devices, my analog and digital values.

But how can i change them ? How get/set values using bacnet4j ?

Best regards, Valter Henrique.

1

There are 1 answers

0
Reggie On

I think you should look into the WritePropertyRequest and WritePropertyMultipleRequest, such as used in the bacnet4j Test.java example file (look for it in the test folder), on lines 199 and 214.

Here's a snippet of those lines:

// Write a value:
System.out.println(send(d,
    new WritePropertyRequest(created, PropertyIdentifier.presentValue, null, new UnsignedInteger(5), null)));

// Write multiple values:
List<WriteAccessSpecification> writeSpecs = new ArrayList<WriteAccessSpecification>();
List<PropertyValue> pvs = new ArrayList<PropertyValue>();
pvs.add(new PropertyValue(PropertyIdentifier.presentValue, new Real(6.7f)));
pvs.add(new PropertyValue(PropertyIdentifier.highLimit, new Real(10f)));
pvs.add(new PropertyValue(PropertyIdentifier.lowLimit, new Real(0f)));
writeSpecs.add(new WriteAccessSpecification(created, new SequenceOf<PropertyValue>(pvs)));
System.out.println(send(d,
    new WritePropertyMultipleRequest(new SequenceOf<WriteAccessSpecification>(writeSpecs))));