Index: suite_leahi/shared/scripts/leahi_dialin =================================================================== diff -u --- suite_leahi/shared/scripts/leahi_dialin (revision 0) +++ suite_leahi/shared/scripts/leahi_dialin (revision c66984223fbddf94471842ba879cfe6cffb83640) @@ -0,0 +1 @@ +/home/denali/Public/leaDevTest/dialin/leahi_dialin \ No newline at end of file Index: suite_leahi/shared/scripts/names.py =================================================================== diff -u --- suite_leahi/shared/scripts/names.py (revision 0) +++ suite_leahi/shared/scripts/names.py (revision c66984223fbddf94471842ba879cfe6cffb83640) @@ -0,0 +1,14 @@ +# encoding: UTF-8 + +from objectmaphelper import * + +o_Gui_MainView = {"type": "Gui::MainView", "unnamed": 1, "visible": True} +standByScreen_MainHome = {"container": o_Gui_MainView, "objectName": "standByScreen", "type": "MainHome", "visible": True} +treatmentStack = {"container": o_Gui_MainView, "objectName": "TreatmentStack", "type": "TreatmentStack", "visible": True} +startTreatmentButton = {"container": standByScreen_MainHome, "id": "_startTreatmentRect", "type": "TouchRect", "unnamed": 1, "visible": True} +mainTreatmentScreen = {"container": treatmentStack, "id": "_treatmentHome", "type": "TreatmentHome", "unnamed": 1, "visible": True} +startFluidButton = {"container": mainTreatmentScreen, "id": "_startFluidButton", "type": "TouchRect", "unnamed": 1, "visible": True} +totalSalineDelivered_Text = {"container": mainTreatmentScreen, "text": "Total Saline Delivered", "type": "Text", "unnamed": 1, "visible": True} +deliveringSaline_Text = {"container": mainTreatmentScreen, "text": "Delivering Saline", "type": "Text", "unnamed": 1, "visible": True} +currentBolusVolume = {"container": mainTreatmentScreen, "text": 75, "type": "Label", "unnamed": 1, "visible": True} +treatmentSaline = {"container": mainTreatmentScreen, "objectName": "treatmentSaline", "type": "TreatmentSaline", "visible": True} Index: suite_leahi/suite.conf =================================================================== diff -u --- suite_leahi/suite.conf (revision 0) +++ suite_leahi/suite.conf (revision c66984223fbddf94471842ba879cfe6cffb83640) @@ -0,0 +1,6 @@ +AUT=leahi +LANGUAGE=Python +OBJECTMAPSTYLE=script +TEST_CASES=tst_saline_bolus +VERSION=3 +WRAPPERS=Qt Index: suite_leahi/tst_solution_infusion/test.py =================================================================== diff -u --- suite_leahi/tst_solution_infusion/test.py (revision 0) +++ suite_leahi/tst_solution_infusion/test.py (revision c66984223fbddf94471842ba879cfe6cffb83640) @@ -0,0 +1,109 @@ +# -*- coding: utf-8 -*- + +# Python +import os +import can + +# plugin specific +from leahi_dialin.common.msg_defs import MsgIds, MsgFieldPositions +from leahi_dialin.protocols import CAN +from leahi_dialin.utils import conversions + +from leahi_dialin.common.td_defs import TDOpModes, TDTreatmentStates + +# td Simulator +from leahi_dialin.ui.td_messaging import TD_Messaging + +import names + +salineBolusStartState = "-1" + +def main(): + td_interface = TD_Messaging() + can_interface = td_interface.can_interface + global salineBolusStartState + + # 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_SOLUTION_INFUSION_REQUEST.value + can_interface.register_receiving_publication_function(channel_id, + message_id, + handle_solution_infusion_request) + + + startApplication("leahi") + test.log("Starting leahi") + + td_interface.td_operation_mode( TDOpModes.MODE_STAN.value, 0 ) + + # verify standy screen + test.verify(waitForObjectExists(names.standByScreen_MainHome), "In Standby") + mouseClick(waitForObject(names.startTreatmentButton)) + + # verify main treatment screen + test.verify(waitForObjectExists(names.mainTreatmentScreen), "In Main Treatment") + + # verify saline text + salineTextObj = waitForObject(names.totalSalineDelivered_Text) + test.compare(salineTextObj.text, "Total Saline Delivered") + + # verify send bolus req message + mouseClick(waitForObject(names.startFluidButton)) + test.verify(waitFor("'salineBolusStartState == 1'", 5000)) + + td_interface.td_tx_state( + TDTreatmentStates.TREATMENT_DIALYSIS_STATE.value , + 0 , + 0 , + 0 , + 0 , + 0 , + 0 , + 0 , + 2 , # saline in progess + 0 + ) + + # verify isStarted property binding to vTDTreatmentStates.sbRunning + treatmentSaline = waitForObject(names.treatmentSaline) + test.compare(treatmentSaline.isStarted, True) + + # verify text + salineDeliveryTextObj = waitForObject(names.deliveringSaline_Text) + test.compare(salineDeliveryTextObj.text, "Delivering Saline") + + # verify saline data + currentBolus = 75 + td_interface.td_saline( + 100 , # target_volume + 150 , # cumulative_volume + currentBolus , # bolus_volume + 0 + ) + + # verify saline text + currentBolusTextObj = waitForObject(names.currentBolusVolume) + test.compare(currentBolusTextObj.text, str(currentBolus)) + + # verify send bolus req message + mouseClick(waitForObject(names.startFluidButton)) + test.verify(waitFor("'salineBolusStartState == 0'", 5000)) + + +# handler for messages from UI to FW +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) + + + + + \ No newline at end of file