/*! * * 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. * * \file CloudSyncController.h * \author (last) Behrouz NematiPour * \author (original) Behrouz NematiPour * \date (last) 13-Oct-2021 * \date (original) 13-Oct-2021 * */ #pragma once // Qt #include #include #include // Project #include "main.h" // Doxygen : do not remove #include "GuiController.h" // define #define _CloudSyncController CloudSyncController::I() // forward declarations class tst_initializations; // namespace /*! * \brief The CloudSyncController class * \details Singleton class which is the main gateway of CloudSync signal/slots. */ class CloudSyncController : public QObject { Q_OBJECT // Singleton SINGLETON(CloudSyncController) // friends friend class ::tst_initializations; QThread *_thread = nullptr; bool _init = false; const int _interval = 1000; // 1s const QString _location = QString(Storage::SDCard_Base_Path_Name) + "cloudsync/"; const char* _out_File = "out.buf"; // The base file name : CloudSync puts its output to this file const char* _inp_File = "inp.buf"; // The base file name : UI Software puts the input data for the CloudSync in this file QString _date_out_File = ""; // The dated/actual filename : CloudSync puts its output to this file QString _date_inp_File = ""; // The dated/actual filename : UI Software puts the input data for the CloudSync in this file QDateTime _datetime ; QString _dateFormatted ; QString _timeFormatted ; const char* _dateFormat = "yyyy_MM_dd" ; // date used in the file name const char* _timeFormat = "HH:mm:ss.zzz"; // timestamp in the file const char _dateSeparator = '_'; // used in filename const char _separator = ','; quint64 _seq = 0; protected: void timerEvent(QTimerEvent *event) override; public slots: bool init(); bool init(QThread &vThread); private slots: void quit(); void onWatchFileChange (const QString &vFile); void onActionReceive (GuiActionType vAction, const QVariantList &vData); private: void initConnections(); void initThread(QThread &vThread); void quitThread(); void checkDate(); void addCSBuffWatch(); bool interpreter(const QString &vContent); // this function may later need to be a class. bool sendUIBuff (const QString &vData); };