Index: sources/device/DeviceController.h =================================================================== diff -u -rac121d27e4b3c4ca5be931f7da167b93381dc0ba -r6c6f1f5d466badd9b4fd67be7c907234c342b2a2 --- sources/device/DeviceController.h (.../DeviceController.h) (revision ac121d27e4b3c4ca5be931f7da167b93381dc0ba) +++ sources/device/DeviceController.h (.../DeviceController.h) (revision 6c6f1f5d466badd9b4fd67be7c907234c342b2a2) @@ -1,13 +1,13 @@ /*! * - * Copyright (c) 2021-2022 Diality Inc. - All Rights Reserved. + * Copyright (c) 2021-2023 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) 28-Sep-2022 + * \date (last) 19-Dec-2022 * \author (original) Behrouz NematiPour * \date (original) 03-Jun-2021 * @@ -46,6 +46,7 @@ int _timeout = 0; QProcess *_process = nullptr; QString _command = ""; + QStringList _arguments = {}; private slots: void onFinish(int) { @@ -55,14 +56,14 @@ deleteLater(); } public: - TimedProcess(QProcess *vProcess, const QString &vCommand, int vTimeout) - : QObject(), _timeout(vTimeout), _process(vProcess), _command(vCommand) { + TimedProcess(QProcess *vProcess, const QString &vCommand, int vTimeout, QStringList vArguments = {}) + : QObject(), _timeout(vTimeout), _process(vProcess), _command(vCommand), _arguments(vArguments) { connect(_process, SIGNAL( finished(int)), this , SLOT(onFinish (int))); } void start() { _pid = startTimer(_timeout); - _process->start(_command, QStringList()); + _process->start(_command, _arguments); } protected: @@ -99,7 +100,6 @@ bool _mounted = false; bool _umounted = false; bool _removed = false; - const char *_usbDrive = ""; const int _interval = 1000; // in ms const qint8 _minRequiredAvailableSpacePercent = 10; @@ -109,6 +109,14 @@ QFileSystemWatcher _fileSystemWatcher; + QString _macEthernet = ""; + QString _macWireless = ""; + QString _macBluetooth = ""; + QString _netCloudSync = ""; + + bool _hasThread = false; + bool _hasSalt = false; + //TODO: all of these should use the TimesProcess (instead of QProcess) // to be able to kill the process automatically after the set time out. DEVICE_DEV_DEFINITION_LIST @@ -123,6 +131,25 @@ private slots: void onScreenshot(const QImage &vImage, const QString &vFileName); + void onUSBDriveUmount(); + void onWatchFileChanged(const QString &vFile); + + + void onEventThreadChange (); + + /*! + * \brief didPOSTData + * \details These signals will be emitted when UI is done with the POST and will let DeviceView update its property(ies). + * \param vMacEthernet - Ethernet Mac Adress + * \param vMacWireless - Wireless Mac Adress + * \param vMacBluetooth - Bluetooth Mac Adress + * \param vNetCloudSync - CloudSync IP Adress + */ + void onPOSTEthernetData (const QString &vMacAddress); + void onPOSTWirelessData (const QString &vMacAddress); + void onPOSTBluetoothData (const QString &vMacAddress); + void onPOSTCloudSyncData (const QString &vNetAddress); + protected: void timerEvent(QTimerEvent *) override; @@ -142,6 +169,8 @@ bool addWatch(const QString &vFilePath); + void checkConfugurationMountReady(); + signals: /*! * \brief didScreenshot @@ -201,29 +230,41 @@ */ void didSDCardSpaceTooLow(quint8 vAvailablePercent); - void didActionReceive( const DeviceBrightnessResponseData &vBrightness ); + void didActionReceive( const DeviceBrightnessResponseData &vBrightness ); + void didActionReceive( const DeviceRootSSHAccessResponseData &vRootSSHAccess); void didWatchFileChange(const QString &vFile); -private slots: - // ----- USB - void usbCheck(); + /*! + * \brief didEventThreadChange + * \details this signal will be emitted when the curr + */ + void didEventThreadChange (QPrivateSignal); - bool usbMount (const QString &vDevice); - bool usbUmount(const QString &vDevice); - void usbRemove(); - void usbError (const QString &vDevice); + void didPOSTEthernetData (const QString &vMacAddress); + void didPOSTWirelessData (const QString &vMacAddress); + void didPOSTBluetoothData (const QString &vMacAddress); + void didPOSTCloudSyncData (const QString &vNetAddress); - void onUSBDriveUmount(); + /*! + * \brief didCryptSetupMount + * \details will be emitted when decrypting the configuration partition is. + * to notify the ApplicationController to call initSettings + */ + void didCryptSetupMount ( bool vPass ); - void onWatchFileChanged(const QString &vFile); +private: + // ----- USB + void usbCheck (); + void usbError (const QString &vDevice ); + void usbMountReq(const QString &vDevice, bool vIsMount = true ); + void usbMount (const QString &vDevice ); + void usbUmount (const QString &vDevice ); + void usbRemove (); - // ----- SDCard void sdcardSpaceCheck(); + void usbSpaceCheck(); - // ----- USBDrive - void usbSpaceCheck(); - SAFE_CALL_EX(doAddWatch, const QString &) }; }