diff --git a/asyncua/sync.py b/asyncua/sync.py index 546ee328d..ce64d5649 100644 --- a/asyncua/sync.py +++ b/asyncua/sync.py @@ -248,9 +248,12 @@ def application_uri(self): def application_uri(self, value): self.aio_obj.application_uri = value - @syncmethod def connect(self) -> None: - pass + if not self.tloop.is_alive(): + self.tloop = ThreadLoop() + self.tloop.start() + self.close_tloop = True + self.tloop.post(self.aio_obj.connect()) def disconnect(self) -> None: try: @@ -259,9 +262,12 @@ def disconnect(self) -> None: if self.close_tloop: self.tloop.stop() - @syncmethod def connect_sessionless(self) -> None: - pass + if not self.tloop.is_alive(): + self.tloop = ThreadLoop() + self.tloop.start() + self.close_tloop = True + self.tloop.post(self.aio_obj.connect_sessionless()) def disconnect_sessionless(self) -> None: try: @@ -270,9 +276,12 @@ def disconnect_sessionless(self) -> None: if self.close_tloop: self.tloop.stop() - @syncmethod def connect_socket(self) -> None: - pass + if not self.tloop.is_alive(): + self.tloop = ThreadLoop() + self.tloop.start() + self.close_tloop = True + self.tloop.post(self.aio_obj.connect_sessionless()) def disconnect_socket(self) -> None: try: @@ -591,9 +600,12 @@ def register_namespace(self, url): def get_namespace_array(self): pass - @syncmethod def start(self): - pass + if not self.tloop.is_alive(): + self.tloop = ThreadLoop() + self.tloop.start() + self.close_tloop = True + self.tloop.post(self.aio_obj.start()) def stop(self): self.tloop.post(self.aio_obj.stop())