mavlink_core

Trait MavConnection

Source
pub trait MavConnection<M: Message> {
    // Required methods
    fn recv(&self) -> Result<(MavHeader, M), MessageReadError>;
    fn send(
        &self,
        header: &MavHeader,
        data: &M,
    ) -> Result<usize, MessageWriteError>;
    fn set_protocol_version(&mut self, version: MavlinkVersion);
    fn protocol_version(&self) -> MavlinkVersion;
    fn setup_signing(&mut self, signing_data: Option<SigningConfig>);

    // Provided methods
    fn send_frame(
        &self,
        frame: &MavFrame<M>,
    ) -> Result<usize, MessageWriteError> { ... }
    fn recv_frame(&self) -> Result<MavFrame<M>, MessageReadError> { ... }
    fn send_default(&self, data: &M) -> Result<usize, MessageWriteError> { ... }
}
Available on crate feature std only.
Expand description

A MAVLink connection

Required Methods§

Source

fn recv(&self) -> Result<(MavHeader, M), MessageReadError>

Receive a mavlink message.

Blocks until a valid frame is received, ignoring invalid messages.

Source

fn send(&self, header: &MavHeader, data: &M) -> Result<usize, MessageWriteError>

Send a mavlink message

Source

fn set_protocol_version(&mut self, version: MavlinkVersion)

Source

fn protocol_version(&self) -> MavlinkVersion

Source

fn setup_signing(&mut self, signing_data: Option<SigningConfig>)

Available on crate feature signing only.

Setup secret key used for message signing, or disable message signing

Provided Methods§

Source

fn send_frame(&self, frame: &MavFrame<M>) -> Result<usize, MessageWriteError>

Write whole frame

Source

fn recv_frame(&self) -> Result<MavFrame<M>, MessageReadError>

Read whole frame

Source

fn send_default(&self, data: &M) -> Result<usize, MessageWriteError>

Send a message with default header

Implementors§