androidtv.adb_manager.adb_manager_sync module¶
Classes to manage ADB connections.
ADBPythonSync
utilizes a Python implementation of the ADB protocol.ADBServerSync
utilizes an ADB server to communicate with the device.
-
class
androidtv.adb_manager.adb_manager_sync.
ADBPythonSync
(host, port, adbkey='', signer=None)[source]¶ Bases:
object
A manager for ADB connections that uses a Python implementation of the ADB protocol.
- Parameters
host (str) – The address of the device; may be an IP address or a host name
port (int) – The device port to which we are connecting (default is 5555)
adbkey (str) – The path to the
adbkey
file for ADB authenticationsigner (PythonRSASigner, None) – The signer for the ADB keys, as loaded by
ADBPythonSync.load_adbkey()
-
property
available
¶ Check whether the ADB connection is intact.
- Returns
Whether or not the ADB connection is intact
- Return type
bool
-
connect
(always_log_errors=True, auth_timeout_s=10.0)[source]¶ Connect to an Android TV / Fire TV device.
- Parameters
always_log_errors (bool) – If True, errors will always be logged; otherwise, errors will only be logged on the first failed reconnect attempt
auth_timeout_s (float) – Authentication timeout (in seconds)
- Returns
Whether or not the connection was successfully established and the device is available
- Return type
bool
-
static
load_adbkey
(adbkey)[source]¶ Load the ADB keys.
- Parameters
adbkey (str) – The path to the
adbkey
file for ADB authentication- Returns
The
PythonRSASigner
with the key files loaded- Return type
PythonRSASigner
-
pull
(local_path, device_path)[source]¶ Pull a file from the device using the Python ADB implementation.
- Parameters
local_path (str) – The path where the file will be saved
device_path (str) – The file on the device that will be pulled
-
push
(local_path, device_path)[source]¶ Push a file to the device using the Python ADB implementation.
- Parameters
local_path (str) – The file that will be pushed to the device
device_path (str) – The path where the file will be saved on the device
-
class
androidtv.adb_manager.adb_manager_sync.
ADBServerSync
(host, port=5555, adb_server_ip='', adb_server_port=5037)[source]¶ Bases:
object
A manager for ADB connections that uses an ADB server.
- Parameters
host (str) – The address of the device; may be an IP address or a host name
port (int) – The device port to which we are connecting (default is 5555)
adb_server_ip (str) – The IP address of the ADB server
adb_server_port (int) – The port for the ADB server
-
property
available
¶ Check whether the ADB connection is intact.
- Returns
Whether or not the ADB connection is intact
- Return type
bool
-
close
()[source]¶ Close the ADB server socket connection.
Currently, this doesn’t do anything except set
self._available = False
.
-
connect
(always_log_errors=True)[source]¶ Connect to an Android TV / Fire TV device.
- Parameters
always_log_errors (bool) – If True, errors will always be logged; otherwise, errors will only be logged on the first failed reconnect attempt
- Returns
Whether or not the connection was successfully established and the device is available
- Return type
bool
-
pull
(local_path, device_path)[source]¶ Pull a file from the device using an ADB server.
- Parameters
local_path (str) – The path where the file will be saved
device_path (str) – The file on the device that will be pulled
-
push
(local_path, device_path)[source]¶ Push a file to the device using an ADB server.
- Parameters
local_path (str) – The file that will be pushed to the device
device_path (str) – The path where the file will be saved on the device
-
androidtv.adb_manager.adb_manager_sync.
LOCK_KWARGS
= {'timeout': 3.0}¶ Use a timeout for the ADB threading lock if it is supported
-
androidtv.adb_manager.adb_manager_sync.
_acquire
(lock)[source]¶ Handle acquisition and release of a
threading.Lock
object withLOCK_KWARGS
keyword arguments.- Parameters
lock (threading.Lock) – The lock that we will try to acquire
- Yields
acquired (bool) – Whether or not the lock was acquired
- Raises
LockNotAcquiredException – Raised if the lock was not acquired