caffeinatedmike

Reworked Connect

Nov 11th, 2018
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.77 KB | None | 0 0
  1.     async def connect(self):
  2.         """ Connect to an Android TV device.
  3.  
  4.        Will attempt to establish ADB connection to the given host.
  5.        Failure sets state to UNKNOWN and disables sending actions.
  6.        """
  7.         try:
  8.             if self.adbkey:
  9.                 self._adb = AsyncADBConnection(self.host, self.adbkey)
  10.             else:
  11.                 self._adb = AsyncADBConnection(self.host)
  12.            
  13.             if not self.package_launcher:
  14.                 with self._adb:
  15.                     await self._adb.command(self.home())
  16.                     self.package_launcher = await self._adb.command(self.current_app)
  17.         except socket_error as serr:
  18.             logging.warning("Couldn't connect to host: %s, error: %s", self.host, serr.strerror)
Advertisement
Add Comment
Please, Sign In to add comment