Index: HD/Watchdog.py =================================================================== diff -u -rc5826238ca4b80671231a9c564af3ea01b9be06f -r0da0106eca868b9144298c60911710b3414a5837 --- HD/Watchdog.py (.../Watchdog.py) (revision c5826238ca4b80671231a9c564af3ea01b9be06f) +++ HD/Watchdog.py (.../Watchdog.py) (revision 0da0106eca868b9144298c60911710b3414a5837) @@ -5,7 +5,7 @@ # THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN # WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. # -# @file Watchdog.py +# @file watchdog.py # # @date 31-Mar-2020 # @author P. Lucia @@ -16,31 +16,31 @@ ############################################################################ from DialIn.CoreCANProtocol import (DenaliMessage, DenaliChannels) -from .utils import integer2ByteArray -from .HemodialysisDevice import HD +from utils import integer_to_byte_array, RESET + class HDWatchdog: """ - \class HD_Watchdog + \class HD_Watchdog - \brief Hemodialysis Device (HD) Dialin API sub-class for watchdog related commands. + \brief Hemodialysis Device (HD) Dialin API sub-class for watchdog related commands. """ - # Watchdog message IDs + # watchdog message IDs MSG_ID_HD_WD_CHECKIN_OVERRIDE = 0x8005 def __init__(self, can_interface): - """ HD_Watchdog constructor \param outer_instance: reference to the HD (outer) class. \returns HD_Watchdog object. """ + self.can_interface = can_interface - def CmdWatchdogTaskCheckinOverride(self, reset, state, task): + def cmd_watchdog_task_check_in_override(self, reset, state, task): """ Constructs and sends the watchdog task check-in override command @@ -50,9 +50,9 @@ \returns 1 if successful, zero otherwise """ - rst = integer2ByteArray(reset) - sta = integer2ByteArray(state) - tsk = integer2ByteArray(task) + rst = integer_to_byte_array(reset) + sta = integer_to_byte_array(state) + tsk = integer_to_byte_array(task) payload = rst + sta + tsk message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_hd_ch_id, @@ -67,11 +67,11 @@ # If there is content... if received_message is not None: # print(received_message) - if reset == HD.RESET: + if reset == RESET: str_res = "reset back to normal" else: str_res = ("checked in" if state != 0 else "not checked in") - print("Watchdog task check-in overridden to " + str_res + ":" + + print("watchdog task check-in overridden to " + str_res + ":" + str(received_message['message'][DenaliMessage.PAYLOAD_START_INDEX])) # response payload is OK or not OK return received_message['message'][DenaliMessage.PAYLOAD_START_INDEX]