Commit e513f2d39538f691974cf4e827b89d7e3b33ea36

Authored by LightBase Consultoria em Software Publico
2 parents 6f49ab5e 27a176d1
Exists in master

Merge branch 'master' of https://github.com/lightbase/cacic-agente

Conflicts:
	cacic-daemon/cacicD/cacicD.pro
	cacic-daemon/cacicD/cacicD.pro.user
cacic-controller/cacic-controller.pro
@@ -1,19 +0,0 @@ @@ -1,19 +0,0 @@
1 -#-------------------------------------------------  
2 -#  
3 -# Project created by QtCreator 2014-09-02T09:30:56  
4 -#  
5 -#-------------------------------------------------  
6 -  
7 -QT += core  
8 -  
9 -QT -= gui  
10 -  
11 -TARGET = cacic-controller  
12 -CONFIG += console  
13 -CONFIG -= app_bundle  
14 -  
15 -TEMPLATE = app  
16 -  
17 -  
18 -SOURCES += main.cpp  
19 -include(../src/qtservice/src/qtservice.pri)  
cacic-controller/cacic-controller.pro.user
@@ -1,267 +0,0 @@ @@ -1,267 +0,0 @@
1 -<?xml version="1.0" encoding="UTF-8"?>  
2 -<!DOCTYPE QtCreatorProject>  
3 -<!-- Written by QtCreator 3.2.0, 2014-09-02T12:19:04. -->  
4 -<qtcreator>  
5 - <data>  
6 - <variable>EnvironmentId</variable>  
7 - <value type="QByteArray">{6923937e-3382-40eb-9eb3-825260fc7246}</value>  
8 - </data>  
9 - <data>  
10 - <variable>ProjectExplorer.Project.ActiveTarget</variable>  
11 - <value type="int">0</value>  
12 - </data>  
13 - <data>  
14 - <variable>ProjectExplorer.Project.EditorSettings</variable>  
15 - <valuemap type="QVariantMap">  
16 - <value type="bool" key="EditorConfiguration.AutoIndent">true</value>  
17 - <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>  
18 - <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>  
19 - <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">  
20 - <value type="QString" key="language">Cpp</value>  
21 - <valuemap type="QVariantMap" key="value">  
22 - <value type="QByteArray" key="CurrentPreferences">CppGlobal</value>  
23 - </valuemap>  
24 - </valuemap>  
25 - <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">  
26 - <value type="QString" key="language">QmlJS</value>  
27 - <valuemap type="QVariantMap" key="value">  
28 - <value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>  
29 - </valuemap>  
30 - </valuemap>  
31 - <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>  
32 - <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>  
33 - <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>  
34 - <value type="int" key="EditorConfiguration.IndentSize">4</value>  
35 - <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>  
36 - <value type="int" key="EditorConfiguration.MarginColumn">80</value>  
37 - <value type="bool" key="EditorConfiguration.MouseHiding">true</value>  
38 - <value type="bool" key="EditorConfiguration.MouseNavigation">true</value>  
39 - <value type="int" key="EditorConfiguration.PaddingMode">1</value>  
40 - <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>  
41 - <value type="bool" key="EditorConfiguration.ShowMargin">false</value>  
42 - <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>  
43 - <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>  
44 - <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>  
45 - <value type="int" key="EditorConfiguration.TabSize">8</value>  
46 - <value type="bool" key="EditorConfiguration.UseGlobal">true</value>  
47 - <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>  
48 - <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>  
49 - <value type="bool" key="EditorConfiguration.cleanIndentation">true</value>  
50 - <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>  
51 - <value type="bool" key="EditorConfiguration.inEntireDocument">false</value>  
52 - </valuemap>  
53 - </data>  
54 - <data>  
55 - <variable>ProjectExplorer.Project.PluginSettings</variable>  
56 - <valuemap type="QVariantMap"/>  
57 - </data>  
58 - <data>  
59 - <variable>ProjectExplorer.Project.Target.0</variable>  
60 - <valuemap type="QVariantMap">  
61 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value>  
62 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value>  
63 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{ee9c574b-e4fe-4328-9914-eb06b7267a22}</value>  
64 - <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>  
65 - <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>  
66 - <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>  
67 - <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">  
68 - <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/thiroc80/lightbase/build-cacic-controller-Desktop-Debug</value>  
69 - <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">  
70 - <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">  
71 - <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>  
72 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>  
73 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>  
74 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>  
75 - <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>  
76 - <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>  
77 - <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>  
78 - <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>  
79 - </valuemap>  
80 - <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">  
81 - <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>  
82 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>  
83 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>  
84 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>  
85 - <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">  
86 - <value type="QString">-w</value>  
87 - <value type="QString">-r</value>  
88 - </valuelist>  
89 - <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>  
90 - <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>  
91 - <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>  
92 - </valuemap>  
93 - <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>  
94 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>  
95 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>  
96 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>  
97 - </valuemap>  
98 - <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">  
99 - <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">  
100 - <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>  
101 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>  
102 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>  
103 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>  
104 - <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">  
105 - <value type="QString">-w</value>  
106 - <value type="QString">-r</value>  
107 - </valuelist>  
108 - <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>  
109 - <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>  
110 - <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>  
111 - </valuemap>  
112 - <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>  
113 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>  
114 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>  
115 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>  
116 - </valuemap>  
117 - <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>  
118 - <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>  
119 - <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>  
120 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Debug</value>  
121 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>  
122 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>  
123 - <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>  
124 - <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>  
125 - </valuemap>  
126 - <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">  
127 - <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/thiroc80/lightbase/build-cacic-controller-Desktop-Release</value>  
128 - <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">  
129 - <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">  
130 - <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>  
131 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>  
132 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>  
133 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>  
134 - <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>  
135 - <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>  
136 - <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>  
137 - <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>  
138 - </valuemap>  
139 - <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">  
140 - <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>  
141 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>  
142 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>  
143 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>  
144 - <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">  
145 - <value type="QString">-w</value>  
146 - <value type="QString">-r</value>  
147 - </valuelist>  
148 - <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>  
149 - <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>  
150 - <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>  
151 - </valuemap>  
152 - <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>  
153 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>  
154 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>  
155 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>  
156 - </valuemap>  
157 - <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">  
158 - <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">  
159 - <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>  
160 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>  
161 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>  
162 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>  
163 - <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">  
164 - <value type="QString">-w</value>  
165 - <value type="QString">-r</value>  
166 - </valuelist>  
167 - <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>  
168 - <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>  
169 - <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>  
170 - </valuemap>  
171 - <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>  
172 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>  
173 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>  
174 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>  
175 - </valuemap>  
176 - <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>  
177 - <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>  
178 - <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>  
179 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>  
180 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>  
181 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>  
182 - <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>  
183 - <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>  
184 - </valuemap>  
185 - <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value>  
186 - <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">  
187 - <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">  
188 - <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>  
189 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>  
190 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>  
191 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>  
192 - </valuemap>  
193 - <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>  
194 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value>  
195 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>  
196 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>  
197 - </valuemap>  
198 - <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>  
199 - <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>  
200 - <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">  
201 - <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>  
202 - <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>  
203 - <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>  
204 - <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>  
205 - <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>  
206 - <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>  
207 - <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>  
208 - <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>  
209 - <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>  
210 - <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>  
211 - <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>  
212 - <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>  
213 - <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>  
214 - <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>  
215 - <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>  
216 - <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>  
217 - <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>  
218 - <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">  
219 - <value type="int">0</value>  
220 - <value type="int">1</value>  
221 - <value type="int">2</value>  
222 - <value type="int">3</value>  
223 - <value type="int">4</value>  
224 - <value type="int">5</value>  
225 - <value type="int">6</value>  
226 - <value type="int">7</value>  
227 - <value type="int">8</value>  
228 - <value type="int">9</value>  
229 - <value type="int">10</value>  
230 - <value type="int">11</value>  
231 - <value type="int">12</value>  
232 - <value type="int">13</value>  
233 - <value type="int">14</value>  
234 - </valuelist>  
235 - <value type="int" key="PE.EnvironmentAspect.Base">2</value>  
236 - <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>  
237 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">cacic-controller</value>  
238 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>  
239 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/home/thiroc80/lightbase/cacic-controller/cacic-controller.pro</value>  
240 - <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>  
241 - <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">cacic-controller.pro</value>  
242 - <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>  
243 - <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value>  
244 - <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>  
245 - <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>  
246 - <value type="bool" key="RunConfiguration.UseCppDebugger">false</value>  
247 - <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>  
248 - <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>  
249 - <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>  
250 - <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>  
251 - </valuemap>  
252 - <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>  
253 - </valuemap>  
254 - </data>  
255 - <data>  
256 - <variable>ProjectExplorer.Project.TargetCount</variable>  
257 - <value type="int">1</value>  
258 - </data>  
259 - <data>  
260 - <variable>ProjectExplorer.Project.Updater.FileVersion</variable>  
261 - <value type="int">16</value>  
262 - </data>  
263 - <data>  
264 - <variable>Version</variable>  
265 - <value type="int">16</value>  
266 - </data>  
267 -</qtcreator>  
cacic-controller/main.cpp
@@ -1,117 +0,0 @@ @@ -1,117 +0,0 @@
1 -#include <QStringList>  
2 -#include <QDir>  
3 -#include <QSettings>  
4 -#include "qtservice.h"  
5 -int processArgs(int argc, char **argv)  
6 -{  
7 - if (argc > 2) {  
8 - QString arg1(argv[1]);  
9 - if (arg1 == QLatin1String("-i") ||  
10 - arg1 == QLatin1String("-install")) {  
11 - if (argc > 2) {  
12 - QString account;  
13 - QString password;  
14 - QString path(argv[2]);  
15 - if (argc > 3)  
16 - account = argv[3];  
17 - if (argc > 4)  
18 - password = argv[4];  
19 - printf("The service %s installed.\n",  
20 - (QtServiceController::install(path, account, password) ? "was" : "was not"));  
21 - return 0;  
22 - }  
23 - } else {  
24 - QString serviceName(argv[1]);  
25 - QtServiceController controller(serviceName);  
26 - QString option(argv[2]);  
27 - if (option == QLatin1String("-u") ||  
28 - option == QLatin1String("-uninstall")) {  
29 - printf("The service \"%s\" %s uninstalled.\n",  
30 - controller.serviceName().toLatin1().constData(),  
31 - (controller.uninstall() ? "was" : "was not"));  
32 - return 0;  
33 - } else if (option == QLatin1String("-s") ||  
34 - option == QLatin1String("-start")) {  
35 - QStringList args;  
36 - for (int i = 3; i < argc; ++i)  
37 - args.append(QString::fromLocal8Bit(argv[i]));  
38 - printf("The service \"%s\" %s started.\n",  
39 - controller.serviceName().toLatin1().constData(),  
40 - (controller.start(args) ? "was" : "was not"));  
41 - return 0;  
42 - } else if (option == QLatin1String("-t") ||  
43 - option == QLatin1String("-terminate")) {  
44 - printf("The service \"%s\" %s stopped.\n",  
45 - controller.serviceName().toLatin1().constData(),  
46 - (controller.stop() ? "was" : "was not"));  
47 - return 0;  
48 - } else if (option == QLatin1String("-p") ||  
49 - option == QLatin1String("-pause")) {  
50 - printf("The service \"%s\" %s paused.\n",  
51 - controller.serviceName().toLatin1().constData(),  
52 - (controller.pause() ? "was" : "was not"));  
53 - return 0;  
54 - } else if (option == QLatin1String("-r") ||  
55 - option == QLatin1String("-resume")) {  
56 - printf("The service \"%s\" %s resumed.\n",  
57 - controller.serviceName().toLatin1().constData(),  
58 - (controller.resume() ? "was" : "was not"));  
59 - return 0;  
60 - } else if (option == QLatin1String("-c") ||  
61 - option == QLatin1String("-command")) {  
62 - if (argc > 3) {  
63 - QString codestr(argv[3]);  
64 - int code = codestr.toInt();  
65 - printf("The command %s sent to the service \"%s\".\n",  
66 - (controller.sendCommand(code) ? "was" : "was not"),  
67 - controller.serviceName().toLatin1().constData());  
68 - return 0;  
69 - }  
70 - } else if (option == QLatin1String("-v") ||  
71 - option == QLatin1String("-version")) {  
72 - bool installed = controller.isInstalled();  
73 - printf("The service\n"  
74 - "\t\"%s\"\n\n", controller.serviceName().toLatin1().constData());  
75 - printf("is %s", (installed ? "installed" : "not installed"));  
76 - printf(" and %s\n\n", (controller.isRunning() ? "running" : "not running"));  
77 - if (installed) {  
78 - printf("path: %s\n", controller.serviceFilePath().toLatin1().data());  
79 - printf("description: %s\n", controller.serviceDescription().toLatin1().data());  
80 - printf("startup: %s\n", controller.startupType() == QtServiceController::AutoStartup ? "Auto" : "Manual");  
81 - }  
82 - return 0;  
83 - }  
84 - }  
85 - }  
86 - printf("cacic-controller [-i PATH | SERVICE_NAME [-v | -u | -s | -t | -p | -r | -c CODE] | -h] [-w]\n\n"  
87 - "\t-i(nstall) PATH\t: Install the service\n"  
88 - "\t-v(ersion)\t: Print status of the service\n"  
89 - "\t-u(ninstall)\t: Uninstall the service\n"  
90 - "\t-s(tart)\t: Start the service\n"  
91 - "\t-t(erminate)\t: Stop the service\n"  
92 - "\t-p(ause)\t: Pause the service\n"  
93 - "\t-r(esume)\t: Resume the service\n"  
94 - "\t-c(ommand) CODE\t: Send a command to the service\n"  
95 - "\t-h(elp)\t\t: Print this help info\n"  
96 - "\t-w(ait)\t\t: Wait for keypress when done\n");  
97 - return 0;  
98 -}  
99 -int main(int argc, char **argv)  
100 -{  
101 -#if !defined(Q_OS_WIN)  
102 - // QtService stores service settings in SystemScope, which normally require root privileges.  
103 - // To allow testing this example as non-root, we change the directory of the SystemScope settings file.  
104 - QSettings::setPath(QSettings::NativeFormat, QSettings::SystemScope, QDir::tempPath());  
105 - qWarning("(Example uses dummy settings file: %s/QtSoftware.conf)", QDir::tempPath().toLatin1().constData());  
106 -#endif  
107 - int result = processArgs(argc, argv);  
108 - if (QString::fromLocal8Bit(argv[argc-1]) == QLatin1String("-w") ||  
109 - QString::fromLocal8Bit(argv[argc-1]) == QLatin1String("-wait")) {  
110 - printf("\nPress Enter to continue...");  
111 - QFile input;  
112 - input.open(stdin, QIODevice::ReadOnly);  
113 - input.readLine();  
114 - printf("\n");  
115 - }  
116 - return result;  
117 -}  
cacic-daemon/cacic-controller/cacic-controller.pro 0 → 100644
@@ -0,0 +1,19 @@ @@ -0,0 +1,19 @@
  1 +#-------------------------------------------------
  2 +#
  3 +# Project created by QtCreator 2014-09-02T09:30:56
  4 +#
  5 +#-------------------------------------------------
  6 +
  7 +QT += core
  8 +
  9 +QT -= gui
  10 +
  11 +TARGET = cacic-daemon
  12 +CONFIG += console
  13 +CONFIG -= app_bundle
  14 +
  15 +TEMPLATE = app
  16 +
  17 +
  18 +SOURCES += main.cpp
  19 +include(../../src/qtservice/src/qtservice.pri)
