Bug in SequenceOf?
-
Hello.
I think there is a bug in SequenceOf constructor.
public SequenceOf(ByteQueue queue, Class<E> clazz) throws BACnetException { values = new ArrayList<E>(); while (peekTagNumber(queue) != -1) values.add(read(queue, clazz)); }
I used ObjectProperties to add property reference for my own bacnet object.
add(new ObjectType(146), new PropertyIdentifier(552), GSMPersons.class, false, false, null);
GSMPersons is a property, that contains SequenceOf<CharacterString> without any context id.
When I'm trying to read this property:
0000 00 23 54 ed 8d 5d 08 60 6e 79 44 75 08 00 45 00 .#T..].`nyDu..E. 0010 00 3e 12 51 00 00 ff 11 fa bd c0 a8 16 cf c0 a8 .>.Q............ 0020 16 80 ba c0 ba c1 00 2a 10 5c 81 0a 00 22 01 00 .......*.\...".. 0030 30 a4 0c 0c 24 80 00 00 1a 02 28 3e 75 0d 00 2b 0...$.....(>u..+ 0040 37 39 32 36 31 33 31 34 31 30 33 3f 79261314103?
it reads one element of sequence ("+79261314103") and then I get an exception, because ByteQueue contains only "3F", that is closing context tag of property value in read property request. And peekTagNumber(queue) is not -1.
-
I changed constructor, now it works.
public SequenceOf(ByteQueue queue, Class<E> clazz) throws BACnetException { values = new ArrayList<E>(); int tagNumber = -1; while ((tagNumber = peekTagNumber(queue)) != -1 && matchNonEndTag(queue, tagNumber)) values.add(read(queue, clazz)); }
-
Maybe the SequenceOf<CharacterString> should just have a context id?