Index: sources/gui/qml/components/ConfirmTreatmentTableEntry.qml =================================================================== diff -u -rc9f8f8cf3c6c37fc6460d8675c62c9442c4d4263 -rf9e747f0f28df1cc6a33179f0bc78bfc03d486fc --- sources/gui/qml/components/ConfirmTreatmentTableEntry.qml (.../ConfirmTreatmentTableEntry.qml) (revision c9f8f8cf3c6c37fc6460d8675c62c9442c4d4263) +++ sources/gui/qml/components/ConfirmTreatmentTableEntry.qml (.../ConfirmTreatmentTableEntry.qml) (revision f9e747f0f28df1cc6a33179f0bc78bfc03d486fc) @@ -39,7 +39,7 @@ Line { id: _line width: _root.width + Variables.createTreatmentTableMargin - thickness: 2 + thickness: 1 color: Colors.backgroundMenu anchors.top: _root.bottom anchors.left: _root.left Index: sources/gui/qml/pages/pretreatment/create/PreTreatmentConfirm.qml =================================================================== diff -u -r159f2bb0317c7c3c0336e4cb80c7fef3f87e329a -rf9e747f0f28df1cc6a33179f0bc78bfc03d486fc --- sources/gui/qml/pages/pretreatment/create/PreTreatmentConfirm.qml (.../PreTreatmentConfirm.qml) (revision 159f2bb0317c7c3c0336e4cb80c7fef3f87e329a) +++ sources/gui/qml/pages/pretreatment/create/PreTreatmentConfirm.qml (.../PreTreatmentConfirm.qml) (revision f9e747f0f28df1cc6a33179f0bc78bfc03d486fc) @@ -21,6 +21,7 @@ // Qml imports import "qrc:/globals" import "qrc:/components" +import "qrc:/compounds" import "qrc:/pages/pretreatment" /*! @@ -39,30 +40,38 @@ // anchors.leftMargin : Variables.minVGap2 // } + Label { id: _txCode + anchors.bottom : _flickable.top + anchors.left : _flickable.left + width : _flickable.width + text : qsTr("Code: ") + vTreatmentCreate.txCode + font.pixelSize : Fonts.fontPixelButton + } + Flickable { id: _flickable objectName: "_PreTreatmentConfirmFlickable" interactive: false Background { // Used instead of ScrollBar background color : Colors.backgroundDialog - anchors.rightMargin : Variables.minVGap2 - anchors.leftMargin : Variables.minVGap2 + // anchors.rightMargin : Variables.minVGap2 + // anchors.leftMargin : Variables.minVGap2 } + clip: true anchors { top : _root.title.bottom - topMargin : 15 + topMargin : Variables.minVGap * 2 // * 2 : it was too close to title and also better with rows not half cut. bottom : _root.bottom - bottomMargin : Variables.notificationHeight + 15 + bottomMargin : Variables.notificationHeight + Variables.minVGap horizontalCenter: parent.horizontalCenter } - width : _root.width - contentWidth : _root.width - contentHeight : _column.implicitHeight - clip: true + width : parent.width - Variables.minVGap2 * 2 // * 2 : for each side + contentWidth : width + contentHeight: height + // TODO: remove this and the sub components and use the TouchGrid instead like in the PostTreatmentReview.qml Column { id: _column anchors.horizontalCenter: parent.horizontalCenter; anchors.fill: parent; - // insert the treatment information table here ConfirmTreatmentTable { anchors.horizontalCenter: parent.horizontalCenter Index: sources/main.h =================================================================== diff -u -rec31f94081864aec8b48a3cfa1e0aea80619714c -rf9e747f0f28df1cc6a33179f0bc78bfc03d486fc --- sources/main.h (.../main.h) (revision ec31f94081864aec8b48a3cfa1e0aea80619714c) +++ sources/main.h (.../main.h) (revision f9e747f0f28df1cc6a33179f0bc78bfc03d486fc) @@ -320,6 +320,26 @@ READONLY( vTYPE , vVARIABLE##Max , vDEFVALUE ) \ READONLY( vTYPE , vVARIABLE##Res , vDEFVALUE ) \ READONLY( vTYPE , vVARIABLE##Def , vDEFVALUE ) +//--------------------------------------------------------------------------------// +#define MEMBER( vTYPE , vVARIABLE , vDEFVALUE ) \ + private: \ + vTYPE _##vVARIABLE = vDEFVALUE; \ + public: \ + /*! \brief Property setter + \details The property setter which update the private variable \n + \param new value + */\ + void vVARIABLE ( const vTYPE & v##vVARIABLE ) { \ + _##vVARIABLE = v##vVARIABLE; \ + } \ + public: \ + /*! \brief Property getter + \details The property getter which reads the private variable + \return current value + */\ + vTYPE vVARIABLE () const { \ + return _##vVARIABLE ; \ + } //--------------------------------------------------------------------------------// #define CONSTANT( vTYPE , vVARIABLE , vDEFVALUE ) \ Index: sources/model/dg/adjustment/settings/MAdjustDGCleaningUsageResponse.h =================================================================== diff -u -r159f2bb0317c7c3c0336e4cb80c7fef3f87e329a -rf9e747f0f28df1cc6a33179f0bc78bfc03d486fc --- sources/model/dg/adjustment/settings/MAdjustDGCleaningUsageResponse.h (.../MAdjustDGCleaningUsageResponse.h) (revision 159f2bb0317c7c3c0336e4cb80c7fef3f87e329a) +++ sources/model/dg/adjustment/settings/MAdjustDGCleaningUsageResponse.h (.../MAdjustDGCleaningUsageResponse.h) (revision f9e747f0f28df1cc6a33179f0bc78bfc03d486fc) @@ -32,7 +32,7 @@ * * | MSG | Type | Ack | Src | Dest | Description | * |:----:|:----:|:---:|:---:|:----:|:-----------:| - * |0x7000| Rsp | Y | DG | UI | DGCleaningUsage | + * |0x8D00| Rsp | Y | DG | UI | DGCleaningUsage | * * | Payload || * | || Index: sources/model/hd/data/MHDUsageInfoResponse.h =================================================================== diff -u -ra7c580f0998ee781c47314384f677249cea4c4b4 -rf9e747f0f28df1cc6a33179f0bc78bfc03d486fc --- sources/model/hd/data/MHDUsageInfoResponse.h (.../MHDUsageInfoResponse.h) (revision a7c580f0998ee781c47314384f677249cea4c4b4) +++ sources/model/hd/data/MHDUsageInfoResponse.h (.../MHDUsageInfoResponse.h) (revision f9e747f0f28df1cc6a33179f0bc78bfc03d486fc) @@ -32,7 +32,7 @@ * * | MSG | CAN ID | Type | Ack | Src | Dst | Description | * |:----:|:------:|:------:|:---:|:---:|:---:|:-----------: | - * |0xA000| 0x040 | 1 Hz | N | HD | UI | HD Usage information data | + * |0x8B00| 0x040 | 1 Hz | N | HD | UI | HD Usage information data | * * | Payload || * | || Index: sources/storage/TreatmentLog.cpp =================================================================== diff -u -r1a9eb2756f33ec0387dd360e5c051ed9a04b9c1c -rf9e747f0f28df1cc6a33179f0bc78bfc03d486fc --- sources/storage/TreatmentLog.cpp (.../TreatmentLog.cpp) (revision 1a9eb2756f33ec0387dd360e5c051ed9a04b9c1c) +++ sources/storage/TreatmentLog.cpp (.../TreatmentLog.cpp) (revision f9e747f0f28df1cc6a33179f0bc78bfc03d486fc) @@ -26,9 +26,6 @@ #include "Settings.h" #include "CloudSyncController.h" -#include "GuiGlobals.h" -#include "MAlarmStatusData.h" - using namespace Storage; #define NONE "N/A" @@ -64,7 +61,7 @@ QOverload< const AdjustSerialNumberHDResponseData & >::of( &ApplicationController::didActionReceive ), [ this ] ( const AdjustSerialNumberHDResponseData &vData ) { - // The serial number is going to be recieved from HD + // The serial number is going to be received from HD // on POST or on request // and will be used for the device ID // which we designed initially to be different. @@ -343,7 +340,8 @@ QString end = "%1" ; uint index = 0 ; - // ADDTITLE("Title"); // will be added with Tx Code when gets out of pending, by receiving the Tx Code from CloudSync + ADDTITLE("Title"); + ADDALINE(QString("TxCode,%1,").arg(_gTxCode)); ADDTOLOG( ePatientID ); ADDTITLE("Treatment Parameters" ); @@ -551,54 +549,45 @@ */ void TreatmentLog::onTxCodeReceive(const QString &vTxCode) { - _txCode = vTxCode; + _rTxCode = vTxCode; // This has to be checked before the addTxCode, // because that function will change the _lastTxInfo.mFilename after it is moved from pending. - bool isLastTxInfo = ! _lastTxInfo.mFileName.isEmpty() && _pendingTx == _lastTxInfo.mFileName; + bool isLastTxInfo = ! _lastTxInfo.mFileName.isEmpty() && _pendingTxr == _lastTxInfo.mFileName; // getting the Tx out of pending and add the received Tx in the file - addTxCode(); + checkTxCode(); if ( isLastTxInfo ) { // avoid updating the screen with another pending Tx in queue - emit didTxCodeReceive(_txCode); + emit didTxCodeReceive(_rTxCode); } } /*! - * \brief TreatmentLog::addTxCode - * \details Adds the [Title] and Tx Code to the file and moves it from pending. + * \brief TreatmentLog::checkTxCode + * \details Compares the received TxCode with the generated and if matches renames Txr from pending. * \return true on success, false on any case of read, write, remove. */ -bool TreatmentLog::addTxCode() +bool TreatmentLog::checkTxCode() { bool ok = true; - QString src = _pendingTx; + QString src = _pendingTxr; QString dst = QString("%1%2.%3") .arg(_treatmentLogPath) .arg(QFileInfo(src).baseName()) .arg(_treatmentLogExtUploaded); - QString logContent; - ADDTITLE("Title"); - ADDALINE(QString("Tx Code,%1,").arg(_txCode)); - ok = FileHandler::read (src, logContent, true ); // reads the file and appends the content to logContent + ok = _gTxCode == _rTxCode; if ( ! ok ) { - LOG_DEBUG(QString("Couldn't read pending treatment log file '%1'").arg(src)); + LOG_DEBUG(QString("Generated '%1' TxCode and Received TxCode '%1' does not match").arg(_gTxCode).arg(_rTxCode)); return ok; } - ok = FileHandler::write (dst, logContent ); + ok = QFile::rename(src, dst); if ( ! ok ) { - LOG_DEBUG(QString("Couldn't settle pending treatment log file '%1'").arg(src)); + LOG_DEBUG(QString("Couldn't change the state of pending treatment log file '%1'").arg(src)); return ok; } - - QFile::remove(src); - if ( ! ok ) { - LOG_DEBUG(QString("Couldn't remove pending treatment log file '%1'").arg(src)); - return ok; - } _lastTxInfo.mFileName = dst; // Update the last Tx file to the new location [ export ] sendPending(); // start looking for the next pending, instead of waiting to timeout return ok; @@ -640,7 +629,7 @@ // the process repeats until there is no file in pending if ( pendingFiles.count() ) { // the most recent/first Tx file, to first ask for the current treatment which has just saved as pending on screen - _pendingTx = pendingFiles.first().absoluteFilePath(); - emit didTxPending( _pendingTx ); + _pendingTxr = pendingFiles.first().absoluteFilePath(); + emit didTxPending( _pendingTxr ); } } Index: sources/storage/TreatmentLog.h =================================================================== diff -u -r1a9eb2756f33ec0387dd360e5c051ed9a04b9c1c -rf9e747f0f28df1cc6a33179f0bc78bfc03d486fc --- sources/storage/TreatmentLog.h (.../TreatmentLog.h) (revision 1a9eb2756f33ec0387dd360e5c051ed9a04b9c1c) +++ sources/storage/TreatmentLog.h (.../TreatmentLog.h) (revision f9e747f0f28df1cc6a33179f0bc78bfc03d486fc) @@ -83,10 +83,12 @@ } _lastTxInfo; - QString _deviceID = "unknown"; - QString _txCode = ""; // content of this value comes from CloudSync App. - QString _pendingTx = ""; + QString _deviceID = "unknown"; + QString _pendingTxr = ""; + MEMBER( QString , gTxCode, ""); // content of this value is generated by VPreTreatment. + MEMBER( QString , rTxCode, ""); // content of this value be received from CloudSync App. + enum Role { eValue, eTitle, @@ -230,7 +232,7 @@ void saveLogConcurrent (); bool exportLog (); void exportLogConcurrent(); - bool addTxCode(); + bool checkTxCode(); void sendPending(); // Pending Tx Report 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 Index: sources/view/VTreatmentCreate.h =================================================================== diff -u -r4b7b6f9506d7c7ad4f611b8c417ed37d5f9a48ac -rf9e747f0f28df1cc6a33179f0bc78bfc03d486fc --- sources/view/VTreatmentCreate.h (.../VTreatmentCreate.h) (revision 4b7b6f9506d7c7ad4f611b8c417ed37d5f9a48ac) +++ sources/view/VTreatmentCreate.h (.../VTreatmentCreate.h) (revision f9e747f0f28df1cc6a33179f0bc78bfc03d486fc) @@ -24,6 +24,8 @@ // Project #include "MPreTreatmentAdjustParametersValidationResponse.h" +#include "MAdjustHDSerialNumberResponse.h" + #include "GuiController.h" #include "StorageGlobals.h" #include "VView.h" @@ -35,8 +37,6 @@ using namespace Gui; using namespace Model; -#define UNSET 9999 - namespace View { /*! @@ -74,6 +74,8 @@ // friends friend class::tst_views; + QString _HDSerialNumber = ""; + PROPERTY(bool , heparinDispensingRateOff , true) PROPERTY(bool , heparinBolusVolumeOff , true) @@ -100,6 +102,8 @@ VALUESET(QString , patientID ,"") VALUESET(bool , continueEnabled , 0) + PROPERTY(QString , txCode , "") + TRIGGER (quint32 , bloodFlowRateRejectReason , 0 ) TRIGGER (quint32 , dialysateFlowRateRejectReason , 0 ) TRIGGER (quint32 , treatmentDurationRejectReason , 0 ) @@ -123,10 +127,13 @@ VIEW_DEC_CLASS(VTreatmentCreate) VIEW_DEC_SLOT(AdjustParametersValidationResponseData) + VIEW_DEC_SLOT(AdjustSerialNumberHDResponseData); private: QString enumToString(GuiRequestReasons vEnum); + void generateTxCode(); + signals: void didAdjustment(const AdjustParametersValidationRequestData &data); void didAdjustment(const AdjustParametersConfirmRequestData &data); Index: sources/view/hd/adjustment/posttreatment/VPostTreatmentAdjustTreatmentLog.cpp =================================================================== diff -u -r4b7b6f9506d7c7ad4f611b8c417ed37d5f9a48ac -rf9e747f0f28df1cc6a33179f0bc78bfc03d486fc --- sources/view/hd/adjustment/posttreatment/VPostTreatmentAdjustTreatmentLog.cpp (.../VPostTreatmentAdjustTreatmentLog.cpp) (revision 4b7b6f9506d7c7ad4f611b8c417ed37d5f9a48ac) +++ sources/view/hd/adjustment/posttreatment/VPostTreatmentAdjustTreatmentLog.cpp (.../VPostTreatmentAdjustTreatmentLog.cpp) (revision f9e747f0f28df1cc6a33179f0bc78bfc03d486fc) @@ -79,7 +79,7 @@ _TreatmentLog.initModel ( vData, _patientID.trimmed(), isHeparinOff); if ( vData.mAccepted ) { //TODO Commented out for now - // It is needed to display NONE for the heparin items if the heparin set to off on Create Treatment Prameters screen. + // It is needed to display NONE for the heparin items if the heparin set to off on Create Treatment Parameters screen. // The problem is the data comes from the _TreatmentLog model // But if that model changes to have the NONE values, then the CloudSync or Cloud may reject the TxLog. // When the Cloud is updated we can as well update the entire flow.