added clear error (test)

This commit is contained in:
Arturo Hernandez 2018-09-13 12:22:47 -04:00
parent 063c520bb1
commit ded7b1d395

View File

@ -484,6 +484,13 @@ class ZK(object):
return safe_cast(response, int, 0) if response else 0 return safe_cast(response, int, 0) if response else 0
else: else:
return None return None
def _clear_error(self, command_string=b''):
""" clear ACK_error """
cmd_response = self.__send_command(const.CMD_ACK_ERROR, command_string, 1024)
# cmd_response['code'] shuld be CMD_ACK_UNKNOWN
cmd_response = self.__send_command(const.CMD_ACK_UNKNOWN, command_string, 1024)
cmd_response = self.__send_command(const.CMD_ACK_UNKNOWN, command_string, 1024)
cmd_response = self.__send_command(const.CMD_ACK_UNKNOWN, command_string, 1024)
def get_extend_fmt(self): def get_extend_fmt(self):
''' '''
@ -499,6 +506,7 @@ class ZK(object):
#definitivo? seleccionar firmware aqui? #definitivo? seleccionar firmware aqui?
return safe_cast(fmt, int, 0) if fmt else 0 return safe_cast(fmt, int, 0) if fmt else 0
else: else:
self._clear_error(command_string)
return None return None
#raise ZKErrorResponse("Can't read extend fmt") #raise ZKErrorResponse("Can't read extend fmt")
@ -516,6 +524,7 @@ class ZK(object):
#definitivo? seleccionar firmware aqui? #definitivo? seleccionar firmware aqui?
return safe_cast(fmt, int, 0) if fmt else 0 return safe_cast(fmt, int, 0) if fmt else 0
else: else:
self._clear_error(command_string)
return None return None
def get_face_fun_on(self): def get_face_fun_on(self):
@ -532,6 +541,7 @@ class ZK(object):
#definitivo? seleccionar firmware aqui? #definitivo? seleccionar firmware aqui?
return safe_cast(response, int ,0) if response else 0 return safe_cast(response, int ,0) if response else 0
else: else:
self._clear_error(command_string)
return None return None
def get_compat_old_firmware(self): def get_compat_old_firmware(self):
@ -548,6 +558,7 @@ class ZK(object):
#definitivo? seleccionar firmware aqui? #definitivo? seleccionar firmware aqui?
return safe_cast(response, int, 0) if response else 0 return safe_cast(response, int, 0) if response else 0
else: else:
self._clear_error(command_string)
return None return None
def get_network_params(self): def get_network_params(self):