C# Класс SharpAdbClient.AdbClient

Implements the IAdbClient interface, and allows you to interact with the adb server and devices that are connected to that adb server.

For example, to fetch a list of all devices that are currently connected to this PC, you can call the GetDevices method.

To run a command on a device, you can use the ExecuteRemoteCommand(string, DeviceData, IShellOutputReceiver, CancellationToken, int) method.

Наследование: IAdbClient
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
AdbClient ( EndPoint endPoint ) : SharpAdbClient.Exceptions

Initializes a new instance of the AdbClient class.

Connect ( DnsEndPoint endpoint ) : string
CreateAdbForwardRequest ( string address, int port ) : byte[]

Creates the adb forward request.

CreateForward ( DeviceData device, ForwardSpec local, ForwardSpec remote, bool allowRebind ) : void
CreateForward ( DeviceData device, string local, string remote, bool allowRebind ) : void
ExecuteRemoteCommand ( string command, DeviceData device, IShellOutputReceiver receiver, CancellationToken cancellationToken, int maxTimeToOutputResponse ) : void
FormAdbRequest ( string req ) : byte[]

Create an ASCII string preceded by four hex digits. The opening "####" is the length of the rest of the string, encoded as ASCII hex(case doesn't matter).

GetAdbVersion ( ) : int
GetDevices ( ) : List
KillAdb ( ) : void
ListForward ( DeviceData device ) : IEnumerable
Reboot ( string into, DeviceData device ) : void
RemoveAllForwards ( DeviceData device ) : void
RemoveForward ( DeviceData device, int localPort ) : void
RunLogService ( DeviceData device ) : IEnumerable
SetDevice ( IAdbSocket socket, DeviceData device ) : void

Защищенные методы

Метод Описание
EnsureDevice ( DeviceData device ) : void

Throws an ArgumentNullException if the device parameter is , and a ArgumentOutOfRangeException if device does not have a valid serial number.

Описание методов

AdbClient() публичный Метод

Initializes a new instance of the AdbClient class.
public AdbClient ( EndPoint endPoint ) : SharpAdbClient.Exceptions
endPoint System.Net.EndPoint /// The at which the adb server is listening. ///
Результат SharpAdbClient.Exceptions

Connect() публичный Метод

public Connect ( DnsEndPoint endpoint ) : string
endpoint System.Net.DnsEndPoint
Результат string

CreateAdbForwardRequest() публичный статический Метод

Creates the adb forward request.
public static CreateAdbForwardRequest ( string address, int port ) : byte[]
address string The address.
port int The port.
Результат byte[]

CreateForward() публичный Метод

public CreateForward ( DeviceData device, ForwardSpec local, ForwardSpec remote, bool allowRebind ) : void
device DeviceData
local ForwardSpec
remote ForwardSpec
allowRebind bool
Результат void

CreateForward() публичный Метод

public CreateForward ( DeviceData device, string local, string remote, bool allowRebind ) : void
device DeviceData
local string
remote string
allowRebind bool
Результат void

EnsureDevice() защищенный Метод

Throws an ArgumentNullException if the device parameter is , and a ArgumentOutOfRangeException if device does not have a valid serial number.
protected EnsureDevice ( DeviceData device ) : void
device DeviceData /// A object to validate. ///
Результат void

ExecuteRemoteCommand() публичный Метод

public ExecuteRemoteCommand ( string command, DeviceData device, IShellOutputReceiver receiver, CancellationToken cancellationToken, int maxTimeToOutputResponse ) : void
command string
device DeviceData
receiver IShellOutputReceiver
cancellationToken System.Threading.CancellationToken
maxTimeToOutputResponse int
Результат void

FormAdbRequest() публичный статический Метод

Create an ASCII string preceded by four hex digits. The opening "####" is the length of the rest of the string, encoded as ASCII hex(case doesn't matter).
public static FormAdbRequest ( string req ) : byte[]
req string The request to form. ///
Результат byte[]

GetAdbVersion() публичный Метод

public GetAdbVersion ( ) : int
Результат int

GetDevices() публичный Метод

public GetDevices ( ) : List
Результат List

KillAdb() публичный Метод

public KillAdb ( ) : void
Результат void

ListForward() публичный Метод

public ListForward ( DeviceData device ) : IEnumerable
device DeviceData
Результат IEnumerable

Reboot() публичный Метод

public Reboot ( string into, DeviceData device ) : void
into string
device DeviceData
Результат void

RemoveAllForwards() публичный Метод

public RemoveAllForwards ( DeviceData device ) : void
device DeviceData
Результат void

RemoveForward() публичный Метод

public RemoveForward ( DeviceData device, int localPort ) : void
device DeviceData
localPort int
Результат void

RunLogService() публичный Метод

public RunLogService ( DeviceData device ) : IEnumerable
device DeviceData
Результат IEnumerable

SetDevice() публичный Метод

public SetDevice ( IAdbSocket socket, DeviceData device ) : void
socket IAdbSocket
device DeviceData
Результат void