Index: sources/storage/DriveWatcher.h =================================================================== diff -u -rb5238b7e7b9973a54a0402f4d6d609989a76629f -r84c5373209a1a488c00917995f5553d442d159a4 --- sources/storage/DriveWatcher.h (.../DriveWatcher.h) (revision b5238b7e7b9973a54a0402f4d6d609989a76629f) +++ sources/storage/DriveWatcher.h (.../DriveWatcher.h) (revision 84c5373209a1a488c00917995f5553d442d159a4) @@ -2,13 +2,14 @@ * * Copyright (c) 2019-2020 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. + * 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 DriveWatcher.h - * \date 12/31/2019 - * \author Behrouz NematiPour + * \file DriveWatcher.h + * \author (last) Behrouz NematiPour + * \date (last) 25-Aug-2020 + * \author (original) Behrouz NemaiPour + * \date (original) 17-Jul-2020 * */ #pragma once @@ -17,8 +18,8 @@ #include // Project -#include "main.h" -#include "threads.h" +#include "main.h" // Doxygen : don't remove +#include "Threads.h" // Define #define _DriveWatcher Storage::DriveWatcher::I() @@ -30,14 +31,24 @@ /*! * \brief The DriveWatcher class - * \details This class is to watch the USB device to be mounted if plugged in - * or to be unmounted if user through UI requests it. - * and will notify UI (user) on mounted and removed(No USB drive exists). + * \details This class is watching for the USB and SD-Card drives in Linux file system. + * It has the interval of 1000 ms and will look if any device between /dev/sda1 to /dev/sdz1 exists then will mount it in /media/usb, + * and does check if the SD-Card has been mounted under /media/sdcard, + * but for SD-Card doesn't try to mount it and it has to be mounted prior to UI Application start + * and that's because from UI Application perspective it is not a removable/hot-plug device (although physically it is). + * This class works in its own thread and will send notification by emitting signals about the USB device status + * which are Mounted, Unmounted, Removed + * and SD-Card space conditions changes. + * \note : 'Removed' is when no USB device present. + * */ class DriveWatcher : public QObject { Q_OBJECT + // Singleton + SINGLETON(DriveWatcher) + // friends friend class ::tst_initializations; @@ -52,9 +63,6 @@ QThread *_thread = nullptr; bool _init = false; -// Singleton -SINGLETON(DriveWatcher) - public slots: bool init(); bool init(QThread &vThread); @@ -111,12 +119,12 @@ /*! * \brief didSDCardStateChange - * \details If sdcard state changes like removed or is not present this signal will emit. + * \details If SDCard state changes like removed or is not present this signal will emit. */ void didSDCardStateChange(bool vIsReady, bool vIsReadOnly); private slots: - // ----- usb + // ----- USB void usbCheck(); bool usbMount (const QString &vDevice); @@ -126,7 +134,7 @@ void onUSBDriveUmount(); - // ----- sdcard + // ----- SDCard void sdcardSpaceCheck(); }; }