Index: sources/storage/TreatmentLog.h =================================================================== diff -u -rf9e747f0f28df1cc6a33179f0bc78bfc03d486fc -r3b323bd6a1a03429c2321a889049de1c3b11302f --- sources/storage/TreatmentLog.h (.../TreatmentLog.h) (revision f9e747f0f28df1cc6a33179f0bc78bfc03d486fc) +++ sources/storage/TreatmentLog.h (.../TreatmentLog.h) (revision 3b323bd6a1a03429c2321a889049de1c3b11302f) @@ -1,13 +1,13 @@ /*! * - * Copyright (c) 2021-2023 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) 18-Sep-2023 + * \date (last) 13-Mar-2024 * \author (original) Behrouz NematiPour * \date (original) 04-May-2021 * @@ -44,10 +44,14 @@ 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; @@ -85,14 +89,16 @@ QString _deviceID = "unknown"; QString _pendingTxr = ""; + QString _emptyPatinetID = "NoPatientIDEntered"; // No translation 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 { @@ -195,24 +201,22 @@ _unitTextFluid , // eSalineBolusVolume }; - 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 < _valuesLog.count()) return _valuesLog[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 _valuesLog; + QStringList _values; - QStringList _valuesGui; - QList _treatmentLogAvrgeData; QList _treatmentLogAlarmData; QList _treatmentLogEventData; @@ -233,6 +237,7 @@ bool exportLog (); void exportLogConcurrent(); bool checkTxCode(); + bool findTxCode (); void sendPending(); // Pending Tx Report @@ -245,12 +250,15 @@ void timerEvent(QTimerEvent *) override; public: - void initModel(const AdjustTreatmentLogResponseData &vData, const QString &vPatientID, bool vIsHeparinOff); + 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 valuesLog () const { return _valuesLog; } - const QStringList valuesGui () const { return _valuesGui; } + const QStringList values () const { return _values ; } void append(const TreatmentLogAvrgeData &vData); void append(const TreatmentLogAlarmData &vData); @@ -270,7 +278,7 @@ void doExport (); signals: - void didTxPending ( const QString &vFileName ); + void didPendingTxr ( const QString &vFileName ); void didTxCodeReceive ( const QString &vTxCode ); void didNotification ( const QString &vNotification );