def _try_reconnect(self):
        """Try to recover an interrupted connection."""

        try:
            if self.connection_interrupted:
                self.connect_direct(self.connection_string, force=True)
                self.connection_interrupted = False
                self.connected = True

                # Reenable streaming interface if that was open before as well
                if self._reports is not None:
                    self._loop.run_coroutine(self.adapter.open_interface(0, 'streaming'))

                # Reenable tracing interface if that was open before as well
                if self._traces is not None:
                    self._loop.run_coroutine(self.adapter.open_interface(0, 'tracing'))
        except HardwareError as exc:
            self._logger.exception("Error reconnecting to device after an unexpected disconnect")
            raise HardwareError("Device disconnected unexpectedly and we could not reconnect", reconnect_error=exc) from exc
def _try_reconnect ( self ) : try : if self . connection_interrupted : self . connect_direct ( self . connection_string , force = True ) self . connection_interrupted = False self . connected = True if self . _reports is not None : self . _loop . run_coroutine ( self . adapter . open_interface ( 0 , 'streaming' ) ) if self . _traces is not None : self . _loop . run_coroutine ( self . adapter . open_interface ( 0 , 'tracing' ) ) except HardwareError as exc : self . _logger . exception ( "Error reconnecting to device after an unexpected disconnect" ) raise HardwareError ( "Device disconnected unexpectedly and we could not reconnect" , reconnect_error = exc ) from exc
Try to recover an interrupted connection.