Qt6 Migration: DDS-Stubs, Logger-Fixes, Export-Header Korrekturen
- NGL_ADD_LIBRARY2: 87 CMakeLists.txt konvertiert für Export-Header Generierung - 44 Export-Header Include-Pfade korrigiert (_export.h) - 81 DDS-Stub-Header generiert (*_dtc.h, *_fts.h, *_dts.h, *_ftc.h) - INGLLogger: Duplikat gelöscht, m_logger Member entfernt, variadische Makros - Q_FUNC_INFO Redefinition behoben (Qt6 definiert bereits) - FATAL_LOG Makro hinzugefügt - InfrastructureManagement DDS-Stubs (ism.hpp, ism_enums.hpp, ism_ftc.h) - FilterManagement DDS-Stubs (flt_ftc.h, flt_dts.h) - AreaEffectSimulation DDS-Stubs (aes.hpp, aes_enums.hpp) - SymbolAppearance Klasse vollständig definiert mit content() Methode - BuildingComponentFilter Klasse definiert mit Copy-Konstruktor - Ftc Factory: nullptr Return (abstract class) - AesFilter Klasse in aes.hpp hinzugefügt - Dtc Klasse in ppm.hpp mit participantChanged Signal - AesType Enum: alle 15 At* Werte definiert - AesEffectState_def: EsReceived hinzugefügt - DataModification Enum: eAdded/eModified/eRemoved - function_reply_object.h → core_types.h Include-Pfad (72 Dateien) - Enum-Class-Streaming Template-Operator in INGLLogger.h - ism_mounting_point.h: QImage → QtGui/QImage, QGuiApplication/QScreen - ism_data_plugin_interface.h: QSet Include, Include-Reihenfolge - QRegExp → QRegularExpression in tpm_js_parser.cpp - .underlying() Aufrufe zu direktem Enum-Vergleich korrigiert - Include-Pfade: aes.hpp in symbol_appearance_settings_impl.h und aes_display_filter_impl.h Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2785 files changed
+18754
-18316
No files matched your search
@@ -32,7 +32,7 @@ CODEGEN_TOPIC_TYPEDEFS(SRCS_common ${xml_FILE})
|
||||
# Generate obd_[d|f]tc.h
|
||||
CODEGEN_CLIENT_TOPICS_IFC(SRCS_common ${xml_FILE} PARTS FTC)
|
||||
|
||||
NGL_ADD_LIBRARY(SV WS svcObdCommon SHARED ${SRCS_common})
|
||||
NGL_ADD_LIBRARY2(SV WS svcObdCommon SHARED ${SRCS_common})
|
||||
NGL_TARGET_INCLUDE_DIRECTORIES(svcObdCommon
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../
|
||||
@@ -60,7 +60,7 @@ SET(SRCS_client
|
||||
# generate obd_[d|f]tc.h, obd_[d|f]tc_impl.[cpp|h]
|
||||
CODEGEN_CLIENT_TOPICS_IMPL(SRCS_client ${xml_FILE} PARTS FTC)
|
||||
|
||||
NGL_ADD_LIBRARY(SV WS svcObdClient SHARED ${SRCS_client})
|
||||
NGL_ADD_LIBRARY2(SV WS svcObdClient SHARED ${SRCS_client})
|
||||
NGL_TARGET_INCLUDE_DIRECTORIES(svcObdClient
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../
|
||||
@@ -88,7 +88,7 @@ SET(SRCS_server
|
||||
# generate obd_[d|f]ts.h, obd_[d|f]ts_impl.[cpp|h]
|
||||
CODEGEN_SERVER_TOPICS(SRCS_server ${xml_FILE} PARTS FTS)
|
||||
|
||||
NGL_ADD_LIBRARY(SV svcObdServer SHARED ${SRCS_server})
|
||||
NGL_ADD_LIBRARY2(SV svcObdServer SHARED ${SRCS_server})
|
||||
NGL_TARGET_INCLUDE_DIRECTORIES(svcObdServer
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../
|
||||
|
||||
-1
@@ -123,7 +123,6 @@ LtsWebSocket::AbstractClientMessage *ClientMessageFactory::createMessage(LtsWebS
|
||||
ClientMessage::ClientMessage(DataManager *dataManager, LtsWebSocket::ReplyHandler *client, const QString &type, const int typeId, const QString &uuid, const QJsonValue &data)
|
||||
: LtsWebSocket::AbstractClientMessage(client, type, typeId, uuid, data)
|
||||
, m_dataManager(dataManager)
|
||||
, m_logger(getLogger("ClientMessage"))
|
||||
{}
|
||||
// ####### ClientMessage end #######
|
||||
|
||||
|
||||
+7
-7
@@ -27,13 +27,13 @@ DataManager::DataManager(MainHandler *mainHandler)
|
||||
//---------------------------------------------------------------------------------------------------------
|
||||
void DataManager::handleErrorMessage(const OcBaseDownload::WebSocketInterface::Messages::ErrorMessage::ErrorData &errData)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "uuid: " << errData.uuid << " error class: " << errData.errorClass << " text: " << errData.errorMessage;
|
||||
ERROR_LOG() << "uuid: " << errData.uuid << " error class: " << errData.errorClass << " text: " << errData.errorMessage;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------
|
||||
void DataManager::servicePortsInformation(const QVector<Messages::ServicePortsInformation::ExerciseInformation> &exerciseInformation)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Got ServicePortsInformation from websocket";
|
||||
DEBUG_LOG() << "Got ServicePortsInformation from websocket";
|
||||
switch (m_currentDownload)
|
||||
{
|
||||
case CurrentDownload::PDF:
|
||||
@@ -44,7 +44,7 @@ void DataManager::servicePortsInformation(const QVector<Messages::ServicePortsIn
|
||||
break;
|
||||
case CurrentDownload::NOTHING:
|
||||
default:
|
||||
WARNING_LOG(m_logger) << "Got Ports Information in neither BASE nor PDF download mode";
|
||||
WARNING_LOG() << "Got Ports Information in neither BASE nor PDF download mode";
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -52,7 +52,7 @@ void DataManager::servicePortsInformation(const QVector<Messages::ServicePortsIn
|
||||
//---------------------------------------------------------------------------------------------------------
|
||||
void DataManager::handlePdfListMessage(const Messages::PdfListMessage::PdfListData &pdfListData)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Got PDF list from websocket";
|
||||
DEBUG_LOG() << "Got PDF list from websocket";
|
||||
m_mainHandler->handlerPdfDownload()->handlePdfListData(pdfListData);
|
||||
}
|
||||
|
||||
@@ -64,19 +64,19 @@ void DataManager::setCurrentDownload(CurrentDownload currentDownload)
|
||||
switch (m_currentDownload)
|
||||
{
|
||||
case CurrentDownload::PDF:
|
||||
DEBUG_LOG(m_logger) << "Setting current download mode to PDF";
|
||||
DEBUG_LOG() << "Setting current download mode to PDF";
|
||||
m_mainHandler->dds()->fts()->enableStartBaseDownload(false);
|
||||
m_mainHandler->dds()->fts()->enableGetPdfList();
|
||||
m_mainHandler->dds()->fts()->enableStartPdfDownload();
|
||||
break;
|
||||
case CurrentDownload::BASE:
|
||||
DEBUG_LOG(m_logger) << "Setting current download mode to BASE";
|
||||
DEBUG_LOG() << "Setting current download mode to BASE";
|
||||
m_mainHandler->dds()->fts()->enableStartBaseDownload();
|
||||
m_mainHandler->dds()->fts()->enableGetPdfList(false);
|
||||
m_mainHandler->dds()->fts()->enableStartPdfDownload(false);
|
||||
break;
|
||||
case CurrentDownload::NOTHING:
|
||||
DEBUG_LOG(m_logger) << "Setting current download mode to NOTHING";
|
||||
DEBUG_LOG() << "Setting current download mode to NOTHING";
|
||||
m_mainHandler->dds()->fts()->enableAll();
|
||||
break;
|
||||
default:
|
||||
|
||||
+5
-6
@@ -27,7 +27,6 @@ WebSocketInterfaceHandler::WebSocketInterfaceHandler(MainHandler *mainHandler, Q
|
||||
, m_dataManager(nullptr)
|
||||
, m_mainHandler(mainHandler)
|
||||
, m_webSocketActivityTimer(new QTimer(this))
|
||||
, m_logger(getLogger("WebSocketInterfaceHandler"))
|
||||
{
|
||||
connect(m_webSocketActivityTimer, &QTimer::timeout, this, &WebSocketInterfaceHandler::dataReceiveTimeout, Qt::UniqueConnection);
|
||||
const int iTimeout = Settings::webSocketActivityTimeoutMSec();
|
||||
@@ -44,9 +43,9 @@ bool WebSocketInterfaceHandler::init()
|
||||
{
|
||||
cleanup();
|
||||
|
||||
DEBUG_LOG(m_logger) << "WebSocketInterfaceHandler::init";
|
||||
DEBUG_LOG() << "WebSocketInterfaceHandler::init";
|
||||
m_dataManager = new DataManager(m_mainHandler);
|
||||
DEBUG_LOG(m_logger) << "... ok";
|
||||
DEBUG_LOG() << "... ok";
|
||||
|
||||
m_messageFactory = new Messages::ClientMessageFactory(m_dataManager);
|
||||
|
||||
@@ -56,7 +55,7 @@ bool WebSocketInterfaceHandler::init()
|
||||
void WebSocketInterfaceHandler::open(const QString &hostname, int port)
|
||||
{
|
||||
|
||||
DEBUG_LOG(m_logger) << "Opening " << hostname << ":" << port;
|
||||
DEBUG_LOG() << "Opening " << hostname << ":" << port;
|
||||
|
||||
recreateWebSocket();
|
||||
|
||||
@@ -80,7 +79,7 @@ void WebSocketInterfaceHandler::close()
|
||||
bool WebSocketInterfaceHandler::send(LtsWebSocket::ReplyMessage *message)
|
||||
{
|
||||
|
||||
DEBUG_LOG(m_logger) << "Sending: " << message->toJsonString();
|
||||
DEBUG_LOG() << "Sending: " << message->toJsonString();
|
||||
|
||||
if (!m_webSocketClient)
|
||||
return false;
|
||||
@@ -113,7 +112,7 @@ void WebSocketInterfaceHandler::recreateWebSocket()
|
||||
connect(m_webSocketClient, &LtsWebSocket::LtsWebSocketClient::dataReceived,
|
||||
this, [this]()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "data received restart timer";
|
||||
DEBUG_LOG() << "data received restart timer";
|
||||
m_webSocketActivityTimer->start();
|
||||
});
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ bool CopyDatabase::doCopy()
|
||||
{
|
||||
if (!runPgDump())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Error running pg_dump";
|
||||
ERROR_LOG() << "Error running pg_dump";
|
||||
emit copyDbFailed();
|
||||
return false;
|
||||
}
|
||||
@@ -74,7 +74,7 @@ void CopyDatabase::onDropDbFinished(int exitCode, QProcess::ExitStatus exitStatu
|
||||
|
||||
if (exitCode > 0)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "DropDb failed";
|
||||
ERROR_LOG() << "DropDb failed";
|
||||
emit dropDatabaseFailed();
|
||||
return;
|
||||
}
|
||||
@@ -129,7 +129,7 @@ void CopyDatabase::onCreateDbFinished(int exitCode, QProcess::ExitStatus exitSta
|
||||
|
||||
if (exitCode > 0)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "CreateDB failed";
|
||||
ERROR_LOG() << "CreateDB failed";
|
||||
emit copyDbFailed();
|
||||
return;
|
||||
}
|
||||
@@ -179,7 +179,7 @@ void CopyDatabase::onPgLoadFinished(int exitCode, QProcess::ExitStatus exitStatu
|
||||
|
||||
if (exitCode > 0)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Loading db failed";
|
||||
ERROR_LOG() << "Loading db failed";
|
||||
emit copyDbFailed();
|
||||
return;
|
||||
}
|
||||
@@ -207,7 +207,7 @@ void CopyDatabase::onPgSetGrantFinished(int exitCode, QProcess::ExitStatus exitS
|
||||
|
||||
if (exitCode > 0)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Set grants to ets_admin failed";
|
||||
ERROR_LOG() << "Set grants to ets_admin failed";
|
||||
emit copyDbFailed();
|
||||
return;
|
||||
}
|
||||
@@ -241,7 +241,7 @@ void CopyDatabase::handleProcFinished(int exitCode, QProcess::ExitStatus exitSta
|
||||
if (!out.isEmpty())
|
||||
out += '\n';
|
||||
out += m_proc->readAllStandardOutput();
|
||||
ERROR_LOG(m_logger) << "Process finished - exitCode: " << exitCode << ", exitStatus = " << exitStatus << ", " << out;
|
||||
ERROR_LOG() << "Process finished - exitCode: " << exitCode << ", exitStatus = " << exitStatus << ", " << out;
|
||||
}
|
||||
m_proc->disconnect(this);
|
||||
m_proc->deleteLater();
|
||||
@@ -250,7 +250,7 @@ void CopyDatabase::handleProcFinished(int exitCode, QProcess::ExitStatus exitSta
|
||||
|
||||
void CopyDatabase::onErrorOccured(QProcess::ProcessError error)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "error: " << error << ", " << m_proc->readAllStandardOutput() << ", " << m_proc->readAllStandardError();
|
||||
ERROR_LOG() << "error: " << error << ", " << m_proc->readAllStandardOutput() << ", " << m_proc->readAllStandardError();
|
||||
}
|
||||
|
||||
QString CopyDatabase::getDumpFile() const
|
||||
@@ -263,7 +263,7 @@ QString CopyDatabase::executablePath(const QString &program)
|
||||
QString errStr;
|
||||
const QString ret = NGL::postgresExecutablePath(program, errStr);
|
||||
if (!errStr.isEmpty())
|
||||
WARNING_LOG(m_logger) << errStr;
|
||||
WARNING_LOG() << errStr;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,5 @@ private:
|
||||
QString m_srcDbName;
|
||||
QString m_dstDbName;
|
||||
QProcess *m_proc;
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
} // namespace OcBaseDownload
|
||||
@@ -16,16 +16,15 @@ namespace OcBaseDownload
|
||||
|
||||
DdsHandler::DdsHandler(int domainId)
|
||||
: m_ddsConnector(std::make_shared<DDSConnector::DdsConnector>(domainId, IDL::PartitionType::Global, 0))
|
||||
, m_logger(getLogger("DdsHandler"))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "DdsHandler(" << domainId << ") for partition: " << m_ddsConnector->getDefaultPartition();
|
||||
DEBUG_LOG() << "DdsHandler(" << domainId << ") for partition: " << m_ddsConnector->getDefaultPartition();
|
||||
}
|
||||
|
||||
bool DdsHandler::init(const QStringList &qosFileList)
|
||||
{
|
||||
if(!m_ddsConnector->init(qosFileList))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Error initializing dds connections - aborting";
|
||||
ERROR_LOG() << "Error initializing dds connections - aborting";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -39,7 +38,7 @@ bool DdsHandler::init(const QStringList &qosFileList)
|
||||
m_ddsFts = OcBaseDownload::Interface::Fts::create(m_ddsConnector);
|
||||
|
||||
bool bRet = m_ddsFts->enableAll();
|
||||
INFO_LOG(m_logger) << "Fts initialised";
|
||||
INFO_LOG() << "Fts initialised";
|
||||
|
||||
return bRet;
|
||||
}
|
||||
|
||||
@@ -41,8 +41,6 @@ private:
|
||||
std::shared_ptr<Core::Pacemaker> m_pacemaker;
|
||||
std::shared_ptr<Core::TopicLockMaster> m_topicLockMaster;
|
||||
std::shared_ptr<OcBaseDownload::Interface::Fts> m_ddsFts;
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
|
||||
} // namespace OcBaseDownload
|
||||
+50
-51
@@ -51,7 +51,6 @@ HandlerBaseDownload::HandlerBaseDownload(MainHandler *mainHandler, QObject *pare
|
||||
, m_remoteDbRetryCounter(0)
|
||||
, m_copyDatabase(new CopyDatabase(getLogger("HandlerBaseDownload"), this))
|
||||
, m_exTblGen(new DBAdministration::ExerciseTableGenerator(getLogger("ExerciseTableGenerator"), NGL::directory(NGL::FileType::ConfigFile, QLatin1String("xml")), this))
|
||||
, m_logger(getLogger("HandlerBaseDownload"))
|
||||
{
|
||||
connect(m_baseDownloadReplyUpdateTimer, &QTimer::timeout,
|
||||
this, &HandlerBaseDownload::updateBaseDownloadReply);
|
||||
@@ -85,7 +84,7 @@ bool HandlerBaseDownload::init()
|
||||
if (!m_scmDtc->enableServiceInformation() ||
|
||||
!m_scmDtc->enableGroupInformation())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Enabling SCM Data-Topics failed.";
|
||||
ERROR_LOG() << "Enabling SCM Data-Topics failed.";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -93,11 +92,11 @@ bool HandlerBaseDownload::init()
|
||||
if (!m_scmFtc->enableRestartGroup() ||
|
||||
!m_scmFtc->enableStopGroup())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Enabling SCM Function-Topics failed.";
|
||||
ERROR_LOG() << "Enabling SCM Function-Topics failed.";
|
||||
return false;
|
||||
}
|
||||
|
||||
INFO_LOG(m_logger) << "HandlerBaseDownload initialised!";
|
||||
INFO_LOG() << "HandlerBaseDownload initialised!";
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -560,7 +559,7 @@ void HandlerBaseDownload::receiveFlmData()
|
||||
" FROM ") + tableName + where + where2);
|
||||
|
||||
|
||||
ERROR_LOG(m_logger) << "FUCK FUCK WE ARE HERE!" << " snapshid id is= " << snapshotFolderId << " also my statement: " << stmt;
|
||||
ERROR_LOG() << "FUCK FUCK WE ARE HERE!" << " snapshid id is= " << snapshotFolderId << " also my statement: " << stmt;
|
||||
std::unique_ptr<NSqlQuery> query = std::unique_ptr<NSqlQuery>(new NSqlQuery(remoteDbIfc->database(), m_logger));
|
||||
query->prepare(stmt);
|
||||
QVector<Database::FlmFileContent> dataVec;
|
||||
@@ -592,10 +591,10 @@ void HandlerBaseDownload::receiveFlmData()
|
||||
data.fileTypeId == FileManagement::FileType::Png)
|
||||
&& data.folderId != snapshotFolderId)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "skip";
|
||||
DEBUG_LOG() << "skip";
|
||||
continue;
|
||||
}
|
||||
// ERROR_LOG(m_logger) << "ADD " << data.name;
|
||||
// ERROR_LOG() << "ADD " << data.name;
|
||||
|
||||
dataVec.append(data);
|
||||
}
|
||||
@@ -603,7 +602,7 @@ void HandlerBaseDownload::receiveFlmData()
|
||||
|
||||
if (!dataVec.isEmpty())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Data vec has sisze: " << dataVec.size();
|
||||
ERROR_LOG() << "Data vec has sisze: " << dataVec.size();
|
||||
storeToDataVecMap(DbDataType::FlmFileContent, std::vector<Database::FlmFileContent>(dataVec.begin(), dataVec.end()));
|
||||
m_remoteDbRetryCounter = 0;
|
||||
}
|
||||
@@ -683,10 +682,10 @@ QSqlDatabase HandlerBaseDownload::openDb(const QString &databaseName, bool remot
|
||||
s->databaseDriver(),
|
||||
remote ? m_hostname : s->databaseHostname(),
|
||||
remote ? Settings::remoteDbName() : databaseName);
|
||||
DEBUG_LOG(m_logger) << "Trying to open database " << s->databaseHostname() << ":" << databaseName;
|
||||
DEBUG_LOG() << "Trying to open database " << s->databaseHostname() << ":" << databaseName;
|
||||
if (!dbConnection.isOpen())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Error opening database " << s->databaseHostname() << ":" << databaseName;
|
||||
ERROR_LOG() << "Error opening database " << s->databaseHostname() << ":" << databaseName;
|
||||
if (bOk)
|
||||
*bOk = false;
|
||||
}
|
||||
@@ -726,11 +725,11 @@ void HandlerBaseDownload::updateBaseDownloadReply()
|
||||
|
||||
void HandlerBaseDownload::onStartBaseDownloadRequest(const rti::core::SampleIdentity &cookie, const StartBaseDownloadRequest &request)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Got Request, check for old one : " << request.hostname();
|
||||
DEBUG_LOG() << "Got Request, check for old one : " << request.hostname();
|
||||
|
||||
if (request.timeStamp() < (QDateTime::currentMSecsSinceEpoch() - 10 * 1000)) //(5Sekunden)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "old call? ignore! ";
|
||||
DEBUG_LOG() << "old call? ignore! ";
|
||||
m_reply.progress(0);
|
||||
m_reply.errorString(std::string());
|
||||
m_reply.currentStep(std::string());
|
||||
@@ -938,7 +937,7 @@ void HandlerBaseDownload::switchState()
|
||||
break;
|
||||
default:
|
||||
{
|
||||
ERROR_LOG(m_logger) << "State " << m_currentState << " is not handled properly.";
|
||||
ERROR_LOG() << "State " << m_currentState << " is not handled properly.";
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -971,7 +970,7 @@ void HandlerBaseDownload::dropOldDatabase()
|
||||
const int revId = val.midRef(idx + 1).toInt(&bOk);
|
||||
if (!bOk)
|
||||
continue;
|
||||
DEBUG_LOG(m_logger) << val << ", " << revId << ", " << curId;
|
||||
DEBUG_LOG() << val << ", " << revId << ", " << curId;
|
||||
if (revId < curId - 1 || revId >= curId)
|
||||
m_databasesToDrop += val;
|
||||
}
|
||||
@@ -1018,14 +1017,14 @@ void HandlerBaseDownload::onCopyDbFinished()
|
||||
|
||||
void HandlerBaseDownload::checkForAsmFinished()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Checking if all ASM base data arrived.";
|
||||
DEBUG_LOG() << "Checking if all ASM base data arrived.";
|
||||
|
||||
if (m_dataVecMap.contains(AsmTrainingArea) &&
|
||||
m_dataVecMap.contains(AsmLocation) &&
|
||||
m_dataVecMap.contains(AsmAsset) &&
|
||||
m_dataVecMap.contains(AsmTechnicalArea))
|
||||
{
|
||||
INFO_LOG(m_logger) << "All ASM base data arrived.";
|
||||
INFO_LOG() << "All ASM base data arrived.";
|
||||
stateFinished();
|
||||
}
|
||||
checkAliveTimer();
|
||||
@@ -1033,12 +1032,12 @@ void HandlerBaseDownload::checkForAsmFinished()
|
||||
|
||||
void HandlerBaseDownload::checkForExmFinished()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Checking if all EXM base data arrived.";
|
||||
DEBUG_LOG() << "Checking if all EXM base data arrived.";
|
||||
if (m_dataVecMap.contains(ExmExercise) &&
|
||||
m_dataVecMap.contains(ExmExercisePhase) &&
|
||||
m_dataVecMap.contains(ExmExerciseStateChange))
|
||||
{
|
||||
INFO_LOG(m_logger) << "All EXM base data arrived.";
|
||||
INFO_LOG() << "All EXM base data arrived.";
|
||||
stateFinished();
|
||||
}
|
||||
checkAliveTimer();
|
||||
@@ -1046,7 +1045,7 @@ void HandlerBaseDownload::checkForExmFinished()
|
||||
|
||||
void HandlerBaseDownload::checkForIsmFinished()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Checking if all ISM base data arrived.";
|
||||
DEBUG_LOG() << "Checking if all ISM base data arrived.";
|
||||
if (m_dataVecMap.contains(IsmAsset) &&
|
||||
m_dataVecMap.contains(IsmMainStructureElement) &&
|
||||
m_dataVecMap.contains(IsmStructureElement) &&
|
||||
@@ -1055,7 +1054,7 @@ void HandlerBaseDownload::checkForIsmFinished()
|
||||
m_dataVecMap.contains(IsmMountingPointSchedule) &&
|
||||
m_dataVecMap.contains(IsmMountingPointPlan))
|
||||
{
|
||||
INFO_LOG(m_logger) << "All ISM base data arrived.";
|
||||
INFO_LOG() << "All ISM base data arrived.";
|
||||
stateFinished();
|
||||
}
|
||||
checkAliveTimer();
|
||||
@@ -1063,22 +1062,22 @@ void HandlerBaseDownload::checkForIsmFinished()
|
||||
|
||||
void HandlerBaseDownload::checkForPpmEx0Finished()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Checking if all PPM Ex0 base data arrived.";
|
||||
DEBUG_LOG() << "Checking if all PPM Ex0 base data arrived.";
|
||||
if (m_dataVecMap.contains(PpmEquipmentType) &&
|
||||
m_dataVecMap.contains(PpmType))
|
||||
{
|
||||
INFO_LOG(m_logger) << "All PPM Ex0 base data arrived.";
|
||||
INFO_LOG() << "All PPM Ex0 base data arrived.";
|
||||
stateFinished();
|
||||
}
|
||||
}
|
||||
|
||||
void HandlerBaseDownload::checkForPpmExNFinished()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Checking if all PPM ExN base data arrived.";
|
||||
DEBUG_LOG() << "Checking if all PPM ExN base data arrived.";
|
||||
if (m_dataVecMap.contains(PpmParty) &&
|
||||
m_dataVecMap.contains(PpmParticipant))
|
||||
{
|
||||
INFO_LOG(m_logger) << "All PPM ExN base data arrived.";
|
||||
INFO_LOG() << "All PPM ExN base data arrived.";
|
||||
stateFinished();
|
||||
}
|
||||
checkAliveTimer();
|
||||
@@ -1086,7 +1085,7 @@ void HandlerBaseDownload::checkForPpmExNFinished()
|
||||
|
||||
void HandlerBaseDownload::checkForOpmFinished()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Checking if all OPM base data arrived.";
|
||||
DEBUG_LOG() << "Checking if all OPM base data arrived.";
|
||||
if (m_dataVecMap.contains(OpmGroup) &&
|
||||
m_dataVecMap.contains(OpmGroupGroup) &&
|
||||
m_dataVecMap.contains(OpmOperator) &&
|
||||
@@ -1096,7 +1095,7 @@ void HandlerBaseDownload::checkForOpmFinished()
|
||||
m_dataVecMap.contains(OpmAclAllow) &&
|
||||
m_dataVecMap.contains(OpmAclDeny))
|
||||
{
|
||||
INFO_LOG(m_logger) << "All OPM base data arrived.";
|
||||
INFO_LOG() << "All OPM base data arrived.";
|
||||
stateFinished();
|
||||
}
|
||||
checkAliveTimer();
|
||||
@@ -1104,11 +1103,11 @@ void HandlerBaseDownload::checkForOpmFinished()
|
||||
|
||||
void HandlerBaseDownload::checkForFlmFinished()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Checking if all FLM base data arrived.";
|
||||
DEBUG_LOG() << "Checking if all FLM base data arrived.";
|
||||
if (m_dataVecMap.contains(FlmFolder) &&
|
||||
m_dataVecMap.contains(FlmFileContent))
|
||||
{
|
||||
INFO_LOG(m_logger) << "All FLM base data arrived.";
|
||||
INFO_LOG() << "All FLM base data arrived.";
|
||||
stateFinished();
|
||||
}
|
||||
checkAliveTimer();
|
||||
@@ -1443,13 +1442,13 @@ void HandlerBaseDownload::insertPpmExNDbData(bool live)
|
||||
participantData.push_back(newEntry);
|
||||
partyToUnit.insert(party.id, newEntry.id);
|
||||
|
||||
TRACE_LOG(m_logger) << "Adding: " << newEntry.name << " to participantData.";
|
||||
TRACE_LOG() << "Adding: " << newEntry.name << " to participantData.";
|
||||
}
|
||||
// insert pseudo-units
|
||||
ppmDbHandler->db()->upsert(participantData);
|
||||
#endif
|
||||
}
|
||||
DEBUG_LOG(m_logger) << "Now add participants: " << getDbDataVec<ParticipantManagement::Database::PpmParticipant>(PpmParticipant).size();
|
||||
DEBUG_LOG() << "Now add participants: " << getDbDataVec<ParticipantManagement::Database::PpmParticipant>(PpmParticipant).size();
|
||||
for (const auto &participant : getDbDataVec<ParticipantManagement::Database::PpmParticipant>(PpmParticipant))
|
||||
{
|
||||
if (participant.partyId == 0)
|
||||
@@ -1465,7 +1464,7 @@ void HandlerBaseDownload::insertPpmExNDbData(bool live)
|
||||
newParticipant.superiorId = partyToUnit.value(participant.partyId);
|
||||
newParticipant.hierarchyNumber = participant.id;
|
||||
#endif
|
||||
DEBUG_LOG(m_logger) << "XXXXXXXX Adding Participant: " << newParticipant.id << " typeId: " << newParticipant.typeId << " typeClass: " << typeClass << " supperioer " << newParticipant.superiorId;
|
||||
DEBUG_LOG() << "XXXXXXXX Adding Participant: " << newParticipant.id << " typeId: " << newParticipant.typeId << " typeClass: " << typeClass << " supperioer " << newParticipant.superiorId;
|
||||
|
||||
newParticipants.push_back(std::move(newParticipant));
|
||||
}
|
||||
@@ -1588,7 +1587,7 @@ inline void resetVector(QPair<bool, QVector<T>> &dbVector)
|
||||
void HandlerBaseDownload::cleanup(const Core::FtReplyState &replyState, const std::string &errStr)
|
||||
{
|
||||
if (errStr.size() > 0)
|
||||
ERROR_LOG(m_logger) << "Base Download ended with error: " << errStr;
|
||||
ERROR_LOG() << "Base Download ended with error: " << errStr;
|
||||
|
||||
// cleanup db data
|
||||
qDeleteAll(m_dataVecMap);
|
||||
@@ -1650,7 +1649,7 @@ void HandlerBaseDownload::copyFromOldDatabase()
|
||||
const QString schemaName = QLatin1String("ex_") + QString::number(m_exerciseId);
|
||||
if (m_exTblGen->existsSchema(schemaName, dbIn))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "### Copying old files from schema " << schemaName;
|
||||
DEBUG_LOG() << "### Copying old files from schema " << schemaName;
|
||||
{
|
||||
// own transaction when old ex_N schema does not exist.
|
||||
DBTransaction trans(m_dbConnection);
|
||||
@@ -1722,7 +1721,7 @@ void HandlerBaseDownload::copyFromOldDatabase()
|
||||
for (const QString &table : std::as_const(tableList))
|
||||
{
|
||||
if (!copyTable(dbIn, m_dbConnection, table))
|
||||
ERROR_LOG(m_logger) << "Failed to copy table " << table;
|
||||
ERROR_LOG() << "Failed to copy table " << table;
|
||||
checkAliveTimer();
|
||||
}
|
||||
trans.commit();
|
||||
@@ -2188,7 +2187,7 @@ void HandlerBaseDownload::onStopGroupReply(const Core::FunctionReplyObject &repl
|
||||
return;
|
||||
}
|
||||
if (!m_stopGroupIds.remove(reply.id()))
|
||||
WARNING_LOG(m_logger) << "Got unknown reply id for stop group request: " << reply.id();
|
||||
WARNING_LOG() << "Got unknown reply id for stop group request: " << reply.id();
|
||||
|
||||
if (!m_stopGroupIds.isEmpty())
|
||||
return;
|
||||
@@ -2215,7 +2214,7 @@ void HandlerBaseDownload::restartCoreGroup()
|
||||
// we are also restarted... so answer here directly with 'finished'
|
||||
stateFinished();
|
||||
if (request.type() != Core::ServiceGroupType::Core)
|
||||
WARNING_LOG(m_logger) << "Could not find core group to restart...";
|
||||
WARNING_LOG() << "Could not find core group to restart...";
|
||||
|
||||
const auto restartCb = [this, request]()
|
||||
{
|
||||
@@ -2232,7 +2231,7 @@ void HandlerBaseDownload::onRestartGroupReply(const Core::FunctionReplyObject &r
|
||||
return;
|
||||
}
|
||||
// we won't get here since we're restarted too
|
||||
ERROR_LOG(m_logger) << "onRestartGroupReply?";
|
||||
ERROR_LOG() << "onRestartGroupReply?";
|
||||
stateFinished();
|
||||
}
|
||||
|
||||
@@ -2267,11 +2266,11 @@ bool HandlerBaseDownload::copyTable(const QSqlDatabase &dbIn, const QSqlDatabase
|
||||
NSqlQuery qIn(dbIn);
|
||||
NSqlQuery qOut(dbOut);
|
||||
|
||||
DEBUG_LOG(m_logger) << "Copying " << tableName << " started";
|
||||
DEBUG_LOG() << "Copying " << tableName << " started";
|
||||
const QSqlRecord record = dbIn.record(tableName);
|
||||
if (record.isEmpty())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Empty record for " << tableName;
|
||||
ERROR_LOG() << "Empty record for " << tableName;
|
||||
return false;
|
||||
}
|
||||
QStringList selectTableColumns;
|
||||
@@ -2292,18 +2291,18 @@ bool HandlerBaseDownload::copyTable(const QSqlDatabase &dbIn, const QSqlDatabase
|
||||
selectTableColumns.join(QStringLiteral(", ")),
|
||||
insertTablePlaceholder.join(QStringLiteral(", "))));
|
||||
|
||||
DEBUG_LOG(m_logger) << selectTableCommand;
|
||||
DEBUG_LOG(m_logger) << insertTableCommand;
|
||||
DEBUG_LOG() << selectTableCommand;
|
||||
DEBUG_LOG() << insertTableCommand;
|
||||
|
||||
if (!qOut.prepare(insertTableCommand))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "qOut prepare failed... " << qOut.lastError().text();
|
||||
ERROR_LOG() << "qOut prepare failed... " << qOut.lastError().text();
|
||||
return false;
|
||||
}
|
||||
if (!qIn.exec(selectTableCommand))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "qIn select failed... " << qIn.lastError().text();
|
||||
DEBUG_LOG(m_logger) << "FAILED statement: " << selectTableCommand;
|
||||
ERROR_LOG() << "qIn select failed... " << qIn.lastError().text();
|
||||
DEBUG_LOG() << "FAILED statement: " << selectTableCommand;
|
||||
qIn.finish();
|
||||
return false;
|
||||
}
|
||||
@@ -2313,17 +2312,17 @@ bool HandlerBaseDownload::copyTable(const QSqlDatabase &dbIn, const QSqlDatabase
|
||||
qOut.bindValue(insertTablePlaceholder.at(i), qIn.value(i));
|
||||
if (!qOut.exec())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "qOut insert failed.. " << qOut.lastError().text();
|
||||
DEBUG_LOG(m_logger) << "FAILED statement: " << insertTableCommand;
|
||||
ERROR_LOG() << "qOut insert failed.. " << qOut.lastError().text();
|
||||
DEBUG_LOG() << "FAILED statement: " << insertTableCommand;
|
||||
qOut.finish();
|
||||
return false;
|
||||
}
|
||||
checkAliveTimer();
|
||||
}
|
||||
DEBUG_LOG(m_logger) << "Copying " << tableName << " finished";
|
||||
DEBUG_LOG() << "Copying " << tableName << " finished";
|
||||
|
||||
if (!fixUpSequence(dbOut, tableName))
|
||||
WARNING_LOG(m_logger) << "Failed to update sequence for table " << tableName;
|
||||
WARNING_LOG() << "Failed to update sequence for table " << tableName;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -2345,14 +2344,14 @@ bool HandlerBaseDownload::fixUpSequence(const QSqlDatabase &dbOut, const QString
|
||||
keyField = QStringLiteral("id");
|
||||
}
|
||||
|
||||
DEBUG_LOG(m_logger) << "Updating sequence " << seqName << " for table " << tableName;
|
||||
DEBUG_LOG() << "Updating sequence " << seqName << " for table " << tableName;
|
||||
|
||||
const QString stmt(QStringLiteral("SELECT setval('%1', COALESCE((SELECT MAX(%2)+1 FROM %3), 1), false)").arg(seqName, keyField, tableName));
|
||||
|
||||
if (!qOut.exec(stmt))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "FAILED to update sequence for table " << tableName << " : " << qOut.lastError().text();
|
||||
DEBUG_LOG(m_logger) << "FAILED statement: " << stmt;
|
||||
ERROR_LOG() << "FAILED to update sequence for table " << tableName << " : " << qOut.lastError().text();
|
||||
DEBUG_LOG() << "FAILED statement: " << stmt;
|
||||
qOut.finish();
|
||||
return false;
|
||||
}
|
||||
|
||||
+25
-26
@@ -42,7 +42,6 @@ HandlerPdfDownload::HandlerPdfDownload(MainHandler *mainHandler, QObject *parent
|
||||
, m_currentPort(NGL::Connections::port(NGL::Connections::eConnection::SCM_WEBSOCKET))
|
||||
, m_currentMode(Mode::PORT_REQUEST)
|
||||
, m_downloader(nullptr)
|
||||
, m_logger(getLogger("HandlerPdfDownload"))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -53,7 +52,7 @@ HandlerPdfDownload::~HandlerPdfDownload()
|
||||
|
||||
bool HandlerPdfDownload::init()
|
||||
{
|
||||
INFO_LOG(m_logger) << "HandlerPdfDownload initialised!";
|
||||
INFO_LOG() << "HandlerPdfDownload initialised!";
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -90,7 +89,7 @@ void HandlerPdfDownload::handleServicePortsInformation(const QVector<WebSocketIn
|
||||
m_webSocket->open(m_hostname, flmPort);
|
||||
else
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Could not connect to FileManagement WebSocket server.";
|
||||
ERROR_LOG() << "Could not connect to FileManagement WebSocket server.";
|
||||
m_currentMode = Mode::PORT_REQUEST;
|
||||
}
|
||||
}
|
||||
@@ -140,7 +139,7 @@ void HandlerPdfDownload::onGetPdfListRequest(const rti::core::SampleIdentity &co
|
||||
void HandlerPdfDownload::onStartPdfDownloadRequest(const rti::core::SampleIdentity &cookie, const StartPdfDownloadRequest &request)
|
||||
{
|
||||
|
||||
ERROR_LOG(m_logger) <<" onOcPdfDownloadRequest START" ;
|
||||
ERROR_LOG() <<" onOcPdfDownloadRequest START" ;
|
||||
m_downloadReply = PdfDownloadReply();
|
||||
m_downloadCookie = cookie;
|
||||
|
||||
@@ -151,13 +150,13 @@ void HandlerPdfDownload::onStartPdfDownloadRequest(const rti::core::SampleIdenti
|
||||
for (int32_t id : request.documentIds())
|
||||
str.append(QString::number(id) + QStringLiteral(" "));
|
||||
|
||||
DEBUG_LOG(m_logger) << str;
|
||||
DEBUG_LOG() << str;
|
||||
}
|
||||
|
||||
if (m_hostname.isEmpty())
|
||||
{
|
||||
QString errorStr = QStringLiteral("Not able to start PDF download. Hostname not set.");
|
||||
ERROR_LOG(m_logger) << errorStr;
|
||||
ERROR_LOG() << errorStr;
|
||||
m_downloadReply.errorString(errorStr.toStdString());
|
||||
m_fts->startPdfDownloadReply(m_downloadCookie, m_downloadReply);
|
||||
return;
|
||||
@@ -201,26 +200,26 @@ void HandlerPdfDownload::onStartPdfDownloadRequest(const rti::core::SampleIdenti
|
||||
|
||||
void HandlerPdfDownload::onOcPdfDownloadRequest(const rti::core::SampleIdentity &cookie, const OcPdfDownloadRequest &request)
|
||||
{
|
||||
DEBUG_LOG(m_logger) <<LOGFUNCTION<<" START OcPdfDownloadRequest" ;
|
||||
DEBUG_LOG() <<Q_FUNC_INFO<<" START OcPdfDownloadRequest" ;
|
||||
m_ocPdfDownloadCookie = cookie;
|
||||
m_ocPdfDownloadReply = Core::FunctionReply();
|
||||
|
||||
if(openRemoteDbConnection(QStringLiteral("lts_ets_pro")) == false)
|
||||
{
|
||||
QString errorStr = QStringLiteral("Not able to open remote connection to DB");
|
||||
ERROR_LOG(m_logger) << errorStr;
|
||||
ERROR_LOG() << errorStr;
|
||||
m_ocPdfDownloadReply.errorString(errorStr.toStdString());
|
||||
m_fts->ocPdfDownloadReply(m_ocPdfDownloadCookie, m_ocPdfDownloadReply);
|
||||
return;
|
||||
}
|
||||
|
||||
DEBUG_LOG(m_logger) << "Got PDF download request for ids: "<< request.folderId();
|
||||
DEBUG_LOG() << "Got PDF download request for ids: "<< request.folderId();
|
||||
|
||||
m_folderId = request.folderId();
|
||||
if(m_folderId == -1)
|
||||
{
|
||||
QString errorStr = QStringLiteral("Not able to start PDF download. Folder id not valid.");
|
||||
ERROR_LOG(m_logger) << errorStr;
|
||||
ERROR_LOG() << errorStr;
|
||||
m_ocPdfDownloadReply.errorString(errorStr.toStdString());
|
||||
m_fts->ocPdfDownloadReply(m_ocPdfDownloadCookie, m_ocPdfDownloadReply);
|
||||
return;
|
||||
@@ -229,7 +228,7 @@ void HandlerPdfDownload::onOcPdfDownloadRequest(const rti::core::SampleIdentity
|
||||
if (m_hostname.isEmpty())
|
||||
{
|
||||
QString errorStr = QStringLiteral("Not able to start PDF download. Hostname not set.");
|
||||
ERROR_LOG(m_logger) << errorStr;
|
||||
ERROR_LOG() << errorStr;
|
||||
m_ocPdfDownloadReply.errorString(errorStr.toStdString());
|
||||
m_fts->ocPdfDownloadReply(m_ocPdfDownloadCookie, m_ocPdfDownloadReply);
|
||||
return;
|
||||
@@ -256,7 +255,7 @@ void HandlerPdfDownload::exportOcPdfFileContent()
|
||||
|
||||
auto remoteDbIfc = remoteDb->db();
|
||||
const QString dir = QStringLiteral("%1/OcPdf/%2/").arg(QDir::tempPath()).arg(m_operatorName);
|
||||
DEBUG_LOG(m_logger)<<" export path: "<<dir;
|
||||
DEBUG_LOG()<<" export path: "<<dir;
|
||||
QDir directory(dir);
|
||||
if(!directory.exists())
|
||||
directory.mkpath(dir);
|
||||
@@ -267,7 +266,7 @@ void HandlerPdfDownload::exportOcPdfFileContent()
|
||||
QString strm = QStringLiteral("Select id from flm.flm_folder WHERE name = '" ) + m_operatorName + QStringLiteral("' and '") +
|
||||
QString::number(m_folderId) + QStringLiteral("' = ANY(path) LIMIT 1;");
|
||||
|
||||
DEBUG_LOG(m_logger) << "folder content ID querry" << strm;
|
||||
DEBUG_LOG() << "folder content ID querry" << strm;
|
||||
|
||||
std::unique_ptr<NSqlQuery> query = std::unique_ptr<NSqlQuery>(new NSqlQuery(remoteDbIfc->database(), m_logger));
|
||||
query->prepare(strm);
|
||||
@@ -322,7 +321,7 @@ void HandlerPdfDownload::exportOcPdfFileContent()
|
||||
|
||||
if(idsList.isEmpty())
|
||||
{
|
||||
WARNING_LOG(m_logger)<< " pdf files outdated! ";
|
||||
WARNING_LOG()<< " pdf files outdated! ";
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -335,7 +334,7 @@ void HandlerPdfDownload::exportOcPdfFileContent()
|
||||
tableName = (QStringLiteral("flm.flm_file_content"));
|
||||
stmt = (QStringLiteral("SELECT id, name, file_status_id, content, last_modified FROM ") + tableName + where);
|
||||
|
||||
DEBUG_LOG(m_logger) << "### statement: " << stmt;
|
||||
DEBUG_LOG() << "### statement: " << stmt;
|
||||
|
||||
query->prepare(stmt);
|
||||
|
||||
@@ -354,7 +353,7 @@ void HandlerPdfDownload::exportOcPdfFileContent()
|
||||
|
||||
if(data.fileStatusId == FileManagement::FileStatus::Deleted)
|
||||
{
|
||||
DEBUG_LOG(m_logger)<< " skip ";
|
||||
DEBUG_LOG()<< " skip ";
|
||||
continue;
|
||||
}
|
||||
dataVec.append(data);
|
||||
@@ -363,7 +362,7 @@ void HandlerPdfDownload::exportOcPdfFileContent()
|
||||
else
|
||||
{
|
||||
const QString errorStr = tr("Not able to export PDF.");
|
||||
ERROR_LOG(m_logger) << errorStr;
|
||||
ERROR_LOG() << errorStr;
|
||||
m_ocPdfDownloadReply.errorString(errorStr.toStdString());
|
||||
return;
|
||||
}
|
||||
@@ -378,7 +377,7 @@ void HandlerPdfDownload::exportOcPdfFileContent()
|
||||
if(fileInfo.exists() && file.remove() == false)
|
||||
{
|
||||
QString err = QStringLiteral("Couldn't replace existing file: ") + data.name;
|
||||
WARNING_LOG(m_logger)<< err;
|
||||
WARNING_LOG()<< err;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -396,7 +395,7 @@ void HandlerPdfDownload::exportOcPdfFileContent()
|
||||
|
||||
bool HandlerPdfDownload::openRemoteDbConnection(const QString &remoteDatabaseName)
|
||||
{
|
||||
DEBUG_LOG(m_logger) <<" Open RemoteDb Connection..." ;
|
||||
DEBUG_LOG() <<" Open RemoteDb Connection..." ;
|
||||
if (m_remoteDbConnection.isValid())
|
||||
closeDb(m_remoteDbConnection);
|
||||
|
||||
@@ -421,10 +420,10 @@ QSqlDatabase HandlerPdfDownload::openDb(const QString &databaseName, bool remote
|
||||
s->databaseDriver(),
|
||||
remote ? m_remoteHostName : s->databaseHostname(),
|
||||
remote ? Settings::remoteDbName() : databaseName);
|
||||
DEBUG_LOG(m_logger) << "Trying to open database " << s->databaseHostname() << ":" << databaseName;
|
||||
DEBUG_LOG() << "Trying to open database " << s->databaseHostname() << ":" << databaseName;
|
||||
if (!dbConnection.isOpen())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Error opening database " << s->databaseHostname() << ":" << databaseName;
|
||||
ERROR_LOG() << "Error opening database " << s->databaseHostname() << ":" << databaseName;
|
||||
if (bOk)
|
||||
*bOk = false;
|
||||
}
|
||||
@@ -444,7 +443,7 @@ void HandlerPdfDownload::closeDb(QSqlDatabase &dbConn)
|
||||
|
||||
void HandlerPdfDownload::onConnected()
|
||||
{
|
||||
INFO_LOG(m_logger) << "Connected to WebSocket server";
|
||||
INFO_LOG() << "Connected to WebSocket server";
|
||||
|
||||
switch (m_currentMode)
|
||||
{
|
||||
@@ -459,12 +458,12 @@ void HandlerPdfDownload::onConnected()
|
||||
|
||||
void HandlerPdfDownload::onDisconnected()
|
||||
{
|
||||
INFO_LOG(m_logger) << "Disconnected from server.";
|
||||
INFO_LOG() << "Disconnected from server.";
|
||||
}
|
||||
|
||||
void HandlerPdfDownload::onNewDownloadState(int progress, const QString &msg)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << msg;
|
||||
DEBUG_LOG() << msg;
|
||||
m_downloadReply.replyState(Core::FtReplyState::InProgress);
|
||||
m_downloadReply.progress(progress);
|
||||
m_downloadReply.currentStep(msg.toStdString());
|
||||
@@ -473,7 +472,7 @@ void HandlerPdfDownload::onNewDownloadState(int progress, const QString &msg)
|
||||
|
||||
void HandlerPdfDownload::onAllDownloadsFinished()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Downloads finished";
|
||||
DEBUG_LOG() << "Downloads finished";
|
||||
m_downloadReply.replyState(Core::FtReplyState::Completed);
|
||||
m_downloadReply.currentStep(tr("Downloads finished").toStdString());
|
||||
m_downloadReply.progress(100);
|
||||
@@ -482,7 +481,7 @@ void HandlerPdfDownload::onAllDownloadsFinished()
|
||||
|
||||
void HandlerPdfDownload::openWebSocket()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Opening websocket to: " << m_hostname << ":" << m_currentPort;
|
||||
DEBUG_LOG() << "Opening websocket to: " << m_hostname << ":" << m_currentPort;
|
||||
m_webSocket->open(m_hostname, m_currentPort);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <NGLLogger/INGLLogger.h>
|
||||
#include "obd_export.h"
|
||||
#include "svcobdcommon_export.h"
|
||||
|
||||
namespace OcBaseDownload
|
||||
{
|
||||
|
||||
@@ -21,7 +21,6 @@ MainHandler::MainHandler(QObject *parent)
|
||||
, m_handlerWebSocket(nullptr)
|
||||
, m_scmDtc(nullptr)
|
||||
, m_scmFtc(nullptr)
|
||||
, m_logger(getLogger("MainHandler"))
|
||||
{}
|
||||
|
||||
MainHandler::~MainHandler()
|
||||
@@ -40,24 +39,24 @@ bool MainHandler::init(int domainId)
|
||||
m_ddsHandler = std::make_shared<DdsHandler>(domainId);
|
||||
if (!m_ddsHandler->init())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Initialisation ddsHandler failed.";
|
||||
ERROR_LOG() << "Initialisation ddsHandler failed.";
|
||||
return false;
|
||||
}
|
||||
DEBUG_LOG(m_logger) << "Initialisation ddsHandler succesful.";
|
||||
DEBUG_LOG() << "Initialisation ddsHandler succesful.";
|
||||
|
||||
// create SCM Dtc
|
||||
m_scmDtc = ServiceManagement::Interface::Dtc::create(m_ddsHandler->dds());
|
||||
DEBUG_LOG(m_logger) << "Created SCM Dtc";
|
||||
DEBUG_LOG() << "Created SCM Dtc";
|
||||
|
||||
// create SCM Ftc
|
||||
m_scmFtc = ServiceManagement::Interface::Ftc::create(m_ddsHandler->dds());
|
||||
DEBUG_LOG(m_logger) << "Created SCM Ftc";
|
||||
DEBUG_LOG() << "Created SCM Ftc";
|
||||
|
||||
// create handler base download
|
||||
m_handlerWebSocket = std::make_shared<WebSocketInterface::WebSocketInterfaceHandler>(this);
|
||||
if (!m_handlerWebSocket->init())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Initialisation HandlerWebSocket failed.";
|
||||
ERROR_LOG() << "Initialisation HandlerWebSocket failed.";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -65,7 +64,7 @@ bool MainHandler::init(int domainId)
|
||||
m_handlerBaseDownload = std::make_shared<HandlerBaseDownload>(this, this);
|
||||
if (!m_handlerBaseDownload->init())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Initialisation HandlerBaseDownload failed.";
|
||||
ERROR_LOG() << "Initialisation HandlerBaseDownload failed.";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -73,7 +72,7 @@ bool MainHandler::init(int domainId)
|
||||
m_handlerPdfDownload = std::make_shared<HandlerPdfDownload>(this, this);
|
||||
if (!m_handlerBaseDownload->init())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Initialisation HandlerPdfDownload failed.";
|
||||
ERROR_LOG() << "Initialisation HandlerPdfDownload failed.";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -49,8 +49,5 @@ private:
|
||||
|
||||
std::shared_ptr<ServiceManagement::Interface::Dtc> m_scmDtc;
|
||||
std::shared_ptr<ServiceManagement::Interface::Ftc> m_scmFtc;
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
};
|
||||
} // namespace OcBaseDownload
|
||||
+10
-11
@@ -20,16 +20,15 @@ PdfDownloadSocket::PdfDownloadSocket(const QString &hostName, QObject *parent)
|
||||
, m_socket(new QTcpSocket(this))
|
||||
, m_readTimeout(new QTimer(this))
|
||||
, m_sizeToDownload(0)
|
||||
, m_logger(getLogger("PdfDownloadSocket"))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "PdfDownloadSocket::PdfDownloadSocket";
|
||||
DEBUG_LOG() << "PdfDownloadSocket::PdfDownloadSocket";
|
||||
connect(m_socket, &QTcpSocket::connected, this, &PdfDownloadSocket::connected);
|
||||
connect(m_socket, &QTcpSocket::readyRead, this, &PdfDownloadSocket::readyRead);
|
||||
unsigned short port = NGL::Connections::port(NGL::Connections::eConnection::FLM_PDF_SERVER);
|
||||
m_socket->connectToHost(hostName, port);
|
||||
m_socket->waitForConnected();
|
||||
|
||||
DEBUG_LOG(m_logger) << "hostname " << hostName << " port " << port;
|
||||
DEBUG_LOG() << "hostname " << hostName << " port " << port;
|
||||
|
||||
m_readTimeout->setInterval(10000);
|
||||
m_readTimeout->setSingleShot(false);
|
||||
@@ -38,23 +37,23 @@ PdfDownloadSocket::PdfDownloadSocket(const QString &hostName, QObject *parent)
|
||||
|
||||
PdfDownloadSocket::~PdfDownloadSocket()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "~PdfDownloadSocket";
|
||||
DEBUG_LOG() << "~PdfDownloadSocket";
|
||||
m_socket->close();
|
||||
}
|
||||
|
||||
void PdfDownloadSocket::readyRead()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "reading...";
|
||||
DEBUG_LOG() << "reading...";
|
||||
m_readTimeout->stop();
|
||||
|
||||
m_downloadedData.append(m_socket->readAll());
|
||||
|
||||
DEBUG_LOG(m_logger) << m_downloadedData.size() << " of " << m_sizeToDownload << " bytes downloaded";
|
||||
DEBUG_LOG() << m_downloadedData.size() << " of " << m_sizeToDownload << " bytes downloaded";
|
||||
|
||||
if (m_downloadedData.size() >= m_sizeToDownload)
|
||||
{
|
||||
m_sizeToDownload = 0;
|
||||
DEBUG_LOG(m_logger) << "Download finished";
|
||||
DEBUG_LOG() << "Download finished";
|
||||
emit downloadFinished(m_downloadedData);
|
||||
}
|
||||
else
|
||||
@@ -63,17 +62,17 @@ void PdfDownloadSocket::readyRead()
|
||||
|
||||
void PdfDownloadSocket::connected()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "connected...";
|
||||
DEBUG_LOG() << "connected...";
|
||||
}
|
||||
|
||||
void PdfDownloadSocket::onReadTimeout()
|
||||
{
|
||||
//check for filesize
|
||||
m_readTimeout->stop();
|
||||
DEBUG_LOG(m_logger) << "TimerEnd" << m_downloadedData.size() << " expected " << m_sizeToDownload;
|
||||
DEBUG_LOG() << "TimerEnd" << m_downloadedData.size() << " expected " << m_sizeToDownload;
|
||||
|
||||
if (m_downloadedData.size() < m_sizeToDownload)
|
||||
WARNING_LOG(m_logger) << "not enough data: got " << m_downloadedData.size() << " expected " << m_sizeToDownload;
|
||||
WARNING_LOG() << "not enough data: got " << m_downloadedData.size() << " expected " << m_sizeToDownload;
|
||||
|
||||
emit downloadFinished(m_downloadedData);
|
||||
}
|
||||
@@ -90,7 +89,7 @@ void PdfDownloadSocket::downloadFromHost(const int fileId, const qint64 fileSize
|
||||
m_socket->readAll();
|
||||
|
||||
int writeHeaderSize = m_socket->write(cmd);
|
||||
DEBUG_LOG(m_logger) << "writeHeaderSize = " << writeHeaderSize;
|
||||
DEBUG_LOG() << "writeHeaderSize = " << writeHeaderSize;
|
||||
m_readTimeout->start();
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +39,5 @@ private:
|
||||
QTimer *m_readTimeout;
|
||||
int m_sizeToDownload;
|
||||
QByteArray m_downloadedData;
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
}
|
||||
@@ -30,7 +30,6 @@ PdfDownloader::PdfDownloader(const QVector<WebSocketInterface::Messages::PdfList
|
||||
, m_exTblGen(new DBAdministration::ExerciseTableGenerator(getLogger("ExerciseTableGenerator"), NGL::directory(NGL::FileType::ConfigFile, QLatin1String("xml")), this))
|
||||
, m_downloadCount(0)
|
||||
, m_totalDownloads(pdfInfoVec.size())
|
||||
, m_logger(getLogger("PdfDownloader"))
|
||||
{
|
||||
connect(m_socket, &PdfDownloadSocket::downloadFinished,
|
||||
this, &PdfDownloader::onSingleDownloadFinished);
|
||||
@@ -43,17 +42,17 @@ PdfDownloader::~PdfDownloader()
|
||||
|
||||
bool PdfDownloader::startDownload()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Downloading startet";
|
||||
DEBUG_LOG() << "Downloading startet";
|
||||
|
||||
if (!m_socket->isConnected())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Download could not be startet. Socket not connected.";
|
||||
ERROR_LOG() << "Download could not be startet. Socket not connected.";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!openDbConnection())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Could not open database connection";
|
||||
ERROR_LOG() << "Could not open database connection";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -62,24 +61,24 @@ bool PdfDownloader::startDownload()
|
||||
|
||||
void PdfDownloader::onSingleDownloadFinished(const QByteArray &data)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Downloading file " << m_currentDownload.name << " finished.";
|
||||
DEBUG_LOG() << "Downloading file " << m_currentDownload.name << " finished.";
|
||||
|
||||
++m_downloadCount;
|
||||
|
||||
if (!data.size())
|
||||
WARNING_LOG(m_logger) << "Got finished download without data";
|
||||
WARNING_LOG() << "Got finished download without data";
|
||||
|
||||
QString msg = QString::fromUtf8(data);
|
||||
if (msg.startsWith(QStringLiteral("ERROR")))
|
||||
{
|
||||
ERROR_LOG(m_logger) << msg;
|
||||
ERROR_LOG() << msg;
|
||||
startNextDownload();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!m_dbConnection.isValid())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Database not open";
|
||||
ERROR_LOG() << "Database not open";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -87,7 +86,7 @@ void PdfDownloader::onSingleDownloadFinished(const QByteArray &data)
|
||||
|
||||
if (!flmDbHandler->init(0, m_dbConnection))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Couldn't initialise flmDbHandler";
|
||||
ERROR_LOG() << "Couldn't initialise flmDbHandler";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -111,7 +110,7 @@ void PdfDownloader::onSingleDownloadFinished(const QByteArray &data)
|
||||
flmDbHandler->db()->insert(dbData);
|
||||
|
||||
if (!trans.commit())
|
||||
ERROR_LOG(m_logger) << "Error while inserting FLM data into database.";
|
||||
ERROR_LOG() << "Error while inserting FLM data into database.";
|
||||
|
||||
startNextDownload();
|
||||
}
|
||||
@@ -120,7 +119,7 @@ bool PdfDownloader::startNextDownload()
|
||||
{
|
||||
if (m_pdfInfoVec.isEmpty())
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "No more pending downloads.";
|
||||
DEBUG_LOG() << "No more pending downloads.";
|
||||
|
||||
closeDb(m_dbConnection);
|
||||
emit allDownloadsFinished();
|
||||
@@ -132,7 +131,7 @@ bool PdfDownloader::startNextDownload()
|
||||
|
||||
emit newState(100 / m_totalDownloads * m_downloadCount, tr("Downloading file \"%1\"").arg(m_currentDownload.name));
|
||||
|
||||
DEBUG_LOG(m_logger) << "Downloading file " << m_currentDownload.name;
|
||||
DEBUG_LOG() << "Downloading file " << m_currentDownload.name;
|
||||
|
||||
m_socket->downloadFromHost(m_currentDownload.id, m_currentDownload.fileSize);
|
||||
|
||||
@@ -169,10 +168,10 @@ QSqlDatabase PdfDownloader::openDb(bool *bOk)
|
||||
s->databaseDriver(),
|
||||
s->databaseHostname(),
|
||||
s->databaseName());
|
||||
DEBUG_LOG(m_logger) << "Trying to open database " << s->databaseHostname() << ":" << s->databaseName();
|
||||
DEBUG_LOG() << "Trying to open database " << s->databaseHostname() << ":" << s->databaseName();
|
||||
if (!dbConnection.isOpen())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Error opening database " << s->databaseHostname() << ":" << s->databaseName();
|
||||
ERROR_LOG() << "Error opening database " << s->databaseHostname() << ":" << s->databaseName();
|
||||
if (bOk)
|
||||
*bOk = false;
|
||||
}
|
||||
@@ -183,7 +182,7 @@ void PdfDownloader::closeDb(QSqlDatabase &dbConn)
|
||||
{
|
||||
const QString connName = dbConn.connectionName();
|
||||
|
||||
DEBUG_LOG(m_logger) << "Closing database: " << connName;
|
||||
DEBUG_LOG() << "Closing database: " << connName;
|
||||
|
||||
dbConn.close();
|
||||
dbConn = QSqlDatabase();
|
||||
|
||||
@@ -67,7 +67,5 @@ private: // attributes
|
||||
DBAdministration::ExerciseTableGenerator *m_exTblGen;
|
||||
int m_downloadCount;
|
||||
int m_totalDownloads;
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user