Skip to main content

CustomControllerCallback

Trait CustomControllerCallback 

Source
pub trait CustomControllerCallback: Send + Sync {
Show 21 methods // Required method fn connect(&self) -> bool; // Provided methods fn connected(&self) -> bool { ... } fn request_uuid(&self) -> Option<String> { ... } fn get_features(&self) -> ControllerFeature { ... } fn start_app(&self, _intent: &str) -> bool { ... } fn stop_app(&self, _intent: &str) -> bool { ... } fn screencap(&self) -> Option<Vec<u8>> { ... } fn click(&self, _x: i32, _y: i32) -> bool { ... } fn swipe( &self, _x1: i32, _y1: i32, _x2: i32, _y2: i32, _duration: i32, ) -> bool { ... } fn touch_down( &self, _contact: i32, _x: i32, _y: i32, _pressure: i32, ) -> bool { ... } fn touch_move( &self, _contact: i32, _x: i32, _y: i32, _pressure: i32, ) -> bool { ... } fn touch_up(&self, _contact: i32) -> bool { ... } fn click_key(&self, _keycode: i32) -> bool { ... } fn input_text(&self, _text: &str) -> bool { ... } fn key_down(&self, _keycode: i32) -> bool { ... } fn key_up(&self, _keycode: i32) -> bool { ... } fn scroll(&self, _dx: i32, _dy: i32) -> bool { ... } fn relative_move(&self, _dx: i32, _dy: i32) -> bool { ... } fn shell(&self, _cmd: &str, _timeout: i64) -> Option<String> { ... } fn inactive(&self) -> bool { ... } fn get_info(&self) -> String { ... }
}
Expand description

Custom controller callback trait for implementing custom device control.

Required Methods§

Source

fn connect(&self) -> bool

Provided Methods§

Source

fn connected(&self) -> bool

Source

fn request_uuid(&self) -> Option<String>

Source

fn get_features(&self) -> ControllerFeature

Get the features supported by this controller.

Returns a combination of ControllerFeature flags.

Source

fn start_app(&self, _intent: &str) -> bool

Source

fn stop_app(&self, _intent: &str) -> bool

Source

fn screencap(&self) -> Option<Vec<u8>>

Returns PNG-encoded screenshot data.

Source

fn click(&self, _x: i32, _y: i32) -> bool

Source

fn swipe(&self, _x1: i32, _y1: i32, _x2: i32, _y2: i32, _duration: i32) -> bool

Source

fn touch_down(&self, _contact: i32, _x: i32, _y: i32, _pressure: i32) -> bool

Source

fn touch_move(&self, _contact: i32, _x: i32, _y: i32, _pressure: i32) -> bool

Source

fn touch_up(&self, _contact: i32) -> bool

Source

fn click_key(&self, _keycode: i32) -> bool

Source

fn input_text(&self, _text: &str) -> bool

Source

fn key_down(&self, _keycode: i32) -> bool

Source

fn key_up(&self, _keycode: i32) -> bool

Source

fn scroll(&self, _dx: i32, _dy: i32) -> bool

Source

fn relative_move(&self, _dx: i32, _dy: i32) -> bool

Source

fn shell(&self, _cmd: &str, _timeout: i64) -> Option<String>

Source

fn inactive(&self) -> bool

Set the controller to inactive state.

For Win32 controllers, this restores window position (removes topmost) and unblocks user input. For other controllers, this is a no-op that always succeeds.

Source

fn get_info(&self) -> String

Get custom controller extra info as a JSON string.

The returned JSON will be merged with base controller info. Default implementation returns empty JSON object.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§