adb_shell.transport.base_transport module

A base class for transports used to communicate with a device.

class adb_shell.transport.base_transport.BaseTransport[source]

Bases: ABC

A base transport class.

_abc_impl = <_abc._abc_data object>
abstract bulk_read(numbytes, transport_timeout_s)[source]

Read data from the device.

Parameters:
  • numbytes (int) – The maximum amount of data to be received

  • transport_timeout_s (float, None) – A timeout for the read operation

Returns:

The received data

Return type:

bytes

abstract bulk_write(data, transport_timeout_s)[source]

Send data to the device.

Parameters:
  • data (bytes) – The data to be sent

  • transport_timeout_s (float, None) – A timeout for the write operation

Returns:

The number of bytes sent

Return type:

int

abstract close()[source]

Close the connection.

abstract connect(transport_timeout_s)[source]

Create a connection to the device.

Parameters:

transport_timeout_s (float, None) – A connection timeout