diff --git a/server/backends/port8080.py b/server/backends/port8080.py index ea5bfd5..bd8ca28 100644 --- a/server/backends/port8080.py +++ b/server/backends/port8080.py @@ -12,3 +12,11 @@ def get_img(): def touch(x, y, is_long): requests.get(f'http://localhost:8080/set_touch?x={x}&y={y}&hold={1 if is_long else 0}') + + +def connect(): + pass + + +def disconnect(): + pass diff --git a/server/backends/x11.py b/server/backends/x11.py index a99c410..9667d6d 100644 --- a/server/backends/x11.py +++ b/server/backends/x11.py @@ -25,3 +25,11 @@ def touch(x, y, is_long): threading.Thread(target=_long_touch, args=(x, y,)).start() else: subprocess.run(['xdotool', 'mousemove', str(x), str(y), 'click', '1']) + + +def connect(): + pass + + +def disconnect(): + pass diff --git a/server/wss.py b/server/wss.py index 74d0e45..b1c56b8 100644 --- a/server/wss.py +++ b/server/wss.py @@ -83,6 +83,7 @@ class HCRAServer(tornado.websocket.WebSocketHandler): self.client.good = None client = None self.is_open = False + imgproc.backend.disconnect() def on_message(self, message): action = message.split(' ', 1)[0] @@ -112,6 +113,8 @@ class HCRAServer(tornado.websocket.WebSocketHandler): except DisconnectError as e: self.write_message(str(e)) return + + imgproc.backend.connect() try: imgname = imgproc.get_full_img()