Index: suite_leahi/tst_rinseback/test.py =================================================================== diff -u -rf0e67d58dd35e4c42c3eeb60893763bca075210a -r96c6a54fac7f3f0c740264eafe2d11f6db377508 --- suite_leahi/tst_rinseback/test.py (.../test.py) (revision f0e67d58dd35e4c42c3eeb60893763bca075210a) +++ suite_leahi/tst_rinseback/test.py (.../test.py) (revision 96c6a54fac7f3f0c740264eafe2d11f6db377508) @@ -1,6 +1,11 @@ # -*- coding: utf-8 -*- import names +import can + +# plugin specific +from leahi_dialin.common.msg_defs import MsgIds, MsgFieldPositions +from leahi_dialin.protocols import CAN from leahi_dialin.ui import utils from configuration import utility,config,navigation from configuration import config @@ -9,6 +14,8 @@ from leahi_dialin.common.td_defs import TDOpModes,TDTreatmentStates td =TD_Messaging() +can_interface = td.can_interface +salineBolusStartState = "-1" def change_treatmentstates(state): test.startSection("Change the treatment parameter") @@ -23,12 +30,23 @@ 0 , 0) test.endSection() + +def handle_solution_infusion_request( message, timestamp = 0.0): + """ + Called when the user requests to firmware from UI + @return: None + """ + message = message['message'] + index = MsgFieldPositions.START_POS_FIELD_1 + state,index = conversions.bytearray_to_integer( message, index) + global salineBolusStartState + salineBolusStartState = str(state) def main(): utils.tstStart(__file__) startApplication(config.AUT_NAME) - test.startSection("Verify the heparin state is off state") + test.startSection("Verify the rinseback page") td.td_operation_mode(TDOpModes.MODE_STAN.value) change_treatmentstates(TDTreatmentStates.TREATMENT_RINSEBACK_STATE.value) td.td_pressure(H2_arterial_pressure = -151, @@ -86,7 +104,15 @@ flow_rate = waitForObject(names.o_EndTreatmentRinseback_flowRateValue_Text) flow_rate_text =flow_rate.text test.log(str(flow_rate_text)) + mouseClick(waitForObject(names.o_EndTreatmentRinseback_pauseResumeButton_TouchRect)) + # handle sent messages from UI + if can_interface is not None: + channel_id = CAN.DenaliChannels.ui_to_td_ch_id + message_id = MsgIds.MSG_ID_UI_RINSEBACK_CMD_REQUEST.value + can_interface.register_receiving_publication_function(channel_id, + message_id, + handle_solution_infusion_request) - - - + # handle_solution_infusion_request(MsgIds.MSG_ID_UI_RINSEBACK_CMD_REQUEST.value) + test.verify(waitFor("'salineBolusStartState == 0'", 5000), "Testing UI -> TD message stop bolus") + test.log("names")