adb_command¶
- class adb_command.AdbCommand(adb: str = 'adb', device: AdbDevice = None)[source]¶
Bases:
object
A class to execute ADB commands on a specified Android device.
- device: AdbDevice = None¶
- query(cmd, stdout=-1, stderr=-1) CompletedProcess [source]¶
- query(cmd: str, stdout=-1, stderr=-1) CompletedProcess
- query(cmd: list, stdout=-1, stderr=-1) CompletedProcess
Executes an ADB command and waits for it to complete.
- Parameters:
cmd – The command to execute (str or list).
stdout – Standard output pipe, defaults to subprocess.PIPE.
stderr – Standard error pipe, defaults to subprocess.PIPE.
- Returns:
The completed process.
- query_async(cmd, stdout=-1, stderr=-1) Popen [source]¶
- query_async(cmd: str, stdout=-1, stderr=-1) Popen
- query_async(cmd: list, stdout=-1, stderr=-1) Popen
Executes an ADB command asynchronously.
- Parameters:
cmd – The command to execute (str or list).
stdout – Standard output pipe, defaults to subprocess.PIPE.
stderr – Standard error pipe, defaults to subprocess.PIPE.
- Returns:
The process object.
- set_device(device: AdbDevice) AdbCommand [source]¶
Sets the target device for ADB commands.
- Parameters:
device – An instance of AdbDevice.
- Returns:
The current instance of AdbCommand.