cacic-daemon/cacic-controller/cacic-controller.pro.user 0 → 100644
@@ -0,0 +1,267 @@ @@ -0,0 +1,267 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE QtCreatorProject>
  3 +<!-- Written by QtCreator 3.2.0, 2014-09-08T10:21:55. -->
  4 +<qtcreator>
  5 + <data>
  6 + <variable>EnvironmentId</variable>
  7 + <value type="QByteArray">{6923937e-3382-40eb-9eb3-825260fc7246}</value>
  8 + </data>
  9 + <data>
  10 + <variable>ProjectExplorer.Project.ActiveTarget</variable>
  11 + <value type="int">0</value>
  12 + </data>
  13 + <data>
  14 + <variable>ProjectExplorer.Project.EditorSettings</variable>
  15 + <valuemap type="QVariantMap">
  16 + <value type="bool" key="EditorConfiguration.AutoIndent">true</value>
  17 + <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
  18 + <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
  19 + <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
  20 + <value type="QString" key="language">Cpp</value>
  21 + <valuemap type="QVariantMap" key="value">
  22 + <value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
  23 + </valuemap>
  24 + </valuemap>
  25 + <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
  26 + <value type="QString" key="language">QmlJS</value>
  27 + <valuemap type="QVariantMap" key="value">
  28 + <value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
  29 + </valuemap>
  30 + </valuemap>
  31 + <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
  32 + <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
  33 + <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
  34 + <value type="int" key="EditorConfiguration.IndentSize">4</value>
  35 + <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
  36 + <value type="int" key="EditorConfiguration.MarginColumn">80</value>
  37 + <value type="bool" key="EditorConfiguration.MouseHiding">true</value>
  38 + <value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
  39 + <value type="int" key="EditorConfiguration.PaddingMode">1</value>
  40 + <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
  41 + <value type="bool" key="EditorConfiguration.ShowMargin">false</value>
  42 + <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
  43 + <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
  44 + <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
  45 + <value type="int" key="EditorConfiguration.TabSize">8</value>
  46 + <value type="bool" key="EditorConfiguration.UseGlobal">true</value>
  47 + <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
  48 + <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
  49 + <value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
  50 + <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
  51 + <value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
  52 + </valuemap>
  53 + </data>
  54 + <data>
  55 + <variable>ProjectExplorer.Project.PluginSettings</variable>
  56 + <valuemap type="QVariantMap"/>
  57 + </data>
  58 + <data>
  59 + <variable>ProjectExplorer.Project.Target.0</variable>
  60 + <valuemap type="QVariantMap">
  61 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value>
  62 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value>
  63 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{ee9c574b-e4fe-4328-9914-eb06b7267a22}</value>
  64 + <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
  65 + <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
  66 + <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
  67 + <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
  68 + <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/thiroc80/lightbase/cacic-agente/build-cacic-daemon-Desktop-Debug</value>
  69 + <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
  70 + <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
  71 + <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
  72 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
  73 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
  74 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
  75 + <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
  76 + <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
  77 + <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
  78 + <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
  79 + </valuemap>
  80 + <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
  81 + <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
  82 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
  83 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
  84 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
  85 + <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
  86 + <value type="QString">-w</value>
  87 + <value type="QString">-r</value>
  88 + </valuelist>
  89 + <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
  90 + <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
  91 + <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
  92 + </valuemap>
  93 + <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
  94 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
  95 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
  96 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
  97 + </valuemap>
  98 + <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
  99 + <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
  100 + <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
  101 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
  102 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
  103 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
  104 + <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
  105 + <value type="QString">-w</value>
  106 + <value type="QString">-r</value>
  107 + </valuelist>
  108 + <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
  109 + <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
  110 + <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
  111 + </valuemap>
  112 + <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
  113 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
  114 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
  115 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
  116 + </valuemap>
  117 + <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
  118 + <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
  119 + <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
  120 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Debug</value>
  121 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
  122 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
  123 + <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
  124 + <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
  125 + </valuemap>
  126 + <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
  127 + <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/thiroc80/lightbase/build-cacic-controller-Desktop-Release</value>
  128 + <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
  129 + <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
  130 + <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
  131 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
  132 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
  133 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
  134 + <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
  135 + <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
  136 + <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
  137 + <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
  138 + </valuemap>
  139 + <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
  140 + <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
  141 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
  142 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
  143 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
  144 + <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
  145 + <value type="QString">-w</value>
  146 + <value type="QString">-r</value>
  147 + </valuelist>
  148 + <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
  149 + <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
  150 + <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
  151 + </valuemap>
  152 + <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
  153 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
  154 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
  155 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
  156 + </valuemap>
  157 + <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
  158 + <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
  159 + <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
  160 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
  161 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
  162 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
  163 + <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
  164 + <value type="QString">-w</value>
  165 + <value type="QString">-r</value>
  166 + </valuelist>
  167 + <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
  168 + <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
  169 + <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
  170 + </valuemap>
  171 + <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
  172 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
  173 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
  174 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
  175 + </valuemap>
  176 + <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
  177 + <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
  178 + <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
  179 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
  180 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
  181 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
  182 + <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
  183 + <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
  184 + </valuemap>
  185 + <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value>
  186 + <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
  187 + <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
  188 + <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
  189 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
  190 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
  191 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
  192 + </valuemap>
  193 + <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
  194 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value>
  195 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
  196 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
  197 + </valuemap>
  198 + <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
  199 + <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
  200 + <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
  201 + <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
  202 + <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
  203 + <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
  204 + <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
  205 + <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
  206 + <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
  207 + <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
  208 + <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
  209 + <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
  210 + <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
  211 + <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
  212 + <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
  213 + <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
  214 + <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
  215 + <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
  216 + <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
  217 + <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
  218 + <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
  219 + <value type="int">0</value>
  220 + <value type="int">1</value>
  221 + <value type="int">2</value>
  222 + <value type="int">3</value>
  223 + <value type="int">4</value>
  224 + <value type="int">5</value>
  225 + <value type="int">6</value>
  226 + <value type="int">7</value>
  227 + <value type="int">8</value>
  228 + <value type="int">9</value>
  229 + <value type="int">10</value>
  230 + <value type="int">11</value>
  231 + <value type="int">12</value>
  232 + <value type="int">13</value>
  233 + <value type="int">14</value>
  234 + </valuelist>
  235 + <value type="int" key="PE.EnvironmentAspect.Base">2</value>
  236 + <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
  237 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">cacic-controller</value>
  238 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
  239 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/home/thiroc80/lightbase/cacic-agente/cacic-daemon/cacic-controller/cacic-controller.pro</value>
  240 + <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
  241 + <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">cacic-controller.pro</value>
  242 + <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
  243 + <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value>
  244 + <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
  245 + <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
  246 + <value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
  247 + <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
  248 + <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
  249 + <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
  250 + <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
  251 + </valuemap>
  252 + <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
  253 + </valuemap>
  254 + </data>
  255 + <data>
  256 + <variable>ProjectExplorer.Project.TargetCount</variable>
  257 + <value type="int">1</value>
  258 + </data>
  259 + <data>
  260 + <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
  261 + <value type="int">16</value>
  262 + </data>
  263 + <data>
  264 + <variable>Version</variable>
  265 + <value type="int">16</value>
  266 + </data>
  267 +</qtcreator>
