pub struct Receiver<R: Read, V: MaybeVersioned> { /* private fields */ }
Expand description
Receives MAVLink frames.
Receives MAVLink frames from an instance of Read
.
Implementations§
source§impl<R: Read> Receiver<R, Versionless>
impl<R: Read> Receiver<R, Versionless>
sourcepub fn new<V: MaybeVersioned>(reader: R) -> Receiver<R, V>
pub fn new<V: MaybeVersioned>(reader: R) -> Receiver<R, V>
Default constructor.
sourcepub fn versionless(reader: R) -> Receiver<R, Versionless>
pub fn versionless(reader: R) -> Receiver<R, Versionless>
Create a MAVLink version agnostic receiver.
Creates a protocol-agnostic receiver which will look up for both MAVLink 1
and MAVLink 2
frames.
If you want a receiver restricted to a specific MAVLink protocol version, use
Receiver::versioned
.
If you want to instantiate a generic receiver, use Receiver::new
.
sourcepub fn versioned<Version: Versioned>(
reader: R,
version: Version
) -> Receiver<R, Version>
pub fn versioned<Version: Versioned>( reader: R, version: Version ) -> Receiver<R, Version>
Create a receiver specific to a particular MAVLink protocol version.
Same as Receiver::new::<V1>
/ Receiver::new::<V2>
but with an explicit version
marker as a parameter.
Since versioned receiver will look up for MAVLink frames starting with a specific
MavSTX
magic byte, it may behave incorrectly, if the incoming
stream contains frames of a different protocol version. If this is the case, it is preferred
to construct versionless receiver by Receiver::new
and then attempt to convert incoming
frames into a specific protocol version with Frame::try_into_versioned
.