Trait DeviceInterface

Source
pub trait DeviceInterface {
    type InterfaceError;

    // Required methods
    fn fill(&mut self) -> usize;
    fn read(&mut self) -> Result<u8, Self::InterfaceError>;
    fn read_many(
        &mut self,
        buffer: &mut [u8],
    ) -> Result<usize, Self::InterfaceError>;
}
Expand description

A method of communicating with the device

Required Associated Types§

Source

type InterfaceError

Interface associated error type

Required Methods§

Source

fn fill(&mut self) -> usize

Fill up our buffer with unsolicited / periodic UBX messages. This function should be called before attempting to read. Returns the number of available bytes.

Source

fn read(&mut self) -> Result<u8, Self::InterfaceError>

Read a single buffered byte. Call fill before calling this.

Source

fn read_many( &mut self, buffer: &mut [u8], ) -> Result<usize, Self::InterfaceError>

Read multiple buffered bytes. Call fill before calling this.

Implementors§

Source§

impl<SER, CommE> DeviceInterface for SerialInterface<SER>
where SER: Read<u8, Error = CommE>,