calimero-project / calimero-core

Core library for KNX network access and management
Other
128 stars 65 forks source link

GroupMonitor: getting data type #70

Closed ViorelOnica closed 5 years ago

ViorelOnica commented 6 years ago

Hello,

I implemented GroupMonitor and I'd like to know if I can get the datapoint type having ProcessEvent e.
I saw that e.getASDU() returns an byte array, but I don't know how to manage it in order to retrieve the data type.

Example: An external writing is done over an object, groupWrite gets triggered and here's when I'd like know if the writing involves a boolean, or a 1 byte unsigned integer, or a 2 byte floating point, or any other type.

Thanks !

bmalinowsky commented 6 years ago

Pass asdu.length * 8 to TranslatorTypes::ofBitSize.

If asdu byte length is 1, check event::isLengthOptimizedAPDU before. If true, query ofBitSize( {1, 2, 4} ) instead (it's either 1, 2, or 4 bits, and cannot easily be distinguished).