cacic-daemon/cacic-controller/main.cpp 0 → 100644
@@ -0,0 +1,126 @@ @@ -0,0 +1,126 @@
  1 +#include <QStringList>
  2 +#include <QDir>
  3 +#include <QSettings>
  4 +#include "qtservice.h"
  5 +int processArgs(int argc, char **argv)
  6 +{
  7 + if (argc > 1) {
  8 + QString arg1(argv[1]);
  9 + if (arg1 == QLatin1String("-i") ||
  10 + arg1 == QLatin1String("-install")) {
  11 +
  12 + QString path = "./cacic-service";
  13 + QFile daemonExec(path);
  14 + if( !daemonExec.exists() ) {
  15 + qCritical("Executável do serviço/daemon não encontrado.");
  16 + return 0;
  17 + }
  18 +
  19 + if (argc > 1) {
  20 + QString account;
  21 + QString password;
  22 +
  23 + if (argc > 2)
  24 + account = argv[2];
  25 + if (argc > 3)
  26 + password = argv[3];
  27 + printf("O serviço %s instalado.\n",
  28 + (QtServiceController::install(path, account, password) ? "foi" : "não foi"));
  29 + return 0;
  30 + }
  31 + } else {
  32 + QtServiceController controller("CacicDaemon");
  33 + QString option(argv[1]);
  34 + if (option == QLatin1String("-u") ||
  35 + option == QLatin1String("-uninstall")) {
  36 + printf("The service \"%s\" %s uninstalled.\n",
  37 + controller.serviceName().toLatin1().constData(),
  38 + (controller.uninstall() ? "was" : "was not"));
  39 + return 0;
  40 + } else if (option == QLatin1String("-s") ||
  41 + option == QLatin1String("-start")) {
  42 + QStringList args;
  43 + for (int i = 2; i < argc; ++i)
  44 + args.append(QString::fromLocal8Bit(argv[i]));
  45 + printf("O serviço \"%s\" %s iniciado.\n",
  46 + controller.serviceName().toLatin1().constData(),
  47 + (controller.start(args) ? "foi" : "não foi"));
  48 + return 0;
  49 + } else if (option == QLatin1String("-t") ||
  50 + option == QLatin1String("-terminate")) {
  51 + printf("O serviço \"%s\" %s terminado.\n",
  52 + controller.serviceName().toLatin1().constData(),
  53 + (controller.stop() ? "foi" : "não foi"));
  54 + return 0;
  55 + } else if (option == QLatin1String("-p") ||
  56 + option == QLatin1String("-pause")) {
  57 + printf("O serviço \"%s\" %s pausado.\n",
  58 + controller.serviceName().toLatin1().constData(),
  59 + (controller.pause() ? "foi" : "não foi"));
  60 + return 0;
  61 + } else if (option == QLatin1String("-r") ||
  62 + option == QLatin1String("-resume")) {
  63 + printf("O serviço \"%s\" %s resumido.\n",
  64 + controller.serviceName().toLatin1().constData(),
  65 + (controller.resume() ? "foi" : "não foi"));
  66 + return 0;
  67 + } else if (option == QLatin1String("-c") ||
  68 + option == QLatin1String("-command")) {
  69 + if (argc > 2) {
  70 + QString codestr(argv[2]);
  71 + int code = codestr.toInt();
  72 + printf("O comando %s enviado para o serviço \"%s\".\n",
  73 + (controller.sendCommand(code) ? "foi" : "não foi"),
  74 + controller.serviceName().toLatin1().constData());
  75 + return 0;
  76 + }
  77 + } else if (option == QLatin1String("-v") ||
  78 + option == QLatin1String("-version")) {
  79 + bool installed = controller.isInstalled();
  80 + printf("O serviço\n"
  81 + "\t\"%s\"\n\n", controller.serviceName().toLatin1().constData());
  82 + printf("está %s", (installed ? "instalado" : "não instalado"));
  83 + printf(" e %s\n\n", (controller.isRunning() ? "executando" : "não executando"));
  84 + if (installed) {
  85 + printf("caminho: %s\n", controller.serviceFilePath().toLatin1().data());
  86 + printf("descrição: %s\n", controller.serviceDescription().toLatin1().data());
  87 + printf("inicialização: %s\n", controller.startupType() == QtServiceController::AutoStartup ? "Auto" : "Manual");
  88 + }
  89 + return 0;
  90 + }
  91 + }
  92 + }
  93 + printf("cacic-daemon [-i | -v | -u | -s | -t | -p | -r | -c CODE | -h] [-w]\n\n"
  94 + "\t-i(nstall)\t: Instala o serviço\n"
  95 + "\t-v(ersion)\t: Imprime status do serviço\n"
  96 + "\t-u(ninstall)\t: Desinstala o serviço\n"
  97 + "\t-s(tart)\t: Inicia o serviço\n"
  98 + "\t-t(erminate)\t: Termina o serviço\n"
  99 + "\t-p(ause)\t: Pausa o serviço\n"
  100 + "\t-r(esume)\t: Resume o serviço\n"
  101 + "\t-c(ommand) CODE\t: Envia um comando CODE para o serviço\n"
  102 + "\t-h(elp)\t\t: Imprime este menu de ajuda\n"
  103 + "\t-w(ait)\t\t: Aguarda uma tecla ser pressionada ao terminar\n");
  104 + return 0;
  105 +}
  106 +int main(int argc, char **argv)
  107 +{
  108 +
  109 +#if !defined(Q_OS_WIN)
  110 + // QtService stores service settings in SystemScope, which normally require root privileges.
  111 + // To allow testing this example as non-root, we change the directory of the SystemScope settings file.
  112 + QSettings::setPath(QSettings::NativeFormat, QSettings::SystemScope, QDir::tempPath());
  113 + qWarning("(Example uses dummy settings file: %s/QtSoftware.conf)", QDir::tempPath().toLatin1().constData());
  114 +#endif
  115 +
  116 + int result = processArgs(argc, argv);
  117 + if (QString::fromLocal8Bit(argv[argc-1]) == QLatin1String("-w") ||
  118 + QString::fromLocal8Bit(argv[argc-1]) == QLatin1String("-wait")) {
  119 + printf("\nAperte Enter para continuar...");
  120 + QFile input;
  121 + input.open(stdin, QIODevice::ReadOnly);
  122 + input.readLine();
  123 + printf("\n");
  124 + }
  125 + return result;
  126 +}
cacic-daemon/cacicD/Readme.txt 0 → 100644
@@ -0,0 +1,6 @@ @@ -0,0 +1,6 @@
  1 +Para instalar um serviço no Windows:
  2 + ~$ sc create "CacicD" binPath= "C:\endereco\do\cacicd\CacicD.exe" start= auto
  3 +
  4 +Para instalar um serviço no Linux:
  5 + Usar o Upstart
  6 +
cacic-daemon/cacicD/cacicD.pro 0 → 100644
@@ -0,0 +1,39 @@ @@ -0,0 +1,39 @@
  1 +#-------------------------------------------------
  2 +#
  3 +# Project created by QtCreator 2014-08-18T11:06:08
  4 +#
  5 +#-------------------------------------------------
  6 +
  7 +QT += core
  8 +QT -= gui
  9 +QT += network
  10 +TARGET = cacic-service
  11 +CONFIG += console
  12 +CONFIG -= app_bundle
  13 +win32 {
  14 + LIBS += -LE:\LightBase\cacic-agente-project\cacic-agente\src\crypto++\lib -lcryptopp
  15 +} else {
  16 + LIBS += -L/usr/lib -lcryptopp
  17 +}
  18 +TEMPLATE = app
  19 +
  20 +
  21 +SOURCES += main.cpp \
  22 + ../../src/ccacic.cpp \
  23 + cacicd.cpp \
  24 + cacictimer.cpp
  25 + ../../src/cacic_computer.cpp \
  26 + ../../src/operatingsystem.cpp
  27 +
  28 +HEADERS += \
  29 + ../../src/ccacic.h \
  30 + cacicd.h \
  31 + ../../src/cacic_computer.h \
  32 + ../../src/operatingsystem.h \
  33 + ../../src/cacic_comm.h
  34 +
  35 +include(../../src/qtservice/src/qtservice.pri)
  36 +
  37 +INCLUDEPATH += ../../src \
  38 + ../../src/crypto++/include/
  39 +
