Index: resources/settings/PowerOnSelfTests/PowerOnSelfTests.conf =================================================================== diff -u --- resources/settings/PowerOnSelfTests/PowerOnSelfTests.conf (revision 0) +++ resources/settings/PowerOnSelfTests/PowerOnSelfTests.conf (revision c8263f48423cf7791f5ef7d46157b9278708d663) @@ -0,0 +1,28 @@ +[HDPostSelfTests] +Processor Image +Processor NVRAM Page +RTC RAM Page +Clock speed +Watchdog timeout +Alarm current +Stuck button +Battery pack +Version Compatibility + +[DGPostSelfTests] +Processor Image +Processor NVRAM Page +RTC RAM Page +Version Compatibility +Clock Speed +Watchdog timeout +Alarm current + +[UIPostSelfTests] +Application Binary +Touch Screen Driver +Wi-Fi Driver +Bluetooth Driver +RTC Clock +Clock Speed +Version Compatibility Index: sources/canbus/MessageGlobals.h =================================================================== diff -u -r7077e38c74db9cccb5496ffefcf8936c0916de76 -rc8263f48423cf7791f5ef7d46157b9278708d663 --- sources/canbus/MessageGlobals.h (.../MessageGlobals.h) (revision 7077e38c74db9cccb5496ffefcf8936c0916de76) +++ sources/canbus/MessageGlobals.h (.../MessageGlobals.h) (revision c8263f48423cf7791f5ef7d46157b9278708d663) @@ -61,6 +61,8 @@ {Gui::GuiActionType::ID_Recirculate , 2 * 4 }, // 3 parameters each 4bytes {Gui::GuiActionType::ID_BloodPrime , 2 * 4 }, // 2 parameters each 4bytes {Gui::GuiActionType::ID_HDAccelerometerData , 9 * 4 }, // 9 parameters each 4bytes + {Gui::GuiActionType::ID_HDPostSingleResultData , 2 * 4 }, // 2 parameters each 4bytes + {Gui::GuiActionType::ID_HDPostFinalResultData , 1 * 4 }, // 1 parameters each 4bytes // ---- @@ -81,6 +83,8 @@ {Gui::GuiActionType::ID_DGLoadCellReadingsData , 4 * 4 }, // 4 parameters each 4bytes {Gui::GuiActionType::ID_DGTemperaturesData , 12 * 4 }, // 12 parameters each 4bytes {Gui::GuiActionType::ID_DGAccelerometerData , 9 * 4 }, // 9 parameters each 4bytes + {Gui::GuiActionType::ID_DGPostSingleResultData , 2 * 4 }, // 2 parameters each 4bytes + {Gui::GuiActionType::ID_DGPostFinalResultData , 1 * 4 }, // 1 parameters each 4bytes // ---- TODO : AFTER GIVING IT SOME THOUGHT, IT SEEMS WE CAN GET THESE LEN FROM THE MODEL AND DON'T NEED TO HAVE THIS BUT NEED TO INVESTIGATE MORE. {Gui::GuiActionType::ID_AlarmStatus , 4 * 4 + 2 }, // 4 parameters each 4bytes + 1 parameter 2bytes Index: sources/gui/GuiGlobals.cpp =================================================================== diff -u -r4e708c6e93443b01ac26c71a466708916ede4abf -rc8263f48423cf7791f5ef7d46157b9278708d663 --- sources/gui/GuiGlobals.cpp (.../GuiGlobals.cpp) (revision 4e708c6e93443b01ac26c71a466708916ede4abf) +++ sources/gui/GuiGlobals.cpp (.../GuiGlobals.cpp) (revision c8263f48423cf7791f5ef7d46157b9278708d663) @@ -37,6 +37,7 @@ #include "VHDTreatmentStatesData.h" #include "VPostTreatmentStatesData.h" #include "VDisinfectStatesData.h" +#include "VUIPostSingleResultData.h" // Pre-treatment #include "VPreTreatmentAdjustmentInitTreatment.h" #include "VDGFilterFlushData.h" Index: sources/gui/qml/main.qml =================================================================== diff -u -r83ffaef436920eba534cde428e14d168ea931bea -rc8263f48423cf7791f5ef7d46157b9278708d663 --- sources/gui/qml/main.qml (.../main.qml) (revision 83ffaef436920eba534cde428e14d168ea931bea) +++ sources/gui/qml/main.qml (.../main.qml) (revision c8263f48423cf7791f5ef7d46157b9278708d663) @@ -24,6 +24,7 @@ // View classes import VHDAccelerometer 0.1 +import VUIPostSingleResult 0.1 // Settings import VSettings 0.1 import VAdjustmentVersions 0.1 @@ -118,6 +119,7 @@ VAdjustmentVersions { id: vAdjustmentVersions } VDateTime { id: vDateTime } VNetworkModel { id: vNetwork } + VUIPostSingleResult { id: vUIPostSingleResult } // ---- States VHDOperationMode { id: vHDOperationMode } VPreTreatmentStates { id: vPreTreatmentStates } Index: sources/gui/qml/pages/post/PostInProgress.qml =================================================================== diff -u -r83ffaef436920eba534cde428e14d168ea931bea -rc8263f48423cf7791f5ef7d46157b9278708d663 --- sources/gui/qml/pages/post/PostInProgress.qml (.../PostInProgress.qml) (revision 83ffaef436920eba534cde428e14d168ea931bea) +++ sources/gui/qml/pages/post/PostInProgress.qml (.../PostInProgress.qml) (revision c8263f48423cf7791f5ef7d46157b9278708d663) @@ -107,6 +107,7 @@ } CheckListScrollView { id: _uiListView + model: vUIPostSingleResult width: _rectangle.width / 3 anchors { top: _uiTestsTitle.bottom Index: sources/view/VUIPostSingleResultData.cpp =================================================================== diff -u --- sources/view/VUIPostSingleResultData.cpp (revision 0) +++ sources/view/VUIPostSingleResultData.cpp (revision c8263f48423cf7791f5ef7d46157b9278708d663) @@ -0,0 +1,162 @@ +/*! + * + * Copyright (c) 2021 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 VUIPostSingleResultData.cpp + * \author (last) Peter Lucia + * \date (last) 21-May-2021 + * \author (original) Peter Lucia + * \date (original) 21-May-2021 + * + */ +#include "VUIPostSingleResultData.h" + +// Project +#include "GuiController.h" + +using namespace View; + +VUIPostSingleResult::VUIPostSingleResult(QAbstractListModel *parent) : QAbstractListModel(parent) +{ + initConnections(); +} + +/*! + * \brief VUIPost::initConnections + * Initializes the connections + */ +void VUIPostSingleResult::initConnections() +{ + ACTION_VIEW_CONNECTION(SettingsData); +} + +/*! + * \brief VUIPost::addSelfTest + * Adds a self test + * \param vTest - the post test to add + */ +void VUIPostSingleResult::addSelfTest(const PostTest &vTest) +{ + LOG_DEBUG(QString("Adding UI power on self test %1").arg(vTest.name)); + beginInsertRows(QModelIndex(), rowCount(), rowCount()); + _tests << vTest; + endInsertRows(); +} + +/*! + * \brief VNetworkModel::removeRows + * Removes all rows from the model + */ +void VUIPostSingleResult::removeAllRows() +{ + beginRemoveRows(QModelIndex(), 0, rowCount()); + _tests.clear(); + endRemoveRows(); +} + +/*! + * \brief VUIPost::data + * Returns the test properties at the specified index + * \param index (QModelIndex) contains the row of data to lookup + * \param role - (int) the property index to return. See TestDataRole + * \return (QVariant) - the value for the specified test property + */ +QVariant VUIPostSingleResult::data(const QModelIndex & index, int role) const +{ + if (index.row() < 0 || index.row() >= _tests.count()) + return QVariant(); + + switch (role) + { + case TestNameRole: + return _tests[index.row()].name; + case TestResultRole: + return _tests[index.row()].result; + } + + return QVariant(); +} + + +/*! + * \brief VUIPost::setData + * \param vIndex - the test number + * \param vValue - the new value for the role + * \param vRole - the role to update + * \return true upon success, false otherwise + */ +bool VUIPostSingleResult::setData(int vIndex, const QVariant &vValue, const TestDataRole &vRole) +{ + if (vIndex < 0 || vIndex >= rowCount()) + return false; + + PostTest &test = _tests[vIndex]; + + if (vRole == TestNameRole) + test.name = vValue.toString(); + else if (vRole == TestResultRole) + { + bool ok = false; + quint32 result = vValue.toInt(&ok); + if (!ok) + return false; + test.result = result; + } + else + return false; + + // FIXME: emit dataChanged... + return true; +} + +/*! + * \brief VNetworkModel::rowCount + * Gets the number of tests + * \param parent - the parent QModelIndex + * \return - the number of networks + */ +int VUIPostSingleResult::rowCount(const QModelIndex & parent) const +{ + Q_UNUSED(parent); + return _tests.count(); +} + +/*! + * \brief VNetworkModel::roleNames + * Translates how to access specific properties of the data for QML from the TestDataRole enum + * \return (QHash) - maps enums to property names + */ +QHash VUIPostSingleResult::roleNames() const +{ + QHash roles; + roles[TestNameRole] = "name"; + roles[TestResultRole] = "result"; + return roles; +} + +/*! + * \brief VUIPost::onActionReceive + * Called when the settings data is read from disk on startup + * \param vData - the settings data + */ +void VUIPostSingleResult::onActionReceive(const SettingsData &) +{ + // POST Settings folder and filename (category): PowerOnSelfTests/PowerOnSelfTests + QStringList tests; + for (const auto &group : _Settings.groups()) + { + if (group == "UIPostSelfTests") + { + tests = _Settings.keys(group); + } + } + for (const QString &test : tests) + { + PostTest posttest; + posttest.name = test; + addSelfTest(posttest); + } +} Index: sources/view/VUIPostSingleResultData.h =================================================================== diff -u --- sources/view/VUIPostSingleResultData.h (revision 0) +++ sources/view/VUIPostSingleResultData.h (revision c8263f48423cf7791f5ef7d46157b9278708d663) @@ -0,0 +1,67 @@ +/*! + * + * Copyright (c) 2021 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 VUIPostSingleResultData.h + * \author (last) Peter Lucia + * \date (last) 21-May-2021 + * \author (original) Peter Lucia + * \date (original) 21-May-2021 + * + */ +#pragma once + +// Qt +#include +#include + +// Project +#include "main.h" // Doxygen : don't remove +#include "VView.h" +#include "MSettings.h" + +// namespace +namespace View { + +/*! + * \brief The VUIPost class + * \details View for displaying UI power on self test results + * + */ +class VUIPostSingleResult : public QAbstractListModel { + Q_OBJECT + + PROPERTY(quint32, result, 0) + PROPERTY(quint32, index, 0) + + VIEW_DEC_SLOT(SettingsData) + +private: + struct PostTest { + QString name; + quint32 result = 2; + }; + + QList _tests; + +public: + explicit VUIPostSingleResult(QAbstractListModel *parent = nullptr); + + enum TestDataRole { + TestNameRole = Qt::UserRole + 1, + TestResultRole, + }; +protected: + int rowCount (const QModelIndex &parent = QModelIndex()) const override; + QVariant data (const QModelIndex &index, int role = Qt::DisplayRole) const override; + QHash roleNames() const override; + bool setData(int vIndex, const QVariant &vValue, const TestDataRole &vRole); + void removeAllRows(); +private: + void initConnections(); + void addSelfTest(const PostTest &vTest); +}; +} Index: sources/view/VView.h =================================================================== diff -u -r4e708c6e93443b01ac26c71a466708916ede4abf -rc8263f48423cf7791f5ef7d46157b9278708d663 --- sources/view/VView.h (.../VView.h) (revision 4e708c6e93443b01ac26c71a466708916ede4abf) +++ sources/view/VView.h (.../VView.h) (revision c8263f48423cf7791f5ef7d46157b9278708d663) @@ -115,6 +115,7 @@ REGISTER_TYPE( VHDTreatmentStates ) \ REGISTER_TYPE( VPostTreatmentStates ) \ REGISTER_TYPE( VDisinfectStates ) \ + REGISTER_TYPE( VUIPostSingleResult ) \ /* In-Treatment - Data */ \ REGISTER_TYPE( VTreatmentBloodFlow ) \ REGISTER_TYPE( VTreatmentDialysateFlow ) \ Index: sources/view/dg/data/VDGPostSingleResultData.cpp =================================================================== diff -u -r83ffaef436920eba534cde428e14d168ea931bea -rc8263f48423cf7791f5ef7d46157b9278708d663 --- sources/view/dg/data/VDGPostSingleResultData.cpp (.../VDGPostSingleResultData.cpp) (revision 83ffaef436920eba534cde428e14d168ea931bea) +++ sources/view/dg/data/VDGPostSingleResultData.cpp (.../VDGPostSingleResultData.cpp) (revision c8263f48423cf7791f5ef7d46157b9278708d663) @@ -109,6 +109,9 @@ else return false; + emit dataChanged(sibling(vIndex, 0, QModelIndex()), + sibling(vIndex,0, QModelIndex()), + QVector() << vRole); return true; } Index: sources/view/hd/data/VHDPostSingleResultData.cpp =================================================================== diff -u -r83ffaef436920eba534cde428e14d168ea931bea -rc8263f48423cf7791f5ef7d46157b9278708d663 --- sources/view/hd/data/VHDPostSingleResultData.cpp (.../VHDPostSingleResultData.cpp) (revision 83ffaef436920eba534cde428e14d168ea931bea) +++ sources/view/hd/data/VHDPostSingleResultData.cpp (.../VHDPostSingleResultData.cpp) (revision c8263f48423cf7791f5ef7d46157b9278708d663) @@ -109,7 +109,9 @@ else return false; - // FIXME: emit dataChanged... + emit dataChanged(sibling(vIndex, 0, QModelIndex()), + sibling(vIndex,0, QModelIndex()), + QVector() << vRole); return true; }