Index: sources/device/DeviceController.h =================================================================== diff -u -r1bf8c894c5cc5ea6d62af0662fcf5a18e1a06459 -r74999b64a6850dd7622d03937bc8c8a8e0ae421e --- sources/device/DeviceController.h (.../DeviceController.h) (revision 1bf8c894c5cc5ea6d62af0662fcf5a18e1a06459) +++ 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) 10-Sep-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: @@ -64,10 +65,13 @@ void start() { #ifdef BUILD_FOR_DESKTOP qDebug() << "DeviceController.TimedProcess: " << _timeout << _command << _arguments; -#else + 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); -#endif } protected: @@ -104,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; @@ -157,6 +164,9 @@ 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; @@ -178,6 +188,11 @@ void checkConfugurationMountReady(); + void findPendingLogs(); + + bool logBackup(const QString &vFileName); + bool logUpload(const QString &vFileName); + signals: /*! * \brief didScreenshot @@ -282,14 +297,47 @@ * to notify the ApplicationController to call initSettings */ void didCryptSetupMount ( bool vPass ); + /*! * \brief didFactoryReset - * \details will be emitted when the factory reset is done, - * to notify the CloudSyncController to do the FactoryReset/TokenRemoval. + * \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 ();