[Solved] How to parse received data with variable length
One approach is to define a packed struct which represents the largest possible packet size: #pragma pack(push,1) // make sure everything is packed to byte level typedef struct { uint8_t Length; uint8_t SrcArsDev; uint32_t Src_ID; uint8_t DstArsDev; uint32_t Dst_ID; uint32_t Session; uint8_t CMD; uint8_t payload[96 + 2]; // payload + CRC } Message; #pragma pack(pop) … Read more