Index: sources/view/VUIPostSingleResultData.cpp =================================================================== diff -u -rc8263f48423cf7791f5ef7d46157b9278708d663 -r3508eb862db3d45a89ef17bd63f385c80fb52775 --- sources/view/VUIPostSingleResultData.cpp (.../VUIPostSingleResultData.cpp) (revision c8263f48423cf7791f5ef7d46157b9278708d663) +++ sources/view/VUIPostSingleResultData.cpp (.../VUIPostSingleResultData.cpp) (revision 3508eb862db3d45a89ef17bd63f385c80fb52775) @@ -108,7 +108,9 @@ else return false; - // FIXME: emit dataChanged... + emit dataChanged(sibling(vIndex, 0, QModelIndex()), + sibling(vIndex,0, QModelIndex()), + QVector() << vRole); return true; } @@ -139,7 +141,7 @@ /*! * \brief VUIPost::onActionReceive - * Called when the settings data is read from disk on startup + * Called once when the settings data is read from disk on startup * \param vData - the settings data */ void VUIPostSingleResult::onActionReceive(const SettingsData &) @@ -159,4 +161,116 @@ posttest.name = test; addSelfTest(posttest); } + + // Kickoff power on self-tests once all tests have been added + selfTestApplicationBinary(); + selfTestTouchScreenDriver(); + selfTestWifiDriver(); + selfTestBluetoothDriver(); + selfTestRTCClock(); + selfTestClockSpeed(); + selfTestVersionCompatibility(); } + +/*! + * \brief VUIPostSingleResult::sha256 + * Gets the Sha256 checksum for the specified file + * \param fileName - the file we want the sha256 hash for + * \return The hash result + */ +QByteArray VUIPostSingleResult::sha256(const QString &vFilename) +{ + QFile f(vFilename); + if (f.open(QFile::ReadOnly)) + { + QCryptographicHash hash(QCryptographicHash::Sha256); + if (hash.addData(&f)) + return hash.result(); + } + return QByteArray(); +} + +/*! + * \brief VUIPostSingleResult::selfTestApplicationBinary + * Tests that the application binary is not corrupted + */ +void VUIPostSingleResult::selfTestApplicationBinary() +{ + // check if the application is in the conf checksum file + // check that its path matches where it is in the actual filesystem + // check that it's checksum is correct + int index = 0; + int result = 1; // pass + setData(index, QVariant(result), TestDataRole::TestResultRole); + // if a test fails +// finalResult(0); +} + +/*! + * \brief VUIPostSingleResult::selfTestTouchScreenDriver + * Tests that the touch screen driver is loaded correctly + */ +void VUIPostSingleResult::selfTestTouchScreenDriver() +{ + // dmesg | grep "touch" + int index = 1; + int result = 1; // pass + setData(index, QVariant(result), TestDataRole::TestResultRole); +} + +/*! + * \brief VUIPostSingleResult::selfTestWifiDriver + * Tests that the Wi-Fi driver is correctly loaded + */ +void VUIPostSingleResult::selfTestWifiDriver() +{ + // check that wpa_supplicant exists + int index = 2; + int result = 1; // pass + setData(index, QVariant(result), TestDataRole::TestResultRole); +} + +/*! + * \brief VUIPostSingleResult::selfTestBluetoothDriver + * Tests that the bluetooth driver is correctly loaded + */ +void VUIPostSingleResult::selfTestBluetoothDriver() +{ + int index = 3; + int result = 1; // pass + setData(index, QVariant(result), TestDataRole::TestResultRole); +} + +/*! + * \brief VUIPostSingleResult::selfTestRTCClock + * Tests that the RTC clock is correct + */ +void VUIPostSingleResult::selfTestRTCClock() +{ + int index = 4; + int result = 1; // pass + setData(index, QVariant(result), TestDataRole::TestResultRole); +} + +/*! + * \brief VUIPostSingleResult::selfTestClockSpeed + * Test that the clock speed is within spec + */ +void VUIPostSingleResult::selfTestClockSpeed() +{ + int index = 5; + int result = 1; // pass + setData(index, QVariant(result), TestDataRole::TestResultRole); +} + +/*! + * \brief VUIPostSingleResult::selfTestVersionCompatibility + * Test that the FW versions are compatible with this UI version + */ +void VUIPostSingleResult::selfTestVersionCompatibility() +{ + int index = 6; + int result = 1; // pass + setData(index, QVariant(result), TestDataRole::TestResultRole); + finalResult(1); +}