How to use the androidtv.adb_manager.adb_manager_sync.ADBPythonSync 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_sync.py View on Github external
def setUp(self):
        """Create an `ADBPythonSync` instance.

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

        """
        with patchers.PATCH_ADB_DEVICE_TCP, patchers.patch_connect(True)[self.PATCH_KEY]:
            self.adb = ADBPythonSync('HOST', 5555)
github JeffLIrion / python-androidtv / tests / test_adb_manager_sync.py View on Github external
def test_close(self):
        """Test the `ADBPythonSync.close` method.

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

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

            self.adb.close()
            self.assertFalse(self.adb.available)
github JeffLIrion / python-androidtv / tests / test_adb_manager_sync.py View on Github external
def test_adb_screencap_success(self):
        """Test the `screencap` method.

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

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

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

            else:
                with patch.object(self.adb._adb_device, 'screencap', return_value=PNG_IMAGE):
                    self.assertEqual(self.adb.screencap(), PNG_IMAGE)
github JeffLIrion / python-androidtv / androidtv / basetv / basetv_sync.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 = ADBPythonSync(host, port, adbkey, signer)
        else:
            # pure-python-adb
            adb = ADBServerSync(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_sync.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, ADBPythonSync):
            return self._adb.connect(always_log_errors, auth_timeout_s)
        return self._adb.connect(always_log_errors)