cacic-daemon/cacicD/cacicD.pro.user 0 → 100644
@@ -0,0 +1,264 @@ @@ -0,0 +1,264 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE QtCreatorProject>
  3 +<!-- Written by QtCreator 3.1.2, 2014-09-03T15:17:46. -->
  4 +<!-- Written by QtCreator 3.2.0, 2014-09-08T10:21:57. -->
  5 +<qtcreator>
  6 + <data>
  7 + <variable>ProjectExplorer.Project.ActiveTarget</variable>
  8 + <value type="int">0</value>
  9 + </data>
  10 + <data>
  11 + <variable>ProjectExplorer.Project.EditorSettings</variable>
  12 + <valuemap type="QVariantMap">
  13 + <value type="bool" key="EditorConfiguration.AutoIndent">true</value>
  14 + <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
  15 + <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
  16 + <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
  17 + <value type="QString" key="language">Cpp</value>
  18 + <valuemap type="QVariantMap" key="value">
  19 + <value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
  20 + </valuemap>
  21 + </valuemap>
  22 + <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
  23 + <value type="QString" key="language">QmlJS</value>
  24 + <valuemap type="QVariantMap" key="value">
  25 + <value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
  26 + </valuemap>
  27 + </valuemap>
  28 + <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
  29 + <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
  30 + <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
  31 + <value type="int" key="EditorConfiguration.IndentSize">4</value>
  32 + <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
  33 + <value type="int" key="EditorConfiguration.MarginColumn">80</value>
  34 + <value type="bool" key="EditorConfiguration.MouseHiding">true</value>
  35 + <value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
  36 + <value type="int" key="EditorConfiguration.PaddingMode">1</value>
  37 + <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
  38 + <value type="bool" key="EditorConfiguration.ShowMargin">false</value>
  39 + <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
  40 + <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
  41 + <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
  42 + <value type="int" key="EditorConfiguration.TabSize">8</value>
  43 + <value type="bool" key="EditorConfiguration.UseGlobal">true</value>
  44 + <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
  45 + <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
  46 + <value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
  47 + <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
  48 + <value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
  49 + </valuemap>
  50 + </data>
  51 + <data>
  52 + <variable>ProjectExplorer.Project.PluginSettings</variable>
  53 + <valuemap type="QVariantMap"/>
  54 + </data>
  55 + <data>
  56 + <variable>ProjectExplorer.Project.Target.0</variable>
  57 + <valuemap type="QVariantMap">
  58 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.3 GCC 64bit</value>
  59 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.3 GCC 64bit</value>
  60 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.53.gcc_64_kit</value>
  61 + <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
  62 + <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
  63 + <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
  64 + <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
  65 + <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/lightbase/cacic-agente/build-cacic-service-Desktop_Qt_5_3_GCC_64bit-Debug</value>
  66 + <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
  67 + <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
  68 + <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
  69 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
  70 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
  71 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
  72 + <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
  73 + <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
  74 + <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
  75 + <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
  76 + </valuemap>
  77 + <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
  78 + <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
  79 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
  80 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
  81 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
  82 + <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
  83 + <value type="QString">-w</value>
  84 + <value type="QString">-r</value>
  85 + </valuelist>
  86 + <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
  87 + <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
  88 + <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
  89 + </valuemap>
  90 + <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
  91 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
  92 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
  93 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
  94 + </valuemap>
  95 + <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
  96 + <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
  97 + <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
  98 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
  99 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
  100 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
  101 + <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
  102 + <value type="QString">-w</value>
  103 + <value type="QString">-r</value>
  104 + </valuelist>
  105 + <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
  106 + <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
  107 + <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
  108 + </valuemap>
  109 + <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
  110 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
  111 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
  112 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
  113 + </valuemap>
  114 + <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
  115 + <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
  116 + <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
  117 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Debug</value>
  118 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
  119 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
  120 + <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
  121 + <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
  122 + </valuemap>
  123 + <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
  124 + <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/lightbase/cacic-agente/build-cacic-service-Desktop_Qt_5_3_GCC_64bit-Release</value>
  125 + <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
  126 + <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
  127 + <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
  128 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
  129 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
  130 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
  131 + <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
  132 + <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
  133 + <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
  134 + <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
  135 + </valuemap>
  136 + <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
  137 + <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
  138 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
  139 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
  140 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
  141 + <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
  142 + <value type="QString">-w</value>
  143 + <value type="QString">-r</value>
  144 + </valuelist>
  145 + <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
  146 + <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
  147 + <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
  148 + </valuemap>
  149 + <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
  150 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
  151 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
  152 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
  153 + </valuemap>
  154 + <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
  155 + <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
  156 + <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
  157 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
  158 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
  159 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
  160 + <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
  161 + <value type="QString">-w</value>
  162 + <value type="QString">-r</value>
  163 + </valuelist>
  164 + <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
  165 + <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
  166 + <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
  167 + </valuemap>
  168 + <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
  169 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
  170 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
  171 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
  172 + </valuemap>
  173 + <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
  174 + <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
  175 + <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
  176 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
  177 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
  178 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
  179 + <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
  180 + <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
  181 + </valuemap>
  182 + <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value>
  183 + <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
  184 + <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
  185 + <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
  186 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
  187 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
  188 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
  189 + </valuemap>
  190 + <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
  191 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value>
  192 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
  193 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
  194 + </valuemap>
  195 + <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
  196 + <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
  197 + <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
  198 + <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
  199 + <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
  200 + <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
  201 + <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
  202 + <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
  203 + <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
  204 + <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
  205 + <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
  206 + <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
  207 + <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
  208 + <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
  209 + <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
  210 + <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
  211 + <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
  212 + <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
  213 + <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
  214 + <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
  215 + <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
  216 + <value type="int">0</value>
  217 + <value type="int">1</value>
  218 + <value type="int">2</value>
  219 + <value type="int">3</value>
  220 + <value type="int">4</value>
  221 + <value type="int">5</value>
  222 + <value type="int">6</value>
  223 + <value type="int">7</value>
  224 + <value type="int">8</value>
  225 + <value type="int">9</value>
  226 + <value type="int">10</value>
  227 + <value type="int">11</value>
  228 + <value type="int">12</value>
  229 + <value type="int">13</value>
  230 + <value type="int">14</value>
  231 + </valuelist>
  232 + <value type="int" key="PE.EnvironmentAspect.Base">2</value>
  233 + <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
  234 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">cacic-service</value>
  235 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
  236 + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/home/lightbase/cacic-agente/cacic-service/cacic-service.pro</value>
  237 + <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
  238 + <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">cacicD.pro</value>
  239 + <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
  240 + <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value>
  241 + <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
  242 + <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
  243 + <value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
  244 + <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
  245 + <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
  246 + <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
  247 + <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
  248 + </valuemap>
  249 + <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
  250 + </valuemap>
  251 + </data>
  252 + <data>
  253 + <variable>ProjectExplorer.Project.TargetCount</variable>
  254 + <value type="int">1</value>
  255 + </data>
  256 + <data>
  257 + <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable>
  258 + <value type="QByteArray">{ece4f619-8231-4029-8d3b-e5858b910820}</value>
  259 + </data>
  260 + <data>
  261 + <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
  262 + <value type="int">15</value>
  263 + </data>
  264 +</qtcreator>
cacic-daemon/cacicD/cacicd.cpp 0 → 100644
@@ -0,0 +1,136 @@ @@ -0,0 +1,136 @@
  1 +#include "cacicd.h"
  2 +
  3 +cacicD::cacicD(int argc, char **argv) : QtService<QCoreApplication>(argc, argv, "CacicD")
  4 +{
  5 + try{
  6 + OCacicComm = new CacicComm();
  7 + OCacicTimer = new CacicTimer();
  8 + setServiceDescription("Cacic Daemon");
  9 + setServiceFlags(QtService::Default);
  10 + } catch (...){
  11 + qCritical() << "Error desconhecido no construtor.";
  12 + }
  13 +}
  14 +
  15 +cacicD::~cacicD()
  16 +{
  17 + try{
  18 +
  19 + } catch (...){
  20 + qCritical() << "Error desconhecido no desconstrutor.";
  21 + }
  22 +}
  23 +
  24 +void cacicD::start() {
  25 + try{
  26 + this->app = application();
  27 + qDebug() << "\nServiço iniciado em" << app->applicationDirPath();
  28 + QJsonObject result = ccacic->getJsonFromFile(app->applicationDirPath() + "/getConfig.json");
  29 + if(!result.contains("error")){
  30 + OCacicTimer->iniciarTimer(result["codestatus"].toInt());
  31 + }
  32 + }catch (...){
  33 + qCritical() << "Error desconhecido ao iniciar o serviço.";
  34 + }
  35 +}
  36 +
  37 +void cacicD::pause()
  38 +{
  39 + try{
  40 + qDebug() << "Serviço pausado.";
  41 + } catch (...){
  42 + qCritical() << "Error desconhecido ao pausar o serviço.";
  43 + }
  44 +}
  45 +
  46 +void cacicD::resume()
  47 +{
  48 + try{
  49 + qDebug() << "Serviço resumido.";
  50 + } catch (...){
  51 + qCritical() << "Error desconhecido ao resumir o serviço.";
  52 + }
  53 +}
  54 +
  55 +void cacicD::stop()
  56 +{
  57 + try{
  58 + qDebug() << "Serviço parado.";
  59 + } catch (...){
  60 + qCritical() << "Error desconhecido ao parar o serviço.";
  61 + }
  62 +}
  63 +
  64 +bool cacicD::getTest(){
  65 + try{
  66 + qDebug() << app->applicationDirPath() + "getTest.json";
  67 + OCacicComm->setUrlGerente("http://10.1.0.137/cacic/web/app_dev.php");
  68 + OCacicComm->setUsuario("cacic");
  69 + OCacicComm->setPassword("cacic123");
  70 + bool ok;
  71 + QJsonObject as;
  72 + as["computador"] = OCacic_Computer.toJsonObject();
  73 + QJsonObject jsonresult = OCacicComm->comm("/ws/neo/login", &ok, as);
  74 + if(jsonresult.contains("error")){
  75 + return false;
  76 + }
  77 + try{
  78 + qDebug() << app->applicationDirPath() + "getTest.json";
  79 + ccacic->setJsonToFile(jsonresult, app->applicationDirPath() + "/getTest.json");
  80 + return true;
  81 + } catch (...) {
  82 + qDebug() << "Erro ao salvar o arquivo de configurações.";
  83 + return false;
  84 + }
  85 + } catch (...){
  86 + qDebug() << "Erro ao conectar com o servidor.";
  87 + return false;
  88 + }
  89 +}
  90 +
  91 +bool cacicD::getConfig(){
  92 + try{
  93 + OCacicComm->setUrlGerente("http://10.1.0.137/cacic/web/app_dev.php");
  94 + OCacicComm->setUsuario("cacic");
  95 + OCacicComm->setPassword("cacic123");
  96 + bool ok;
  97 + QJsonObject as;
  98 + as["computador"] = OCacic_Computer.toJsonObject();
  99 + QJsonObject jsonresult = OCacicComm->comm("/ws/neo/login", &ok, as);
  100 + if(jsonresult.contains("error")){
  101 + return false;
  102 + }
  103 + try{
  104 + ccacic->setJsonToFile(jsonresult, app->applicationDirPath() + "/getConfig.json");
  105 + return true;
  106 + } catch (...) {
  107 + qDebug() << "Erro ao salvar o arquivo de configurações.";
  108 + return false;
  109 + }
  110 + } catch (...){
  111 + qDebug() << "Erro ao conectar com o servidor.";
  112 + return false;
  113 + }
  114 +}
  115 +
  116 +void cacicD::registraInicio()
  117 +{
  118 +
  119 +}
  120 +
  121 +void cacicD::registraFim()
  122 +{
  123 +
  124 +}
  125 +
  126 +bool cacicD::compararHashMD5(QJsonDocument getconfigfile,QJsonDocument getConfig){
  127 + QString getconfigMD5 = QString(QCryptographicHash::hash(
  128 + (getconfigfile.toVariant().toByteArray()),QCryptographicHash::Md5).toHex());
  129 + QString getconfigMD52 = QString(QCryptographicHash::hash(
  130 + (getConfig.toVariant().toByteArray()),QCryptographicHash::Md5).toHex());
  131 + if(getconfigMD5 == getconfigMD52){
  132 + return true;
  133 + }else{
  134 + return false;
  135 + }
  136 +}
