How to use the androidtv.adb_manager.adb_manager_async.ADBPythonAsync function in androidtv

To help you get started, we’ve selected a few androidtv examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github JeffLIrion / python-androidtv / tests / test_adb_manager_async.py View on Github external
def setUp(self):
        """Create an `ADBPythonAsync` instance.

        """
        with async_patchers.PATCH_ADB_DEVICE_TCP, async_patchers.patch_connect(True)[self.PATCH_KEY]:
            self.adb = ADBPythonAsync('HOST', 5555, 'adbkey')
github JeffLIrion / python-androidtv / tests / test_adb_manager_async.py View on Github external
def setUp(self):
        """Create an `ADBPythonAsync` instance.

        """
        with async_patchers.PATCH_ADB_DEVICE_TCP, async_patchers.patch_connect(True)[self.PATCH_KEY]:
            self.adb = ADBPythonAsync('HOST', 5555)
github JeffLIrion / python-androidtv / tests / test_adb_manager_async.py View on Github external
async def test_adb_screencap_success(self):
        """Test the `screencap` method.

        """
        with async_patchers.patch_connect(True)[self.PATCH_KEY], async_patchers.patch_shell(PNG_IMAGE)[self.PATCH_KEY]:
            self.assertTrue(await self.adb.connect())

            if isinstance(self.adb, ADBPythonAsync):
                self.assertEqual(await self.adb.screencap(), PNG_IMAGE)

                with async_patchers.patch_shell(PNG_IMAGE_NEEDS_REPLACING)[self.PATCH_KEY]:
                    self.assertEqual(await self.adb.screencap(), PNG_IMAGE)

            else:
                with patch.object(self.adb._adb_device, 'screencap', return_value=PNG_IMAGE, new_callable=async_patchers.AsyncMock):
                    self.assertEqual(await self.adb.screencap(), PNG_IMAGE)
github JeffLIrion / python-androidtv / tests / test_adb_manager_async.py View on Github external
async def test_close(self):
        """Test the `ADBPythonAsync.close` method.

        """
        with async_patchers.PATCH_ADB_DEVICE_TCP, async_patchers.patch_connect(True)[self.PATCH_KEY]:
            self.adb = ADBPythonAsync('HOST', 5555)

        with async_patchers.patch_connect(True)[self.PATCH_KEY]:
            self.assertTrue(await self.adb.connect())
            self.assertTrue(self.adb.available)
            self.assertTrue(self.adb._available)

            await self.adb.close()
            self.assertFalse(self.adb.available)
github JeffLIrion / python-androidtv / androidtv / basetv / basetv_async.py View on Github external
def __init__(self, host, port=5555, adbkey='', adb_server_ip='', adb_server_port=5037, state_detection_rules=None, signer=None):
        # the handler for ADB commands
        if not adb_server_ip:
            # python-adb
            adb = ADBPythonAsync(host, port, adbkey, signer)
        else:
            # pure-python-adb
            adb = ADBServerAsync(host, port, adb_server_ip, adb_server_port)

        BaseTV.__init__(self, adb, host, port, adbkey, adb_server_ip, adb_server_port, state_detection_rules)
github JeffLIrion / python-androidtv / androidtv / basetv / basetv_async.py View on Github external
"""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
        -------
        bool
            Whether or not the connection was successfully established and the device is available

        """
        if isinstance(self._adb, ADBPythonAsync):
            return await self._adb.connect(always_log_errors, auth_timeout_s)
        return await self._adb.connect(always_log_errors)