Not understand how to know the objectType value
-
I have some objects that I must to know which is the exactly the value of this object, if it's analog OUTPUT or analog INPUT, got it ?
For example:
If you I did this :System.out.println("oi.getObjectType().intValue(): " + oi.getObjectType().intValue()); System.out.println("ObjectType.analogOutput.intValue(): " + ObjectType.analogOutput.intValue()); System.out.println("ObjectType.analogInput.intValue(): " + ObjectType.analogInput.intValue()); System.out.println("ObjectType.analogValue.intValue(): " + ObjectType.analogValue.intValue());
Which the answer gonna be:
oi.getObjectType().intValue(): 2 ObjectType.analogOutput.intValue(): 1 ObjectType.analogInput.intValue(): 0 ObjectType.analogValue.intValue(): 2
But I need to know if is OUTPUT (1) or INPUT (0).
How can I do that ? -
That object, "oi", is not an "output" or an "input"; it is a "value", which is a valid third type of bacnet input. "Value"s are basically both input and output.
-
@mlohbihler said:
That object, "oi", is not an "output" or an "input"; it is a "value", which is a valid third type of bacnet input. "Value"s are basically both input and output.
So, what should I do to get the exact type of the object ?
I mean, how do I know if is a analog output or analog input ? -
Valter,
You are incorrect in thinking that an analog can only be an input or an output. There are three possible analog types: input, output, and value. Your object is a value.
-
@mlohbihler said:
Valter,
You are incorrect in thinking that an analog can only be an input or an output. There are three possible analog types: input, output, and value. Your object is a value.
Ow, got it mlohbihler.There's some way to get the values from the input and output objects ?
This is how I'm doing to get these values :
private List<ObjectIdentifier> getListObjectIdentifier(LocalDevice localDevice) throws Exception { ReadPropertyRequest rpr = new ReadPropertyRequest(new ObjectIdentifier(ObjectType.device, deviceID), PropertyIdentifier.objectList); ReadPropertyAck rpa = (ReadPropertyAck) localDevice.send(isa, null, 1476, Segmentation.segmentedBoth, rpr); SequenceOf<ObjectIdentifier> sOis = (SequenceOf<ObjectIdentifier>) rpa.getValue(); List<ObjectIdentifier> ois = new ArrayList<ObjectIdentifier>(); for (ObjectIdentifier oi : sOis) { ois.add(oi); } return ois; }
-
Use read property requests with the present value property identifier.
-
@mlohbihler said:
Use read property requests with the present value property identifier.
I did as you said :
public String getPresentValue(LocalDevice localDevice, ObjectIdentifier oid) throws Exception { ReadPropertyRequest rpr = new ReadPropertyRequest(oid, PropertyIdentifier.presentValue); ReadPropertyAck rpa = (ReadPropertyAck) localDevice.send(isa, null, 1476, Segmentation.segmentedReceive, rpr); SequenceOf<ObjectIdentifier> sOis = (SequenceOf<ObjectIdentifier>) rpa.getValue(); List<ObjectIdentifier> ois = new ArrayList<ObjectIdentifier>(); for (ObjectIdentifier oi : sOis) { System.out.println("--> " + oi.getObjectType().intValue()); } return rpa.getValue().toString(); }
But it gives this follow error:
java.lang.ClassCastException: com.serotonin.bacnet4j.type.primitive.Real cannot be cast to com.serotonin.bacnet4j.type.constructed.SequenceOf at brainset.bacnet4j.Supervisory.getPresentValue(Supervisory.java:123)
What I'm trying to do is scan my device and know what kind of points I have, if is a analog output, analog input, etc.
And store these points values in my List<...>.