How to use the androidtv.basetv.basetv_async.BaseTVAsync 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 / androidtv / androidtv / androidtv_async.py View on Github external
"""Communicate with an Android TV device via ADB over a network.

ADB Debugging must be enabled.
"""


import logging

from .base_androidtv import BaseAndroidTV
from ..basetv.basetv_async import BaseTVAsync
from .. import constants

_LOGGER = logging.getLogger(__name__)


class AndroidTVAsync(BaseTVAsync, BaseAndroidTV):
    """Representation of an Android TV device.

    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 authentication
    adb_server_ip : str
        The IP address of the ADB server
    adb_server_port : int
        The port for the ADB server
    state_detection_rules : dict, None
        A dictionary of rules for determining the state (see :class:`~androidtv.basetv.basetv.BaseTV`)
github JeffLIrion / python-androidtv / androidtv / androidtv / androidtv_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):  # pylint: disable=super-init-not-called
        BaseTVAsync.__init__(self, host, port, adbkey, adb_server_ip, adb_server_port, state_detection_rules, signer)
github JeffLIrion / python-androidtv / androidtv / firetv / firetv_async.py View on Github external
"""Communicate with an Amazon Fire TV device via ADB over a network.

ADB Debugging must be enabled.
"""


import logging

from .base_firetv import BaseFireTV
from ..basetv.basetv_async import BaseTVAsync
from .. import constants

_LOGGER = logging.getLogger(__name__)


class FireTVAsync(BaseTVAsync, BaseFireTV):
    """Representation of an Amazon Fire TV device.

    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 authentication
    adb_server_ip : str
        The IP address of the ADB server
    adb_server_port : int
        The port for the ADB server
    state_detection_rules : dict, None
        A dictionary of rules for determining the state (see :class:`~androidtv.basetv.basetv.BaseTV`)
github JeffLIrion / python-androidtv / androidtv / firetv / firetv_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):  # pylint: disable=super-init-not-called
        BaseTVAsync.__init__(self, host, port, adbkey, adb_server_ip, adb_server_port, state_detection_rules, signer)
github JeffLIrion / python-androidtv / androidtv / setup_async.py View on Github external
if device_class == 'androidtv':
        atv = AndroidTVAsync(host, port, adbkey, adb_server_ip, adb_server_port, state_detection_rules, signer)
        await atv.adb_connect(auth_timeout_s=auth_timeout_s)
        atv.device_properties = await atv.get_device_properties()
        return atv

    if device_class == 'firetv':
        ftv = FireTVAsync(host, port, adbkey, adb_server_ip, adb_server_port, state_detection_rules, signer)
        await ftv.adb_connect(auth_timeout_s=auth_timeout_s)
        ftv.device_properties = await ftv.get_device_properties()
        return ftv

    if device_class != 'auto':
        raise ValueError("`device_class` must be 'androidtv', 'firetv', or 'auto'.")

    aftv = BaseTVAsync(host, port, adbkey, adb_server_ip, adb_server_port, state_detection_rules, signer)

    # establish the ADB connection
    await aftv.adb_connect(auth_timeout_s=auth_timeout_s)

    # get device properties
    aftv.device_properties = await aftv.get_device_properties()

    # Fire TV
    if aftv.device_properties.get('manufacturer') == 'Amazon':
        aftv.__class__ = FireTVAsync

    # Android TV
    else:
        aftv.__class__ = AndroidTVAsync

    return aftv