Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
+89
@@ -0,0 +1,89 @@
|
||||
/**
|
||||
* Initialisation for Publisher
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
#include "initialisation.h"
|
||||
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
#include <DDS/DDSConnector/publisher.h>
|
||||
|
||||
#include <ExerciseManagement/exm.hpp>
|
||||
#include <ExerciseManagement/exm_enums.hpp>
|
||||
#include <ParticipantManagement/ppm.hpp>
|
||||
|
||||
#include <QVariant>
|
||||
#include <QDateTime>
|
||||
|
||||
namespace DataSampleGenerator
|
||||
{
|
||||
|
||||
Initialisation::Initialisation(int domainId, int exerciseId)
|
||||
: DDSConnector::DdsConnector(domainId, IDL::PartitionType::Exercise, exerciseId)
|
||||
, m_isUsed(0)
|
||||
, m_participantId(222)
|
||||
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("DataSampleGenerator.Initialisation"))
|
||||
|
||||
{
|
||||
INFO_LOG(m_logger) << "Initialisation for partition: " << getDefaultPartition();
|
||||
}
|
||||
|
||||
bool Initialisation::init(const QStringList &qosFileList)
|
||||
{
|
||||
if (!DDSConnector::DdsConnector::init(qosFileList))
|
||||
return false;
|
||||
|
||||
// Initialisation publisher
|
||||
initPublisher();
|
||||
return true;
|
||||
}
|
||||
|
||||
void Initialisation::generateTestData(const QString &type)
|
||||
{
|
||||
m_isUsed = !m_isUsed;
|
||||
|
||||
if (type == QLatin1String("ExerciseManagement::Exercise"))
|
||||
{
|
||||
ExerciseManagement::Exercise data;
|
||||
|
||||
data.id(999);
|
||||
data.name("TestExe");
|
||||
data.isUsed(m_isUsed);
|
||||
data.partitionName("Exe999");
|
||||
data.state(ExerciseManagement::ExerciseState::Started);
|
||||
data.isDeleted(false);
|
||||
|
||||
getPublisher()->write(data);
|
||||
|
||||
}
|
||||
else if (type == QLatin1String("ParticipantManagement::ExerciseParticipant"))
|
||||
{
|
||||
ParticipantManagement::Participant data;
|
||||
|
||||
data.id(m_participantId);
|
||||
data.symbol(std::string("231"));
|
||||
//data.relatedUnit(1);
|
||||
|
||||
data.equipmentNumber (1111);
|
||||
|
||||
data.isSimulated(true);
|
||||
data.sampleTime(QDateTime::currentMSecsSinceEpoch());
|
||||
//data.isNBCProtectionActivated(false);
|
||||
|
||||
getPublisher()->write(data);
|
||||
|
||||
data.id(m_participantId+10);
|
||||
getPublisher()->write(data);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
WARNING_LOG(m_logger) << "TopicType " << type << " not implemented.";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
} // Namespace DataSampleGenerator
|
||||
Reference in new issue
Block a user