Commit fb6a9d75eece15bcbe19f272311df4d08d878b19
Exists in
master
Merge branch 'master' of https://github.com/lightbase/cacic-agente
Showing
6 changed files
with
25 additions
and
8 deletions
Show diff stats
cacic-daemon/cacicD/cacicD.pro
@@ -32,7 +32,8 @@ SOURCES += main.cpp \ | @@ -32,7 +32,8 @@ SOURCES += main.cpp \ | ||
32 | ../../src/wmi.cpp \ | 32 | ../../src/wmi.cpp \ |
33 | ../../src/cacic_computer.cpp \ | 33 | ../../src/cacic_computer.cpp \ |
34 | ../../src/operatingsystem.cpp \ | 34 | ../../src/operatingsystem.cpp \ |
35 | - ../../src/QLogger.cpp | 35 | + ../../src/QLogger.cpp \ |
36 | + ../../src/checkmodules.cpp | ||
36 | 37 | ||
37 | 38 | ||
38 | HEADERS += cacicd.h \ | 39 | HEADERS += cacicd.h \ |
@@ -43,7 +44,8 @@ HEADERS += cacicd.h \ | @@ -43,7 +44,8 @@ HEADERS += cacicd.h \ | ||
43 | ../../src/cacic_computer.h \ | 44 | ../../src/cacic_computer.h \ |
44 | ../../src/operatingsystem.h \ | 45 | ../../src/operatingsystem.h \ |
45 | ../../src/cacic_comm.h \ | 46 | ../../src/cacic_comm.h \ |
46 | - ../../src/QLogger.h | 47 | + ../../src/QLogger.h \ |
48 | + ../../src/checkmodules.h | ||
47 | 49 | ||
48 | include(../../src/qtservice/src/qtservice.pri) | 50 | include(../../src/qtservice/src/qtservice.pri) |
49 | 51 |
cacic-daemon/cacicD/cacictimer.cpp
@@ -13,6 +13,7 @@ CacicTimer::~CacicTimer() | @@ -13,6 +13,7 @@ CacicTimer::~CacicTimer() | ||
13 | delete logManager; | 13 | delete logManager; |
14 | delete ccacic; | 14 | delete ccacic; |
15 | delete OCacicComm; | 15 | delete OCacicComm; |
16 | + delete checkModules; | ||
16 | } | 17 | } |
17 | 18 | ||
18 | void CacicTimer::reiniciarTimer(){ | 19 | void CacicTimer::reiniciarTimer(){ |
@@ -58,6 +59,10 @@ void CacicTimer::mslot(){ | @@ -58,6 +59,10 @@ void CacicTimer::mslot(){ | ||
58 | // QStringList nomesModulos = verificarModulos(); | 59 | // QStringList nomesModulos = verificarModulos(); |
59 | // if ( !nomesModulos.empty() ) { | 60 | // if ( !nomesModulos.empty() ) { |
60 | // foreach( QString nome, nomesModulos ) { | 61 | // foreach( QString nome, nomesModulos ) { |
62 | + | ||
63 | + checkModules = new CheckModules(this->applicationDirPath); | ||
64 | + checkModules->start(); | ||
65 | + | ||
61 | QString nome = "gercols"; | 66 | QString nome = "gercols"; |
62 | definirDirModulo(getApplicationDirPath(), nome); | 67 | definirDirModulo(getApplicationDirPath(), nome); |
63 | cacicthread->setCcacic(ccacic); | 68 | cacicthread->setCcacic(ccacic); |
@@ -66,6 +71,7 @@ void CacicTimer::mslot(){ | @@ -66,6 +71,7 @@ void CacicTimer::mslot(){ | ||
66 | cacicthread->setCMutex(cMutex); | 71 | cacicthread->setCMutex(cMutex); |
67 | cacicthread->setModuloDirPath(getDirProgram()); | 72 | cacicthread->setModuloDirPath(getDirProgram()); |
68 | cacicthread->start(QThread::NormalPriority); | 73 | cacicthread->start(QThread::NormalPriority); |
74 | + | ||
69 | }else{ | 75 | }else{ |
70 | QLogger::QLog_Error("Cacic Daemon (Timer)", "Falha na obtenção do arquivo de configuração."); | 76 | QLogger::QLog_Error("Cacic Daemon (Timer)", "Falha na obtenção do arquivo de configuração."); |
71 | } | 77 | } |
@@ -184,6 +190,7 @@ void CacicTimer::iniciarInstancias(){ | @@ -184,6 +190,7 @@ void CacicTimer::iniciarInstancias(){ | ||
184 | OCacicComm->setUrlGerente("teste.cacic.cc"); | 190 | OCacicComm->setUrlGerente("teste.cacic.cc"); |
185 | OCacicComm->setUsuario("cacic"); | 191 | OCacicComm->setUsuario("cacic"); |
186 | OCacicComm->setPassword("cacic123"); | 192 | OCacicComm->setPassword("cacic123"); |
193 | + | ||
187 | } | 194 | } |
188 | 195 | ||
189 | void CacicTimer::verificarPeriodicidadeJson() | 196 | void CacicTimer::verificarPeriodicidadeJson() |
cacic-daemon/cacicD/cacictimer.h
@@ -13,6 +13,7 @@ | @@ -13,6 +13,7 @@ | ||
13 | #include "cacic_computer.h" | 13 | #include "cacic_computer.h" |
14 | #include "QLogger.h" | 14 | #include "QLogger.h" |
15 | #include "cacicthread.h" | 15 | #include "cacicthread.h" |
16 | +#include "checkmodules.h" | ||
16 | 17 | ||
17 | class CacicTimer : public QObject | 18 | class CacicTimer : public QObject |
18 | { | 19 | { |
@@ -37,18 +38,20 @@ private: | @@ -37,18 +38,20 @@ private: | ||
37 | bool verificarEIniciarQMutex(); | 38 | bool verificarEIniciarQMutex(); |
38 | QStringList verificarModulos(); | 39 | QStringList verificarModulos(); |
39 | void reiniciarTimer(); | 40 | void reiniciarTimer(); |
40 | - QLogger::QLoggerManager *logManager; | ||
41 | - CacicThread *cacicthread; | ||
42 | - QString dirProgram; | ||
43 | - QString applicationDirPath; | ||
44 | QString getDirProgram() const; | 41 | QString getDirProgram() const; |
45 | void iniciarInstancias(); | 42 | void iniciarInstancias(); |
46 | void verificarPeriodicidadeJson(); | 43 | void verificarPeriodicidadeJson(); |
47 | void lerArquivoConfig( const QJsonObject &jsonConfig); | 44 | void lerArquivoConfig( const QJsonObject &jsonConfig); |
48 | void definirDirModulo(QString appDirPath, QString nome); | 45 | void definirDirModulo(QString appDirPath, QString nome); |
46 | + int getPeriodicidadeExecucao() const; | ||
47 | + | ||
48 | + QLogger::QLoggerManager *logManager; | ||
49 | + CacicThread *cacicthread; | ||
50 | + CheckModules *checkModules; | ||
51 | + QString dirProgram; | ||
52 | + QString applicationDirPath; | ||
49 | QJsonObject jsonConfig; | 53 | QJsonObject jsonConfig; |
50 | int periodicidadeExecucao = 14400; // 4*3600. Tempo default de execução. | 54 | int periodicidadeExecucao = 14400; // 4*3600. Tempo default de execução. |
51 | - int getPeriodicidadeExecucao() const; | ||
52 | 55 | ||
53 | private slots: | 56 | private slots: |
54 | void mslot(); | 57 | void mslot(); |
install-cacic/installcacic.cpp
@@ -121,7 +121,7 @@ void InstallCacic::run(QStringList argv, int argc) { | @@ -121,7 +121,7 @@ void InstallCacic::run(QStringList argv, int argc) { | ||
121 | } else { | 121 | } else { |
122 | std::cout << "\nInstalador do Agente Cacic.\n\n" | 122 | std::cout << "\nInstalador do Agente Cacic.\n\n" |
123 | << "Parametros incorretos. (<obrigatorios> [opcional])\n\n" | 123 | << "Parametros incorretos. (<obrigatorios> [opcional])\n\n" |
124 | - << "<-host=url_gerente> <-user=usuario> <-password=senha> [-help]\n\n" | 124 | + << "<-host=url_gerente> <-user=usuario> <-pass=senha> [-help]\n\n" |
125 | << " <-host=url_gerente> url_gerente: Caminho para a aplicação do gerente.\n" | 125 | << " <-host=url_gerente> url_gerente: Caminho para a aplicação do gerente.\n" |
126 | << " <-user=usuario> usuario: usuário de login no gerente.\n" | 126 | << " <-user=usuario> usuario: usuário de login no gerente.\n" |
127 | << " <-pass=senha> senha: senha de login no gerente\n" | 127 | << " <-pass=senha> senha: senha de login no gerente\n" |
src/checkmodules.cpp
@@ -26,6 +26,10 @@ CheckModules::CheckModules(const QString &workingPath) | @@ -26,6 +26,10 @@ CheckModules::CheckModules(const QString &workingPath) | ||
26 | } | 26 | } |
27 | } | 27 | } |
28 | 28 | ||
29 | +QVariantMap CheckModules::getModules() const { | ||
30 | + return modules; | ||
31 | +} | ||
32 | + | ||
29 | bool CheckModules::start(){ | 33 | bool CheckModules::start(){ |
30 | if (!modules.isEmpty()){ | 34 | if (!modules.isEmpty()){ |
31 | QVariantMap::const_iterator i = modules.constBegin(); | 35 | QVariantMap::const_iterator i = modules.constBegin(); |
src/checkmodules.h
@@ -11,6 +11,7 @@ public: | @@ -11,6 +11,7 @@ public: | ||
11 | CheckModules(const QString &workingPath); | 11 | CheckModules(const QString &workingPath); |
12 | // QStringList verificaModulos(); | 12 | // QStringList verificaModulos(); |
13 | bool start(); | 13 | bool start(); |
14 | + QVariantMap getModules() const; | ||
14 | private: | 15 | private: |
15 | CCacic oCacic; | 16 | CCacic oCacic; |
16 | CacicComm oCacicComm; | 17 | CacicComm oCacicComm; |