driver: send cmd err msg to a pyqt sig
This commit is contained in:
parent
c2e78e6f17
commit
89a1270c02
|
@ -642,6 +642,7 @@ class Kirdy:
|
|||
# PyQt Signal
|
||||
self._report_sig = None # Dict
|
||||
self._connected_sig = None # Bool
|
||||
self._err_msg_sig = None # Str
|
||||
|
||||
self.connected_event = None
|
||||
|
||||
|
@ -662,6 +663,12 @@ class Kirdy:
|
|||
"""
|
||||
self._connected_sig = sig
|
||||
|
||||
def set_err_msg_sig(self, sig):
|
||||
"""
|
||||
Emit a error message to a PyQt Signal(str) when a cmd fails to execute
|
||||
"""
|
||||
self._err_msg_sig = sig
|
||||
|
||||
def start_session(self, host='192.168.1.128', port=1337):
|
||||
"""
|
||||
Start Kirdy Connection Session.
|
||||
|
@ -900,6 +907,10 @@ class Kirdy:
|
|||
elif msg["msg_type"] == msg_type:
|
||||
if sig is not None:
|
||||
sig.emit(msg)
|
||||
else:
|
||||
logging.warn(f"Commands fail to execute. {msg['msg_type']}:{msg['msg']}")
|
||||
if self._err_msg_sig is not None and msg['msg'] is not None:
|
||||
self._err_msg_sig.emit(msg['msg'])
|
||||
return msg
|
||||
|
||||
async def _send_raw_cmd(self, cmd, msg_type="Acknowledge", sig=None):
|
||||
|
|
Loading…
Reference in New Issue