Index: dialin/common/__init__.py =================================================================== diff -u -r3f12fb75e3d92e3ecbcb86a4b9b284dd0b05e26f -rf053467ac7cfb9fe349e394342d3a9253a377403 --- dialin/common/__init__.py (.../__init__.py) (revision 3f12fb75e3d92e3ecbcb86a4b9b284dd0b05e26f) +++ dialin/common/__init__.py (.../__init__.py) (revision f053467ac7cfb9fe349e394342d3a9253a377403) @@ -3,3 +3,4 @@ from .msg_defs import * from .prs_defs import * from .hd_defs import * +from .ui_defs import * \ No newline at end of file Index: dialin/common/alarm_defs.py =================================================================== diff -u -r02eff24a2b116fe3d71d8275eeb78f419302efd6 -rf053467ac7cfb9fe349e394342d3a9253a377403 --- dialin/common/alarm_defs.py (.../alarm_defs.py) (revision 02eff24a2b116fe3d71d8275eeb78f419302efd6) +++ dialin/common/alarm_defs.py (.../alarm_defs.py) (revision f053467ac7cfb9fe349e394342d3a9253a377403) @@ -1,4 +1,3 @@ - ########################################################################### # # Copyright (c) 2019-2021 Diality Inc. - All Rights Reserved. @@ -18,7 +17,7 @@ from ..utils.base import AlarmEnum -# Branch: Sprint37 +# Branch: staging @unique class AlarmList(AlarmEnum): ALARM_ID_NO_ALARM = 0 Index: dialin/common/msg_defs.py =================================================================== diff -u -r02eff24a2b116fe3d71d8275eeb78f419302efd6 -rf053467ac7cfb9fe349e394342d3a9253a377403 --- dialin/common/msg_defs.py (.../msg_defs.py) (revision 02eff24a2b116fe3d71d8275eeb78f419302efd6) +++ dialin/common/msg_defs.py (.../msg_defs.py) (revision f053467ac7cfb9fe349e394342d3a9253a377403) @@ -16,8 +16,22 @@ from enum import unique from ..utils.base import DialinEnum from .msg_ids import MsgIds +from aenum import extend_enum +# Define msg ids that are not yet added to common but are needed in dialin @unique +class MsgIdsDialin(DialinEnum): + pass + +# extend MsgIds +for each in MsgIdsDialin: + extend_enum(MsgIds, each.name, each.value) + +ACK_NOT_REQUIRED = [ + MsgIds.MSG_ID_ALARM_CONDITION_CLEARED.value +] + +@unique class RequestRejectReasons(DialinEnum): REQUEST_REJECT_REASON_NONE = 0 REQUEST_REJECT_REASON_NOT_ALLOWED_IN_CURRENT_MODE = 1 @@ -88,6 +102,3 @@ END_POS_FIELD_20 = START_POS_FIELD_20 + 4 -ACK_NOT_REQUIRED = [ - MsgIds.MSG_ID_ALARM_CONDITION_CLEARED.value -] Index: dialin/common/msg_ids.py =================================================================== diff -u -r02eff24a2b116fe3d71d8275eeb78f419302efd6 -rf053467ac7cfb9fe349e394342d3a9253a377403 --- dialin/common/msg_ids.py (.../msg_ids.py) (revision 02eff24a2b116fe3d71d8275eeb78f419302efd6) +++ dialin/common/msg_ids.py (.../msg_ids.py) (revision f053467ac7cfb9fe349e394342d3a9253a377403) @@ -1,4 +1,3 @@ - ########################################################################### # # Copyright (c) 2019-2021 Diality Inc. - All Rights Reserved. @@ -18,7 +17,7 @@ from ..utils.base import DialinEnum -# Branch: Sprint37 +# Branch: staging @unique class MsgIds(DialinEnum): MSG_ID_UNUSED = 0X0 @@ -121,7 +120,11 @@ MSG_ID_HD_FLUID_LEAK_STATE = 0X6A MSG_ID_DG_FLUID_LEAK_STATE = 0X6B MSG_ID_HD_BLOOD_LEAK_STATE = 0X6C + MSG_ID_UI_HD_SET_RTC_REQUEST = 0X6D + MSG_ID_HD_UI_SET_RTC_RESPONSE = 0X6E + MSG_ID_UI_DG_SET_RTC_REQUEST = 0X6F MSG_ID_UI_CHECK_IN = 0X7 + MSG_ID_DG_UI_SET_RTC_RESPONSE = 0X70 MSG_ID_UI_START_TREATMENT_REQUEST = 0X71 MSG_ID_HD_START_TREATMENT_RESPONSE = 0X72 MSG_ID_UI_DISPOSABLE_REMOVAL_CONFIRM = 0X73 @@ -130,7 +133,7 @@ MSG_ID_HD_TREATMENT_LOG_DATA_RESPONSE = 0X76 MSG_ID_HD_POST_TREATMENT_STATE = 0X77 MSG_ID_DIALYSATE_FLOW_DATA = 0X8 - MSG_ID_FIRST_TESTER_MESSAGE = 0X8000 + MSG_ID_TESTER_LOGIN_REQUEST = 0X8000 MSG_ID_DIAL_OUT_FLOW_SET_PT_OVERRIDE = 0X8001 MSG_ID_OFF_BUTTON_STATE_OVERRIDE = 0X8002 MSG_ID_STOP_BUTTON_STATE_OVERRIDE = 0X8003 @@ -211,7 +214,7 @@ MSG_ID_PRESSURE_OCCLUSION_DATA = 0X9 MSG_ID_CAN_ERROR_COUNT = 0X999 MSG_ID_RTC_EPOCH = 0XA - MSG_ID_FIRST_DG_TESTER_MESSAGE = 0XA000 + MSG_ID_DG_TESTER_LOGIN_REQUEST = 0XA000 MSG_ID_DG_ALARM_STATE_OVERRIDE = 0XA001 MSG_ID_DG_WATCHDOG_TASK_CHECKIN_OVERRIDE = 0XA002 MSG_ID_DG_SET_RTC_DATE_TIME = 0XA004 Index: dialin/common/ui_defs.py =================================================================== diff -u --- dialin/common/ui_defs.py (revision 0) +++ dialin/common/ui_defs.py (revision f053467ac7cfb9fe349e394342d3a9253a377403) @@ -0,0 +1,176 @@ +################################################################ +# +# Copyright (c) 2019-2021 Diality Inc. - All Rights Reserved. +# +# 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 ui_defs.py +# +# @author (last) Peter Lucia +# @date (last) 06-Apr-2021 +# @author (original) Peter Lucia +# @date (original) 06-Apr-2021 +# +############################################################################ + +from . import RequestRejectReasons + + +class EResponse: + Rejected = 0 + Accepted = 1 + + +class GuiActionType: + Unknown = 0 + PowerOff = 1 + KeepAlive = 7 + BloodFlow = 5 + DialysateInletFlow = 8 + DialysateOutletFlow = 11 + TreatmentTime = 13 + PowerOffBroadcast = 14 + + AlarmStatus = 2 + AlarmTriggered = 3 + AlarmCleared = 4 + + PressureOcclusion = 9 + + DGDrainPumpData = 36 + DGHeatersData = 44 + LoadCellReadings = 12 + DGPressuresData = 32 + TemperatureSensors = 45 + + CanBUSFaultCount = 2457 + HDDebugText = 0xFFF1 + DGDebugText = 0xFFF2 + + AdjustBloodDialysateReq = 23 + AdjustBloodDialysateRsp = 24 + + AdjustDurationReq = 22 + AdjustDurationRsp = 27 + + AdjustUltrafiltrationStateReq = 16 + AdjustUltrafiltrationStateRsp = 65 + AdjustUltrafiltrationEditReq = 17 + AdjustUltrafiltrationEditRsp = 19 + AdjustUltrafiltrationConfirmReq = 21 + AdjustUltrafiltrationConfirmRsp = 46 + + AdjustPressuresLimitsReq = 70 + AdjustPressuresLimitsRsp = 71 + + TreatmentRanges = 26 + + String = 65279 + Acknow = 65535 + AcknowGeneric = 0 # Generic Acknowledgment is not a unique message ID and inherits its Id from the actual message. Zero is a placeholder + + +class TXStates: + # Sub Mode + TREATMENT_START_STATE = 0 # Start treatment - initialize treatment and go to blood prime state + TREATMENT_BLOOD_PRIME_STATE = 1 # Prime blood-side of dialyzer with gradual ramp for 1 min. while dialyzer is bypassed. No dialysis or UF taking place. No treatment time. + TREATMENT_DIALYSIS_STATE = 2 # Perform dialysis. Deliver Heparin as prescribed. Deliver UF as prescribed. Handle saline boluses as requested + TREATMENT_STOP_STATE = 3 # Treatment stopped. All pumps off. Dializer bypassed + TREATMENT_RINSEBACK_STATE = 4 # Perform rinseback with saline. Dialyzer bypassed. Dialysate recirculating + TREATMENT_RECIRC_STATE = 5 # Recirculate saline and dialysate while patient disconnected. Blood lines open and shunted. Dialyzer is bypassed + TREATMENT_END_STATE = 6 # Dialysis has ended. Blood pump slowed. Dialyzer is bypassed. Dialysate is recirculated. User can rinseback + + # Saline states + SALINE_BOLUS_STATE_IDLE = 0 # No saline bolus delivery is in progress + SALINE_BOLUS_STATE_WAIT_FOR_PUMPS_STOP = 1 # Wait for pumps to stop before starting bolus + SALINE_BOLUS_STATE_IN_PROGRESS = 2 # A saline bolus delivery is in progress + SALINE_BOLUS_STATE_MAX_DELIVERED = 3 # Maximum saline bolus volume reached - no more saline bolus deliveries allowed + + # UF states + UF_START_STATE = 0 # Start state of the ultrafiltration state machine + UF_PAUSED_STATE = 1 # Paused state of the ultrafiltration state machine + UF_RUNNING_STATE = 2 # Running state of the ultrafiltration state machine + UF_OFF_STATE = 3 # Completed/off state of the ultrafiltration state machine + UF_COMPLETED_STATE = 4 # Completed state of ultrafiltration state machine + + # Sub Mode + TREATMENT_START_STATE = 0 + TREATMENT_BLOOD_PRIME_STATE = 1 + TREATMENT_DIALYSIS_STATE = 2 + TREATMENT_STOP_STATE = 3 + TREATMENT_RINSEBACK_STATE = 4 + TREATMENT_RECIRC_STATE = 5 + TREATMENT_END_STATE = 6 + + # Heparin states + HEPARIN_STATE_OFF = 0 # No heparin delivery is in progress + HEPARIN_STATE_PAUSED = 1 # Heparin delivery paused + HEPARIN_STATE_INITIAL_BOLUS = 2 # Initial heparin bolus delivery in progress + HEPARIN_STATE_DISPENSING = 3 # Gradual heparin dispensing in progress + HEPARIN_STATE_COMPLETED = 4 # Heparin delivery stopped due to the set stop time before treatment end + HEPARIN_STATE_EMPTY = 5 # Heparin Syringe empty + + # Rinseback states + RINSEBACK_STOP_INIT_STATE = 0 # Start state (stopped) of the rinseback sub-mode state machine + RINSEBACK_RUN_STATE = 1 # Rinseback running state of the rinseback sub-mode state machine + RINSEBACK_PAUSED_STATE = 2 # Rinseback paused state of the rinseback sub-mode state machine + RINSEBACK_STOP_STATE = 3 # Rinseback stopped (done) state of the rinseback sub-mode state machine + RINSEBACK_RUN_ADDITIONAL_STATE = 4 # Additional rinseback volume (10 mL) state of the rinseback sub-mode state machine + + # Recirculate + TREATMENT_RECIRC_RECIRC_STATE = 0 # Re-circulate state of the treatment re-circulate sub-mode state machine + TREATMENT_RECIRC_STOPPED_STATE = 1 # Stopped state of the treatment re-circulate sub-mode state machine + + # Blood Prime + BLOOD_PRIME_RAMP_STATE = 0 # Ramp state of the blood prime sub-mode state machine + + # Treatment End + TREATMENT_END_WAIT_FOR_RINSEBACK_STATE = 0 # Wait for rinseback state of the treatment end sub-mode state machine + TREATMENT_END_PAUSED_STATE = 1 # Paused state of the treatment end sub-mode state machine + + # Treatment Stop + TREATMENT_STOP_RECIRC_STATE = 0 # Dialysate re-circulation state of the treatment stop sub-mode state machine + TREATMENT_STOP_NO_RECIRC_STATE = 1 # No dialysate re-circulation state of the treatment stop sub-mode state machine + + +class TreatmentParameterRejections: + def __init__(self): + self.param_request_valid = RequestRejectReasons.REQUEST_REJECT_REASON_NONE + self.param_blood_flow_rate = RequestRejectReasons.REQUEST_REJECT_REASON_NONE + self.param_dialysate_flow_rate = RequestRejectReasons.REQUEST_REJECT_REASON_NONE + self.param_duration = RequestRejectReasons.REQUEST_REJECT_REASON_NONE + self.param_heparin_stop_time = RequestRejectReasons.REQUEST_REJECT_REASON_NONE + self.param_saline_bolus = RequestRejectReasons.REQUEST_REJECT_REASON_NONE + self.param_acid_concentrate = RequestRejectReasons.REQUEST_REJECT_REASON_NONE + self.param_bicarbonate_concentrate = RequestRejectReasons.REQUEST_REJECT_REASON_NONE + self.param_dialyzer_type = RequestRejectReasons.REQUEST_REJECT_REASON_NONE + self.param_blood_pressure_measure_interval = RequestRejectReasons.REQUEST_REJECT_REASON_NONE + self.param_rinseback_flow_rate = RequestRejectReasons.REQUEST_REJECT_REASON_NONE + self.param_arterial_pressure_limit_low = RequestRejectReasons.REQUEST_REJECT_REASON_NONE + self.param_arterial_pressure_limit_high = RequestRejectReasons.REQUEST_REJECT_REASON_NONE + self.param_venous_pressure_limit_low = RequestRejectReasons.REQUEST_REJECT_REASON_NONE + self.param_venous_pressure_limit_high = RequestRejectReasons.REQUEST_REJECT_REASON_NONE + self.param_heparin_dispensing_rate = RequestRejectReasons.REQUEST_REJECT_REASON_NONE + self.param_heparin_bolus_volume = RequestRejectReasons.REQUEST_REJECT_REASON_NONE + self.param_dialysate_temp = RequestRejectReasons.REQUEST_REJECT_REASON_NONE + + def set_all_valid(self): + """ + Sets all parameters as valid + + @return: None + """ + for attr in dir(self): + if not callable(getattr(self, attr)) and attr.startswith("param_"): + self.__dict__[attr] = RequestRejectReasons.REQUEST_REJECT_REASON_NONE + + def set_all_invalid(self): + """ + Sets all treatment parameters to be invalid + + @return: None + """ + for attr in dir(self): + if not callable(getattr(self, attr)) and attr.startswith("param_"): + self.__dict__[attr] = RequestRejectReasons.REQUEST_REJECT_REASON_NOT_ALLOWED_IN_CURRENT_MODE Index: dialin/dg/fans.py =================================================================== diff -u -re851e75aa1d8f801324442b0cb034ba3e82325c9 -rf053467ac7cfb9fe349e394342d3a9253a377403 --- dialin/dg/fans.py (.../fans.py) (revision e851e75aa1d8f801324442b0cb034ba3e82325c9) +++ dialin/dg/fans.py (.../fans.py) (revision f053467ac7cfb9fe349e394342d3a9253a377403) @@ -154,7 +154,7 @@ payload = rst + mis message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_dg_ch_id, - message_id=MsgIds.MSG_ID_DG_FANS_DATA_PUBLISH_OVERRIDE.value, + message_id=MsgIds.MSG_ID_DG_FANS_DATA_PUBLISH_INTERVAL_OVERRIDE.value, payload=payload) self.logger.debug("Override fans data publish interval") Index: dialin/dg/hd_proxy.py =================================================================== diff -u -r300390c34a81a42b5eb606e4f4499a1439bfc432 -rf053467ac7cfb9fe349e394342d3a9253a377403 --- dialin/dg/hd_proxy.py (.../hd_proxy.py) (revision 300390c34a81a42b5eb606e4f4499a1439bfc432) +++ dialin/dg/hd_proxy.py (.../hd_proxy.py) (revision f053467ac7cfb9fe349e394342d3a9253a377403) @@ -32,7 +32,6 @@ MSG_ID_HD_FILL_CMD = 0x0022 MSG_ID_HD_DRAIN_CMD = 0x0023 MSG_ID_HD_START_STOP_DG_CMD = 0x0026 - MSG_ID_HD_START_STOP_DG_TRIMMER_HEATER = 0x002B # Reservoir IDs RESERVOIR1 = 0 @@ -256,7 +255,7 @@ # 0 is to stop payload = integer_to_bytearray(0) message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_dg_ch_id, - message_id=MsgIds.MSG_ID_HD_START_STOP_DG_TRIMMER_HEATER.value, + message_id=MsgIds.MSG_ID_DG_START_STOP_TRIMMER_HEATER_CMD.value, payload=payload) self.logger.debug("Stopping heat disinfection process") self.can_interface.send(message, 0) Index: dialin/dg/ro_pump.py =================================================================== diff -u -r65cf1d8021361e0f51aed3a60fceefb54cc784e1 -rf053467ac7cfb9fe349e394342d3a9253a377403 --- dialin/dg/ro_pump.py (.../ro_pump.py) (revision 65cf1d8021361e0f51aed3a60fceefb54cc784e1) +++ dialin/dg/ro_pump.py (.../ro_pump.py) (revision f053467ac7cfb9fe349e394342d3a9253a377403) @@ -130,7 +130,7 @@ payload = rst + prs message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_dg_ch_id, - message_id=MsgIds.MSG_ID_RO_PUMP_SET_PT_OVERRIDE.value, + message_id=MsgIds.MSG_ID_RO_PUMP_SEND_INTERVAL_OVERRIDE.value, payload=payload) self.logger.debug("Override RO pump pressure set point") @@ -196,7 +196,7 @@ payload = rst + flo message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_dg_ch_id, - message_id=MsgIds.MSG_ID_RO_PUMP_SET_PT_OVERRIDE.value, + message_id=MsgIds.MSG_ID_DG_RO_PUMP_TARGET_FLOW_OVERRIDE.value, payload=payload) self.logger.debug("override RO pump pressure set point") Index: dialin/dg/uv_reactors.py =================================================================== diff -u -re851e75aa1d8f801324442b0cb034ba3e82325c9 -rf053467ac7cfb9fe349e394342d3a9253a377403 --- dialin/dg/uv_reactors.py (.../uv_reactors.py) (revision e851e75aa1d8f801324442b0cb034ba3e82325c9) +++ dialin/dg/uv_reactors.py (.../uv_reactors.py) (revision f053467ac7cfb9fe349e394342d3a9253a377403) @@ -196,7 +196,7 @@ operation = 'Turning off ' message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_dg_ch_id, - message_id=MsgIds.MSG_ID_DG_START_STOP_INLET_UV_REACTOR.value, + message_id=MsgIds.MSG_ID_DG_START_STOP_UV_REACTORS.value, payload=payload) # Send message received_message = self.can_interface.send(message) @@ -225,7 +225,7 @@ operation = 'Turning off ' message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_hd_ch_id, - message_id=MsgIds.MSG_ID_DG_START_STOP_OUTLET_UV_REACTOR.value, + message_id=MsgIds.MSG_ID_DG_START_STOP_UV_REACTORS.value, payload=payload) # Send message received_message = self.can_interface.send(message) Index: dialin/hd/air_trap.py =================================================================== diff -u -r91dc90bd009bdbf5621dcaa1bc12ab3d691673f7 -rf053467ac7cfb9fe349e394342d3a9253a377403 --- dialin/hd/air_trap.py (.../air_trap.py) (revision 91dc90bd009bdbf5621dcaa1bc12ab3d691673f7) +++ dialin/hd/air_trap.py (.../air_trap.py) (revision f053467ac7cfb9fe349e394342d3a9253a377403) @@ -127,7 +127,7 @@ payload = rst + det + idx message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_hd_ch_id, - message_id=MsgIds.MSG_ID_DG_AIR_TRAP_LEVEL_SENSOR_OVERRIDE.value, + message_id=MsgIds.MSG_ID_HD_AIR_TRAP_LEVEL_SENSOR_OVERRIDE.value, payload=payload) self.logger.debug("override air trap level sensor detection value for sensor " + str(sensor)) @@ -160,7 +160,7 @@ payload = rst + mis message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_hd_ch_id, - message_id=MsgIds.MSG_ID_DG_AIR_TRAP_DATA_BROADCAST_INTERVAL_OVERRIDE.value, + message_id=MsgIds.MSG_ID_HD_AIR_TRAP_SEND_INTERVAL_OVERRIDE.value, payload=payload) self.logger.debug("override HD air trap data broadcast interval") Index: dialin/hd/hemodialysis_device.py =================================================================== diff -u -r3a5030c08d57bddc2c22dca05d1070375e3cb5f7 -rf053467ac7cfb9fe349e394342d3a9253a377403 --- dialin/hd/hemodialysis_device.py (.../hemodialysis_device.py) (revision 3a5030c08d57bddc2c22dca05d1070375e3cb5f7) +++ dialin/hd/hemodialysis_device.py (.../hemodialysis_device.py) (revision f053467ac7cfb9fe349e394342d3a9253a377403) @@ -91,9 +91,6 @@ msg_id = MsgIds.MSG_ID_HD_OP_MODE.value self.can_interface.register_receiving_publication_function(channel_id, msg_id, self._handler_hd_op_mode_sync) - #msg_id = MsgIds.MSG_ID_HD_CALIBRATION_DATA.value - #self.can_interface.register_receiving_publication_function(channel_id, msg_id, - # self._handler_hd_cal_data_sync) # create properties self.hd_operation_mode = self.HD_OP_MODE_INIT_POST @@ -184,8 +181,9 @@ """ message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_hd_ch_id, - message_id=MsgIds.MSG_ID_HD_REQUEST_CALIBRATION_DATA.value) + message_id=MsgIds.MSG_ID_HD_GET_CALIBRATION_RECORD.value) + self.logger.debug("requesting HD calibration data.") # Send message @@ -201,38 +199,6 @@ self.logger.debug("Timeout!!!!") return False - def cmd_hd_erase_calibration_data(self): - """ - Constructs and sends an erase HD calibration data request command via CAN bus. - Constraints: - Must be logged into HD. - - \returns response message if received, False if no response received - - @return: 1 if successful, zero otherwise - - """ - key = integer_to_bytearray(-758926171) # 0xD2C3B4A5 - - message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_hd_ch_id, - message_id=MsgIds.MSG_ID_HD_ERASE_CALIBRATION_DATA.value, - payload=key) - - self.logger.debug("requesting HD calibration data be erased.") - - # Send message - received_message = self.can_interface.send(message) - - if received_message is not None: - if received_message['message'][DenaliMessage.PAYLOAD_START_INDEX] == 1: - self.logger.debug("HD calibration data erasure request accepted.") - else: - self.logger.debug("HD calibration data erasure request failed.") - return received_message['message'][DenaliMessage.PAYLOAD_START_INDEX] - else: - self.logger.debug("Timeout!!!!") - return False - def cmd_hd_set_operation_mode(self, newMode=0): """ Constructs and sends a set operation mode request command via CAN bus. Index: dialin/hd/ui_proxy.py =================================================================== diff -u -r0b4c9b6e916085cf79c916c0c7c04b953f40e709 -rf053467ac7cfb9fe349e394342d3a9253a377403 --- dialin/hd/ui_proxy.py (.../ui_proxy.py) (revision 0b4c9b6e916085cf79c916c0c7c04b953f40e709) +++ dialin/hd/ui_proxy.py (.../ui_proxy.py) (revision f053467ac7cfb9fe349e394342d3a9253a377403) @@ -182,7 +182,7 @@ self._handler_treatment_param_settings_response) self.can_interface.register_receiving_publication_function(DenaliChannels.hd_to_ui_ch_id, MsgIds.MSG_ID_USER_SALINE_BOLUS_RESPONSE.value, self._handler_saline_bolus_response) - self.can_interface.register_receiving_publication_function(DenaliChannels.ui_to_hd_ch_id, MsgIds.MSG_ID_UI_PRE_TREATMENT_UF_REQUEST.value, + self.can_interface.register_receiving_publication_function(DenaliChannels.ui_to_hd_ch_id, MsgIds.MSG_ID_UI_SET_UF_VOLUME_PARAMETER.value, self._handler_uf_volume_setting_response) self.can_interface.register_receiving_publication_function(DenaliChannels.hd_to_ui_ch_id, MsgIds.MSG_ID_HD_RINSEBACK_CMD_RESPONSE.value, self._handler_rinseback_cmd_response) @@ -1383,7 +1383,7 @@ cmd = integer_to_bytearray(cmnd) payload = cmd message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_hd_ch_id, - message_id=MsgIds.MSG_ID_UI_START_TREATMENT.value, + message_id=MsgIds.MSG_ID_UI_START_TREATMENT_REQUEST.value, payload=payload) self.logger.debug("Sending start treatment command request.") @@ -1766,7 +1766,7 @@ """ message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_hd_ch_id, - message_id=MsgIds.MSG_ID_UI_CONTINUE_TO_TREATMENT_REQUEST.value) + message_id=MsgIds.MSG_ID_UI_START_TREATMENT_REQUEST.value) self.logger.debug("Sending user continue to treatment request to HD.") self.can_interface.send(message, 0) Index: dialin/ui/__init__.py =================================================================== diff -u -r02eff24a2b116fe3d71d8275eeb78f419302efd6 -rf053467ac7cfb9fe349e394342d3a9253a377403 --- dialin/ui/__init__.py (.../__init__.py) (revision 02eff24a2b116fe3d71d8275eeb78f419302efd6) +++ dialin/ui/__init__.py (.../__init__.py) (revision f053467ac7cfb9fe349e394342d3a9253a377403) @@ -1,163 +1,3 @@ from .hd_simulator import HDSimulator from .dg_simulator import DGSimulator from .hd_simulator_alarms import HDAlarmsSimulator -from ..common.msg_defs import RequestRejectReasons - - -class EResponse: - Rejected = 0 - Accepted = 1 - - -class GuiActionType: - Unknown = 0 - PowerOff = 1 - KeepAlive = 7 - BloodFlow = 5 - DialysateInletFlow = 8 - DialysateOutletFlow = 11 - TreatmentTime = 13 - PowerOffBroadcast = 14 - - AlarmStatus = 2 - AlarmTriggered = 3 - AlarmCleared = 4 - - PressureOcclusion = 9 - - DGDrainPumpData = 36 - DGHeatersData = 44 - LoadCellReadings = 12 - DGPressuresData = 32 - TemperatureSensors = 45 - - CanBUSFaultCount = 2457 - HDDebugText = 0xFFF1 - DGDebugText = 0xFFF2 - - AdjustBloodDialysateReq = 23 - AdjustBloodDialysateRsp = 24 - - AdjustDurationReq = 22 - AdjustDurationRsp = 27 - - AdjustUltrafiltrationStateReq = 16 - AdjustUltrafiltrationStateRsp = 65 - AdjustUltrafiltrationEditReq = 17 - AdjustUltrafiltrationEditRsp = 19 - AdjustUltrafiltrationConfirmReq = 21 - AdjustUltrafiltrationConfirmRsp = 46 - - AdjustPressuresLimitsReq = 70 - AdjustPressuresLimitsRsp = 71 - - TreatmentRanges = 26 - - String = 65279 - Acknow = 65535 - AcknowGeneric = 0 # Generic Acknowledgment is not a unique message ID and inherits its Id from the actual message. Zero is a placeholder - - -class TXStates: - # Sub Mode - TREATMENT_START_STATE = 0 # Start treatment - initialize treatment and go to blood prime state - TREATMENT_BLOOD_PRIME_STATE = 1 # Prime blood-side of dialyzer with gradual ramp for 1 min. while dialyzer is bypassed. No dialysis or UF taking place. No treatment time. - TREATMENT_DIALYSIS_STATE = 2 # Perform dialysis. Deliver Heparin as prescribed. Deliver UF as prescribed. Handle saline boluses as requested - TREATMENT_STOP_STATE = 3 # Treatment stopped. All pumps off. Dializer bypassed - TREATMENT_RINSEBACK_STATE = 4 # Perform rinseback with saline. Dialyzer bypassed. Dialysate recirculating - TREATMENT_RECIRC_STATE = 5 # Recirculate saline and dialysate while patient disconnected. Blood lines open and shunted. Dialyzer is bypassed - TREATMENT_END_STATE = 6 # Dialysis has ended. Blood pump slowed. Dialyzer is bypassed. Dialysate is recirculated. User can rinseback - - # Saline states - SALINE_BOLUS_STATE_IDLE = 0 # No saline bolus delivery is in progress - SALINE_BOLUS_STATE_WAIT_FOR_PUMPS_STOP = 1 # Wait for pumps to stop before starting bolus - SALINE_BOLUS_STATE_IN_PROGRESS = 2 # A saline bolus delivery is in progress - SALINE_BOLUS_STATE_MAX_DELIVERED = 3 # Maximum saline bolus volume reached - no more saline bolus deliveries allowed - - # UF states - UF_START_STATE = 0 # Start state of the ultrafiltration state machine - UF_PAUSED_STATE = 1 # Paused state of the ultrafiltration state machine - UF_RUNNING_STATE = 2 # Running state of the ultrafiltration state machine - UF_OFF_STATE = 3 # Completed/off state of the ultrafiltration state machine - UF_COMPLETED_STATE = 4 # Completed state of ultrafiltration state machine - - # Sub Mode - TREATMENT_START_STATE = 0 - TREATMENT_BLOOD_PRIME_STATE = 1 - TREATMENT_DIALYSIS_STATE = 2 - TREATMENT_STOP_STATE = 3 - TREATMENT_RINSEBACK_STATE = 4 - TREATMENT_RECIRC_STATE = 5 - TREATMENT_END_STATE = 6 - - # Heparin states - HEPARIN_STATE_OFF = 0 # No heparin delivery is in progress - HEPARIN_STATE_PAUSED = 1 # Heparin delivery paused - HEPARIN_STATE_INITIAL_BOLUS = 2 # Initial heparin bolus delivery in progress - HEPARIN_STATE_DISPENSING = 3 # Gradual heparin dispensing in progress - HEPARIN_STATE_COMPLETED = 4 # Heparin delivery stopped due to the set stop time before treatment end - HEPARIN_STATE_EMPTY = 5 # Heparin Syringe empty - - # Rinseback states - RINSEBACK_STOP_INIT_STATE = 0 # Start state (stopped) of the rinseback sub-mode state machine - RINSEBACK_RUN_STATE = 1 # Rinseback running state of the rinseback sub-mode state machine - RINSEBACK_PAUSED_STATE = 2 # Rinseback paused state of the rinseback sub-mode state machine - RINSEBACK_STOP_STATE = 3 # Rinseback stopped (done) state of the rinseback sub-mode state machine - RINSEBACK_RUN_ADDITIONAL_STATE = 4 # Additional rinseback volume (10 mL) state of the rinseback sub-mode state machine - - # Recirculate - TREATMENT_RECIRC_RECIRC_STATE = 0 # Re-circulate state of the treatment re-circulate sub-mode state machine - TREATMENT_RECIRC_STOPPED_STATE = 1 # Stopped state of the treatment re-circulate sub-mode state machine - - # Blood Prime - BLOOD_PRIME_RAMP_STATE = 0 # Ramp state of the blood prime sub-mode state machine - - # Treatment End - TREATMENT_END_WAIT_FOR_RINSEBACK_STATE = 0 # Wait for rinseback state of the treatment end sub-mode state machine - TREATMENT_END_PAUSED_STATE = 1 # Paused state of the treatment end sub-mode state machine - - # Treatment Stop - TREATMENT_STOP_RECIRC_STATE = 0 # Dialysate re-circulation state of the treatment stop sub-mode state machine - TREATMENT_STOP_NO_RECIRC_STATE = 1 # No dialysate re-circulation state of the treatment stop sub-mode state machine - - -class TreatmentParameterRejections: - def __init__(self): - self.param_request_valid = RequestRejectReasons.REQUEST_REJECT_REASON_NONE - self.param_blood_flow_rate = RequestRejectReasons.REQUEST_REJECT_REASON_NONE - self.param_dialysate_flow_rate = RequestRejectReasons.REQUEST_REJECT_REASON_NONE - self.param_duration = RequestRejectReasons.REQUEST_REJECT_REASON_NONE - self.param_heparin_stop_time = RequestRejectReasons.REQUEST_REJECT_REASON_NONE - self.param_saline_bolus = RequestRejectReasons.REQUEST_REJECT_REASON_NONE - self.param_acid_concentrate = RequestRejectReasons.REQUEST_REJECT_REASON_NONE - self.param_bicarbonate_concentrate = RequestRejectReasons.REQUEST_REJECT_REASON_NONE - self.param_dialyzer_type = RequestRejectReasons.REQUEST_REJECT_REASON_NONE - self.param_blood_pressure_measure_interval = RequestRejectReasons.REQUEST_REJECT_REASON_NONE - self.param_rinseback_flow_rate = RequestRejectReasons.REQUEST_REJECT_REASON_NONE - self.param_arterial_pressure_limit_low = RequestRejectReasons.REQUEST_REJECT_REASON_NONE - self.param_arterial_pressure_limit_high = RequestRejectReasons.REQUEST_REJECT_REASON_NONE - self.param_venous_pressure_limit_low = RequestRejectReasons.REQUEST_REJECT_REASON_NONE - self.param_venous_pressure_limit_high = RequestRejectReasons.REQUEST_REJECT_REASON_NONE - self.param_heparin_dispensing_rate = RequestRejectReasons.REQUEST_REJECT_REASON_NONE - self.param_heparin_bolus_volume = RequestRejectReasons.REQUEST_REJECT_REASON_NONE - self.param_dialysate_temp = RequestRejectReasons.REQUEST_REJECT_REASON_NONE - - def set_all_valid(self): - """ - Sets all parameters as valid - - @return: None - """ - for attr in dir(self): - if not callable(getattr(self, attr)) and attr.startswith("param_"): - self.__dict__[attr] = RequestRejectReasons.REQUEST_REJECT_REASON_NONE - - def set_all_invalid(self): - """ - Sets all treatment parameters to be invalid - - @return: None - """ - for attr in dir(self): - if not callable(getattr(self, attr)) and attr.startswith("param_"): - self.__dict__[attr] = RequestRejectReasons.REQUEST_REJECT_REASON_NOT_ALLOWED_IN_CURRENT_MODE Index: dialin/ui/dg_simulator.py =================================================================== diff -u -r02eff24a2b116fe3d71d8275eeb78f419302efd6 -rf053467ac7cfb9fe349e394342d3a9253a377403 --- dialin/ui/dg_simulator.py (.../dg_simulator.py) (revision 02eff24a2b116fe3d71d8275eeb78f419302efd6) +++ dialin/ui/dg_simulator.py (.../dg_simulator.py) (revision f053467ac7cfb9fe349e394342d3a9253a377403) @@ -22,9 +22,9 @@ DenaliChannels) from ..utils.base import _AbstractSubSystem, _LogManager from ..utils.conversions import integer_to_bytearray, float_to_bytearray, byte_to_bytearray, short_to_bytearray -from . import messageBuilder, GuiActionType +from . import messageBuilder +from ..common import GuiActionType - class DGSimulator(_AbstractSubSystem): instance_count = 0 Index: dialin/ui/hd_simulator.py =================================================================== diff -u -r02eff24a2b116fe3d71d8275eeb78f419302efd6 -rf053467ac7cfb9fe349e394342d3a9253a377403 --- dialin/ui/hd_simulator.py (.../hd_simulator.py) (revision 02eff24a2b116fe3d71d8275eeb78f419302efd6) +++ dialin/ui/hd_simulator.py (.../hd_simulator.py) (revision f053467ac7cfb9fe349e394342d3a9253a377403) @@ -21,6 +21,7 @@ import subprocess from . import messageBuilder +from ..common import TreatmentParameterRejections, GuiActionType, EResponse, TXStates from .hd_simulator_alarms import HDAlarmsSimulator from ..common.msg_defs import RequestRejectReasons, MsgIds, MsgFieldPositions from ..common.hd_defs import HDDefs @@ -30,7 +31,6 @@ from ..utils.base import _AbstractSubSystem, _LogManager from ..utils.conversions import integer_to_bytearray, float_to_bytearray, byte_to_bytearray, short_to_bytearray from ..utils import YES -from . import GuiActionType, EResponse, TXStates class HDSimulator(_AbstractSubSystem): @@ -60,10 +60,10 @@ if self.can_interface is not None: channel_id = DenaliChannels.ui_to_hd_ch_id self.can_interface.register_receiving_publication_function(channel_id, - MsgIds.MSG_ID_UI_START_TREATMENT.value, + MsgIds.MSG_ID_UI_START_TREATMENT_REQUEST.value, self._handler_ui_start_treatment) self.can_interface.register_receiving_publication_function(channel_id, - MsgIds.MSG_ID_UI_PRE_TREATMENT_UF_REQUEST.value, + MsgIds.MSG_ID_UI_SET_UF_VOLUME_PARAMETER.value, self._handler_ui_pre_treatment_uf_request) self.can_interface.register_receiving_publication_function(channel_id, MsgIds.MSG_ID_UI_NEW_TREATMENT_PARAMS.value, @@ -227,24 +227,6 @@ self.can_interface.send(message, 0) - def cmd_send_priming_time_remaining(self, state, seconds_remaining, seconds_total): - """ - Broadcasts the number of seconds remaining in priming to the UI - - @return: None - """ - - payload = bytearray() - payload += integer_to_bytearray(state) - payload += integer_to_bytearray(seconds_remaining) - payload += integer_to_bytearray(seconds_total) - - message = DenaliMessage.build_message(channel_id=DenaliChannels.hd_sync_broadcast_ch_id, - message_id=MsgIds.MSG_ID_DG_PRIMING_STATUS_DATA.value, - payload=payload) - - self.can_interface.send(message, 0) - def _handler_ui_confirm_treatment(self, message): """ Handler function to detect when a treatment is confirmed @@ -365,7 +347,7 @@ payload += float_to_bytearray(volume) message = DenaliMessage.build_message(channel_id=DenaliChannels.hd_to_ui_ch_id, - message_id=MsgIds.MSG_ID_HD_PRE_TREATMENT_UF_RESPONSE.value, + message_id=MsgIds.MSG_ID_HD_SET_UF_VOLUME_PARAMETER_RESPONSE.value, payload=payload) self.can_interface.send(message, 0) @@ -379,7 +361,7 @@ payload = integer_to_bytearray(YES) message = DenaliMessage.build_message(channel_id=DenaliChannels.hd_to_ui_ch_id, - message_id=MsgIds.MSG_ID_HD_TREATMENT_END_RESPONSE.value, + message_id=MsgIds.MSG_ID_HD_TX_END_CMD_RESPONSE.value, payload=payload) self.can_interface.send(message, 0) @@ -775,7 +757,7 @@ payload += float_to_bytearray(vVolume) message = DenaliMessage.build_message(channel_id=DenaliChannels.hd_to_ui_ch_id, - message_id=MsgIds.MSG_ID_HD_PRE_TREATMENT_UF_RESPONSE.value, + message_id=MsgIds.MSG_ID_HD_SET_UF_VOLUME_PARAMETER_RESPONSE.value, payload=payload) self.can_interface.send(message, 0) @@ -1240,7 +1222,7 @@ payload += integer_to_bytearray(vTimeoutCountDown) message = DenaliMessage.build_message(channel_id=DenaliChannels.hd_to_ui_ch_id, - message_id=MsgIds.MSG_ID_HD_RECIRCULATE_PROGRESS.value, + message_id=MsgIds.MSG_ID_HD_RECIRC_PROGRESS.value, payload=payload) self.can_interface.send(message, 0) Index: tests/unit_tests/test_constructors.py =================================================================== diff -u --- tests/unit_tests/test_constructors.py (revision 0) +++ tests/unit_tests/test_constructors.py (revision f053467ac7cfb9fe349e394342d3a9253a377403) @@ -0,0 +1,37 @@ +########################################################################### +# +# Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. +# +# 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 test_constructors.py +# +# @author (last) Peter Lucia +# @date (last) 06-Apr-2021 +# @author (original) Peter Lucia +# @date (original) 06-Apr-2021 +# +############################################################################ +import unittest +import sys +sys.path.append("../../") +from dialin import HDSimulator, DGSimulator, HD, DG + + +class Test(unittest.TestCase): + + def test_hd_simulator(self): + HDSimulator() + + def test_hd_simulator(self): + DGSimulator() + + def test_hd(self): + HD() + + def test_dg(self): + DG() + +if __name__ == '__main__': + sys.exit(unittest.main(verbosity=2).result.wasSuccessful()) Index: tests/unit_tests/test_imports.py =================================================================== diff -u -rf7cd7cb24f34bc40f718ecd8824c600ee1565134 -rf053467ac7cfb9fe349e394342d3a9253a377403 --- tests/unit_tests/test_imports.py (.../test_imports.py) (revision f7cd7cb24f34bc40f718ecd8824c600ee1565134) +++ tests/unit_tests/test_imports.py (.../test_imports.py) (revision f053467ac7cfb9fe349e394342d3a9253a377403) @@ -20,7 +20,6 @@ class Test(unittest.TestCase): - # @unittest.skip("Skipping test_imports") def test_hd_imports(self): from dialin.hd.alarms import HDAlarms from dialin.hd.blood_flow import HDBloodFlow @@ -35,7 +34,6 @@ from dialin.hd.ui_proxy import HDUIProxy from dialin.hd.watchdog import HDWatchdog - # @unittest.skip("Skipping test_imports") def test_dg_imports(self): from dialin.dg.dialysate_generator import DG @@ -46,21 +44,18 @@ from dialin.dg.reservoirs import DGReservoirs - # @unittest.skip("Skipping test_imports") def test_protocols_imports(self): from dialin.protocols.CAN import (DenaliCanMessenger, DenaliMessage, DenaliChannels, LongDenaliMessageBuilder) - # @unittest.skip("Skipping test_imports") def test_utils_imports(self): from dialin.utils.conversions import (integer_to_bytearray, float_to_bytearray) - # @unittest.skip("Skipping test_imports") def test_api_version(self): import dialin @@ -96,5 +91,16 @@ from dialin.ui import HDSimulator, HDAlarmsSimulator + def test_common(self): + from dialin.common import (AlarmList, + AlarmPriority, + AlarmFlags, + AlarmPriorities, + MsgIds, + MsgFieldPositions, + Ranges, + RequestRejectReasons) + + if __name__ == '__main__': sys.exit(unittest.main(verbosity=2).result.wasSuccessful()) Index: tests/unit_tests/test_msg_ids.py =================================================================== diff -u --- tests/unit_tests/test_msg_ids.py (revision 0) +++ tests/unit_tests/test_msg_ids.py (revision f053467ac7cfb9fe349e394342d3a9253a377403) @@ -0,0 +1,43 @@ +########################################################################### +# +# Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. +# +# 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 test_msg_ids.py +# +# @author (last) Peter Lucia +# @date (last) 06-Apr-2021 +# @author (original) Peter Lucia +# @date (original) 06-Apr-2021 +# +############################################################################ +import re +import unittest +import sys +import os +sys.path.append("../../") +from dialin.common import MsgIds + + +class Test(unittest.TestCase): + + def test_msg_ids(self): + os.chdir("../../") + for root, dirs, files in os.walk("dialin/"): + for file in files: + if file.endswith(".py"): + path = os.path.join(root, file) + with open(path, 'r') as f: + for line in f.readlines(): + m = re.search('MSG_ID_.*.value', line) + if m is not None: + s = m.group(0) + s = s.replace(".value", "").strip() + self.assertTrue(s in MsgIds.__members__, "{0} in {1} not found in MsgIds." + .format(s, path)) + + +if __name__ == '__main__': + sys.exit(unittest.main(verbosity=2).result.wasSuccessful()) Index: tools/build_common_defs.py =================================================================== diff -u -r02eff24a2b116fe3d71d8275eeb78f419302efd6 -rf053467ac7cfb9fe349e394342d3a9253a377403 --- tools/build_common_defs.py (.../build_common_defs.py) (revision 02eff24a2b116fe3d71d8275eeb78f419302efd6) +++ tools/build_common_defs.py (.../build_common_defs.py) (revision f053467ac7cfb9fe349e394342d3a9253a377403) @@ -19,7 +19,13 @@ from datetime import datetime -def create_enum_file(in_path: str, out_path:str, author: str, code_imports: str, code_class_def: str, as_int=True): +def create_enum_file(in_path: str, + out_path:str, + author: str, + code_imports: str, + code_class_def: str, + as_int=True, + custom_defs: dict = {}): """ Generates an enum source code file @param in_path: (str) input txt file @@ -28,6 +34,7 @@ @param code_imports: (str) raw source code as string imports needed for this header file @param code_class_def: (str) raw source code class definition for this enum @param as_int: (bool) if True, output enums as int, if False output as hex + @param custom_defs: (dict) custom enums (if mapped to None they are ignored) @return: True upon success, False upon failure """ @@ -41,6 +48,13 @@ num = num.replace(",", "").strip() var = split_str[0].strip() + if var in custom_defs: + if custom_defs[var] is None: + print("Ignoring {0}.".format(var)) + continue + num = custom_defs[var] + print("Applied custom mapping {0} = {1}.".format(var, num)) + base = 10 if "x" in num.lower(): base = 16 @@ -61,8 +75,7 @@ current_time = datetime.now() code_header = \ -""" -########################################################################### +"""########################################################################### # # Copyright (c) 2019-{0} Diality Inc. - All Rights Reserved. # @@ -118,6 +131,7 @@ code_prepend: str, code_class_def: str, as_int: bool, + custom_defs: dict = {}, ): """ Driver function to build a common defs .py source file @@ -131,23 +145,24 @@ @param code_prepend: (str) raw source code as string imports needed for this header file @param code_class_def: (str) raw source code class definition for this enum @param as_int: (bool) if True, output enums as int, if False output as hex + @param custom_defs: (dict) custom enums (if mapped to None they are ignored) @return: None """ - if subprocess.call("bash gen_alarm_ids.sh {0} {1} {2} {3} {4}" + if subprocess.call("bash gen_common_defs.sh {0} {1} {2} {3} {4}" .format(dst_alarms_txt, dst_common, common_branch, prefix_match, cpp_header), shell=True) != 0: print("Failure: Could not generate alarm ids.") return - if create_enum_file(dst_alarms_txt, dst_python, author, code_prepend, code_class_def, as_int): + if create_enum_file(dst_alarms_txt, dst_python, author, code_prepend, code_class_def, as_int, custom_defs): print("Created enum file: {0}".format(dst_python)) print("Done.") else: print("Failure: Could not create enum file.") if __name__ == '__main__': - common_branch="Sprint37" + common_branch="staging" build_common_defs(dst_alarms_txt="/tmp/AlarmIds.txt", dst_common="/tmp/common", common_branch=common_branch, @@ -164,6 +179,12 @@ "class AlarmList(AlarmEnum):\n").format(common_branch), as_int=True, ) + custom_defs = { + "MSG_ID_FIRST_TESTER_MESSAGE": None, + "MSG_ID_FIRST_DG_TESTER_MESSAGE": None, + "MSG_ID_TESTER_LOGIN_REQUEST": "0x8000", + "MSG_ID_DG_TESTER_LOGIN_REQUEST": "0xA000", + } build_common_defs(dst_alarms_txt="/tmp/MsgDefs.txt", dst_common="/tmp/common", common_branch=common_branch, @@ -179,4 +200,5 @@ "@unique\n" "class MsgIds(DialinEnum):\n").format(common_branch), as_int=False, + custom_defs=custom_defs, ) Fisheye: Tag f053467ac7cfb9fe349e394342d3a9253a377403 refers to a dead (removed) revision in file `tools/gen_alarm_ids.sh'. Fisheye: No comparison available. Pass `N' to diff? Index: tools/gen_common_defs.sh =================================================================== diff -u --- tools/gen_common_defs.sh (revision 0) +++ tools/gen_common_defs.sh (revision f053467ac7cfb9fe349e394342d3a9253a377403) @@ -0,0 +1,36 @@ +#!/bin/bash +########################################################################### +# +# Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. +# +# 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 gen_alarm_ids.sh +# +# @author (last) Quang Nguyen +# @date (last) 06-Jan-2021 +# @author (original) Quang Nguyen +# @date (original) 06-Jan-2020 +# +############################################################################ + +if [[ "$1" == "-h" || "$1" == "--help" || $# -eq 0 ]]; then + currentFile=$(basename "$0") + echo "Usage: ./$currentFile " + exit 1 +fi + +OUTPUT_FILE=$1 +COMMON_REPO=$2 +COMMON_BRANCH=$3 +PREFIX_MATCH=$4 +CPP_HEADER=$5 + +rm -rf "$COMMON_REPO" + +git clone -b "$COMMON_BRANCH" ssh://git@dvm-linux02:7999/comm/common.git "$COMMON_REPO" +if [ $? -ne 0 ]; then echo "Could not clone common"; exit 1; fi + +grep -oh "$PREFIX_MATCH.* = .*," -- "$COMMON_REPO/$CPP_HEADER" > "$OUTPUT_FILE" +if [ $? -ne 0 ]; then echo "Error during grep"; exit 1; fi