Refactor DataReport logic and add dynamic array chunking (#346)
* Enhance and document existing DataDecoder logic
* DataVersion field is allowed to be absent when we consider tag compression
so make the field optional
* Decompress DataVersion field via Tag compression too
* Add DataEncoder to process DataReport data
This file introduces functions and also "intermediate types" that are near to DataReport types, but contain the schema and JS value instead of the already encoded value, so that chunking and compression can be applied dynamically.
InteractionServer and SubscriptionHandler (the places that generate DataReports right now) will use these types instead of the final Tlv ones to prepare the data.
The provided functions here support dynamic atray chunking and tag compression
* Adjust InteractionServer "read" logic to use new types and formats
* Adjust SubscriptionHandler "read" logic to use new types and formats
* Introduce intermediate Tlv type for Pre-Encoded attribute/eventReport entries
The new optimized DateReport send logic will encode each data element itself and adds it. This way we can build the message dynamically. This type is needed for it. I placed it here to be more "near" to the relevant partner-type if changes happen.
* Allow to calculate the byteLength of a Tlv(Any)Stream
... without actually really encoding it. This way we know the size of an encoded DataReport attribute/event element. This is expected to be more performant then a full encoding.
* Adjust DataReport send logic
This commit splits up the DataReport handling and sending into two methods. one for only sending and one to handle the packaging up to the allowed size together with dynamic chunking only if required because an array do not fit.
* Enhance testing for new DataReport logic
* address review feedback