Index: sources/storage/TreatmentLog.h =================================================================== diff -u -r0f1aa395dfb46e006bdec10d0bb99f2ed27739bf -r3b323bd6a1a03429c2321a889049de1c3b11302f --- sources/storage/TreatmentLog.h (.../TreatmentLog.h) (revision 0f1aa395dfb46e006bdec10d0bb99f2ed27739bf) +++ sources/storage/TreatmentLog.h (.../TreatmentLog.h) (revision 3b323bd6a1a03429c2321a889049de1c3b11302f) @@ -1,13 +1,13 @@ /*! * - * Copyright (c) 2021-2022 Diality Inc. - All Rights Reserved. + * Copyright (c) 2021-2024 Diality Inc. - All Rights Reserved. * \copyright * 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 TreatmentLog.h * \author (last) Behrouz NematiPour - * \date (last) 01-Mar-2022 + * \date (last) 13-Mar-2024 * \author (original) Behrouz NematiPour * \date (original) 04-May-2021 * @@ -40,8 +40,18 @@ { Q_OBJECT + const int _interval = 1000; // 1s + const int _pendingInterval= 60 ; // 1m + int _pendingCounter = 0 ; // + + const QString _sep = ","; + QString _treatmentLogPath; + const char* _treatmentLogExtUploaded = "txr"; + const char* _treatmentLogExtPending = "txr.p"; + const char* _txCodeKey = "Tx Code"; + QFutureWatcher _saveWatcher; QFutureWatcher _exportWatcher; @@ -53,7 +63,7 @@ QString _unitTextFlowRate = tr("mL/min" ); QString _unitTextDurationHour = tr("hour" ); QString _unitTextDurationMin = tr("min" ); - QString _unitTextConcentration = tr("mEg/L" ); + QString _unitTextConcentration = tr("mEq/L" ); QString _unitTextTemperature = tr("C" ); QString _unitTextVolume = tr("L" ); QString _unitTextFluid = tr("mL" ); @@ -75,20 +85,24 @@ QString mPatientID = ""; QString mFileName = ""; } - _lastTxInfo; + _lastTxInfo; + QString _deviceID = "unknown"; + QString _pendingTxr = ""; + QString _emptyPatinetID = "NoPatientIDEntered"; // No translation - QString _deviceID = ""; + 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, - eUnit + eValue, + eUnit , + eCount }; enum TreatmentLogIndex { ePatientID , -// eDeviceID , // removed during our meeting with Sean and Jahnavi 04/11/2022@16:00. eBloodFlowRate , eDialysateFlowRate , eTreatmentDuration , @@ -118,18 +132,11 @@ eTargetUFRate , eActualUFRate , eSalineBolusVolume , -// eAverageBloodFlow , // removed during our meeting with Sean and Jahnavi 04/11/2022@16:00. -// eAverageDialysateFlow , // removed during our meeting with Sean and Jahnavi 04/11/2022@16:00. -// eAverageDialysateTemp , // removed during our meeting with Sean and Jahnavi 04/11/2022@16:00. -// eAverageArterialPressure , // removed during our meeting with Sean and Jahnavi 04/11/2022@16:00. -// eAverageVenousPressure , // removed during our meeting with Sean and Jahnavi 04/11/2022@16:00. - - eTreatmentLogIndexCount + eTreatmentLogIndexCount , }; const QStringList _titles { tr("Patient ID" ), // ePatientID -// tr("Device ID" ), // eDeviceID // removed during our meeting with Sean and Jahnavi 04/11/2022@16:00. tr("Blood Flow Rate" ), // eBloodFlowRate tr("Dialysate Flow Rate" ), // eDialysateFlowRate tr("Treatment Duration" ), // eTreatmentDuration @@ -159,16 +166,10 @@ tr("Target UF Rate" ), // eTargetUFRate tr("Actual UF Rate" ), // eActualUFRate tr("Saline Bolus Volume" ), // eSalineBolusVolume -// tr("Average Blood Flow" ), // eAverageBloodFlow // removed during our meeting with Sean and Jahnavi 04/11/2022@16:00. -// tr("Average Dialysate Flow" ), // eAverageDialysateFlow // removed during our meeting with Sean and Jahnavi 04/11/2022@16:00. -// tr("Average Dialysate Temp" ), // eAverageDialysateTemp // removed during our meeting with Sean and Jahnavi 04/11/2022@16:00. -// tr("Average Arterial Pressure" ), // eAverageArterialPressure // removed during our meeting with Sean and Jahnavi 04/11/2022@16:00. -// tr("Average Venous Pressure" ), // eAverageVenousPressure // removed during our meeting with Sean and Jahnavi 04/11/2022@16:00. }; const QStringList _units { "" , // ePatientID -// "" , // eDeviceID // removed during our meeting with Sean and Jahnavi 04/11/2022@16:00. _unitTextFlowRate , // eBloodFlowRate _unitTextFlowRate , // eDialysateFlowRate _unitTextDurationMin , // eTreatmentDuration @@ -198,67 +199,89 @@ _unitTextFlowRate , // eTargetUFRate _unitTextFlowRate , // eActualUFRate _unitTextFluid , // eSalineBolusVolume -// _unitTextFlowRate , // eAverageBloodFlow // removed during our meeting with Sean and Jahnavi 04/11/2022@16:00. -// _unitTextFlowRate , // eAverageDialysateFlow // removed during our meeting with Sean and Jahnavi 04/11/2022@16:00. -// _unitTextTemperature , // eAverageDialysateTemp // removed during our meeting with Sean and Jahnavi 04/11/2022@16:00. -// _unitTextBloodPressure , // eAverageArterialPressure // removed during our meeting with Sean and Jahnavi 04/11/2022@16:00. -// _unitTextBloodPressure , // eAverageVenousPressure // removed during our meeting with Sean and Jahnavi 04/11/2022@16:00. }; - QString title(quint8 vIndex) const { - if (vIndex < _titles.count()) return _titles[vIndex]; - return ""; + QString string(quint8 vIndex , const QStringList &vStringList) const { + QString str = ""; + if (vIndex < vStringList.count()) { + str = vStringList[vIndex]; + str.remove(_sep); + } + return str; } - QString value(quint8 vIndex) const { - if (vIndex < _values.count()) return _values[vIndex]; - return ""; - } - QString unit(quint8 vIndex) const { - if (vIndex < _units.count()) return _units[vIndex]; - return ""; - } + QString title(quint8 vIndex) const { return string(vIndex, _titles );} + QString value(quint8 vIndex) const { return string(vIndex, _values );} + QString unit (quint8 vIndex) const { return string(vIndex, _units );} + // Lists QStringList _values; + QList _treatmentLogAvrgeData; QList _treatmentLogAlarmData; QList _treatmentLogEventData; + QMap _treatmentLogAlarmTitles; + QMap _treatmentLogEventTitles; + + void readAlarmTitles ( ); + void readEventTitles ( ); + QString alarmTitle (quint32 vID); + QString eventTitle (quint32 vID); + void initConnections(); - void logPath (Logger::LogType vLogType = Logger::eLogTrtmt, QString vLogPath = ""); + void logPath (Logger::LogType vLogType, QString vLogPath); bool saveLog (); void saveLogConcurrent (); bool exportLog (); void exportLogConcurrent(); + bool checkTxCode(); + bool findTxCode (); + void sendPending(); + // Pending Tx Report + void testPendingTxReports (); // eMessageID_TxReport + NOTIFIER(isIdle) SINGLETON(TreatmentLog) +protected: + void timerEvent(QTimerEvent *) override; + public: - void initModel(const AdjustTreatmentLogResponseData &vData, const QString &vPatientID); + void initModel(const AdjustTreatmentLogResponseData &vData, const QString &vPatientID, bool vHeparinBolusVolumeOff, bool vHeparinDispensingRateOff); + void clearModel() { + _values.clear(); + for (int i = 0; i < eTreatmentLogIndexCount; i++) _values << ""; + } - const QStringList titles() const { return _titles; } - const QStringList units () const { return _units ; } - const QStringList values() const { return _values; } + const QStringList titles () const { return _titles ; } + const QStringList units () const { return _units ; } + const QStringList values () const { return _values ; } void append(const TreatmentLogAvrgeData &vData); void append(const TreatmentLogAlarmData &vData); void append(const TreatmentLogEventData &vData); + QString logPath () const { return _treatmentLogPath; } + private slots: void onLogPathSet(Logger::LogType vLogType, const QString &vLogPath); void onSave (); void onExport (); + void onTxCodeReceive (const QString &vTxCode); + void onCloudSyncStatus ( bool vReady ); public slots: void doSave (); void doExport (); signals: - void didTreatmentLogSave( const QString &vDeviceID , - const QString &vPatientID , - const QString &vFileName ); + void didPendingTxr ( const QString &vFileName ); + void didTxCodeReceive ( const QString &vTxCode ); + + void didNotification ( const QString &vNotification ); }; }