I'm looking for a concise way to deserilaize a byte array to a class. I have a byte array of length 133 and almost every single byte represents 1 property. I would like to define a class and map the byte array to it so that I don't have to write:
val speed = bytes[1] and 0xFF
val brightness = bytes[0] and 0xFF
val mmc = byteArrayOf(bytes[11], bytes[12], bytes[13], bytes[14])
Something similar to a struct. Does someone has an idea?