Add connect() and disconnect() to backend API
This commit is contained in:
parent
185e515c66
commit
1fc8aa4505
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue
Block a user