Skip to content
This repository has been archived by the owner on Jun 14, 2024. It is now read-only.

How should we handle unparsable listOfValues? #15

Open
baardl opened this issue Sep 10, 2020 · 0 comments
Open

How should we handle unparsable listOfValues? #15

baardl opened this issue Sep 10, 2020 · 0 comments
Labels
help wanted Extra attention is needed question Further information is requested

Comments

@baardl
Copy link
Contributor

baardl commented Sep 10, 2020

When a part of the hexString with BacNet Octets can not be parsed into something this library understand we need to flag this to the client.
Also we want to trace this behavior to be able to implement updates solving these issues.

Test Code:
https://github.com/entraeiendom/bacnet-2-json/blob/8d302caad3c4c0fc86bd12666bc26f1b4fca016a/src/test/java/no/entra/bacnet/json/observation/ObservationParserTest.java#L26

Affected code:
https://github.com/entraeiendom/bacnet-2-json/blob/8d302caad3c4c0fc86bd12666bc26f1b4fca016a/src/main/java/no/entra/bacnet/json/values/ValueParser.java#L104

static Object findValue(ApplicationTag applicationTag, String valueHex) { Object value = null; int type = applicationTag.findType(); switch (type) { case INT_VALUE: int intValue = toInt(valueHex); value = Integer.valueOf(intValue); break; case REAL_VALUE: float floatValue = toFloat(valueHex); value = Float.valueOf(floatValue); break; default: value = null; //Alternative: //value = "#" + valueHex; } return value; }

References:
https://github.com/entraeiendom/bacnet-2-json/blob/8d302caad3c4c0fc86bd12666bc26f1b4fca016a/src/test/java/no/entra/bacnet/json/observation/ObservationParserTest.java#L49-L51
Observation observation = observations.getObservations().get(1); assertEquals("StatusFlags", observation.getName()); assertEquals("0400", observation.getValue());

@baardl baardl added help wanted Extra attention is needed question Further information is requested labels Sep 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant