async def _discover_qtm(self, interface): try: async for qtm_instance in qtm.Discover(interface): info = qtm_instance.info.decode("utf-8").split(",")[0] if not info in self._found_qtms: self.discoveredQTM.emit(info, qtm_instance.host) self._found_qtms[info] = True except Exception: pass self.discovering = False
async def choose_qtm_instance(interface): """ List running QTM instances, asks for input and return chosen QTM """ instances = {} print("Available QTM instances:") async for i, qtm_instance in AsyncEnumerate(qtm.Discover(interface), start=1): instances[i] = qtm_instance print("{} - {}".format(i, qtm_instance.info)) try: choice = int(input("Connect to: ")) if choice not in instances: raise ValueError except ValueError: LOG.error("Invalid choice") return None return instances[choice].host
async def _discover(self): async for qtm_instance in qtm.Discover('0.0.0.0'): return qtm_instance