in leda_python/deviceMbus.py [0:0]
def driver_set_watchdog(self, thread_name, count_down):
'''
:param thread_name: 需要保活的线程名称
:param count_down: 倒计时时间,-1表示停止保活
:return:
'''
if (None == self.driverMbusHandle):
raise exception.LedaBusHandleException("mbus Handle is None")
if (False == isinstance(thread_name, str)):
raise exception.LedaRPCMethodException("driver_set_watchdog: thread_name is valid:%s" % (thread_name))
else:
if ((len(thread_name) > mbusConfig.STRING_NAME_MAX_LEN) or (len(thread_name) == 0)):
raise exception.LedaRPCMethodException("driver_set_watchdog: thread_name is valid:%s" % (thread_name))
if (False == isinstance(count_down, int)):
raise exception.LedaRPCMethodException("driver_set_watchdog: count_down is valid:%s" % (count_down))
else:
if ((count_down == 0) or (count_down < -2)):
raise exception.LedaRPCMethodException("driver_set_watchdog: count_down is valid:%s" % (count_down))
try:
self.driverMbusHandle.feedDog(thread_name, count_down)
except:
_logger.exception("Err")
raise exception.LedaFeedDogException("feed dog failed")