Skip to content
Snippets Groups Projects
Commit 5a06a274 authored by jkerdreu's avatar jkerdreu
Browse files

- remove wait_for_event from Helper class..

git-svn-id: https://redmine.imt-atlantique.fr/svn/xaal/code/Python/branches/0.7@3050 b32b6428-25c9-4566-ad07-03861ab6144f
parent e183d646
Branches
No related tags found
No related merge requests found
......@@ -385,7 +385,7 @@ class ToolboxHelper(object):
async def find_db_server(self):
self.engine.subscribe(self.find_db_callback)
self.engine.send_is_alive(self.device, dev_types=[DB_DEV_TYPE])
await self.wait_for_event(self.db_server_found, timeout=0.3)
await wait_for_event(self.db_server_found, timeout=0.3)
self.engine.unsubscribe(self.find_db_callback)
def request_db_values(self, addr):
......@@ -406,7 +406,7 @@ class ToolboxHelper(object):
#####################################################
async def wait_completed(self, timeout=0.5):
"""wait until exit event is set"""
await self.wait_for_event(self.exit_event, timeout=timeout)
await wait_for_event(self.exit_event, timeout=timeout)
def update_idle(self):
self.last_msg_time = now()
......@@ -446,14 +446,6 @@ class ToolboxHelper(object):
self.parser.print_help()
exit(1)
#####################################################
# misc
#####################################################
async def wait_for_event(self, event, timeout):
""" wait for a given event or timeout"""
wait_task = asyncio.create_task(event.wait())
await asyncio.wait([wait_task], timeout=timeout)
def colorize(color, text):
return f"{color}{text}{style.RESET}"
......@@ -482,6 +474,12 @@ def match_address(msg, addr):
return False
async def wait_for_event(event, timeout):
""" wait for a given event or timeout"""
wait_task = asyncio.create_task(event.wait())
await asyncio.wait([wait_task], timeout=timeout)
#####################################################
# dumper
#####################################################
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment