Skip to content

Class hal::skip_past

ClassList > hal > skip_past

Discard received bytes until the sequence is found.

  • #include <serial_coroutines.hpp>

Public Functions

Type Name
result< work_state > operator() ()
skip data from the serial port until the sequence is reached.
skip_past (serial & p_serial, std::span< const hal::byte > p_sequence, size_t p_read_limit=32)
Construct a new skip beyond object.

Public Functions Documentation

function operator()

skip data from the serial port until the sequence is reached.

inline result< work_state > hal::skip_past::operator() () 

This function will return if the sequence is found or if there are no more bytes in the serial port.

Call this function again to resume reading from the port.

Returns:

result<work_state> - work_state::in_progress if the sequence hasn't been met and the buffer still has space.

Returns:

result<work_state> - work_state::finished if the sequence was found before the buffer was filled completely.

function skip_past

Construct a new skip beyond object.

inline hal::skip_past::skip_past (
    serial & p_serial,
    std::span< const hal::byte > p_sequence,
    size_t p_read_limit=32
) 

Parameters:

  • p_serial - serial port to skip through
  • p_sequence - sequence to search for. The lifetime of this data pointed to by this span must outlive this object, or not be used when the lifetime of that data is no longer available.
  • p_read_limit - the maximum number read attempts from the port before returning. A value 0 will result in no reads from the serial port.

The documentation for this class was generated from the following file libraries/include/libhal-util/serial_coroutines.hpp