minitel

Struct Minitel

Source
pub struct Minitel<S> {
    pub port: S,
}
Expand description

Minitel interface, the entry point to the library

This struct wraps a serial port (websocket, physical, file, …) and provides methods to interact with the device.

This struct can be initialized using the ws_minitel, esp_minitel or esp_minitel_uart2 functions, depending on the target platform and enabled features. It can also operate on any std::io::Read and/or std::io::Write object.

Fields§

§port: S

Implementations§

Source§

impl<S> Minitel<S>

Source

pub fn new(port: S) -> Minitel<S>

Source§

impl<S> Minitel<S>

Source

pub fn clear_screen(&mut self) -> Result<(), Error>

Source

pub fn read_rom(&mut self) -> Result<Rom, Error>

Source

pub fn get_pos(&mut self) -> Result<(u8, u8), Error>

Source

pub fn set_function_mode( &mut self, mode: FunctionMode, enable: bool, ) -> Result<(), Error>

Source

pub fn set_routing( &mut self, enable: bool, recepter: RoutingRx, emitter: RoutingTx, ) -> Result<(), Error>

Source

pub fn get_speed(&mut self) -> Result<Baudrate, Error>

Source

pub fn set_rouleau(&mut self, enable: bool) -> Result<(), Error>

Source

pub fn set_procedure(&mut self, enable: bool) -> Result<(), Error>

Source

pub fn set_minuscule(&mut self, enable: bool) -> Result<(), Error>

Source§

impl<S> Minitel<S>
where S: MinitelRead,

Source

pub fn read_bytes(&mut self, data: &mut [u8]) -> Result<(), Error>

Read a raw sequence from the minitel

Source

pub fn read_byte(&mut self) -> Result<u8, Error>

Read a single byte from the minitel

Source

pub fn read_s0_stroke(&mut self) -> Result<UserInput, Error>

Read a key stroke from the minitel assuming it is in S0 (text) mode.

G0 and G2 characters are returned as unicode characters.

Source

pub fn wait_for(&mut self, byte: impl Into<u8> + Copy) -> Result<(), Error>

Source

pub fn expect_read(&mut self, byte: impl Into<u8> + Copy) -> Result<(), Error>

Source

pub fn read_pro2(&mut self, expected_ack: Pro2Resp) -> Result<u8, Error>

Source

pub fn read_pro3(&mut self, expected_ack: Pro3Resp) -> Result<(u8, u8), Error>

Source§

impl<S> Minitel<S>
where S: MinitelWrite,

Source

pub fn write_bytes(&mut self, data: &[u8]) -> Result<(), Error>

Write a raw sequence to the minitel

Source

pub fn write_byte<T>(&mut self, byte: T) -> Result<(), Error>
where T: Into<u8> + Copy,

Write a single byte to the minitel

Source

pub fn flush(&mut self) -> Result<(), Error>

Flush the serial port

Source

pub fn write_sequence<const N: usize>( &mut self, sequence: impl IntoSequence<N>, ) -> Result<(), Error>

Source

pub fn c1(&mut self, c1: C1) -> Result<(), Error>

Source

pub fn write_g2(&mut self, g2: G2) -> Result<(), Error>

Source

pub fn show_cursor(&mut self) -> Result<(), Error>

Source

pub fn hide_cursor(&mut self) -> Result<(), Error>

Source

pub fn set_pos(&mut self, x: u8, y: u8) -> Result<(), Error>

Source

pub fn cursor_down(&mut self) -> Result<(), Error>

Source

pub fn cursor_up(&mut self) -> Result<(), Error>

Source

pub fn cursor_right(&mut self) -> Result<(), Error>

Source

pub fn cursor_left(&mut self) -> Result<(), Error>

Source

pub fn start_zone(&mut self, funcs: &[C1]) -> Result<(), Error>

Source

pub fn zone_delimiter(&mut self) -> Result<(), Error>

Source

pub fn write_char(&mut self, c: char) -> Result<(), Error>

Source

pub fn si_char(&mut self, c: SIChar) -> Result<(), Error>

Source

pub fn write_str(&mut self, s: &str) -> Result<(), Error>

Source

pub fn writeln(&mut self, s: &str) -> Result<(), Error>

Source

pub fn pro1(&mut self, x: Pro1) -> Result<(), Error>

Protocol command with a single argument

Source

pub fn pro2(&mut self, x: Pro2, y: impl Into<u8> + Copy) -> Result<(), Error>

Protocol command with two arguments

Source

pub fn pro3( &mut self, x: Pro3, y: impl Into<u8> + Copy, z: impl Into<u8> + Copy, ) -> Result<(), Error>

Protocol command with three arguments

Source§

impl<S> Minitel<S>

Ability to communicate with a minitel through a serial port with baudrate control

Source

pub fn search_speed(&mut self) -> Result<Baudrate, Error>

Source

pub fn set_speed(&mut self, baudrate: Baudrate) -> Result<Baudrate, Error>

Auto Trait Implementations§

§

impl<S> Freeze for Minitel<S>
where S: Freeze,

§

impl<S> RefUnwindSafe for Minitel<S>
where S: RefUnwindSafe,

§

impl<S> Send for Minitel<S>
where S: Send,

§

impl<S> Sync for Minitel<S>
where S: Sync,

§

impl<S> Unpin for Minitel<S>
where S: Unpin,

§

impl<S> UnwindSafe for Minitel<S>
where S: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V