Skip to main content

DeviceDriver

Trait DeviceDriver 

Source
pub trait DeviceDriver: Send + Sync {
Show 15 methods // Required methods fn connect<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn ensure_connected<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn tap<'life0, 'async_trait>( &'life0 self, x: i32, y: i32, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn swipe<'life0, 'async_trait>( &'life0 self, x1: i32, y1: i32, x2: i32, y2: i32, duration_ms: u32, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn input_text<'life0, 'life1, 'async_trait>( &'life0 self, text: &'life1 str, clear: bool, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn press_key<'life0, 'async_trait>( &'life0 self, keycode: i32, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn drag<'life0, 'async_trait>( &'life0 self, x1: i32, y1: i32, x2: i32, y2: i32, duration_ms: u32, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn start_app<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, package: &'life1 str, activity: Option<&'life2 str>, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn install_app<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 Path, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn get_apps<'life0, 'async_trait>( &'life0 self, include_system: bool, ) -> Pin<Box<dyn Future<Output = Result<Vec<AppInfo>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn list_packages<'life0, 'async_trait>( &'life0 self, include_system: bool, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn screenshot<'life0, 'async_trait>( &'life0 self, hide_overlay: bool, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_ui_tree<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_date<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn supported_actions(&self) -> &HashSet<Action>;
}
Expand description

Trait for all device drivers.

Concrete drivers implement the methods they support. Unsupported methods return DroidrunError::NotSupported.

Required Methods§

Source

fn connect<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Establish connection to the device.

Source

fn ensure_connected<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Connect if not already connected.

Source

fn tap<'life0, 'async_trait>( &'life0 self, x: i32, y: i32, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Tap at absolute pixel coordinates.

Source

fn swipe<'life0, 'async_trait>( &'life0 self, x1: i32, y1: i32, x2: i32, y2: i32, duration_ms: u32, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Swipe from (x1, y1) to (x2, y2) over duration_ms.

Source

fn input_text<'life0, 'life1, 'async_trait>( &'life0 self, text: &'life1 str, clear: bool, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Type text into the currently focused field.

Source

fn press_key<'life0, 'async_trait>( &'life0 self, keycode: i32, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Send a single key event.

Source

fn drag<'life0, 'async_trait>( &'life0 self, x1: i32, y1: i32, x2: i32, y2: i32, duration_ms: u32, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Drag from (x1, y1) to (x2, y2).

Source

fn start_app<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, package: &'life1 str, activity: Option<&'life2 str>, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Launch an application.

Source

fn install_app<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 Path, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Install an APK.

Source

fn get_apps<'life0, 'async_trait>( &'life0 self, include_system: bool, ) -> Pin<Box<dyn Future<Output = Result<Vec<AppInfo>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

List installed apps with labels.

Source

fn list_packages<'life0, 'async_trait>( &'life0 self, include_system: bool, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

List installed package names.

Source

fn screenshot<'life0, 'async_trait>( &'life0 self, hide_overlay: bool, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Take a screenshot (PNG bytes).

Source

fn get_ui_tree<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get the accessibility tree + phone state as JSON.

Source

fn get_date<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get the device date/time.

Source

fn supported_actions(&self) -> &HashSet<Action>

Which actions this driver supports.

Implementors§