Index: dialin/hd/alarms.py =================================================================== diff -u -r05176be46b1bcb2cd406be63b7888900b3086b67 -r044087c3a2f8b762452ebd58eaeb27db968b31a2 --- dialin/hd/alarms.py (.../alarms.py) (revision 05176be46b1bcb2cd406be63b7888900b3086b67) +++ dialin/hd/alarms.py (.../alarms.py) (revision 044087c3a2f8b762452ebd58eaeb27db968b31a2) @@ -155,6 +155,73 @@ # self.ids = sorted(self.ids, key=lambda x: x[1]) self.ids = OrderedDict(sorted(self.ids.items(), key=lambda key: key[1])) + def get_alarm_states(self): + """ + Gets all states for all alarms + + @return: List of booleans of size 500 + """ + return self.alarm_states + + def get_alarms_state(self): + """ + Gets the alarms state + + None = 0 \n + Low = 1 \n + Medium = 2 \n + High = 3 \n + + @return: The alarms state + """ + return self.alarms_state + + def get_alarms_top(self): + """ + Gets the top alarm + + @return: (int) the top alarm + """ + return self.alarm_top + + def get_alarms_silence_expires_in(self): + """ + Gets the remaining time the alarms will be silenced (s) + + @return: (int) how long until the alarm silence expires + """ + def get_alarms_escalates_in(self): + """ + Gets the alarms escalates in time (s) + + @return: (int) how long until the alarm escalates + """ + return self.alarms_escalates_in + + def get_alarms_flags(self): + """ + Gets the alarms flags + + @return: (int) The alarms flags value + """ + return self.alarms_flags + + def get_alarm_states(self): + """ + Alarm states based on received HD alarm activation and alarm clear messages + + @return: + """ + self.alarm_states = [False] * 500 + + def get_alarm_ids(self): + """ + Returns a dictionary of the alarm short name and the corresponding id + + @return: OrderedDict of the alarm ids + """ + return self.ids + def _handler_alarms_status_sync(self, message): """ Handles published alarms status messages. alarms status data are captured @@ -282,7 +349,7 @@ @param reset: integer - 1 to reset a previous override, 0 to override @return: 1 if successful, zero otherwise - \details Patterns: \n + Patterns: \n 0 = off \n 1 = ok \n 2 = fault \n @@ -299,7 +366,7 @@ message_id=self.MSG_ID_HD_ALARM_LAMP_OVERRIDE, payload=payload) - print("override alarm lamp pattern") + print("Override Alarm Lamp Pattern") # Send message received_message = self.can_interface.send(message) @@ -334,6 +401,7 @@ def get_current_alarms_state(self): """ Gets the current alarms state. + @return: the current alarms state in text form. """ result = "" Index: dialin/hd/blood_flow.py =================================================================== diff -u -r02e6bbf85f0699488317daa135d2530bc5b19507 -r044087c3a2f8b762452ebd58eaeb27db968b31a2 --- dialin/hd/blood_flow.py (.../blood_flow.py) (revision 02e6bbf85f0699488317daa135d2530bc5b19507) +++ dialin/hd/blood_flow.py (.../blood_flow.py) (revision 044087c3a2f8b762452ebd58eaeb27db968b31a2) @@ -77,6 +77,62 @@ self.measured_blood_pump_mc_current = 0.0 self.pwm_duty_cycle_pct = 0.0 + def get_target_blood_flow_rate(self): + """ + Gets the target blood flow rate + + @return: The target blood flow rate + """ + return self.target_blood_flow_rate + + def get_measured_blood_flow_rate(self): + """ + Gets the measured blood flow rate + + @return: the measured blood flow rate + """ + return self.measured_blood_flow_rate + + def get_measured_blood_pump_rotor_speed(self): + """ + Gets the measured blood pump rotor speed + + @return: The measured blood pump rotor speed + """ + return self.measured_blood_pump_rotor_speed + + def get_measured_blood_pump_speed(self): + """ + Gets the measured blood pump speed + + @return: the measured blood pump speed + """ + return self.measured_blood_pump_speed + + def get_measured_blood_pump_mc_speed(self): + """ + Gets the measured blood pump mc speed + + @return: The measured blood pump mc speed + """ + return self.measured_blood_pump_mc_speed + + def get_measured_blood_pump_mc_current(self): + """ + Gets the measured blood pump mc current + + @return: the measured blood pump mc current + """ + return self.measured_blood_pump_mc_current + + def get_pwm_duty_cycle_pct(self): + """ + Gets the pwm duty cycle pct + + @return: the pwm duty cycle pct + """ + return self.pwm_duty_cycle_pct + def _handler_blood_flow_sync(self, message): """ Handles published blood flow data messages. Blood flow data are captured Index: dialin/hd/dialysate_inlet_flow.py =================================================================== diff -u -r02e6bbf85f0699488317daa135d2530bc5b19507 -r044087c3a2f8b762452ebd58eaeb27db968b31a2 --- dialin/hd/dialysate_inlet_flow.py (.../dialysate_inlet_flow.py) (revision 02e6bbf85f0699488317daa135d2530bc5b19507) +++ dialin/hd/dialysate_inlet_flow.py (.../dialysate_inlet_flow.py) (revision 044087c3a2f8b762452ebd58eaeb27db968b31a2) @@ -75,6 +75,63 @@ self.measured_dialysate_inlet_pump_mc_current = 0.0 self.pwm_duty_cycle_pct = 0.0 + + def get_target_dialysate_inlet_flow_rate(self): + """ + Gets the target dialysate inlet flow rate + + @return: the target dialysate inlet flow rate + """ + return self.target_dialysate_inlet_flow_rate + + def get_measured_dialysate_inlet_flow_rate(self): + """ + Gets the measured dialysate inlet flow rate + + @return: the measured dialysate inlet flow rate + """ + return self.measured_dialysate_inlet_flow_rate + + def get_measured_dialysate_inlet_pump_rotor_speed(self): + """ + Gets the measured dialysate inlet pump rotor speed + + @return: the measured dialysate inlet pump rotor speed + """ + return self.measured_dialysate_inlet_pump_rotor_speed + + def get_measured_dialysate_inlet_pump_speed(self): + """ + Gets the measured dialysate inlet pump speed + + @return: the measured dialysate inlet pump speed + """ + return self.measured_dialysate_inlet_pump_speed + + def get_measured_dialysate_inlet_pump_mc_speed(self): + """ + Gets the measured dialysate inlet pump mc speed + + @return: the measured dialysate inlet pump mc speed + """ + return self.measured_dialysate_inlet_pump_mc_speed + + def get_measured_dialysate_inlet_pump_mc_current(self): + """ + Gets the measured dialysate inlet pump mc current + + @return: the measured dialysate inlet pump mc current + """ + return self.measured_dialysate_inlet_pump_mc_current + + def get_pwm_duty_cycle_pct(self): + """ + Gets the pwm duty cycle pct + + @return: the pwm dutcy cycle pct + """ + return self.pwm_duty_cycle_pct + def _handler_dialysate_inlet_flow_sync(self, message): """ Handles published dialysate inlet flow data messages. Dialysate flow data are captured Index: dialin/hd/dialysate_outlet_flow.py =================================================================== diff -u -r02e6bbf85f0699488317daa135d2530bc5b19507 -r044087c3a2f8b762452ebd58eaeb27db968b31a2 --- dialin/hd/dialysate_outlet_flow.py (.../dialysate_outlet_flow.py) (revision 02e6bbf85f0699488317daa135d2530bc5b19507) +++ dialin/hd/dialysate_outlet_flow.py (.../dialysate_outlet_flow.py) (revision 044087c3a2f8b762452ebd58eaeb27db968b31a2) @@ -22,10 +22,7 @@ class HDDialysateOutletFlow: """ - \class HD_DialysateOutletFlow - - \brief Hemodialysis Device (HD) Dialin API sub-class for dialysate outlet pump related commands. - + Hemodialysis Device (HD) Dialin API sub-class for dialysate outlet pump related commands. """ # DialysateFlow message IDs @@ -76,6 +73,60 @@ self.measured_dialysate_outlet_pump_mc_current = 0.0 self.pwm_duty_cycle_pct = 0.0 + def get_reference_dialysate_outlet_uf_volume(self): + """ + Gets the reference dialysate outlet uf volume + + @return: the reference dialysate outlet uf volume + """ + return self.reference_dialysate_outlet_uf_volume + + def get_measured_dialysate_outlet_uf_volume(self): + """ + Gets the measured dialysate outlet uf volume + + @return: the measured dialysate outlet uf volume + """ + return self.measured_dialysate_outlet_uf_volume + + def get_measured_dialysate_outlet_pump_rotor_speed(self): + """ + Gets the measured dialysate outlet pump rotor speed + @return: the measured dialysate outlet pump rotor speed + """ + return self.measured_dialysate_outlet_pump_rotor_speed + + def get_measured_dialysate_outlet_pump_speed(self): + """ + Gets the measured dialysate outlet pump speed + @return: the measured dialysate outlet pump speed + """ + return self.measured_dialysate_outlet_pump_speed + + def get_measured_dialysate_outlet_pump_mc_speed(self): + """ + Gets the measured dialysate outlet pump mc speed + + @return: the measured dialysate outlet pump mc speed + """ + return self.measured_dialysate_outlet_pump_mc_speed + + def get_measured_dialysate_outlet_pump_mc_current(self): + """ + Gets the measured dialysate outlet pump mc current + + @return: Gets the measured dialysate outlet pump mc current + """ + return self.measured_dialysate_outlet_pump_mc_current + + def get_pwm_duty_cycle_pct(self): + """ + Gets the pwm duty cycle pct + + @return: the pwm duty cycle pct + """ + return self.pwm_duty_cycle_pct + def _handler_dialysate_outlet_flow_sync(self, message): """ Handles published dialysate outlet flow data messages. Dialysate flow data are captured @@ -380,7 +431,7 @@ @param reset: integer - 1 to reset a previous override, 0 to override @return: 1 if successful, zero otherwise - \details Load Cells: \n + Load Cells: \n 0 = reservoir 1 primary \n 1 = reservoir 1 backup \n 2 = reservoir 2 primary \n Index: dialin/hd/hemodialysis_device.py =================================================================== diff -u -r02e6bbf85f0699488317daa135d2530bc5b19507 -r044087c3a2f8b762452ebd58eaeb27db968b31a2 --- dialin/hd/hemodialysis_device.py (.../hemodialysis_device.py) (revision 02e6bbf85f0699488317daa135d2530bc5b19507) +++ dialin/hd/hemodialysis_device.py (.../hemodialysis_device.py) (revision 044087c3a2f8b762452ebd58eaeb27db968b31a2) @@ -96,6 +96,14 @@ self.treatment = HDTreatment(self.can_interface) self.pressure_occlusion = HDPressureOcclusion(self.can_interface) + def get_operation_mode(self): + """ + Gets the HD operation mode + + @return: The hd operation mode + """ + return self.hd_operation_mode + def _handler_hd_op_mode_sync(self, message): """ Handles published HD operation mode messages. Current HD operation mode Index: dialin/hd/pressure_occlusion.py =================================================================== diff -u -r02e6bbf85f0699488317daa135d2530bc5b19507 -r044087c3a2f8b762452ebd58eaeb27db968b31a2 --- dialin/hd/pressure_occlusion.py (.../pressure_occlusion.py) (revision 02e6bbf85f0699488317daa135d2530bc5b19507) +++ dialin/hd/pressure_occlusion.py (.../pressure_occlusion.py) (revision 044087c3a2f8b762452ebd58eaeb27db968b31a2) @@ -61,12 +61,51 @@ self.can_interface.register_receiving_publication_function(channel_id, msg_id, self._handler_pressure_occlusion_sync) - self.arterialPressure = 0 - self.venousPressure = 0.0 - self.bloodPumpOcclusion = 0.0 - self.dialysateInletPumpOcclusion = 0.0 - self.dialysateOutletPumpOcclusion = 0.0 + self.arterial_pressure = 0 + self.venous_pressure = 0.0 + self.blood_pump_occlusion = 0.0 + self.dialysate_inlet_pump_occlusion = 0.0 + self.dialysate_outlet_pump_occlusion = 0.0 + def get_arterial_pressure(self): + """ + Gets the arterial pressure. + @return: (int) The arterial pressure + """ + return self.arterial_pressure + + def get_venous_pressure(self): + """ + Gets the venous pressure + + @return: (float) The venous pressure + """ + return self.venous_pressure + + def get_blood_pump_occlusion(self): + """ + Gets the blood pump occlusion + + @return: (float) The blood pump occlusion + """ + return self.blood_pump_occlusion + + def get_dialysate_inlet_pump_occlusion(self): + """ + Gets the dialysate inlet pump occlusion + + @return: (float)The dialysate inlet pump occlusion + """ + return self.dialysate_inlet_pump_occlusion + + def get_dialysate_outlet_pump_occlusion(self): + """ + Gets the dialysate outlet pump occlusion + + @return: (float)The dialysate outlet pump occlusion + """ + return self.dialysate_outlet_pump_occlusion + def _handler_pressure_occlusion_sync(self, message): """ Handles published pressure & occlusion data messages. Pressure data are captured @@ -87,11 +126,11 @@ dpo = struct.unpack('f', bytearray( message['message'][self.START_POS_DOP_OCCL:self.END_POS_DOP_OCCL])) - self.arterialPressure = art[0] - self.venousPressure = ven[0] - self.bloodPumpOcclusion = bp[0] - self.dialysateInletPumpOcclusion = dpi[0] - self.dialysateOutletPumpOcclusion = dpo[0] + self.arterial_pressure = art[0] + self.venous_pressure = ven[0] + self.blood_pump_occlusion = bp[0] + self.dialysate_inlet_pump_occlusion = dpi[0] + self.dialysate_outlet_pump_occlusion = dpo[0] def cmd_arterial_pressure_measured_override(self, pres, reset=NO_RESET): """ Index: dialin/hd/rtc.py =================================================================== diff -u -r02e6bbf85f0699488317daa135d2530bc5b19507 -r044087c3a2f8b762452ebd58eaeb27db968b31a2 --- dialin/hd/rtc.py (.../rtc.py) (revision 02e6bbf85f0699488317daa135d2530bc5b19507) +++ dialin/hd/rtc.py (.../rtc.py) (revision 044087c3a2f8b762452ebd58eaeb27db968b31a2) @@ -21,9 +21,7 @@ class HDRTC: """ - \class HDRTC - - \brief Hemodialysis Device (HD) Dialin API sub-class for rtc commands. + Hemodialysis Device (HD) Dialin API sub-class for rtc commands. """ MSG_ID_SET_RTC_DATE_TIME = 0x801D @@ -32,13 +30,10 @@ START_POS_SET_PT = DenaliMessage.PAYLOAD_START_INDEX END_POS_SET_PT = START_POS_SET_PT + 4 - def __init__(self, outer_instance, can_interface=None): + def __init__(self, can_interface=None): """ - HD_BloodFlow constructor - @param outer_instance: reference to the HD (outer) class. - - @return: HD_BloodFlow object. + @param can_interface: Denali Can Messenger object """ self.can_interface = can_interface @@ -49,12 +44,20 @@ self._handler_rtc_epoch) self.rtc_epoch = 0 + def get_rtc_epoch(self): + """ + Gets the rtc epoch + + @return: The rtc epoch + """ + return self.rtc_epoch + def _handler_rtc_epoch(self, message): """ - Publishes the rtc time in epoch + Publishes the rtc time in epoch - @param message: published rtc epoch message - @return: none + @param message: published rtc epoch message + @return: None """ epoch = int.from_bytes(bytearray( message['message'][self.START_POS_SET_PT:self.END_POS_SET_PT]), Index: dialin/hd/treatment.py =================================================================== diff -u -r02e6bbf85f0699488317daa135d2530bc5b19507 -r044087c3a2f8b762452ebd58eaeb27db968b31a2 --- dialin/hd/treatment.py (.../treatment.py) (revision 02e6bbf85f0699488317daa135d2530bc5b19507) +++ dialin/hd/treatment.py (.../treatment.py) (revision 044087c3a2f8b762452ebd58eaeb27db968b31a2) @@ -68,13 +68,61 @@ self.treatment_uf_state = 0 self.saline_bolus_in_progress = False + def get_treatment_time_prescribed(self): + """ + Gets the prescribed treatment time + + @return: The prescribed treatment time + """ + return self.treatment_time_prescribed + + def get_treatment_time_elapsed(self): + """ + Gets the elapsed treatment time + + @return: The elapsed treatment time + """ + return self.treatment_time_elapsed + + def get_treatment_time_remaining(self): + """ + Gets the remaining treatment time + + @return: The remaining treatment time + """ + return self.treatment_time_remaining + + def get_treatment_state(self): + """ + Gets the treatment state + + @return: The treatment state + """ + return self.treatment_state + + def get_treatment_uf_state(self): + """ + Gets the treatment uf state + + @return: The treatment uf state + """ + return self.treatment_uf_state + + def get_saline_bolus_in_progress(self): + """ + Returns whether saline bolus is in progress + + @return: True if saline bolus is in progress, False otherwise + """ + return self.saline_bolus_in_progress + def _handler_treatment_time_sync(self, message): """ Handles published treatment time data messages. treatment time data are captured for reference. - @param message: published treatment time data message - @return: none + @param message: published treatment time data message + @return: None """ tot = struct.unpack('i', bytearray( @@ -93,7 +141,7 @@ Handles published treatment state data messages. treatment state data are captured for reference. - @param message: published treatment state data message + @param message: published treatment state data message @return: none """ Index: dialin/hd/ui_proxy.py =================================================================== diff -u -r02e6bbf85f0699488317daa135d2530bc5b19507 -r044087c3a2f8b762452ebd58eaeb27db968b31a2 --- dialin/hd/ui_proxy.py (.../ui_proxy.py) (revision 02e6bbf85f0699488317daa135d2530bc5b19507) +++ dialin/hd/ui_proxy.py (.../ui_proxy.py) (revision 044087c3a2f8b762452ebd58eaeb27db968b31a2) @@ -22,9 +22,7 @@ class HDUIProxy: """ - \class HDUIProxy - - \brief Hemodialysis Device (HD) Dialin API sub-class for ui commands. + Hemodialysis Device (HD) Dialin API sub-class for ui commands. """ # ui message IDs @@ -111,7 +109,6 @@ def __init__(self, can_interface): """ - HD_UI constructor @param can_interface: the denali can interface object """ @@ -162,6 +159,180 @@ self.target_blood_flow_rate = 0 self.target_dialysate_flow_rate = 0 + def get_hd_version(self): + """ + Gets the hd version + + @return: The hd version + """ + return self.hd_version + + def get_min_treatment_duration_min(self): + """ + Gets the min treatment duration + + @return: the min treatment duration (minutes) + """ + return self.min_treatment_duration_min + + def get_max_treatment_duration_min(self): + """ + Gets the max treatment duration + + @return: The max treatment duration (minutes) + """ + return self.max_treatment_duration_min + + def get_min_uf_volume_ml(self): + """ + Gets the min uf volume + + @return: the min uf volume (mL) + """ + return self.min_uf_volume_ml + + def get_max_uf_volume_ml(self): + """ + Gets the max uf volume + + @return: The max uf volume (mL) + """ + return self.max_uf_volume_ml + + def get_min_dialysate_flow_rate_ml_min(self): + """ + Gets the min dialysate flow rate + + @return: The min dialysate flow rate (mL/min) + """ + return self.min_dialysate_flow_rate_ml_min + + def get_max_dialysate_flow_rate_ml_min(self): + """ + Gets the max dialysate flow rate + + @return: The max dialysate flow rate (mL/min) + """ + return self.max_dialysate_flow_rate_ml_min + + def get_duration_change_succeeded(self): + """ + Gets the duration change succeeded status + + @return: (bool) The duration change succeeded status + """ + return self.duration_change_succeeded + + def get_duration_change_reject_reason(self): + """ + Gets the duration change reject reason + + @return: (int) The duration change reject reason + """ + return self.duration_change_reject_reason + + def get_duration_change_time_min(self): + """ + Gets the duration change time + + @return: the duration change time (min) + """ + return self.duration_change_time_min + + def get_duration_change_uf_vol_ml(self): + """ + Gets the duration change uf vol + + @return: the duration change uf vol (mL) + """ + return self.duration_change_uf_vol_ml + + def get_uf_change_succeeded(self): + """ + Gets the uf change succeeded status + + @return: The uf change succeeded status + """ + return self.uf_change_succeeded + + def get_uf_change_reject_reason(self): + """ + Gets the uf change reject reason + @return: (int) The uf change reject reason + """ + return self.uf_change_reject_reason + + def get_uf_change_volume_ml(self): + """ + Gets the uf change volume + @return: The uf change volume (mL) + """ + return self.uf_change_volume_ml + + def get_uf_change_time_min(self): + """ + Gets the uf change time + + @return: The uf change time (min) + """ + return self.uf_change_time_min + + def get_uf_change_rate_ml_min(self): + """ + Gets the uf change rate + + @return: The uf change rate (mL/min) + """ + return self.uf_change_rate_ml_min + + def get_uf_change_time_diff(self): + """ + Gets the uf change time diff + + @return: The uf change time diff + """ + return self.uf_change_time_diff + + def get_uf_change_rate_diff(self): + """ + Gets the uf change rate diff + + @return: The uf change rate diff + """ + return self.uf_change_rate_diff + + def get_blood_and_dialysate_flow_rate_change_succeeded(self): + """ + Gets the blood and dialysate flow rate change succeeded status + + @return: True if successful, False otherwise + """ + return self.blood_and_dialysate_flow_rate_change_succeeded + + def get_blood_and_dialysate_flow_rate_change_reject_reason(self): + """ + Gets the blood and dialysate flow rate change reject reason + + @return: (int) The reason for the rejection + """ + return self.blood_and_dialysate_flow_rate_change_reject_reason + + def get_target_blood_flow_rate(self): + """ + Gets the target blood flow rate + + @return: The target blood flow rate + """ + return self.target_blood_flow_rate + + def get_target_dialysate_flow_rate(self): + """ + Gets the target dialysate flow rate + + @return: The target dialysate flow rate + """ + return self.target_dialysate_flow_rate + def _handler_hd_version(self, message): """ Handler for response from HD regarding its version. @@ -314,11 +485,11 @@ resp = True self.uf_change_succeeded = resp self.uf_change_reject_reason = rea[0] - self.UFChangeVolumeL = vol[0] / self.LITER_TO_ML_CONVERSION_FACTOR + self.uf_change_volume_ml = vol[0] self.uf_change_time_min = tim[0] self.uf_change_time_diff = tmd[0] self.uf_change_rate_ml_min = rat[0] - self.UFChangeRateDiff = rtd[0] + self.uf_change_rate_diff = rtd[0] def cmd_ui_checkin_with_hd(self): """ Index: dialin/hd/watchdog.py =================================================================== diff -u -r02e6bbf85f0699488317daa135d2530bc5b19507 -r044087c3a2f8b762452ebd58eaeb27db968b31a2 --- dialin/hd/watchdog.py (.../watchdog.py) (revision 02e6bbf85f0699488317daa135d2530bc5b19507) +++ dialin/hd/watchdog.py (.../watchdog.py) (revision 044087c3a2f8b762452ebd58eaeb27db968b31a2) @@ -22,21 +22,16 @@ class HDWatchdog: """ - \class HD_Watchdog - - \brief Hemodialysis Device (HD) Dialin API sub-class for watchdog related commands. + Hemodialysis Device (HD) Dialin API sub-class for watchdog related commands. """ # 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. - - @return: HD_Watchdog object. + @param can_interface: the denali can interface object """ self.can_interface = can_interface