C# Class 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.

Inheritance: IAdbClient
ファイルを表示 Open project: ArduPilot/MissionPlanner Class Usage Examples

Public Methods

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

Protected Methods

Method Description
EnsureDevice ( DeviceData device ) : void

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

Method Details

AdbClient() public method

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. ///
return SharpAdbClient.Exceptions

Connect() public method

public Connect ( DnsEndPoint endpoint ) : string
endpoint System.Net.DnsEndPoint
return string

CreateAdbForwardRequest() public static method

Creates the adb forward request.
public static CreateAdbForwardRequest ( string address, int port ) : byte[]
address string The address.
port int The port.
return byte[]

CreateForward() public method

public CreateForward ( DeviceData device, ForwardSpec local, ForwardSpec remote, bool allowRebind ) : void
device DeviceData
local ForwardSpec
remote ForwardSpec
allowRebind bool
return void

CreateForward() public method

public CreateForward ( DeviceData device, string local, string remote, bool allowRebind ) : void
device DeviceData
local string
remote string
allowRebind bool
return void

EnsureDevice() protected method

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. ///
return void

ExecuteRemoteCommand() public method

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

FormAdbRequest() public static method

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. ///
return byte[]

GetAdbVersion() public method

public GetAdbVersion ( ) : int
return int

GetDevices() public method

public GetDevices ( ) : List
return List

KillAdb() public method

public KillAdb ( ) : void
return void

ListForward() public method

public ListForward ( DeviceData device ) : IEnumerable
device DeviceData
return IEnumerable

Reboot() public method

public Reboot ( string into, DeviceData device ) : void
into string
device DeviceData
return void

RemoveAllForwards() public method

public RemoveAllForwards ( DeviceData device ) : void
device DeviceData
return void

RemoveForward() public method

public RemoveForward ( DeviceData device, int localPort ) : void
device DeviceData
localPort int
return void

RunLogService() public method

public RunLogService ( DeviceData device ) : IEnumerable
device DeviceData
return IEnumerable

SetDevice() public method

public SetDevice ( IAdbSocket socket, DeviceData device ) : void
socket IAdbSocket
device DeviceData
return void