cacic-daemon/cacicD/cacicd.h 0 → 100644
@@ -0,0 +1,35 @@ @@ -0,0 +1,35 @@
  1 +#ifndef CACICD_H
  2 +#define CACICD_H
  3 +#include <QTextStream>
  4 +#include <QVariant>
  5 +#include <QCryptographicHash>
  6 +#include <QCoreApplication>
  7 +#include "qtservice.h"
  8 +#include "cacictimer.h"
  9 +
  10 +class cacicD : public QtService<QCoreApplication>
  11 +{
  12 +public:
  13 + QCoreApplication *app;
  14 + CCacic *ccacic;
  15 + CACIC_Computer OCacic_Computer;
  16 + CacicComm *OCacicComm;
  17 + CacicTimer *OCacicTimer;
  18 + cacicD(int argc, char **argv);
  19 + ~cacicD();
  20 + void start();
  21 + void pause();
  22 + void resume();
  23 + void stop();
  24 +
  25 +private:
  26 + bool compararHashMD5(QJsonDocument getconfigfile,QJsonDocument getConfig);
  27 + void registraInicio();
  28 + void registraFim();
  29 +
  30 +public slots:
  31 + bool getTest();
  32 + bool getConfig();
  33 +
  34 +};
  35 +#endif // CACICD_H
cacic-daemon/cacicD/cacicdaemon.cpp 0 → 100644
@@ -0,0 +1,5 @@ @@ -0,0 +1,5 @@
  1 +#include "cacicdaemon.h"
  2 +
  3 +CacicDaemon::CacicDaemon()
  4 +{
  5 +}
cacic-daemon/cacicD/cacicdaemon.h 0 → 100644
@@ -0,0 +1,10 @@ @@ -0,0 +1,10 @@
  1 +#ifndef CACICDAEMON_H
  2 +#define CACICDAEMON_H
  3 +
  4 +class CacicDaemon
  5 +{
  6 +public:
  7 + CacicDaemon();
  8 +};
  9 +
  10 +#endif // CACICDAEMON_H
cacic-daemon/cacicD/cacicservice.cpp 0 → 100644
@@ -0,0 +1,134 @@ @@ -0,0 +1,134 @@
  1 +#include "cacicd.h"
  2 +
  3 +cacicD::cacicD(int argc, char **argv) : QtService<QCoreApplication>(argc, argv, "CacicD")
  4 +{
  5 + try{
  6 + setServiceDescription("Cacic Daemon");
  7 + setServiceFlags(QtServiceBase::CannotBeStopped);
  8 + } catch (...){
  9 + qCritical() << "Error desconhecido no construtor.";
  10 + }
  11 +}
  12 +
  13 +cacicD::~cacicD()
  14 +{
  15 + try{
  16 +
  17 + } catch (...){
  18 + qCritical() << "Error desconhecido no desconstrutor.";
  19 + }
  20 +}
  21 +
  22 +void cacicD::start()
  23 +{
  24 + try{
  25 + this->app = application();
  26 + qDebug() << "\nServiço iniciado em" << app->applicationDirPath();
  27 + if(getTest()){
  28 + qDebug() << "\ngetTest() success.";
  29 + }else{
  30 + qDebug() << "\ngetTest() error.";
  31 + }
  32 + if(getConfig()){
  33 + qDebug() << "\ngetconfig() success.";
  34 + }else{
  35 + qDebug() << "\ngetconfig() error.";
  36 + }
  37 + } catch (...){
  38 + qCritical() << "Error desconhecido ao iniciar o serviço.";
  39 + }
  40 +}
  41 +
  42 +void cacicD::pause()
  43 +{
  44 + try{
  45 + qDebug() << "Serviço pausado.";
  46 + } catch (...){
  47 + qCritical() << "Error desconhecido ao pausar o serviço.";
  48 + }
  49 +}
  50 +
  51 +void cacicD::resume()
  52 +{
  53 + try{
  54 + qDebug() << "Serviço resumido.";
  55 + } catch (...){
  56 + qCritical() << "Error desconhecido ao resumir o serviço.";
  57 + }
  58 +}
  59 +
  60 +void cacicD::stop()
  61 +{
  62 + try{
  63 + qDebug() << "Serviço parado.";
  64 + } catch (...){
  65 + qCritical() << "Error desconhecido ao parar o serviço.";
  66 + }
  67 +}
  68 +
  69 +bool cacicD::getTest(){
  70 + try{
  71 + CacicComm OCacicComm;
  72 + OCacicComm.setUrlGerente("http://10.1.0.137/cacic/web/app_dev.php");
  73 + OCacicComm.setUsuario("cacic");
  74 + OCacicComm.setPassword("cacic123");
  75 + bool ok;
  76 + QJsonObject as;
  77 + as["computador"] = OCacic_Computer.toJsonObject();
  78 + QJsonObject jsonresult = OCacicComm.comm("/ws/neo/login", &ok, as);
  79 + try{
  80 + saveJson(QJsonDocument::fromVariant(jsonresult.toVariantMap()), "getTest.conf");
  81 + return true;
  82 + } catch (...) {
  83 + qDebug() << "Erro ao salvar o arquivo de configurações.";
  84 + return false;
  85 + }
  86 + } catch (...){
  87 + qDebug() << "Erro ao conectar com o servidor.";
  88 + return false;
  89 + }
  90 +}
  91 +
  92 +bool cacicD::getConfig(){
  93 + try{
  94 + CacicComm OCacicComm;
  95 + OCacicComm.setUrlGerente("http://10.1.0.137/cacic/web/app_dev.php");
  96 + OCacicComm.setUsuario("cacic");
  97 + OCacicComm.setPassword("cacic123");
  98 + bool ok;
  99 + QJsonObject as;
  100 + as["computador"] = OCacic_Computer.toJsonObject();
  101 + QJsonObject jsonresult = OCacicComm.comm("/ws/neo/login", &ok, as);
  102 + try{
  103 + saveJson(QJsonDocument::fromVariant(jsonresult.toVariantMap()), "getConfig.conf");
  104 + return true;
  105 + } catch (...) {
  106 + qDebug() << "Erro ao salvar o arquivo de configurações.";
  107 + return false;
  108 + }
  109 + } catch (...){
  110 + qDebug() << "Erro ao conectar com o servidor.";
  111 + return false;
  112 + }
  113 +}
  114 +
  115 +void cacicD::saveJson(QJsonDocument document, QString fileName) {
  116 +#if defined(Q_OS_LINUX)
  117 + QFile jsonFile(app->applicationDirPath().append("/" + fileName));
  118 +#elif defined(Q_OS_WIN)
  119 + QFile jsonFile(app->applicationDirPath().append("\\" + fileName));
  120 +#endif
  121 + jsonFile.open(QFile::WriteOnly);
  122 + jsonFile.write(document.toJson());
  123 + jsonFile.close();
  124 +}
  125 +
  126 +QJsonDocument cacicD::loadJson(QString fileName) {
  127 +#if defined(Q_OS_LINUX)
  128 + QFile jsonFile(app->applicationDirPath().append("/" + fileName));
  129 +#elif defined(Q_OS_WIN)
  130 + QFile jsonFile(app->applicationDirPath().append("\\" + fileName));
  131 +#endif
  132 + jsonFile.open(QFile::ReadOnly);
  133 + return QJsonDocument().fromJson(jsonFile.readAll());
  134 +}
cacic-daemon/cacicD/cacicservice.h 0 → 100644
@@ -0,0 +1,4 @@ @@ -0,0 +1,4 @@
  1 +#ifndef CACICSERVICE_H
  2 +#define CACICSERVICE_H
  3 +
  4 +#endif // CACICSERVICE_H
cacic-daemon/cacicD/main.cpp 0 → 100644
@@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
  1 +#include <QCoreApplication>
  2 +#include "cacicd.h"
  3 +#include "cacictimer.h"
  4 +
  5 +int main(int argc, char **argv)
  6 +{
  7 + cacicD service(argc, argv);
  8 + return service.exec();
  9 +}
