- 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>
186 lines
5.4 KiB
C++
Executable File
186 lines
5.4 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
* SRP Data Topic test executable
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
*
|
|
* Created by Hanna E. Rathje, SLSE, 2015-09-11
|
|
*/
|
|
|
|
#include "srp_dt_tests.h"
|
|
|
|
#include <nglapplication/nglcoreapplication.h>
|
|
#include <LtsCommandLineParser/LtsCommandLineParser.h>
|
|
#include <QTimer>
|
|
|
|
#include <SituationReplay/srp_dtc.h>
|
|
|
|
//---------------------------------------------------------------------------------
|
|
namespace SituationReplay
|
|
{
|
|
SrpDtTests::SrpDtTests(QObject *parent)
|
|
: QObject(parent)
|
|
, m_replayPartitionId(0)
|
|
, m_situationReplayId(0)
|
|
, m_bTestsSuccessful(true)
|
|
{
|
|
qRegisterMetaType<Core::FunctionReply>("Core::FunctionReply");
|
|
}
|
|
|
|
//---------------------------------------------------------------------------------
|
|
SrpDtTests::~SrpDtTests()
|
|
{}
|
|
|
|
//---------------------------------------------------------------------------------
|
|
bool SrpDtTests::init(int domainId, int replayPartitionId)
|
|
{
|
|
DEBUG_LOG() << "init begin";
|
|
m_replayPartitionId = replayPartitionId;
|
|
|
|
// initialize DDS
|
|
m_ddsConnector.reset(new DDSConnector::DdsConnector(domainId, IDL::PartitionType::Replay, replayPartitionId));
|
|
if (!m_ddsConnector->init())
|
|
return false;
|
|
|
|
// Subscribe on replayPartition - default = true in this DdsSubscriber
|
|
|
|
// DdsInterface Subscriber
|
|
m_ddsConnector->initSubscriber();
|
|
|
|
// DdsInterface Publisher
|
|
//m_ddsConnector->setPublisher(new Publisher(domainId, m_ddsConnector->getPartition(), m_ddsConnector->getDomainParticipant()));
|
|
|
|
DEBUG_LOG() << "Create dtc";
|
|
m_dtc = SituationReplay::Interface::Dtc::create(m_ddsConnector);
|
|
DEBUG_LOG() << "Init dtc";
|
|
bool bRet = m_dtc->enableAll();
|
|
DEBUG_LOG() << "init end - bRet = " << bRet;
|
|
|
|
connect(m_dtc.get(), &SituationReplay::Interface::Dtc::sitReplayChanged,
|
|
this, &SrpDtTests::onReceiveSituationReplayData);
|
|
|
|
return bRet;
|
|
}
|
|
|
|
//---------------------------------------------------------------------------------
|
|
void SrpDtTests::startTest()
|
|
{
|
|
INFO_LOG() << "startTest";
|
|
QTimer::singleShot(1000, this, &SrpDtTests::tryGetAllSituationReplays);
|
|
}
|
|
|
|
//---------------------------------------------------------------------------------
|
|
void SrpDtTests::tryGetAllSituationReplays()
|
|
{
|
|
INFO_LOG() << "trying to get all situationReplays";
|
|
const QMap<qint32, SituationReplay::SitReplay> map = m_dtc->sitReplays();
|
|
if (map.isEmpty())
|
|
{
|
|
ERROR_LOG() << "Error requesting all situation replay data";
|
|
failExit();
|
|
}
|
|
else
|
|
{
|
|
INFO_LOG() << "Amout of existing situation replays = " << map.size();
|
|
m_situationReplayId = map.firstKey();
|
|
for(auto it = map.begin(); it != map.end(); ++it)
|
|
INFO_LOG() << "situationReplay(" << it.key() << ") : " << it.value().replayPartitionId() ;
|
|
}
|
|
|
|
QTimer::singleShot(10, this, &SrpDtTests::tryGetSituationReplay);
|
|
}
|
|
|
|
//---------------------------------------------------------------------------------
|
|
void SrpDtTests::tryGetSituationReplay()
|
|
{
|
|
INFO_LOG() << "trying get itemData for situationReplay " << m_situationReplayId;
|
|
SituationReplay::SitReplay data = m_dtc->sitReplay(m_situationReplayId);
|
|
|
|
if (data.id() <= 0)
|
|
{
|
|
ERROR_LOG() << "Error receiving data for situation replay " << m_situationReplayId;
|
|
failExit();
|
|
}
|
|
else
|
|
{
|
|
INFO_LOG() << "## SitReplay(" << data.id() << "), replayPartition: " << data.replayPartitionId()
|
|
<< ", on exercise " << data.exerciseId();
|
|
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
|
|
}
|
|
}
|
|
|
|
//---------------------------------------------------------------------------------
|
|
void SrpDtTests::onReceiveSituationReplayData(const SituationReplay::SitReplay &data)
|
|
{
|
|
if (m_situationReplayId == data.id())
|
|
INFO_LOG() << "##################### Data for id = " << data.id() << " received";
|
|
}
|
|
|
|
// ------------------------------------------------------------------------------
|
|
void SrpDtTests::failExit()
|
|
{
|
|
m_bTestsSuccessful = false;
|
|
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
|
|
}
|
|
|
|
} // end namespace
|
|
|
|
// ------------------------------------------------------------------
|
|
class CmdLineParser : public LtsCommandLineParser::LtsCommandLineParser
|
|
{
|
|
public:
|
|
CmdLineParser()
|
|
: LtsCommandLineParser()
|
|
{
|
|
addOption( { QStringList() << QLatin1String("p") << QLatin1String("replay-partition-id")
|
|
, QLatin1String("ReplayPartitionId (required).")
|
|
, QLatin1String("> 0")
|
|
, QLatin1String("1")
|
|
} );
|
|
|
|
addHelpOption();
|
|
}
|
|
|
|
int replayPartitionId() const { return isSet(QLatin1String("p")) ? value(QLatin1String("p")).toInt() : -1; }
|
|
};
|
|
|
|
// ------------------------------------------------------------------
|
|
int main(int argc, char **argv)
|
|
{
|
|
NGLCoreApplication app(argc, argv);
|
|
app.createLogger("SRP", "log4cxx_srp.props");
|
|
|
|
int iRet = -1;
|
|
CmdLineParser options;
|
|
if (!options.init())
|
|
return -1;
|
|
|
|
if (options.replayPartitionId() <= 0)
|
|
{
|
|
ERROR_LOG(app.baseLogger()) << "Required parameter p: (replay) partitionId ";
|
|
options.showHelp();
|
|
return -2;
|
|
}
|
|
|
|
std::unique_ptr<SituationReplay::SrpDtTests> srpDtTests(new SituationReplay::SrpDtTests);
|
|
|
|
if(!srpDtTests->init(options.domainId(), options.replayPartitionId()))
|
|
return iRet;
|
|
|
|
QTimer::singleShot(0, srpDtTests.get(), &SituationReplay::SrpDtTests::startTest);
|
|
|
|
STARTUP_LOG(app.baseLogger());
|
|
|
|
app.exec();
|
|
iRet = srpDtTests->testsSuccessful() ? 0 : 1;
|
|
fprintf(stderr, "%d\n", iRet);
|
|
|
|
DEBUG_LOG(app.baseLogger()) << "** TEST result = " << iRet;
|
|
|
|
SHUTDOWN_LOG(app.baseLogger());
|
|
|
|
return iRet;
|
|
}
|
|
|