RKTK API Docs RKTK Home Repo

Trait ReporterDriver

Source
pub trait ReporterDriver {
    type Error: Error;

    // Required methods
    fn try_send_keyboard_report(
        &self,
        _report: KeyboardReport,
    ) -> Result<(), Self::Error>;
    fn try_send_media_keyboard_report(
        &self,
        _report: MediaKeyboardReport,
    ) -> Result<(), Self::Error>;
    fn try_send_mouse_report(
        &self,
        _report: MouseReport,
    ) -> Result<(), Self::Error>;
    async fn send_rrp_data(&self, _data: &[u8]) -> Result<(), Self::Error>;
    fn wakeup(&self) -> Result<bool, Self::Error>;

    // Provided methods
    async fn wait_ready(&self) { ... }
    async fn recv_keyboard_report(&self) -> Result<u8, Self::Error> { ... }
    async fn recv_rrp_data(&self, _buf: &mut [u8]) -> Result<usize, Self::Error> { ... }
    async fn send_raw_hid_data(&self, _data: &[u8]) -> Result<(), Self::Error> { ... }
    async fn recv_raw_hid_data(
        &self,
        _buf: &mut [u8],
    ) -> Result<usize, Self::Error> { ... }
}

Required Associated Types§

Required Methods§

Source

fn try_send_keyboard_report( &self, _report: KeyboardReport, ) -> Result<(), Self::Error>

Source

fn try_send_media_keyboard_report( &self, _report: MediaKeyboardReport, ) -> Result<(), Self::Error>

Source

fn try_send_mouse_report(&self, _report: MouseReport) -> Result<(), Self::Error>

Source

async fn send_rrp_data(&self, _data: &[u8]) -> Result<(), Self::Error>

Source

fn wakeup(&self) -> Result<bool, Self::Error>

Wake up the device. This is used to wake up the device from suspend mode.

§Returns
  • Ok(true): Woke up signal sent successfully.
  • Ok(false): The device is already awake.
  • Err(_): Failed to send the wake up signal or not supported.

Provided Methods§

Source

async fn wait_ready(&self)

Source

async fn recv_keyboard_report(&self) -> Result<u8, Self::Error>

Read a keyboard report from the device and return leds data.

Source

async fn recv_rrp_data(&self, _buf: &mut [u8]) -> Result<usize, Self::Error>

Source

async fn send_raw_hid_data(&self, _data: &[u8]) -> Result<(), Self::Error>

Source

async fn recv_raw_hid_data(&self, _buf: &mut [u8]) -> Result<usize, Self::Error>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§