cacic-service/cacic-service.pro
@@ -1,26 +0,0 @@ @@ -1,26 +0,0 @@
1 -#-------------------------------------------------  
2 -#  
3 -# Project created by QtCreator 2014-09-02T09:28:06  
4 -#  
5 -#-------------------------------------------------  
6 -  
7 -QT += core  
8 -  
9 -QT -= gui  
10 -  
11 -TARGET = cacic-service  
12 -CONFIG += console  
13 -CONFIG -= app_bundle  
14 -  
15 -TEMPLATE = app  
16 -  
17 -  
18 -SOURCES += main.cpp \  
19 - cacicservice.cpp \  
20 - cacicdaemon.cpp  
21 -  
22 -include(../src/qtservice/src/qtservice.pri)  
23 -  
24 -HEADERS += \  
25 - cacicservice.h \  
26 - cacicdaemon.h  
cacic-service/cacic-service.pro.user
@@ -1,263 +0,0 @@ @@ -1,263 +0,0 @@
1 -<?xml version="1.0" encoding="UTF-8"?>  
2 -<!DOCTYPE QtCreatorProject>  
3 -<!-- Written by QtCreator 3.1.2, 2014-09-03T15:17:46. -->  
4 -<qtcreator>  
5 - <data>  
6 - <variable>ProjectExplorer.Project.ActiveTarget</variable>  
7 - <value type="int">0</value>  
8 - </data>  
9 - <data>  
10 - <variable>ProjectExplorer.Project.EditorSettings</variable>  
11 - <valuemap type="QVariantMap">  
12 - <value type="bool" key="EditorConfiguration.AutoIndent">true</value>  
13 - <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>  
14 - <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>  
15 - <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">  
16 - <value type="QString" key="language">Cpp</value>  
17 - <valuemap type="QVariantMap" key="value">  
18 - <value type="QByteArray" key="CurrentPreferences">CppGlobal</value>  
19 - </valuemap>  
20 - </valuemap>  
21 - <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">  
22 - <value type="QString" key="language">QmlJS</value>  
23 - <valuemap type="QVariantMap" key="value">  
24 - <value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>  
25 - </valuemap>  
26 - </valuemap>  
27 - <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>  
28 - <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>  
29 - <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>  
30 - <value type="int" key="EditorConfiguration.IndentSize">4</value>  
31 - <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>  
32 - <value type="int" key="EditorConfiguration.MarginColumn">80</value>  
33 - <value type="bool" key="EditorConfiguration.MouseHiding">true</value>  
34 - <value type="bool" key="EditorConfiguration.MouseNavigation">true</value>  
35 - <value type="int" key="EditorConfiguration.PaddingMode">1</value>  
36 - <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>  
37 - <value type="bool" key="EditorConfiguration.ShowMargin">false</value>  
38 - <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>  
39 - <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>  
40 - <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>  
41 - <value type="int" key="EditorConfiguration.TabSize">8</value>  
42 - <value type="bool" key="EditorConfiguration.UseGlobal">true</value>  
43 - <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>  
44 - <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>  
45 - <value type="bool" key="EditorConfiguration.cleanIndentation">true</value>  
46 - <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>  
47 - <value type="bool" key="EditorConfiguration.inEntireDocument">false</value>  
48 - </valuemap>  
49 - </data>  
50 - <data>  
51 - <variable>ProjectExplorer.Project.PluginSettings</variable>  
52 - <valuemap type="QVariantMap"/>  
53 - </data>  
54 - <data>  
55 - <variable>ProjectExplorer.Project.Target.0</variable>  
56 - <valuemap type="QVariantMap">  
57 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.3 GCC 64bit</value>  
58 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.3 GCC 64bit</value>  
59 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.53.gcc_64_kit</value>  
60 - <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>  
61 - <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>  
62 - <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>  
63 - <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">  
64 - <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/lightbase/cacic-agente/build-cacic-service-Desktop_Qt_5_3_GCC_64bit-Debug</value>  
65 - <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">  
66 - <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">  
67 - <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>  
68 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>  
69 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>  
70 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>  
71 - <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>  
72 - <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>  
73 - <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>  
74 - <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>  
75 - </valuemap>  
76 - <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">  
77 - <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>  
78 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>  
79 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>  
80 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>  
81 - <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">  
82 - <value type="QString">-w</value>  
83 - <value type="QString">-r</value>  
84 - </valuelist>  
85 - <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>  
86 - <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>  
87 - <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>  
88 - </valuemap>  
89 - <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>  
90 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>  
91 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>  
92 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>  
93 - </valuemap>  
94 - <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">  
95 - <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">  
96 - <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>  
97 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>  
98 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>  
99 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>  
100 - <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">  
101 - <value type="QString">-w</value>  
102 - <value type="QString">-r</value>  
103 - </valuelist>  
104 - <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>  
105 - <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>  
106 - <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>  
107 - </valuemap>  
108 - <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>  
109 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>  
110 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>  
111 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>  
112 - </valuemap>  
113 - <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>  
114 - <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>  
115 - <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>  
116 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Debug</value>  
117 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>  
118 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>  
119 - <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>  
120 - <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>  
121 - </valuemap>  
122 - <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">  
123 - <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/lightbase/cacic-agente/build-cacic-service-Desktop_Qt_5_3_GCC_64bit-Release</value>  
124 - <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">  
125 - <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">  
126 - <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>  
127 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>  
128 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>  
129 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>  
130 - <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>  
131 - <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>  
132 - <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>  
133 - <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>  
134 - </valuemap>  
135 - <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">  
136 - <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>  
137 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>  
138 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>  
139 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>  
140 - <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">  
141 - <value type="QString">-w</value>  
142 - <value type="QString">-r</value>  
143 - </valuelist>  
144 - <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>  
145 - <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>  
146 - <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>  
147 - </valuemap>  
148 - <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>  
149 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>  
150 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>  
151 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>  
152 - </valuemap>  
153 - <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">  
154 - <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">  
155 - <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>  
156 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>  
157 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>  
158 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>  
159 - <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">  
160 - <value type="QString">-w</value>  
161 - <value type="QString">-r</value>  
162 - </valuelist>  
163 - <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>  
164 - <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>  
165 - <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>  
166 - </valuemap>  
167 - <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>  
168 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>  
169 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>  
170 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>  
171 - </valuemap>  
172 - <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>  
173 - <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>  
174 - <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>  
175 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>  
176 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>  
177 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>  
178 - <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>  
179 - <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>  
180 - </valuemap>  
181 - <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value>  
182 - <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">  
183 - <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">  
184 - <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>  
185 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>  
186 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>  
187 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>  
188 - </valuemap>  
189 - <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>  
190 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value>  
191 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>  
192 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>  
193 - </valuemap>  
194 - <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>  
195 - <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>  
196 - <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">  
197 - <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>  
198 - <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>  
199 - <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>  
200 - <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>  
201 - <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>  
202 - <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>  
203 - <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>  
204 - <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>  
205 - <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>  
206 - <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>  
207 - <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>  
208 - <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>  
209 - <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>  
210 - <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>  
211 - <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>  
212 - <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>  
213 - <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>  
214 - <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">  
215 - <value type="int">0</value>  
216 - <value type="int">1</value>  
217 - <value type="int">2</value>  
218 - <value type="int">3</value>  
219 - <value type="int">4</value>  
220 - <value type="int">5</value>  
221 - <value type="int">6</value>  
222 - <value type="int">7</value>  
223 - <value type="int">8</value>  
224 - <value type="int">9</value>  
225 - <value type="int">10</value>  
226 - <value type="int">11</value>  
227 - <value type="int">12</value>  
228 - <value type="int">13</value>  
229 - <value type="int">14</value>  
230 - </valuelist>  
231 - <value type="int" key="PE.EnvironmentAspect.Base">2</value>  
232 - <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>  
233 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">cacic-service</value>  
234 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>  
235 - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/home/lightbase/cacic-agente/cacic-service/cacic-service.pro</value>  
236 - <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>  
237 - <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">cacic-service.pro</value>  
238 - <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>  
239 - <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value>  
240 - <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>  
241 - <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>  
242 - <value type="bool" key="RunConfiguration.UseCppDebugger">false</value>  
243 - <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>  
244 - <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>  
245 - <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>  
246 - <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>  
247 - </valuemap>  
248 - <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>  
249 - </valuemap>  
250 - </data>  
251 - <data>  
252 - <variable>ProjectExplorer.Project.TargetCount</variable>  
253 - <value type="int">1</value>  
254 - </data>  
255 - <data>  
256 - <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable>  
257 - <value type="QByteArray">{ece4f619-8231-4029-8d3b-e5858b910820}</value>  
258 - </data>  
259 - <data>  
260 - <variable>ProjectExplorer.Project.Updater.FileVersion</variable>  
261 - <value type="int">15</value>  
262 - </data>  
263 -</qtcreator>  
cacic-service/cacicdaemon.cpp
@@ -1,123 +0,0 @@ @@ -1,123 +0,0 @@
1 -#include "cacicdaemon.h"  
2 -  
3 -CacicDaemon::CacicDaemon(QObject * parent):  
4 - QThread(parent)  
5 -{  
6 - abort = false;  
7 - paused = false;  
8 -}  
9 -  
10 -CacicDaemon::~CacicDaemon()  
11 -{  
12 - mutex.lock();  
13 - abort = true;  
14 - condition.wakeOne();  
15 - mutex.unlock();  
16 -  
17 - wait();  
18 -}  
19 -  
20 -void CacicDaemon::run()  
21 -{  
22 - while(!paused && !abort) {  
23 - sleep(5000);  
24 - getTest();  
25 - sleep(1000);  
26 - getConfig();  
27 -  
28 - if(abort)  
29 - return;  
30 - }  
31 -}  
32 -  
33 -void CacicDaemon::pause()  
34 -{  
35 - mutex.lock();  
36 - paused = true;  
37 - mutex.unlock();  
38 -}  
39 -  
40 -void CacicDaemon::resume()  
41 -{  
42 - mutex.lock();  
43 - paused = false;  
44 - condition.wakeOne();  
45 - mutex.unlock();  
46 -}  
47 -  
48 -bool CacicDaemon::getConfig()  
49 -{  
50 - qDebug() << ">>> getConfig()";  
51 - return true;  
52 -  
53 -// try{  
54 -// CacicComm OCacicComm;  
55 -// OCacicComm.setUrlGerente("http://10.1.0.137/cacic/web/app_dev.php");  
56 -// OCacicComm.setUsuario("cacic");  
57 -// OCacicComm.setPassword("cacic123");  
58 -// bool ok;  
59 -// QJsonObject as;  
60 -// as["computador"] = OCacic_Computer.toJsonObject();  
61 -// QJsonObject jsonresult = OCacicComm.comm("/ws/neo/login", &ok, as);  
62 -// try{  
63 -// saveJson(QJsonDocument::fromVariant(jsonresult.toVariantMap()), "getConfig.conf");  
64 -// return true;  
65 -// } catch (...) {  
66 -// qDebug() << "Erro ao salvar o arquivo de configurações.";  
67 -// return false;  
68 -// }  
69 -// } catch (...){  
70 -// qDebug() << "Erro ao conectar com o servidor.";  
71 -// return false;  
72 -// }  
73 -}  
74 -  
75 -bool CacicDaemon::getTest()  
76 -{  
77 - qDebug() << ">>> getTest()";  
78 - return true;  
79 -  
80 -// try{  
81 -// CacicComm OCacicComm;  
82 -// OCacicComm.setUrlGerente("http://10.1.0.137/cacic/web/app_dev.php");  
83 -// OCacicComm.setUsuario("cacic");  
84 -// OCacicComm.setPassword("cacic123");  
85 -// bool ok;  
86 -// QJsonObject as;  
87 -// as["computador"] = OCacic_Computer.toJsonObject();  
88 -// QJsonObject jsonresult = OCacicComm.comm("/ws/neo/login", &ok, as);  
89 -// try{  
90 -// saveJson(QJsonDocument::fromVariant(jsonresult.toVariantMap()), "getTest.conf");  
91 -// return true;  
92 -// } catch (...) {  
93 -// qDebug() << "Erro ao salvar o arquivo de configurações.";  
94 -// return false;  
95 -// }  
96 -// } catch (...){  
97 -// qDebug() << "Erro ao conectar com o servidor.";  
98 -// return false;  
99 -// }  
100 -}  
101 -  
102 -  
103 -//void cacicD::saveJson(QJsonDocument document, QString fileName) {  
104 -//#if defined(Q_OS_LINUX)  
105 -// QFile jsonFile(app->applicationDirPath().append("/" + fileName));  
106 -//#elif defined(Q_OS_WIN)  
107 -// QFile jsonFile(app->applicationDirPath().append("\\" + fileName));  
108 -//#endif  
109 -// jsonFile.open(QFile::WriteOnly);  
110 -// jsonFile.write(document.toJson());  
111 -// jsonFile.close();  
112 -//}  
113 -  
114 -//QJsonDocument cacicD::loadJson(QString fileName) {  
115 -//#if defined(Q_OS_LINUX)  
116 -// QFile jsonFile(app->applicationDirPath().append("/" + fileName));  
117 -//#elif defined(Q_OS_WIN)  
118 -// QFile jsonFile(app->applicationDirPath().append("\\" + fileName));  
119 -//#endif  
120 -// jsonFile.open(QFile::ReadOnly);  
121 -// return QJsonDocument().fromJson(jsonFile.readAll());  
122 -//}  
123 -  
cacic-service/cacicdaemon.h
@@ -1,39 +0,0 @@ @@ -1,39 +0,0 @@
1 -#ifndef CACICDAEMON_H  
2 -#define CACICDAEMON_H  
3 -  
4 -#include <QCoreApplication>  
5 -#include <QDebug>  
6 -#include <QMutex>  
7 -#include <QThread>  
8 -#include <QWaitCondition>  
9 -#include <stdlib.h>  
10 -#include <unistd.h>  
11 -  
12 -  
13 -class CacicDaemon : public QThread  
14 -{  
15 - Q_OBJECT  
16 -public:  
17 - CacicDaemon(QObject* parent = 0);  
18 - ~CacicDaemon();  
19 -  
20 - void pause();  
21 - void resume();  
22 -  
23 -protected:  
24 - void run();  
25 -  
26 -private slots:  
27 -  
28 -private:  
29 - bool getTest();  
30 - bool getConfig();  
31 -  
32 - QMutex mutex;  
33 - QWaitCondition condition;  
34 - bool abort;  
35 - bool paused;  
36 -  
37 -};  
38 -  
39 -#endif // CACICDAEMON_H  
cacic-service/cacicservice.cpp
@@ -1,40 +0,0 @@ @@ -1,40 +0,0 @@
1 -#include "cacicservice.h"  
2 -  
3 -CacicService::CacicService(int argc, char **argv)  
4 - : QtService<QCoreApplication>(argc, argv, "CacicDaemon")  
5 -{  
6 - setServiceDescription("A dummy Cacic service implemented with Qt");  
7 - setServiceFlags(QtServiceBase::CanBeSuspended);  
8 -}  
9 -  
10 -void CacicService::pause()  
11 -{  
12 - daemon->pause();  
13 -}  
14 -  
15 -void CacicService::resume()  
16 -{  
17 - daemon->resume();  
18 -}  
19 -  
20 -void CacicService::stop()  
21 -{  
22 - daemon->quit();  
23 - app->quit();  
24 -}  
25 -  
26 -void CacicService::start()  
27 -{  
28 - app = application();  
29 -  
30 - daemon = new CacicDaemon(app);  
31 - daemon->start();  
32 -  
33 -qDebug() << daemon->isFinished();  
34 -qDebug() << daemon->isRunning();  
35 -  
36 - if (!daemon->isRunning()) {  
37 - qDebug() << "Inicialização do daemon falhou";  
38 - app->quit();  
39 - }  
40 -}  
cacic-service/cacicservice.h
@@ -1,27 +0,0 @@ @@ -1,27 +0,0 @@
1 -#ifndef CACICSERVICE_H  
2 -#define CACICSERVICE_H  
3 -  
4 -#include <QDebug>  
5 -#include <QString>  
6 -#include "qtservice.h"  
7 -#include "cacicdaemon.h"  
8 -  
9 -class CacicService : public QtService<QCoreApplication>  
10 -{  
11 -  
12 -public:  
13 - CacicService(int argc, char **argv);  
14 -  
15 -protected:  
16 -  
17 - void pause();  
18 - void resume();  
19 - void start();  
20 - void stop();  
21 -  
22 -private:  
23 - CacicDaemon *daemon;  
24 - QCoreApplication *app;  
25 -};  
26 -  
27 -#endif // CACICSERVICE_H  
cacic-service/main.cpp
@@ -1,18 +0,0 @@ @@ -1,18 +0,0 @@
1 -//#include "main.moc"  
2 -#include <QDir>  
3 -#include <QSettings>  
4 -//#include <QtGlobal>  
5 -#include "cacicservice.h"  
6 -  
7 -  
8 -int main(int argc, char **argv)  
9 -{  
10 -#if !defined(Q_OS_WIN)  
11 - // QtService stores service settings in SystemScope, which normally require root privileges.  
12 - // To allow testing this example as non-root, we change the directory of the SystemScope settings file.  
13 - QSettings::setPath(QSettings::NativeFormat, QSettings::SystemScope, QDir::tempPath());  
14 - qWarning("(Example uses dummy settings file: %s/QtSoftware.conf)", QDir::tempPath().toLatin1().constData());  
15 -#endif  
16 - CacicService service(argc, argv);  
17 - return service.exec();  
18 -}  
cacicD/Readme.txt
@@ -1,6 +0,0 @@ @@ -1,6 +0,0 @@
1 -Para instalar um serviço no Windows:  
2 - ~$ sc create "CacicD" binPath= "C:\endereco\do\cacicd\CacicD.exe" start= auto  
3 -  
4 -Para instalar um serviço no Linux:  
5 - Usar o Upstart  
6 -  
cacicD/cacicD.pro
@@ -1,39 +0,0 @@ @@ -1,39 +0,0 @@
1 -#-------------------------------------------------  
2 -#  
3 -# Project created by QtCreator 2014-08-18T11:06:08  
4 -#  
5 -#-------------------------------------------------  
6 -  
7 -QT += core  
8 -QT -= gui  
9 -QT += network  
10 -TARGET = cacicD  
11 -CONFIG += console  
12 -CONFIG -= app_bundle  
13 -win32 {  
14 - LIBS += -LE:\LightBase\cacic-agente-project\cacic-agente\src\crypto++\lib -lcryptopp  
15 -} else {  
16 - LIBS += -L/usr/lib -lcryptopp  
17 -}  
18 -TEMPLATE = app  
19 -  
20 -  
21 -SOURCES += main.cpp \  
22 - ../src/ccacic.cpp \  
23 - cacicd.cpp \  
24 - ../src/cacic_computer.cpp \  
25 - ../src/operatingsystem.cpp \  
26 - cacictimer.cpp  
27 -  
28 -HEADERS += \  
29 - ../src/ccacic.h \  
30 - cacicd.h \  
31 - ../src/cacic_computer.h \  
32 - ../src/operatingsystem.h \  
33 - cacictimer.h  
34 -  
35 -include(../src/qtservice/src/qtservice.pri)  
36 -  
37 -INCLUDEPATH += ../src \  
38 - ../src/crypto++/include/  
39 -  
cacicD/cacicd.cpp
@@ -1,136 +0,0 @@ @@ -1,136 +0,0 @@
1 -#include "cacicd.h"  
2 -  
3 -cacicD::cacicD(int argc, char **argv) : QtService<QCoreApplication>(argc, argv, "CacicD")  
4 -{  
5 - try{  
6 - OCacicComm = new CacicComm();  
7 - OCacicTimer = new CacicTimer();  
8 - setServiceDescription("Cacic Daemon");  
9 - setServiceFlags(QtService::Default);  
10 - } catch (...){  
11 - qCritical() << "Error desconhecido no construtor.";  
12 - }  
13 -}  
14 -  
15 -cacicD::~cacicD()  
16 -{  
17 - try{  
18 -  
19 - } catch (...){  
20 - qCritical() << "Error desconhecido no desconstrutor.";  
21 - }  
22 -}  
23 -  
24 -void cacicD::start() {  
25 - try{  
26 - this->app = application();  
27 - qDebug() << "\nServiço iniciado em" << app->applicationDirPath();  
28 - QJsonObject result = ccacic->getJsonFromFile(app->applicationDirPath() + "/getConfig.json");  
29 - if(!result.contains("error")){  
30 - OCacicTimer->iniciarTimer(result["codestatus"].toInt());  
31 - }  
32 - }catch (...){  
33 - qCritical() << "Error desconhecido ao iniciar o serviço.";  
34 - }  
35 -}  
36 -  
37 -void cacicD::pause()  
38 -{  
39 - try{  
40 - qDebug() << "Serviço pausado.";  
41 - } catch (...){  
42 - qCritical() << "Error desconhecido ao pausar o serviço.";  
43 - }  
44 -}  
45 -  
46 -void cacicD::resume()  
47 -{  
48 - try{  
49 - qDebug() << "Serviço resumido.";  
50 - } catch (...){  
51 - qCritical() << "Error desconhecido ao resumir o serviço.";  
52 - }  
53 -}  
54 -  
55 -void cacicD::stop()  
56 -{  
57 - try{  
58 - qDebug() << "Serviço parado.";  
59 - } catch (...){  
60 - qCritical() << "Error desconhecido ao parar o serviço.";  
61 - }  
62 -}  
63 -  
64 -bool cacicD::getTest(){  
65 - try{  
66 - qDebug() << app->applicationDirPath() + "getTest.json";  
67 - OCacicComm->setUrlGerente("http://10.1.0.137/cacic/web/app_dev.php");  
68 - OCacicComm->setUsuario("cacic");  
69 - OCacicComm->setPassword("cacic123");  
70 - bool ok;  
71 - QJsonObject as;  
72 - as["computador"] = OCacic_Computer.toJsonObject();  
73 - QJsonObject jsonresult = OCacicComm->comm("/ws/neo/login", &ok, as);  
74 - if(jsonresult.contains("error")){  
75 - return false;  
76 - }  
77 - try{  
78 - qDebug() << app->applicationDirPath() + "getTest.json";  
79 - ccacic->setJsonToFile(jsonresult, app->applicationDirPath() + "/getTest.json");  
80 - return true;  
81 - } catch (...) {  
82 - qDebug() << "Erro ao salvar o arquivo de configurações.";  
83 - return false;  
84 - }  
85 - } catch (...){  
86 - qDebug() << "Erro ao conectar com o servidor.";  
87 - return false;  
88 - }  
89 -}  
90 -  
91 -bool cacicD::getConfig(){  
92 - try{  
93 - OCacicComm->setUrlGerente("http://10.1.0.137/cacic/web/app_dev.php");  
94 - OCacicComm->setUsuario("cacic");  
95 - OCacicComm->setPassword("cacic123");  
96 - bool ok;  
97 - QJsonObject as;  
98 - as["computador"] = OCacic_Computer.toJsonObject();  
99 - QJsonObject jsonresult = OCacicComm->comm("/ws/neo/login", &ok, as);  
100 - if(jsonresult.contains("error")){  
101 - return false;  
102 - }  
103 - try{  
104 - ccacic->setJsonToFile(jsonresult, app->applicationDirPath() + "/getConfig.json");  
105 - return true;  
106 - } catch (...) {  
107 - qDebug() << "Erro ao salvar o arquivo de configurações.";  
108 - return false;  
109 - }  
110 - } catch (...){  
111 - qDebug() << "Erro ao conectar com o servidor.";  
112 - return false;  
113 - }  
114 -}  
115 -  
116 -void cacicD::registraInicio()  
117 -{  
118 -  
119 -}  
120 -  
121 -void cacicD::registraFim()  
122 -{  
123 -  
124 -}  
125 -  
126 -bool cacicD::compararHashMD5(QJsonDocument getconfigfile,QJsonDocument getConfig){  
127 - QString getconfigMD5 = QString(QCryptographicHash::hash(  
128 - (getconfigfile.toVariant().toByteArray()),QCryptographicHash::Md5).toHex());  
129 - QString getconfigMD52 = QString(QCryptographicHash::hash(  
130 - (getConfig.toVariant().toByteArray()),QCryptographicHash::Md5).toHex());  
131 - if(getconfigMD5 == getconfigMD52){  
132 - return true;  
133 - }else{  
134 - return false;  
135 - }  
136 -}  
cacicD/cacicd.h
@@ -1,35 +0,0 @@ @@ -1,35 +0,0 @@
1 -#ifndef CACICD_H  
2 -#define CACICD_H  
3 -#include <QTextStream>  
4 -#include <QVariant>  
5 -#include <QCryptographicHash>  
6 -#include <QCoreApplication>  
7 -#include "qtservice.h"  
8 -#include "cacictimer.h"  
9 -  
10 -class cacicD : public QtService<QCoreApplication>  
11 -{  
12 -public:  
13 - QCoreApplication *app;  
14 - CCacic *ccacic;  
15 - CACIC_Computer OCacic_Computer;  
16 - CacicComm *OCacicComm;  
17 - CacicTimer *OCacicTimer;  
18 - cacicD(int argc, char **argv);  
19 - ~cacicD();  
20 - void start();  
21 - void pause();  
22 - void resume();  
23 - void stop();  
24 -  
25 -private:  
26 - bool compararHashMD5(QJsonDocument getconfigfile,QJsonDocument getConfig);  
27 - void registraInicio();  
28 - void registraFim();  
29 -  
30 -public slots:  
31 - bool getTest();  
32 - bool getConfig();  
33 -  
34 -};  
35 -#endif // CACICD_H  
cacicD/main.cpp
@@ -1,9 +0,0 @@ @@ -1,9 +0,0 @@
1 -#include <QCoreApplication>  
2 -#include "cacicd.h"  
3 -#include "cacictimer.h"  
4 -  
5 -int main(int argc, char **argv)  
6 -{  
7 - cacicD sevice(argc, argv);  
8 - return sevice.exec();  
9 -}  
install-cacic/installcacic.cpp
@@ -35,7 +35,7 @@ void InstallCacic::run(QStringList argv, int argc) { @@ -35,7 +35,7 @@ void InstallCacic::run(QStringList argv, int argc) {
35 #ifdef Q_OS_WIN 35 #ifdef Q_OS_WIN
36 QString exitStatus = oCacic.startProcess(oCacic.getCacicMainFolder() + "cacic.exe", true, &ok); 36 QString exitStatus = oCacic.startProcess(oCacic.getCacicMainFolder() + "cacic.exe", true, &ok);
37 #else 37 #else
38 - oCacic.startProcess("cacic.exe", true, &ok); 38 + QString exitStatus = oCacic.startProcess("cacic", true, &ok);
39 #endif 39 #endif
40 if (!ok) 40 if (!ok)
41 std::cout << "Erro ao iniciar o processo: " 41 std::cout << "Erro ao iniciar o processo: "
src/cacic_hardware.cpp
@@ -287,6 +287,7 @@ QJsonObject cacic_hardware::coletaLinux() @@ -287,6 +287,7 @@ QJsonObject cacic_hardware::coletaLinux()
287 if ( getuid() != 0 ) qDebug() << "Coleta de Bios e Motherboard requer root."; 287 if ( getuid() != 0 ) qDebug() << "Coleta de Bios e Motherboard requer root.";
288 coletaLinuxBios(hardware); 288 coletaLinuxBios(hardware);
289 coletaLinuxMotherboard(hardware); 289 coletaLinuxMotherboard(hardware);
  290 + coletaLinuxIsNotebook(hardware);
290 291
291 return hardware; 292 return hardware;
292 } 293 }
@@ -414,6 +415,22 @@ void cacic_hardware::coletaLinuxMotherboard(QJsonObject &amp;hardware) @@ -414,6 +415,22 @@ void cacic_hardware::coletaLinuxMotherboard(QJsonObject &amp;hardware)
414 hardware["motherboard"] = motherboard; 415 hardware["motherboard"] = motherboard;
415 } 416 }
416 417
  418 +void cacic_hardware::coletaLinuxIsNotebook(QJsonObject &hardware)
  419 +{
  420 +
  421 + QStringList consoleOutput;
  422 +
  423 + consoleOutput= console("dmidecode -t 3").split("\n");
  424 +// qDebug() << consoleOutput;
  425 + foreach(QString line, consoleOutput){
  426 + if(line.contains("Type:")
  427 + && line.contains("Notebook") ){
  428 + hardware["is_notebook"] = QJsonValue::fromVariant(QString("true"));
  429 + }
  430 + }
  431 +
  432 +}
  433 +
