Index: sources/device/DeviceController.h =================================================================== diff -u -r2afdc76a7d8f97a518da0158e9bd08217de41a97 -r74999b64a6850dd7622d03937bc8c8a8e0ae421e --- sources/device/DeviceController.h (.../DeviceController.h) (revision 2afdc76a7d8f97a518da0158e9bd08217de41a97) +++ sources/device/DeviceController.h (.../DeviceController.h) (revision 74999b64a6850dd7622d03937bc8c8a8e0ae421e) @@ -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 DeviceController.h * \author (last) Behrouz NematiPour - * \date (last) 18-Jul-2023 + * \date (last) 22-Oct-2023 * \author (original) Behrouz NematiPour * \date (original) 03-Jun-2021 * @@ -51,8 +51,9 @@ private slots: void onFinish(int) { killTimer(_pid); + // emit _process->finished(-1, QProcess::CrashExit); _process->kill(); - _process = nullptr; + _process = nullptr; //->deleteLater(); deleteLater(); } public: @@ -62,6 +63,13 @@ this , SLOT(onFinish (int))); } void start() { +#ifdef BUILD_FOR_DESKTOP + qDebug() << "DeviceController.TimedProcess: " << _timeout << _command << _arguments; + QFileInfo fileInfo(_command); + QString path = fileInfo.absolutePath(); + QString name = "empty.sh"; + _command = QString("%1/%2").arg(path, name); +#endif _pid = startTimer(_timeout); _process->start(_command, _arguments); } @@ -100,7 +108,10 @@ bool _mounted = false; bool _umounted = false; bool _removed = false; - const int _interval = 1000; // in ms + const int _interval = 1000; // in ms = 1s + const int _pendingInterval = 60 ; // 1m + int _pendingCounter = 0 ; // + QString _pendingLog = ""; const qint8 _minRequiredAvailableSpacePercent = 10; @@ -109,6 +120,7 @@ QFileSystemWatcher _fileSystemWatcher; + QString _osVersion = ""; QString _macEthernet = ""; QString _macWireless = ""; QString _macBluetooth = ""; @@ -138,18 +150,23 @@ void onEventThreadChange (); /*! - * \brief didPOSTData + * \brief onPOSTData * \details These signals will be emitted when UI is done with the POST and will let DeviceView update its property(ies). + * \param vOSVersion - OS Version * \param vMacEthernet - Ethernet Mac Adress * \param vMacWireless - Wireless Mac Adress * \param vMacBluetooth - Bluetooth Mac Adress * \param vNetCloudSync - CloudSync IP Adress */ + void onPOSTOSVersionData (const QString &vOSVersion ); void onPOSTEthernetData (const QString &vMacAddress); void onPOSTWirelessData (const QString &vMacAddress); void onPOSTBluetoothData (const QString &vMacAddress); void onPOSTCloudSyncData (const QString &vNetAddress); + void onLogBackup (const QString &vFileName ); + void onLogUpload (const QString &vFileName ); + protected: void timerEvent(QTimerEvent *) override; @@ -171,6 +188,11 @@ void checkConfugurationMountReady(); + void findPendingLogs(); + + bool logBackup(const QString &vFileName); + bool logUpload(const QString &vFileName); + signals: /*! * \brief didScreenshot @@ -263,6 +285,7 @@ */ void didEventThreadChange (QPrivateSignal); + void didPOSTOSVersionData (const QString &vOSVersion ); void didPOSTEthernetData (const QString &vMacAddress); void didPOSTWirelessData (const QString &vMacAddress); void didPOSTBluetoothData (const QString &vMacAddress); @@ -275,6 +298,46 @@ */ void didCryptSetupMount ( bool vPass ); + /*! + * \brief didFactoryReset + * \details will be emitted when the Factory Reset is done, + * to notify the CloudSyncController to do the Factory Reset/Logs Removal. + * \param vPass + */ + void didFactoryReset ( bool vPass ); + + /*! + * \brief didDecommissioning + * \details will be emitted when the Decommissioning is done, + * to notify the CloudSyncController to do the Decommissioning/TokenRemoval. + * \param vPass + */ + void didDecommissioning ( bool vPass ); + + /*! + * \brief didPendingLog + * \details will be emitted when a log file is pending to be uploaded. + * \param vFileName - the pending log file name + */ + void didPendingLog (const QString &vFileName, const QString vChecksum ); + + /*! + * \brief logBackup + * \details notification of the log back up complete (either case of pass or fail) + * \param vFileName - file name to backup + * \param vPass - false if the backup failed. + * \return void + */ + void didLogBackup ( bool vPass, const QString &vFileName ); + + /*! + * \brief didLogUpload + * \details notification of pending log upload file rename complete (rename and remove the 'u.' (pending sub-ext)) + * \param vPass - true if the pending log file name rename was successful. + * \param vFileName - the pending log file name (meaning it includes 'u.' ) + */ + void didLogUpload ( bool vPass, const QString &vFileName ); + private: // ----- USB void usbCheck (); @@ -288,6 +351,6 @@ void usbSpaceCheck(); void settingsPartitionSpaceCheck(); - SAFE_CALL_EX(doAddWatch, const QString &) + SAFE_CALL_EX2(doAddWatch, const QString &, bool) }; }