Struct ADBServer

Source
pub struct ADBServer { /* private fields */ }
Expand description

Represents an ADB Server

Implementations§

Source§

impl ADBServer

Source

pub fn new(address: SocketAddrV4) -> Self

Instantiates a new ADBServer

Source

pub fn new_from_path(address: SocketAddrV4, adb_path: Option<String>) -> Self

Instantiates a new ADBServer with a custom adb path

Source

pub fn start(envs: &HashMap<String, String>, adb_path: &Option<String>)

Start an instance of adb-server

Source§

impl ADBServer

Source

pub fn connect_device(&mut self, address: SocketAddrV4) -> Result<()>

Connect device over tcp with address and port

Source§

impl ADBServer

Source

pub fn devices(&mut self) -> Result<Vec<DeviceShort>>

Gets a list of connected devices.

Source

pub fn devices_long(&mut self) -> Result<Vec<DeviceLong>>

Gets an extended list of connected devices including the device paths in the state.

Source

pub fn get_device(&mut self) -> Result<ADBServerDevice>

Get a device, assuming that only this device is connected.

Source

pub fn get_device_by_name(&mut self, name: &str) -> Result<ADBServerDevice>

Get a device matching the given name, if existing.

  • There is no device connected => Error
  • There is a single device connected => Ok
  • There are more than 1 device connected => Error
Source

pub fn track_devices( &mut self, callback: impl Fn(DeviceShort) -> Result<()>, ) -> Result<()>

Tracks new devices showing up.

Source

pub fn get_emulator_device(&mut self) -> Result<ADBEmulatorDevice>

Get an emulator, assuming that only this device is connected.

Source

pub fn get_emulator_device_by_name( &mut self, name: &str, ) -> Result<ADBEmulatorDevice>

Get an emulator by its name

Source§

impl ADBServer

Source

pub fn disconnect_device(&mut self, address: SocketAddrV4) -> Result<()>

Connect device over tcp with address and port

Source§

impl ADBServer

Source

pub fn kill(&mut self) -> Result<()>

Asks the ADB server to quit immediately.

Source§

impl ADBServer

Source

pub fn mdns_check(&mut self) -> Result<bool>

Check if mdns discovery is available

Source

pub fn mdns_services(&mut self) -> Result<Vec<MDNSServices>>

List all discovered mdns services

Source

pub fn mdns_force_backend(&mut self, backend: MDNSBackend) -> Result<()>

Check if specified backend mdns service is used, otherwise restart adb server with envs

Source§

impl ADBServer

Source

pub fn pair(&mut self, address: SocketAddrV4, code: String) -> Result<()>

Pair device on a specific port with a generated ‘code’

Source§

impl ADBServer

Source

pub fn reconnect_offline(&mut self) -> Result<()>

Reconnect the device

Source§

impl ADBServer

Source

pub fn server_status(&mut self) -> Result<ServerStatus>

Check ADB server status

Source§

impl ADBServer

Source

pub fn version(&mut self) -> Result<AdbVersion>

Gets server’s internal version number.

Source§

impl ADBServer

Source

pub fn wait_for_device( &mut self, state: WaitForDeviceState, transport: Option<WaitForDeviceTransport>, ) -> Result<()>

Wait for a device in a given state to be connected

Trait Implementations§

Source§

impl Debug for ADBServer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ADBServer

Source§

fn default() -> ADBServer

Returns the “default value” for a type. Read more
Source§

impl Drop for ADBServer

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

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> 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