src/transports/eui_binary_transport.c
/*
    If byte 0x00 seen, cancel all parsing
    first byte is COBS offset, bytes falling on the offset location are 0x00,
    crc the actual data (COB corrected)
    then process the packet
        header 3 bytes
        msg identifier (1 to 15 bytes)
        offset 2 bytes optional
        data 0 to 1024 bytes
        CRC 2 bytes
*/
If byte 0x00 seen, cancel all parsing
first byte is COBS offset, bytes falling on the offset location are 0x00,
crc the actual data (COB corrected)
then process the packet
header 3 bytes
msg identifier (1 to 15 bytes)
offset 2 bytes optional
data 0 to 1024 bytes
CRC 2 bytes
If byte 0x00 seen cancel all parsing first byte is COBS offset bytes falling on the offset location are 0x00 crc the actual data ( COB corrected ) then process the packet header 3 bytes msg identifier ( 1 to 15 bytes ) offset 2 bytes optional data 0 to 1024 bytes CRC 2 bytes
uint8_t
decode_packet(uint8_t byte_in, eui_packet_t *p_link_in)
{
    uint8_t status = EUI_PARSER_IDLE;
    if( 0x00u == byte_in )
    {
        p_link_in->parser.state = 0u;
        p_link_in->crc_in = 0xFFFFu;
    }
    else
    {
        if( 0x01 < p_link_in->parser.frame_offset )
        {
            p_link_in->parser.frame_offset -= 1u;
        }
        else
        {
            p_link_in->parser.frame_offset = byte_in;
            byte_in = 0x00u; 
        }
        if( (exp_crc_b1 > (uint8_t)p_link_in->parser.state)
            && (exp_frame_offset < (uint8_t)p_link_in->parser.state) )
        {
            crc16( byte_in, &(p_link_in->crc_in)) ; 
        }
        status = parse_decoded_packet( byte_in, p_link_in );
    }
    return status;
}
uint8_t decode_packet ( uint8_t byte_in , eui_packet_t * p_link_in ) { uint8_t status = EUI_PARSER_IDLE ; if ( 0x00u == byte_in ) { p_link_in -> parser . state = 0u ; p_link_in -> crc_in = 0xFFFFu ; } else { if ( 0x01 < p_link_in -> parser . frame_offset ) { p_link_in -> parser . frame_offset -= 1u ; } else { p_link_in -> parser . frame_offset = byte_in ; byte_in = 0x00u ; } if ( ( exp_crc_b1 > ( uint8_t ) p_link_in -> parser . state ) && ( exp_frame_offset < ( uint8_t ) p_link_in -> parser . state ) ) { crc16 ( byte_in , & ( p_link_in -> crc_in ) ) ; } status = parse_decoded_packet ( byte_in , p_link_in ) ; } return status ; }
If byte 0x00 seen, cancel all parsing
first byte is COBS offset, bytes falling on the offset location are 0x00,
crc the actual data (COB corrected)
then process the packet
header 3 bytes
msg identifier (1 to 15 bytes)
offset 2 bytes optional
data 0 to 1024 bytes
CRC 2 bytes
If byte 0x00 seen cancel all parsing first byte is COBS offset bytes falling on the offset location are 0x00 crc the actual data ( COB corrected ) then process the packet header 3 bytes msg identifier ( 1 to 15 bytes ) offset 2 bytes optional data 0 to 1024 bytes CRC 2 bytes
//reset // One byte closer to the next offset // Offset has expired, this inbound byte should be the next data framing byte // Replace with pre-COBS byte. // CRC data up to the packet's CRC