Commit 18065fa9f6932a0eb34d44f9a07f0ffb65dad20d
1 parent
b0435f21
Exists in
master
COLETA PRONTA! Até o momento, em linux e windows, funcionando.
Showing
10 changed files
with
261 additions
and
69 deletions
Show diff stats
cacic-teste/cacic-teste.pro
| @@ -9,11 +9,11 @@ QT += network | @@ -9,11 +9,11 @@ QT += network | ||
| 9 | 9 | ||
| 10 | TARGET = cacic-teste | 10 | TARGET = cacic-teste |
| 11 | 11 | ||
| 12 | -QT += axcontainer | ||
| 13 | CONFIG -= app_bundle | 12 | CONFIG -= app_bundle |
| 14 | CONFIG += c++11 | 13 | CONFIG += c++11 |
| 15 | TEMPLATE = app | 14 | TEMPLATE = app |
| 16 | win32 { | 15 | win32 { |
| 16 | + QT += axcontainer | ||
| 17 | LIBS += -LE:\LightBase\cacic-agente-project\cacic-agente\src\crypto++\lib -lcryptopp | 17 | LIBS += -LE:\LightBase\cacic-agente-project\cacic-agente\src\crypto++\lib -lcryptopp |
| 18 | } else { | 18 | } else { |
| 19 | LIBS += -L/usr/lib -lcryptopp | 19 | LIBS += -L/usr/lib -lcryptopp |
| @@ -28,6 +28,7 @@ SOURCES += \ | @@ -28,6 +28,7 @@ SOURCES += \ | ||
| 28 | ../src/cacic_hardware.cpp \ | 28 | ../src/cacic_hardware.cpp \ |
| 29 | ../src/vqtconvert.cpp \ | 29 | ../src/vqtconvert.cpp \ |
| 30 | ../src/vregistry.cpp \ | 30 | ../src/vregistry.cpp \ |
| 31 | + ../src/ccoleta.cpp \ | ||
| 31 | # ../src/qtservice/src/qtservice.cpp \ | 32 | # ../src/qtservice/src/qtservice.cpp \ |
| 32 | # ../src/qtservice/src/qtservice_unix.cpp \ | 33 | # ../src/qtservice/src/qtservice_unix.cpp \ |
| 33 | # ../src/qtservice/src/qtservice_win.cpp \ | 34 | # ../src/qtservice/src/qtservice_win.cpp \ |
| @@ -46,6 +47,7 @@ HEADERS += \ | @@ -46,6 +47,7 @@ HEADERS += \ | ||
| 46 | ../src/cacic_hardware.h \ | 47 | ../src/cacic_hardware.h \ |
| 47 | ../src/vqtconvert.h \ | 48 | ../src/vqtconvert.h \ |
| 48 | ../src/vregistry.h \ | 49 | ../src/vregistry.h \ |
| 50 | + ../src/ccoleta.h \ | ||
| 49 | # ../src/qtservice/src/qtservice.h \ | 51 | # ../src/qtservice/src/qtservice.h \ |
| 50 | # ../src/qtservice/src/qtservice_p.h \ | 52 | # ../src/qtservice/src/qtservice_p.h \ |
| 51 | # ../src/qtservice/src/qtunixserversocket.h \ | 53 | # ../src/qtservice/src/qtunixserversocket.h \ |
cacic-teste/testcacic.cpp
| @@ -101,14 +101,11 @@ void CTestCacic::testpegarOS(){ | @@ -101,14 +101,11 @@ void CTestCacic::testpegarOS(){ | ||
| 101 | 101 | ||
| 102 | void CTestCacic::testConsole() | 102 | void CTestCacic::testConsole() |
| 103 | { | 103 | { |
| 104 | - ConsoleObject console; | ||
| 105 | #if defined(Q_OS_LINUX) | 104 | #if defined(Q_OS_LINUX) |
| 105 | + ConsoleObject console; | ||
| 106 | QVERIFY(console("echo teste").toStdString() == "teste\n"); | 106 | QVERIFY(console("echo teste").toStdString() == "teste\n"); |
| 107 | -#elif defined(Q_OS_WIN) | ||
| 108 | - qDebug() << console("echo teste"); | ||
| 109 | - QVERIFY(console("echo teste").toStdString() == "teste"); | ||
| 110 | #else | 107 | #else |
| 111 | - QVERIFY(false); | 108 | + QSKIP("Teste desnecessário nessa plataforma"); |
| 112 | #endif | 109 | #endif |
| 113 | } | 110 | } |
| 114 | 111 | ||
| @@ -245,11 +242,33 @@ void CTestCacic::testGetTest() | @@ -245,11 +242,33 @@ void CTestCacic::testGetTest() | ||
| 245 | QJsonObject envio; | 242 | QJsonObject envio; |
| 246 | envio["computador"] = OCacicComp.toJsonObject(); | 243 | envio["computador"] = OCacicComp.toJsonObject(); |
| 247 | OCacicComm.setUrlGerente("http://10.1.0.137/cacic/web/app_dev.php"); | 244 | OCacicComm.setUrlGerente("http://10.1.0.137/cacic/web/app_dev.php"); |
| 245 | + OCacicComm.comm("/ws/neo/getTest", &ok, envio); | ||
| 248 | QVERIFY(ok); | 246 | QVERIFY(ok); |
| 249 | } | 247 | } |
| 250 | 248 | ||
| 249 | +void CTestCacic::testColeta() | ||
| 250 | +{ | ||
| 251 | + QJsonObject configTeste; | ||
| 252 | + QJsonObject configComputer; | ||
| 253 | + configComputer["operating_system"] = QJsonValue::fromVariant(QString("")); | ||
| 254 | + configComputer["user"] = QJsonValue::fromVariant(QString("")); | ||
| 255 | + configComputer["network_interface"] = QJsonValue::fromVariant(QString("")); | ||
| 256 | + configTeste["computer"] = configComputer; | ||
| 257 | + configTeste["hardware"] = QJsonValue::fromVariant(QString("")); | ||
| 258 | + configTeste["software"] = QJsonValue::fromVariant(QString("")); | ||
| 259 | + | ||
| 260 | + OCacic.setJsonToFile(configTeste,"configReq.json"); | ||
| 261 | + oColeta.configuraColetas(); | ||
| 262 | + oColeta.run(); | ||
| 263 | + oColeta.waitToCollect(); | ||
| 264 | +// qDebug() << oColeta.toJsonObject(); | ||
| 265 | + QVERIFY(!oColeta.toJsonObject()["software"].toObject().isEmpty() && | ||
| 266 | + !oColeta.toJsonObject()["hardware"].toObject().isEmpty()); | ||
| 267 | +} | ||
| 268 | + | ||
| 251 | void CTestCacic::cleanupTestCase() | 269 | void CTestCacic::cleanupTestCase() |
| 252 | { | 270 | { |
| 253 | OCacic.deleteFile("configRequest.json"); | 271 | OCacic.deleteFile("configRequest.json"); |
| 254 | OCacic.deleteFile("teste.json"); | 272 | OCacic.deleteFile("teste.json"); |
| 273 | + OCacic.deleteFile("configReq.json"); | ||
| 255 | } | 274 | } |
cacic-teste/testcacic.h
| @@ -16,6 +16,7 @@ | @@ -16,6 +16,7 @@ | ||
| 16 | #include <iostream> | 16 | #include <iostream> |
| 17 | #include <QtNetwork/QtNetwork> | 17 | #include <QtNetwork/QtNetwork> |
| 18 | #include <QJsonObject> | 18 | #include <QJsonObject> |
| 19 | +#include <ccoleta.h> | ||
| 19 | 20 | ||
| 20 | class CTestCacic : public QObject | 21 | class CTestCacic : public QObject |
| 21 | { | 22 | { |
| @@ -33,6 +34,7 @@ private: | @@ -33,6 +34,7 @@ private: | ||
| 33 | QString testIniPath; | 34 | QString testIniPath; |
| 34 | QJsonObject session; | 35 | QJsonObject session; |
| 35 | QString cripTeste; | 36 | QString cripTeste; |
| 37 | + CColeta oColeta; | ||
| 36 | // cacicD OcacicD; | 38 | // cacicD OcacicD; |
| 37 | 39 | ||
| 38 | signals: | 40 | signals: |
| @@ -71,6 +73,7 @@ private slots: | @@ -71,6 +73,7 @@ private slots: | ||
| 71 | void testColetaHardware(); | 73 | void testColetaHardware(); |
| 72 | void testConvertDouble(); | 74 | void testConvertDouble(); |
| 73 | void testGetTest(); | 75 | void testGetTest(); |
| 76 | + void testColeta(); | ||
| 74 | void cleanupTestCase(); | 77 | void cleanupTestCase(); |
| 75 | }; | 78 | }; |
| 76 | 79 |
gercols/gercols.cpp
| @@ -23,7 +23,6 @@ Gercols::Gercols(QObject *parent) | @@ -23,7 +23,6 @@ Gercols::Gercols(QObject *parent) | ||
| 23 | //Pega chave do registro, que será pega na instalação. | 23 | //Pega chave do registro, que será pega na instalação. |
| 24 | oCacic.setChaveCrypt(oCacic.getValueFromRegistry("Lightbase", "Cacic", "key").toString()); | 24 | oCacic.setChaveCrypt(oCacic.getValueFromRegistry("Lightbase", "Cacic", "key").toString()); |
| 25 | 25 | ||
| 26 | -qDebug() << "TESTE"; | ||
| 27 | oColeta = new CColeta(); | 26 | oColeta = new CColeta(); |
| 28 | 27 | ||
| 29 | QObject::connect(this, SIGNAL(iniciaConfiguracao()), oColeta, SLOT(configuraColetas())); | 28 | QObject::connect(this, SIGNAL(iniciaConfiguracao()), oColeta, SLOT(configuraColetas())); |
| @@ -47,7 +46,7 @@ void Gercols::run() | @@ -47,7 +46,7 @@ void Gercols::run() | ||
| 47 | emit iniciaColeta(); | 46 | emit iniciaColeta(); |
| 48 | 47 | ||
| 49 | oCacic.deleteFile("configReq.json"); | 48 | oCacic.deleteFile("configReq.json"); |
| 50 | - | 49 | + oColeta->waitToCollect(); |
| 51 | //salva json em arquivo | 50 | //salva json em arquivo |
| 52 | if (!oColeta->toJsonObject().isEmpty()) | 51 | if (!oColeta->toJsonObject().isEmpty()) |
| 53 | oCacic.setJsonToFile(oColeta->toJsonObject(), "coleta.json"); | 52 | oCacic.setJsonToFile(oColeta->toJsonObject(), "coleta.json"); |
gercols/gercols.pro
| @@ -12,6 +12,7 @@ TARGET = gercols | @@ -12,6 +12,7 @@ TARGET = gercols | ||
| 12 | CONFIG += console | 12 | CONFIG += console |
| 13 | CONFIG -= app_bundle | 13 | CONFIG -= app_bundle |
| 14 | CONFIG += qt | 14 | CONFIG += qt |
| 15 | +CONFIG += c++11 | ||
| 15 | 16 | ||
| 16 | win32 { | 17 | win32 { |
| 17 | QT += axcontainer | 18 | QT += axcontainer |
| @@ -33,7 +34,6 @@ SOURCES += \ | @@ -33,7 +34,6 @@ SOURCES += \ | ||
| 33 | ./gercols.cpp \ | 34 | ./gercols.cpp \ |
| 34 | ../src/vregistry.cpp \ | 35 | ../src/vregistry.cpp \ |
| 35 | ../src/vqtconvert.cpp \ | 36 | ../src/vqtconvert.cpp \ |
| 36 | -#win32 SOURCES += \ ../src/vregistry.cpp \ ../src/vqtconvert.cpp \ | ||
| 37 | 37 | ||
| 38 | HEADERS += \ | 38 | HEADERS += \ |
| 39 | ../src/ccacic.h \ | 39 | ../src/ccacic.h \ |
| @@ -46,7 +46,6 @@ HEADERS += \ | @@ -46,7 +46,6 @@ HEADERS += \ | ||
| 46 | ./gercols.h \ | 46 | ./gercols.h \ |
| 47 | ../src/vregistry.h \ | 47 | ../src/vregistry.h \ |
| 48 | ../src/vqtconvert.h \ | 48 | ../src/vqtconvert.h \ |
| 49 | -#win32 HEADERS += \ ../src/vregistry.h \ ../src/vqtconvert.h \ | ||
| 50 | 49 | ||
| 51 | INCLUDEPATH += ../src \ | 50 | INCLUDEPATH += ../src \ |
| 52 | ../src/crypto++/include/ | 51 | ../src/crypto++/include/ |
install-cacic/install-cacic.pro.user
| 1 | <?xml version="1.0" encoding="UTF-8"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | <!DOCTYPE QtCreatorProject> | 2 | <!DOCTYPE QtCreatorProject> |
| 3 | -<!-- Written by QtCreator 3.1.2, 2014-08-27T18:46:27. --> | 3 | +<!-- Written by QtCreator 3.1.2, 2014-08-29T15:37:15. --> |
| 4 | <qtcreator> | 4 | <qtcreator> |
| 5 | <data> | 5 | <data> |
| 6 | <variable>ProjectExplorer.Project.ActiveTarget</variable> | 6 | <variable>ProjectExplorer.Project.ActiveTarget</variable> |
| @@ -217,9 +217,7 @@ | @@ -217,9 +217,7 @@ | ||
| 217 | <value type="int">14</value> | 217 | <value type="int">14</value> |
| 218 | </valuelist> | 218 | </valuelist> |
| 219 | <value type="int" key="PE.EnvironmentAspect.Base">2</value> | 219 | <value type="int" key="PE.EnvironmentAspect.Base">2</value> |
| 220 | - <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"> | ||
| 221 | - <value type="QString">PROCESSOR_ARCHITECTURE=x64</value> | ||
| 222 | - </valuelist> | 220 | + <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> |
| 223 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">install-cacic</value> | 221 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">install-cacic</value> |
| 224 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | 222 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
| 225 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:E:/LightBase/cacic-agente-project/cacic-agente/install-cacic/install-cacic.pro</value> | 223 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:E:/LightBase/cacic-agente-project/cacic-agente/install-cacic/install-cacic.pro</value> |
src/cacic_hardware.cpp
| @@ -16,111 +16,235 @@ QJsonObject cacic_hardware::coletaWin() | @@ -16,111 +16,235 @@ QJsonObject cacic_hardware::coletaWin() | ||
| 16 | { | 16 | { |
| 17 | QJsonObject hardware; | 17 | QJsonObject hardware; |
| 18 | QStringList params; | 18 | QStringList params; |
| 19 | - QJsonObject wmi; | 19 | + QJsonValue wmi; |
| 20 | // Win32_ComputerSystem (Caption, Description, Domain, DNSHostName, Manufacturer, | 20 | // Win32_ComputerSystem (Caption, Description, Domain, DNSHostName, Manufacturer, |
| 21 | // Model, Name, PrimaryOwnerName, TotalPhysicalMemory, Workgroup) | 21 | // Model, Name, PrimaryOwnerName, TotalPhysicalMemory, Workgroup) |
| 22 | params << "Caption" << "Description" << "Domain" << "DNSHostName" << "Manufacturer" << "Model" | 22 | params << "Caption" << "Description" << "Domain" << "DNSHostName" << "Manufacturer" << "Model" |
| 23 | << "Name" << "PrimaryOwnerName" << "TotalPhysicalMemory" << "Workgroup"; | 23 | << "Name" << "PrimaryOwnerName" << "TotalPhysicalMemory" << "Workgroup"; |
| 24 | wmi = wmiSearch("Win32_ComputerSystem", params); | 24 | wmi = wmiSearch("Win32_ComputerSystem", params); |
| 25 | - if (!wmi.isEmpty()) | ||
| 26 | - hardware["ComputerSystem"] = wmiSearch("Win32_ComputerSystem", params); | 25 | + if (!wmi.isNull()) |
| 26 | + hardware["ComputerSystem"] = wmi; | ||
| 27 | //Win32_PortableBattery | 27 | //Win32_PortableBattery |
| 28 | // (Verifica se é notebook) | 28 | // (Verifica se é notebook) |
| 29 | params.clear(); | 29 | params.clear(); |
| 30 | - hardware["IsNotebook"] = QJsonValue::fromVariant(!wmiSearch("Win32_PortableBattery", params).isEmpty()); | 30 | + hardware["IsNotebook"] = QJsonValue::fromVariant(!wmiSearch("Win32_PortableBattery", params).isNull()); |
| 31 | //Win32_Bios | 31 | //Win32_Bios |
| 32 | // (Manufacturer, SMBIOSBIOSVersion, BIOSVersion, Version, SerialNumber, ReleaseDate) | 32 | // (Manufacturer, SMBIOSBIOSVersion, BIOSVersion, Version, SerialNumber, ReleaseDate) |
| 33 | params.clear(); | 33 | params.clear(); |
| 34 | params << "Manufacturer" << "SMBIOSBIOSVersion" << "BIOSVersion" << "Version" << "SerialNumber" << "ReleaseDate"; | 34 | params << "Manufacturer" << "SMBIOSBIOSVersion" << "BIOSVersion" << "Version" << "SerialNumber" << "ReleaseDate"; |
| 35 | wmi = wmiSearch("Win32_Bios", params); | 35 | wmi = wmiSearch("Win32_Bios", params); |
| 36 | - if (!wmi.isEmpty()) | 36 | + if (!wmi.isNull()) |
| 37 | hardware["Bios"] = wmi; | 37 | hardware["Bios"] = wmi; |
| 38 | //Win32_BaseBoard | 38 | //Win32_BaseBoard |
| 39 | // (Manufacturer, Model, SerialNumber) | 39 | // (Manufacturer, Model, SerialNumber) |
| 40 | params.clear(); | 40 | params.clear(); |
| 41 | params << "Manufacturer" << "Model" << "SerialNumber"; | 41 | params << "Manufacturer" << "Model" << "SerialNumber"; |
| 42 | wmi = wmiSearch("Win32_Baseboard", params); | 42 | wmi = wmiSearch("Win32_Baseboard", params); |
| 43 | - if (!wmi.isEmpty()) | 43 | + if (!wmi.isNull()) |
| 44 | hardware["BaseBoard"] = wmi; | 44 | hardware["BaseBoard"] = wmi; |
| 45 | //Win32_SystemEnclosure | 45 | //Win32_SystemEnclosure |
| 46 | // (Manufacturer, ChassisTypes, SerialNumber, SMBIOSAssetTag) | 46 | // (Manufacturer, ChassisTypes, SerialNumber, SMBIOSAssetTag) |
| 47 | + params.clear(); | ||
| 48 | + params << "Manufacturer" << "ChassisTypes" << "SerialNumber" << "SMBIOSAssetTag"; | ||
| 49 | + wmi = wmiSearch("Win32_SystemEnclosure", params); | ||
| 50 | + if (!wmi.isNull()) | ||
| 51 | + hardware["SystemEnclosure"] = wmi; | ||
| 47 | //Win32_FloppyDrive | 52 | //Win32_FloppyDrive |
| 48 | // (Manufacturer, Caption, Description, Name, MediaType, Size) | 53 | // (Manufacturer, Caption, Description, Name, MediaType, Size) |
| 54 | + params.clear(); | ||
| 55 | + params << "Manufacturer" << "Caption" << "Description" << "Name"; | ||
| 56 | + wmi = wmiSearch("Win32_FloppyDrive", params); | ||
| 57 | + if (!wmi.isNull()) | ||
| 58 | + hardware["FloppyDrive"] = wmi; | ||
| 49 | //Win32_DiskDrive | 59 | //Win32_DiskDrive |
| 50 | // (Manufacturer, Caption, Description, Name, MediaType, Size, SerialNumber, Model, FirmwareRevision) | 60 | // (Manufacturer, Caption, Description, Name, MediaType, Size, SerialNumber, Model, FirmwareRevision) |
| 61 | + params.clear(); | ||
| 62 | + params << "Manufacturer" << "Caption" << "Description" << "Name" << "MediaType" << "Size" << "SerialNumber" | ||
| 63 | + << "Model" << "FirmwareRevision"; | ||
| 64 | + wmi = wmiSearch("Win32_DiskDrive", params); | ||
| 65 | + if (!wmi.isNull()) | ||
| 66 | + hardware["DiskDrive"] = wmi; | ||
| 51 | //Win32_CDROMDrive | 67 | //Win32_CDROMDrive |
| 52 | // (Manufacturer, Caption, Description, Name, MediaType, Size) | 68 | // (Manufacturer, Caption, Description, Name, MediaType, Size) |
| 69 | + params.clear(); | ||
| 70 | + params << "Manufacturer" << "Caption" << "Description" << "MediaType" << "Name" << "Size"; | ||
| 71 | + wmi = wmiSearch("Win32_CDROMDrive", params); | ||
| 72 | + if (!wmi.isNull()) | ||
| 73 | + hardware["CDROMDrive"] = wmi; | ||
| 53 | //Win32_FloppyController | 74 | //Win32_FloppyController |
| 54 | // (Manufacturer, Caption, Description, Name) | 75 | // (Manufacturer, Caption, Description, Name) |
| 76 | + params.clear(); | ||
| 77 | + params << "Manufacturer" << "Caption" << "Description" << "Name"; | ||
| 78 | + wmi = wmiSearch("Win32_FloppyController", params); | ||
| 79 | + if (!wmi.isNull()) | ||
| 80 | + hardware["FloppyController"] = wmi; | ||
| 55 | //Win32_SCSIController | 81 | //Win32_SCSIController |
| 56 | // (Manufacturer, Caption, Description, Name, HardwareVersion) | 82 | // (Manufacturer, Caption, Description, Name, HardwareVersion) |
| 83 | + params.clear(); | ||
| 84 | + params << "Manufacturer" << "Caption" << "Description" << "Name" << "HardwareVersion"; | ||
| 85 | + wmi = wmiSearch("Win32_SCSIController", params); | ||
| 86 | + if (!wmi.isNull()) | ||
| 87 | + hardware["SCSIController"] = wmi; | ||
| 57 | //Win32_InfraredDevice | 88 | //Win32_InfraredDevice |
| 58 | // (Manufacturer, Caption, Description, Name) | 89 | // (Manufacturer, Caption, Description, Name) |
| 90 | + params.clear(); | ||
| 91 | + params << "Manufacturer" << "Caption" << "Description" << "Name"; | ||
| 92 | + wmi = wmiSearch("Win32_InfraredDevice", params); | ||
| 93 | + if (!wmi.isNull()) | ||
| 94 | + hardware["InfraredDevice"] = wmi; | ||
| 59 | //Win32_USBController | 95 | //Win32_USBController |
| 60 | // (Manufacturer, Caption, Description, Name) | 96 | // (Manufacturer, Caption, Description, Name) |
| 97 | + params.clear(); | ||
| 98 | + params << "Manufacturer" << "Caption" << "Description" << "Name"; | ||
| 99 | + wmi = wmiSearch("Win32_USBController", params); | ||
| 100 | + if (!wmi.isNull()) | ||
| 101 | + hardware["USBController"] = wmi; | ||
| 61 | //Win32_PCMCIAController | 102 | //Win32_PCMCIAController |
| 62 | // (Manufacturer, Caption, Description, Name) | 103 | // (Manufacturer, Caption, Description, Name) |
| 104 | + params.clear(); | ||
| 105 | + params << "Manufacturer" << "Caption" << "Description" << "Name"; | ||
| 106 | + wmi = wmiSearch("Win32_PCMCIAController", params); | ||
| 107 | + if (!wmi.isNull()) | ||
| 108 | + hardware["PCMCIAController"] = wmi; | ||
| 63 | //Win32_VideoController | 109 | //Win32_VideoController |
| 64 | - // (Description, VideoProcessor, AdapterRAM, CurrentHorizontalResolution, CurrentVerticalResolution) | 110 | + // (Description, VideoProcessor, AdapterRAM, CurrentHorizontalResolution, CurrentVerticalResolution, Caption, Name) |
| 111 | + params.clear(); | ||
| 112 | + params << "VideoProcessor" << "AdapterRAM" << "Description" << "Name" << "CurrentHorizontalResolution" | ||
| 113 | + << "CurrentVerticalResolution" << "Caption" << "AcceleratorCapabilities"; | ||
| 114 | + wmi = wmiSearch("Win32_VideoController", params); | ||
| 115 | + if (!wmi.isNull()) | ||
| 116 | + hardware["VideoController"] = wmi; | ||
| 65 | //Win32_DesktopMonitor | 117 | //Win32_DesktopMonitor |
| 66 | - // (MonitorManufacturer, Caption, Description, MonitorType) | 118 | + // (MonitorManufacturer, Caption, Description, MonitorType, Name) |
| 119 | + params.clear(); | ||
| 120 | + params << "MonitorManufacturer" << "Caption" << "Description" << "MonitorType" << "Name"; | ||
| 121 | + wmi = wmiSearch("Win32_DesktopMonitor", params); | ||
| 122 | + if (!wmi.isNull()) | ||
| 123 | + hardware["DesktopMonitor"] = wmi; | ||
| 67 | //Win32_Printer | 124 | //Win32_Printer |
| 68 | // (Name, DriverName, PortName, ServerName, ShareName, HorizontalResolution, VerticalResolution, Comment, Shared, Network) | 125 | // (Name, DriverName, PortName, ServerName, ShareName, HorizontalResolution, VerticalResolution, Comment, Shared, Network) |
| 126 | + params.clear(); | ||
| 127 | + params << "Name" << "DriverName" << "PortName" << "ServerName" << "ShareName" << "HorizontalResolution" | ||
| 128 | + << "VerticalResolution" << "Comment" << "Shared" << "Network"; | ||
| 129 | + wmi = wmiSearch("Win32_Printer", params); | ||
| 130 | + if (!wmi.isNull()) | ||
| 131 | + hardware["Printer"] = wmi; | ||
| 69 | //Win32_PortConnector | 132 | //Win32_PortConnector |
| 70 | - // (ExternalReferenceDesignator, PortType, ConnectorType) | 133 | + // (ExternalReferenceDesignator, PortType (verificar), ConnectorType (verificar), Manufacturer, Caption, Name) |
| 134 | + params.clear(); | ||
| 135 | + params << "ExternalReferenceDesignator" << "PortType" << "ConnectorType" << "Name" << "Caption" << "Manufacturer"; | ||
| 136 | + wmi = wmiSearch("Win32_PortConnector", params); | ||
| 137 | + if (!wmi.isNull()) | ||
| 138 | + hardware["PortConnector"] = wmi; | ||
| 71 | //Win32_SerialPort | 139 | //Win32_SerialPort |
| 72 | // (Name, Caption, Description, StatusInfo) | 140 | // (Name, Caption, Description, StatusInfo) |
| 141 | + params.clear(); | ||
| 142 | + params << "Name" << "Caption" << "Description" << "StatusInfo"; | ||
| 143 | + wmi = wmiSearch("Win32_SerialPort", params); | ||
| 144 | + if (!wmi.isNull()) | ||
| 145 | + hardware["SerialPort"] = wmi; | ||
| 73 | //Win32_Processor | 146 | //Win32_Processor |
| 74 | - // (MaxClockSpeed, Name, Architecture, NumberOfCores, SocketDesignation, Manufacturer, Name, Architecture, NumberOfCores | 147 | + // (MaxClockSpeed, Name, Architecture, NumberOfCores, SocketDesignation, Manufacturer, Architecture, NumberOfCores |
| 75 | // CurrentClockSpeed, MaxClockSpeed, L2CacheSize, AddressWidth, DataWidth, VoltageCaps, CpuStatus, | 148 | // CurrentClockSpeed, MaxClockSpeed, L2CacheSize, AddressWidth, DataWidth, VoltageCaps, CpuStatus, |
| 76 | // ProcessorId || UniqueId, AddressWidth) | 149 | // ProcessorId || UniqueId, AddressWidth) |
| 150 | + params.clear(); | ||
| 151 | + params << "MaxClockSpeed" << "Name" << "Architecture" << "NumberOfCores" << "SocketDesignation" << "Manufacturer" | ||
| 152 | + << "Architecture" << "NumberOfCores" << "CurrentClockSpeed" << "MaxClockSpeed" << "L2CacheSize" << "AddressWidth" | ||
| 153 | + << "DataWidth" << "VoltageCaps" << "CpuStatus" << "ProcessorId" << "UniqueId" << "AddressWidth"; | ||
| 154 | + wmi = wmiSearch("Win32_Processor", params); | ||
| 155 | + if (!wmi.isNull()) | ||
| 156 | + hardware["Processor"] = wmi; | ||
| 77 | //Win32_OperatingSystem | 157 | //Win32_OperatingSystem |
| 78 | // (Name, Version, CSDVersion, Description, InstallDate, Organization, RegisteredUser, SerialNumber) | 158 | // (Name, Version, CSDVersion, Description, InstallDate, Organization, RegisteredUser, SerialNumber) |
| 159 | + params.clear(); | ||
| 160 | + params << "Name" << "Version" << "CSDVersion" << "Description" << "InstallDate" << "Organization" << "RegisteredUser" | ||
| 161 | + << "SerialNumber"; | ||
| 162 | + wmi = wmiSearch("Win32_OperatingSystem", params); | ||
| 163 | + if (!wmi.isNull()) | ||
| 164 | + hardware["OperatingSystem"] = wmi; | ||
| 79 | //Win32_SystemSlot | 165 | //Win32_SystemSlot |
| 80 | // (Name, Description, SlotDesignation, CurrentUsage, Status, Shared) | 166 | // (Name, Description, SlotDesignation, CurrentUsage, Status, Shared) |
| 167 | + params.clear(); | ||
| 168 | + params << "Name" << "Description" << "SlotDesignation" << "CurrentUsage" << "Status" << "Shared"; | ||
| 169 | + wmi = wmiSearch("Win32_SystemSlot", params); | ||
| 170 | + if (!wmi.isNull()) | ||
| 171 | + hardware["SystemSlot"] = wmi; | ||
| 81 | //Win32_LogicalDisk | 172 | //Win32_LogicalDisk |
| 82 | // (Caption, DriveType, Filesystem, VolumeName, ProviderName, Filesystem, VolumeName, Size, FreeSpace) | 173 | // (Caption, DriveType, Filesystem, VolumeName, ProviderName, Filesystem, VolumeName, Size, FreeSpace) |
| 174 | + params.clear(); | ||
| 175 | + params << "Caption" << "DriveType" << "Filesystem" << "VolumeName" << "ProviderName" << "Filesystem" << "VolumeName" | ||
| 176 | + << "Size" << "FreeSpace"; | ||
| 177 | + wmi = wmiSearch("Win32_LogicalDisk", params); | ||
| 178 | + if (!wmi.isNull()) | ||
| 179 | + hardware["LogicalDisk"] = wmi; | ||
| 83 | //Win32_PhysicalMemory | 180 | //Win32_PhysicalMemory |
| 84 | - // (Caption, Description, BankLabel, DeviceLocator, Capacity, Speed, MemoryTypem, SerialNumber) | 181 | + // (Caption, Description, BankLabel, DeviceLocator, Capacity, Speed, MemoryType, SerialNumber) |
| 182 | + params.clear(); | ||
| 183 | + params << "Caption" << "Description" << "BankLabel" << "DeviceLocator" << "Capacity" << "Speed" << "MemoryType"; | ||
| 184 | + wmi = wmiSearch("Win32_PhysicalMemory", params); | ||
| 185 | + if (!wmi.isNull()) | ||
| 186 | + hardware["PhysicalMemory"] = wmi; | ||
| 85 | //Win32_Keyboard | 187 | //Win32_Keyboard |
| 86 | - // (Manufacturer, Caption, Description) | 188 | + // (Caption, Description, Name) |
| 189 | + params.clear(); | ||
| 190 | + params << "Caption" << "Description" << "Name" << "Layout"; | ||
| 191 | + wmi = wmiSearch("Win32_Keyboard", params); | ||
| 192 | + if (!wmi.isNull()) | ||
| 193 | + hardware["Keyboard"] = wmi; | ||
| 87 | //Win32_PointingDevice | 194 | //Win32_PointingDevice |
| 88 | // (Manufacturer, Caption, Description, PointingType, DeviceInterface) | 195 | // (Manufacturer, Caption, Description, PointingType, DeviceInterface) |
| 196 | + params.clear(); | ||
| 197 | + params << "Manufacturer" << "Caption" << "Description" << "PointingType" << "DeviceInterface"; | ||
| 198 | + wmi = wmiSearch("Win32_PointingDevice", params); | ||
| 199 | + if (!wmi.isNull()) | ||
| 200 | + hardware["PointingDevice"] = wmi; | ||
| 89 | //Win32_PnPSignedDriver | 201 | //Win32_PnPSignedDriver |
| 90 | // (Manufacturer, DeviceName, Description, Location, DeviceClass) | 202 | // (Manufacturer, DeviceName, Description, Location, DeviceClass) |
| 91 | - qDebug() << hardware; | 203 | + params.clear(); |
| 204 | + params << "Manufacturer" << "DeviceName" << "Description" << "Location" << "DeviceClass"; | ||
| 205 | + wmi = wmiSearch("Win32_PnPSignedDriver", params); | ||
| 206 | + if (!wmi.isNull()) | ||
| 207 | + hardware["PnPSignedDriver"] = wmi; | ||
| 208 | +// qDebug() << hardware; | ||
| 92 | return hardware; | 209 | return hardware; |
| 93 | } | 210 | } |
| 94 | 211 | ||
| 95 | -QJsonObject cacic_hardware::wmiSearch(QString classe, QStringList params) | 212 | +QJsonValue cacic_hardware::wmiSearch(QString classe, QStringList params) |
| 96 | { | 213 | { |
| 97 | - QJsonObject wmiReturn; | 214 | + QJsonValue wmiReturn; |
| 215 | + QJsonObject itemWmi; | ||
| 216 | + QJsonArray arrayItens; | ||
| 98 | QString paramsString; | 217 | QString paramsString; |
| 99 | if (!params.empty()){ | 218 | if (!params.empty()){ |
| 100 | for(int i = 0; i!=params.size();i++) | 219 | for(int i = 0; i!=params.size();i++) |
| 101 | paramsString.append(params.at(i) + ((i != params.size() - 1) ? "," : "")); | 220 | paramsString.append(params.at(i) + ((i != params.size() - 1) ? "," : "")); |
| 102 | } | 221 | } |
| 103 | - QAxObject *objIWbemLocator = new QAxObject("WbemScripting.SWbemLocator"); | 222 | + QString query = "SELECT " + ((!paramsString.isEmpty()) ? paramsString : "*") + " FROM " + classe; |
| 223 | + //conecta ao script (Como já estamos usando QObject, o WbemScripting... não funciona chamando normal, | ||
| 224 | + // por isso deve ser usado o CoInitializeEx) | ||
| 225 | + ::CoInitializeEx(NULL, COINIT_MULTITHREADED); | ||
| 226 | + QAxObject *objIWbemLocator = new QAxObject(); | ||
| 227 | + objIWbemLocator->setControl("WbemScripting.SWbemLocator"); | ||
| 228 | + if (objIWbemLocator->isNull()) | ||
| 229 | + return QJsonValue(); | ||
| 230 | + //conecta ao wmi | ||
| 104 | QAxObject *objWMIService = objIWbemLocator->querySubObject("ConnectServer(QString&,QString&)", | 231 | QAxObject *objWMIService = objIWbemLocator->querySubObject("ConnectServer(QString&,QString&)", |
| 105 | QString("."), | 232 | QString("."), |
| 106 | QString("root\\CIMV2") | 233 | QString("root\\CIMV2") |
| 107 | ); | 234 | ); |
| 108 | - QAxObject* returnList = objWMIService->querySubObject("ExecQuery(QString&)", | ||
| 109 | - QString("SELECT " + ((!paramsString.isEmpty()) ? | ||
| 110 | - paramsString : "*") + | ||
| 111 | - " FROM " + classe) | ||
| 112 | - ); | 235 | +// qDebug() << ">>>>>>>>>" << objIWbemLocator->isNull() << objWMIService->isNull(); |
| 236 | + //Faz a pesquisa no wmi | ||
| 237 | + QAxObject* returnList = objWMIService->querySubObject("ExecQuery(QString&)", query); | ||
| 238 | +// qDebug() << "<<<<<<<<<<<<<<<<<<<<<<<"; | ||
| 113 | QAxObject *enum1 = returnList->querySubObject("_NewEnum"); | 239 | QAxObject *enum1 = returnList->querySubObject("_NewEnum"); |
| 114 | - //ui->textBrowser_4->setHtml(enum1->generateDocumentation()); | 240 | + |
| 115 | IEnumVARIANT* enumInterface = 0; | 241 | IEnumVARIANT* enumInterface = 0; |
| 242 | + | ||
| 116 | enum1->queryInterface(IID_IEnumVARIANT, (void**)&enumInterface); | 243 | enum1->queryInterface(IID_IEnumVARIANT, (void**)&enumInterface); |
| 117 | 244 | ||
| 118 | - //ui->textBrowser_4->setHtml(enumInterface->); | ||
| 119 | enumInterface->Reset(); | 245 | enumInterface->Reset(); |
| 120 | - // QAxObject *item = 0; | ||
| 121 | - | ||
| 122 | - //qDebug()<<"the count of objinterlist is "<<QString::number(objInterList->dynamicCall("Count").toInt()); | ||
| 123 | - for (int i = 0; i < returnList->dynamicCall("Count").toInt(); i++) { | 246 | + int countReturnListObj = returnList->dynamicCall("Count").toInt(); |
| 247 | + for (int i = 0; i < countReturnListObj; i++) { | ||
| 124 | VARIANT *theItem = (VARIANT*)malloc(sizeof(VARIANT)); | 248 | VARIANT *theItem = (VARIANT*)malloc(sizeof(VARIANT)); |
| 125 | if (enumInterface->Next(1,theItem,NULL) != S_FALSE){ | 249 | if (enumInterface->Next(1,theItem,NULL) != S_FALSE){ |
| 126 | QAxObject *item = new QAxObject((IUnknown *)theItem->punkVal); | 250 | QAxObject *item = new QAxObject((IUnknown *)theItem->punkVal); |
| @@ -130,7 +254,6 @@ QJsonObject cacic_hardware::wmiSearch(QString classe, QStringList params) | @@ -130,7 +254,6 @@ QJsonObject cacic_hardware::wmiSearch(QString classe, QStringList params) | ||
| 130 | QStringList instanceList = instance.split("\n\t"); | 254 | QStringList instanceList = instance.split("\n\t"); |
| 131 | //Pra cada linha grava no json os valores com cada tag | 255 | //Pra cada linha grava no json os valores com cada tag |
| 132 | foreach(QString value, instanceList){ | 256 | foreach(QString value, instanceList){ |
| 133 | - qDebug() << value; | ||
| 134 | QStringList valueList = value.split("="); | 257 | QStringList valueList = value.split("="); |
| 135 | if (valueList.size() > 1){ | 258 | if (valueList.size() > 1){ |
| 136 | QString tag = valueList.at(0).trimmed(); | 259 | QString tag = valueList.at(0).trimmed(); |
| @@ -139,29 +262,41 @@ QJsonObject cacic_hardware::wmiSearch(QString classe, QStringList params) | @@ -139,29 +262,41 @@ QJsonObject cacic_hardware::wmiSearch(QString classe, QStringList params) | ||
| 139 | aux.remove(";"); | 262 | aux.remove(";"); |
| 140 | aux.remove("\n"); | 263 | aux.remove("\n"); |
| 141 | //verifica se é lista | 264 | //verifica se é lista |
| 142 | - qDebug() << aux; | ||
| 143 | - if(aux.contains("{") && aux.contains("}")){ | 265 | + if(aux.startsWith("{") && aux.endsWith("}")){ |
| 144 | QStringList auxList = aux.split(","); | 266 | QStringList auxList = aux.split(","); |
| 145 | QJsonArray jList; | 267 | QJsonArray jList; |
| 146 | foreach(QString valueList, auxList){ | 268 | foreach(QString valueList, auxList){ |
| 147 | if (valueList.contains("{")) | 269 | if (valueList.contains("{")) |
| 148 | valueList.remove("{"); | 270 | valueList.remove("{"); |
| 149 | - else if (valueList.contains("}")) | 271 | + if (valueList.contains("}")) |
| 150 | valueList.remove("}"); | 272 | valueList.remove("}"); |
| 151 | jList.append(valueList.trimmed()); | 273 | jList.append(valueList.trimmed()); |
| 152 | } | 274 | } |
| 153 | - wmiReturn[tag] = jList; | 275 | + itemWmi[tag] = jList; |
| 154 | } else { | 276 | } else { |
| 155 | //O último valor sempre volta com "}" no final. | 277 | //O último valor sempre volta com "}" no final. |
| 156 | if (aux.contains("}")) | 278 | if (aux.contains("}")) |
| 157 | aux.remove("}"); | 279 | aux.remove("}"); |
| 158 | - wmiReturn[tag] = QJsonValue::fromVariant(aux.trimmed()); | 280 | + itemWmi[tag] = QJsonValue::fromVariant(aux.trimmed()); |
| 159 | } | 281 | } |
| 160 | } | 282 | } |
| 161 | - } | ||
| 162 | - } | 283 | + } // foreach(QString value, instanceList) |
| 284 | + } // if(item) | ||
| 285 | + } // if (enumInterface->Next(1,theItem,NULL) != S_FALSE) | ||
| 286 | + //Se houver mais de um objeto, grava em uma lista | ||
| 287 | + if (countReturnListObj > 1){ | ||
| 288 | + arrayItens.append(QJsonValue(itemWmi)); | ||
| 163 | } | 289 | } |
| 164 | } | 290 | } |
| 291 | + objIWbemLocator->clear(); | ||
| 292 | + ::CoUninitialize(); | ||
| 293 | + //se for mais de um objeto, retorna array. | ||
| 294 | + if (!arrayItens.isEmpty()) | ||
| 295 | + wmiReturn = QJsonValue(arrayItens); | ||
| 296 | + //senão, se o objeto não for vazio (se tiver coletado algo) | ||
| 297 | + else if (!itemWmi.isEmpty()) | ||
| 298 | + wmiReturn = QJsonValue(itemWmi); | ||
| 299 | + | ||
| 165 | return wmiReturn; | 300 | return wmiReturn; |
| 166 | } | 301 | } |
| 167 | #elif defined(Q_OS_LINUX) | 302 | #elif defined(Q_OS_LINUX) |
src/cacic_hardware.h
| @@ -22,7 +22,7 @@ public: | @@ -22,7 +22,7 @@ public: | ||
| 22 | private: | 22 | private: |
| 23 | #ifdef Q_OS_WIN | 23 | #ifdef Q_OS_WIN |
| 24 | QJsonObject coletaWin(); | 24 | QJsonObject coletaWin(); |
| 25 | - QJsonObject wmiSearch(QString classe, QStringList params); | 25 | + QJsonValue wmiSearch(QString classe, QStringList params); |
| 26 | 26 | ||
| 27 | #elif defined(Q_OS_LINUX) | 27 | #elif defined(Q_OS_LINUX) |
| 28 | QJsonObject coletaLinux(); | 28 | QJsonObject coletaLinux(); |
src/ccoleta.cpp
| @@ -11,6 +11,7 @@ void CColeta::coletaHardware() | @@ -11,6 +11,7 @@ void CColeta::coletaHardware() | ||
| 11 | qDebug() << "coletaHardware() começando sua execução"; | 11 | qDebug() << "coletaHardware() começando sua execução"; |
| 12 | oHardware.iniciaColeta(); | 12 | oHardware.iniciaColeta(); |
| 13 | qDebug() << "coletaHardware() executado"; | 13 | qDebug() << "coletaHardware() executado"; |
| 14 | + emit hardwareFinish(); | ||
| 14 | } | 15 | } |
| 15 | 16 | ||
| 16 | 17 | ||
| @@ -19,45 +20,75 @@ void CColeta::coletaSoftware() | @@ -19,45 +20,75 @@ void CColeta::coletaSoftware() | ||
| 19 | qDebug() << "coletaSoftware() começando sua execução"; | 20 | qDebug() << "coletaSoftware() começando sua execução"; |
| 20 | oSoftware.iniciaColeta(); | 21 | oSoftware.iniciaColeta(); |
| 21 | qDebug() << "coletaSoftware() executado"; | 22 | qDebug() << "coletaSoftware() executado"; |
| 22 | - | 23 | + emit softwareFinish(); |
| 23 | } | 24 | } |
| 24 | 25 | ||
| 25 | void CColeta::configuraColetas(){ | 26 | void CColeta::configuraColetas(){ |
| 26 | QObject::connect(this, SIGNAL(beginHardware()), this, SLOT(coletaHardware())); | 27 | QObject::connect(this, SIGNAL(beginHardware()), this, SLOT(coletaHardware())); |
| 27 | QObject::connect(this, SIGNAL(beginSoftware()), this, SLOT(coletaSoftware())); | 28 | QObject::connect(this, SIGNAL(beginSoftware()), this, SLOT(coletaSoftware())); |
| 29 | + QObject::connect(this, SIGNAL(softwareFinish()), this, SLOT(softwareReady())); | ||
| 30 | + QObject::connect(this, SIGNAL(hardwareFinish()), this, SLOT(hardwareReady())); | ||
| 28 | } | 31 | } |
| 29 | 32 | ||
| 30 | -CACIC_Computer CColeta::getOComputer() const | 33 | +bool CColeta::waitToCollect() |
| 31 | { | 34 | { |
| 32 | - return oComputer; | ||
| 33 | -} | ||
| 34 | - | ||
| 35 | -cacic_software CColeta::getOSoftware() const | ||
| 36 | -{ | ||
| 37 | - return oSoftware; | ||
| 38 | -} | ||
| 39 | - | ||
| 40 | -cacic_hardware CColeta::getOHardware() const | ||
| 41 | -{ | ||
| 42 | - return oHardware; | 35 | + int timeout = 0; |
| 36 | + while(!(this->softwareIsFinish && this->hardwareIsFinish) && timeout != 30){ | ||
| 37 | + QThread::sleep(1); | ||
| 38 | + timeout++; | ||
| 39 | + } | ||
| 40 | + return true; | ||
| 43 | } | 41 | } |
| 44 | 42 | ||
| 45 | void CColeta::run() | 43 | void CColeta::run() |
| 46 | { | 44 | { |
| 47 | QJsonObject coleta = oCacic.getJsonFromFile("configReq.json"); | 45 | QJsonObject coleta = oCacic.getJsonFromFile("configReq.json"); |
| 48 | 46 | ||
| 49 | - if( coleta.contains("hardware") ) | 47 | + if( coleta.contains("hardware") ){ |
| 48 | + this->hardwareIsFinish = false; | ||
| 50 | emit beginHardware(); | 49 | emit beginHardware(); |
| 51 | - if ( coleta.contains("software") ) | 50 | + } else |
| 51 | + this->hardwareIsFinish = true; | ||
| 52 | + if ( coleta.contains("software") ){ | ||
| 53 | + this->softwareIsFinish = false; | ||
| 52 | emit beginSoftware(); | 54 | emit beginSoftware(); |
| 55 | + } else | ||
| 56 | + this->softwareIsFinish = true; | ||
| 53 | 57 | ||
| 54 | } | 58 | } |
| 55 | 59 | ||
| 56 | QJsonObject CColeta::toJsonObject() | 60 | QJsonObject CColeta::toJsonObject() |
| 57 | { | 61 | { |
| 58 | QJsonObject coletaJson; | 62 | QJsonObject coletaJson; |
| 59 | - coletaJson["computer"] = oComputer.toJsonObject(); | ||
| 60 | - coletaJson["software"] = oSoftware.toJsonObject(); | ||
| 61 | - coletaJson["hardware"] = oHardware.toJsonObject(); | 63 | + if (this->hardwareIsFinish && this->softwareIsFinish){ |
| 64 | + coletaJson["computer"] = oComputer.toJsonObject(); | ||
| 65 | + coletaJson["software"] = oSoftware.toJsonObject(); | ||
| 66 | + coletaJson["hardware"] = oHardware.toJsonObject(); | ||
| 67 | + } | ||
| 62 | return coletaJson; | 68 | return coletaJson; |
| 63 | } | 69 | } |
| 70 | + | ||
| 71 | +void CColeta::hardwareReady() | ||
| 72 | +{ | ||
| 73 | + this->hardwareIsFinish = true; | ||
| 74 | +} | ||
| 75 | + | ||
| 76 | +void CColeta::softwareReady() | ||
| 77 | +{ | ||
| 78 | + this->softwareIsFinish = true; | ||
| 79 | +} | ||
| 80 | + | ||
| 81 | +CACIC_Computer CColeta::getOComputer() const | ||
| 82 | +{ | ||
| 83 | + return oComputer; | ||
| 84 | +} | ||
| 85 | + | ||
| 86 | +cacic_software CColeta::getOSoftware() const | ||
| 87 | +{ | ||
| 88 | + return oSoftware; | ||
| 89 | +} | ||
| 90 | + | ||
| 91 | +cacic_hardware CColeta::getOHardware() const | ||
| 92 | +{ | ||
| 93 | + return oHardware; | ||
| 94 | +} |
src/ccoleta.h
| @@ -19,6 +19,8 @@ private: | @@ -19,6 +19,8 @@ private: | ||
| 19 | CACIC_Computer oComputer; | 19 | CACIC_Computer oComputer; |
| 20 | cacic_software oSoftware; | 20 | cacic_software oSoftware; |
| 21 | cacic_hardware oHardware; | 21 | cacic_hardware oHardware; |
| 22 | + bool hardwareIsFinish; | ||
| 23 | + bool softwareIsFinish; | ||
| 22 | 24 | ||
| 23 | public: | 25 | public: |
| 24 | explicit CColeta(QObject *parent = 0); | 26 | explicit CColeta(QObject *parent = 0); |
| @@ -26,19 +28,23 @@ public: | @@ -26,19 +28,23 @@ public: | ||
| 26 | CACIC_Computer getOComputer() const; | 28 | CACIC_Computer getOComputer() const; |
| 27 | cacic_software getOSoftware() const; | 29 | cacic_software getOSoftware() const; |
| 28 | cacic_hardware getOHardware() const; | 30 | cacic_hardware getOHardware() const; |
| 29 | - | 31 | + bool waitToCollect(); |
| 30 | QJsonObject toJsonObject(); | 32 | QJsonObject toJsonObject(); |
| 31 | 33 | ||
| 32 | public slots: | 34 | public slots: |
| 33 | void coletaHardware(); | 35 | void coletaHardware(); |
| 34 | void coletaSoftware(); | 36 | void coletaSoftware(); |
| 35 | void configuraColetas(); | 37 | void configuraColetas(); |
| 38 | + void hardwareReady(); | ||
| 39 | + void softwareReady(); | ||
| 36 | void run(); | 40 | void run(); |
| 37 | 41 | ||
| 38 | signals: | 42 | signals: |
| 39 | void beginComputer(); | 43 | void beginComputer(); |
| 40 | void beginHardware(); | 44 | void beginHardware(); |
| 41 | void beginSoftware(); | 45 | void beginSoftware(); |
| 46 | + void hardwareFinish(); | ||
| 47 | + void softwareFinish(); | ||
| 42 | void finished(); | 48 | void finished(); |
| 43 | }; | 49 | }; |
| 44 | 50 |