417 #endif 434 #endif
418 QJsonObject cacic_hardware::toJsonObject() { 435 QJsonObject cacic_hardware::toJsonObject() {
419 return coletaHardware; 436 return coletaHardware;
src/cacic_hardware.h
@@ -33,6 +33,7 @@ private: @@ -33,6 +33,7 @@ private:
33 void coletaLinuxPci(QJsonObject &hardware, const QJsonObject &pciJson); 33 void coletaLinuxPci(QJsonObject &hardware, const QJsonObject &pciJson);
34 void coletaLinuxBios(QJsonObject &hardware); 34 void coletaLinuxBios(QJsonObject &hardware);
35 void coletaLinuxMotherboard(QJsonObject &hardware); 35 void coletaLinuxMotherboard(QJsonObject &hardware);
  36 + void coletaLinuxIsNotebook(QJsonObject &hardware);
36 #endif 37 #endif
37 38
38 CCacic oCacic; 39 CCacic oCacic;
src/logfile.cpp 0 → 100644
@@ -0,0 +1,59 @@ @@ -0,0 +1,59 @@
  1 +#include "logfile.h"
  2 +#include <QMetaType>
  3 +
  4 +
  5 +LogFile::LogFile(QObject *parent) :
  6 + QObject(parent)
  7 +{
  8 + qRegisterMetaType<QtMsgType>("QtMsgType");
  9 + qWarning() << "Sem caminho de arquivo passado como parâmetro.";
  10 + qWarning() << "Utilizando arquivo-padrão logfile.txt.";
  11 +
  12 + logFile = new QFile("./logfile.txt");
  13 +
  14 + bool fileOpened = logFile->open(QFile::ReadWrite);
  15 + if(!fileOpened) {
  16 + qWarning() << "Não foi possível abrir arquivo de log.";
  17 + return;
  18 + }
  19 +}
  20 +
  21 +LogFile::LogFile(const QString &location, QObject *parent) :
  22 + QObject(parent)
  23 +{
  24 + qRegisterMetaType<QtMsgType>("QtMsgType");
  25 +
  26 + logFile = new QFile(location);
  27 +
  28 + bool fileOpened = logFile->open(QFile::ReadWrite);
  29 + if(!fileOpened) {
  30 + qWarning() << "Não foi possível abrir arquivo de log.";
  31 + return;
  32 + }
  33 +}
  34 +
  35 +LogFile::~LogFile()
  36 +{
  37 + logFile->close();
  38 + delete logFile;
  39 +}
  40 +
  41 +
  42 +void LogFile::outputMessage(QtMsgType type, const QString &msg)
  43 +{
  44 +
  45 +
  46 + if (type == QtDebugMsg) {
  47 + QByteArray localMsg = QString("Debug: ").append(msg).append("\n").toLocal8Bit();
  48 + logFile->write(localMsg);
  49 + } else if(type == QtWarningMsg) {
  50 + QByteArray localMsg = QString("Warning: ").append(msg).append("\n").toLocal8Bit();
  51 + logFile->write(localMsg);
  52 + } else if(type == QtCriticalMsg) {
  53 + QByteArray localMsg = QString("Critical: ").append(msg).append("\n").toLocal8Bit();
  54 + logFile->write(localMsg);
  55 + } else if(type == QtFatalMsg) {
  56 + QByteArray localMsg = QString("Fatal: ").append(msg).append("\n").toLocal8Bit();
  57 + logFile->write(localMsg);
  58 + }
  59 +}
src/logfile.h 0 → 100644
@@ -0,0 +1,22 @@ @@ -0,0 +1,22 @@
  1 +#ifndef LOGBROWSER_H
  2 +#define LOGBROWSER_H
  3 +
  4 +#include <QDebug>
  5 +#include <QFile>
  6 +#include <QObject>
  7 +
  8 +class LogFile : public QObject
  9 +{
  10 + Q_OBJECT
  11 +public:
  12 + explicit LogFile(QObject *parent = 0);
  13 + explicit LogFile(const QString &fileLocation, QObject *parent = 0);
  14 + ~LogFile();
  15 + void outputMessage( QtMsgType type, const QString &msg );
  16 +
  17 +private:
  18 + QFile *logFile;
  19 +
  20 +};
  21 +
  22 +#endif // LOGBROWSER_H