Index: sources/view/VTreatmentCreate.cpp =================================================================== diff -u -r9b550e71f934b8a43bcdeafaa74fec91c50d3739 -rf9e747f0f28df1cc6a33179f0bc78bfc03d486fc --- sources/view/VTreatmentCreate.cpp (.../VTreatmentCreate.cpp) (revision 9b550e71f934b8a43bcdeafaa74fec91c50d3739) +++ sources/view/VTreatmentCreate.cpp (.../VTreatmentCreate.cpp) (revision f9e747f0f28df1cc6a33179f0bc78bfc03d486fc) @@ -20,6 +20,7 @@ #include "VTreatmentCreate.h" #include "FileHandler.h" #include "MsgDefs.h" +#include "TreatmentLog.h" using namespace Gui; using namespace View; @@ -30,6 +31,7 @@ ADJUST_VIEW_CONNECTION(AdjustParametersValidationRequestData ) ACTION_VIEW_CONNECTION(AdjustParametersValidationResponseData ) ADJUST_VIEW_CONNECTION(AdjustParametersConfirmRequestData ) + ACTION_VIEW_CONNECTION(AdjustSerialNumberHDResponseData ) } @@ -105,7 +107,6 @@ * \returns True if FW OK's treatment parameters, false otherwise */ void VTreatmentCreate::onActionReceive(const AdjustParametersValidationResponseData &data) { - if (! data.mAccepted) { bloodFlowRateRejectReason (data.mBloodFlowRate ); dialysateFlowRateRejectReason (data.mDialysateFlowRate ); @@ -130,11 +131,33 @@ emit didValidationFail(); } else { + generateTxCode(); emit didValidationPass(); } } /*! + * \brief VTreatmentCreate::onActionReceive + * \details This message is received from the HD in POST through the applicationController and GuiController. + * This class keeps the serial for any treatment Code (txCode) generation + * \param data - the message model data + */ +void VTreatmentCreate::onActionReceive(const AdjustSerialNumberHDResponseData &data) { + _HDSerialNumber = data.mSerialNumber; +} + +/*! + * \brief VTreatmentCreate::generateTxCode + * \details Generates the txCode by combination of the HD serial number and date and time in yyyyMMddHHmm + * And updates the TreatmenLog class to be saved in the Tx Report. + */ +void VTreatmentCreate::generateTxCode() { + QDateTime datetime = QDateTime::currentDateTime(); + txCode(datetime.toString("%1yyyyMMddHHmm").arg(_HDSerialNumber)); + _TreatmentLog.gTxCode(_txCode); +} + +/*! * \brief VCreateTreatment::doGetPrescriptionParameterValues * \details Gets a list of the prescription parameter values * \return (QStringList) The list of parameter values with units