Adds immediate migration results in progress
This commit is contained in:
2102 files changed
+17482
-15071
No files matched your search
+31
-31
@@ -56,14 +56,14 @@ HandlerExercise::~HandlerExercise()
|
||||
|
||||
bool HandlerExercise::init()
|
||||
{
|
||||
DEBUG_LOG() << "Finish Initialise DbAdministration (dba) ";
|
||||
INFO_LOG() << "Data available for services: " << m_exTblGen->getAvailableServices().join(QLatin1Char(','));
|
||||
DEBUG_LOG(m_logger) << "Finish Initialise DbAdministration (dba) ";
|
||||
INFO_LOG(m_logger) << "Data available for services: " << m_exTblGen->getAvailableServices().join(QLatin1Char(','));
|
||||
|
||||
QVector<Database::ExmExercise> dataVec;
|
||||
// read all exercises from database
|
||||
if (!m_db->select(dataVec))
|
||||
{
|
||||
ERROR_LOG() << "Error reading data from database!";
|
||||
ERROR_LOG(m_logger) << "Error reading data from database!";
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -77,13 +77,13 @@ bool HandlerExercise::init()
|
||||
if (ret.error())
|
||||
{
|
||||
delete ifs;
|
||||
ERROR_LOG() << ret();
|
||||
ERROR_LOG(m_logger) << ret();
|
||||
return false;
|
||||
}
|
||||
m_exeObjMap.insert(ifs->id(), ifs);
|
||||
exerciseStates.push_back({ifs->id(), ifs->data().exerciseStateId});
|
||||
}
|
||||
DEBUG_LOG() << "m_exeObjMap.size() = " << m_exeObjMap.size();
|
||||
DEBUG_LOG(m_logger) << "m_exeObjMap.size() = " << m_exeObjMap.size();
|
||||
|
||||
// make sure to start the important exercises first
|
||||
std::sort(exerciseStates.begin(), exerciseStates.end(),
|
||||
@@ -140,7 +140,7 @@ void HandlerExercise::onStartNextExercise()
|
||||
auto *objEx = m_exeObjMap.value(exId);
|
||||
if (!objEx)
|
||||
{
|
||||
WARNING_LOG() << "Trying to start exercise with id " << exId << " but could not find a handler !?";
|
||||
WARNING_LOG(m_logger) << "Trying to start exercise with id " << exId << " but could not find a handler !?";
|
||||
continue;
|
||||
}
|
||||
NOTICE_LOG(m_logger) << "Init state machine for exercise " << exId << " (" << objEx->data().name << ")";
|
||||
@@ -155,7 +155,7 @@ bool HandlerExercise::hasError(const Core::FunctionReplyObject &replyObject, Obj
|
||||
if (replyObject.error())
|
||||
{
|
||||
delete ifs;
|
||||
ERROR_LOG() << replyObject();
|
||||
ERROR_LOG(m_logger) << replyObject();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -194,7 +194,7 @@ void HandlerExercise::onExerciseCreateRequest(const rti::core::SampleIdentity &c
|
||||
auto ret = exerciseCreateRequest(request);
|
||||
if (ret.error())
|
||||
{
|
||||
WARNING_LOG() << ret();
|
||||
WARNING_LOG(m_logger) << ret();
|
||||
|
||||
}
|
||||
m_ddsHandler->fts()->exerciseCreateReply(cookie, ret);
|
||||
@@ -202,7 +202,7 @@ void HandlerExercise::onExerciseCreateRequest(const rti::core::SampleIdentity &c
|
||||
|
||||
Core::FunctionReplyObject HandlerExercise::exerciseCreateRequest(const ExerciseCreateRequest &request)
|
||||
{
|
||||
DEBUG_LOG() << "onExerciseCreateRequest: " << request;
|
||||
DEBUG_LOG(m_logger) << "onExerciseCreateRequest: " << request;
|
||||
|
||||
Database::ExmExercise newData(copyBaseData(request));
|
||||
newData.linkedExerciseId = 0;
|
||||
@@ -234,7 +234,7 @@ Core::FunctionReplyObject HandlerExercise::exerciseCreateRequest(const ExerciseC
|
||||
if (hasError(ret, ifs))
|
||||
{
|
||||
// remove failed create exercise request from DDS bus (id = 0)
|
||||
ERROR_LOG() << "CreateExercise failed, removing request from dds";
|
||||
ERROR_LOG(m_logger) << "CreateExercise failed, removing request from dds";
|
||||
m_ddsHandler->dts()->removeExerciseByKey(0);
|
||||
return ret;
|
||||
}
|
||||
@@ -250,7 +250,7 @@ Core::FunctionReplyObject HandlerExercise::exerciseCreateRequest(const ExerciseC
|
||||
|
||||
if (hasError(ret, ifs))
|
||||
{
|
||||
ERROR_LOG() << "CreateExercisePhase failed, removing requests from dds";
|
||||
ERROR_LOG(m_logger) << "CreateExercisePhase failed, removing requests from dds";
|
||||
m_ddsHandler->dts()->removeExercisePhaseByKey(0);
|
||||
m_ddsHandler->dts()->removeExerciseByKey(0);
|
||||
return ret;
|
||||
@@ -263,7 +263,7 @@ Core::FunctionReplyObject HandlerExercise::exerciseCreateRequest(const ExerciseC
|
||||
|
||||
if (hasError(ret, ifs))
|
||||
{
|
||||
ERROR_LOG() << "Set active phase failed, removing requests from dds";
|
||||
ERROR_LOG(m_logger) << "Set active phase failed, removing requests from dds";
|
||||
m_ddsHandler->dts()->removeExercisePhaseByKey(0);
|
||||
m_ddsHandler->dts()->removeExerciseByKey(0);
|
||||
return ret;
|
||||
@@ -283,13 +283,13 @@ void HandlerExercise::onExerciseModifyRequest(const rti::core::SampleIdentity &c
|
||||
{
|
||||
auto ret = exerciseModifyRequest(request);
|
||||
if (ret.error())
|
||||
WARNING_LOG() << ret();
|
||||
WARNING_LOG(m_logger) << ret();
|
||||
m_ddsHandler->fts()->exerciseModifyReply(cookie, ret);
|
||||
}
|
||||
|
||||
Core::FunctionReplyObject HandlerExercise::exerciseModifyRequest(const ExerciseModifyRequest &request)
|
||||
{
|
||||
INFO_LOG() << "onExerciseModifyRequest: " << request;
|
||||
INFO_LOG(m_logger) << "onExerciseModifyRequest: " << request;
|
||||
|
||||
ObjectExercise *ifs = m_exeObjMap.value(request.id());
|
||||
if (ifs == nullptr)
|
||||
@@ -430,7 +430,7 @@ Core::FunctionReplyObject HandlerExercise::exerciseModifyRequest(const ExerciseM
|
||||
}
|
||||
}
|
||||
|
||||
DEBUG_LOG() << "Linked exercise: " << request.linkedExerciseId()
|
||||
DEBUG_LOG(m_logger) << "Linked exercise: " << request.linkedExerciseId()
|
||||
<< ", state: " << ifs->exerciseState()
|
||||
<< ", new: " << request.newState();
|
||||
if (request.linkedExerciseId() != 0 && ifs->exerciseState() != request.newState())
|
||||
@@ -440,7 +440,7 @@ Core::FunctionReplyObject HandlerExercise::exerciseModifyRequest(const ExerciseM
|
||||
{
|
||||
ObjectExercise *ifsLinked = m_exeObjMap.value(request.linkedExerciseId());
|
||||
if (!ifsLinked)
|
||||
WARNING_LOG() << "Linked exercise with id " << request.linkedExerciseId() << " not found!";
|
||||
WARNING_LOG(m_logger) << "Linked exercise with id " << request.linkedExerciseId() << " not found!";
|
||||
else
|
||||
{
|
||||
if (ifsLinked->exerciseState() != ExerciseManagement::ExerciseState::Paused ||
|
||||
@@ -478,7 +478,7 @@ Core::FunctionReplyObject HandlerExercise::exerciseModifyRequest(const ExerciseM
|
||||
//{
|
||||
// Core::FunctionReplyObject ret;
|
||||
|
||||
// INFO_LOG() << "onExerciseChangeStateRequest id = " << request.id();
|
||||
// INFO_LOG(m_logger) << "onExerciseChangeStateRequest id = " << request.id();
|
||||
|
||||
// ObjectExercise *ifs = m_exeObjMap.value(request.id());
|
||||
// if (ifs == nullptr)
|
||||
@@ -488,7 +488,7 @@ Core::FunctionReplyObject HandlerExercise::exerciseModifyRequest(const ExerciseM
|
||||
// return;
|
||||
// }
|
||||
|
||||
// DEBUG_LOG() << "request.newState() = " << request.newState();
|
||||
// DEBUG_LOG(m_logger) << "request.newState() = " << request.newState();
|
||||
|
||||
// ret = ifs->switchToState(request.newState());
|
||||
// if (!ret.error() && ifs->linkedExerciseId() != 0)
|
||||
@@ -498,7 +498,7 @@ Core::FunctionReplyObject HandlerExercise::exerciseModifyRequest(const ExerciseM
|
||||
// {
|
||||
// ObjectExercise *ifsLinked = m_exeObjMap.value(ifs->linkedExerciseId());
|
||||
// if (!ifsLinked)
|
||||
// WARNING_LOG() << "Linked exercise with id " << ifs->linkedExerciseId() << " not found!";
|
||||
// WARNING_LOG(m_logger) << "Linked exercise with id " << ifs->linkedExerciseId() << " not found!";
|
||||
// else
|
||||
// {
|
||||
// if (ifsLinked->exerciseState() != ExerciseManagement::ExerciseState::Paused ||
|
||||
@@ -509,7 +509,7 @@ Core::FunctionReplyObject HandlerExercise::exerciseModifyRequest(const ExerciseM
|
||||
// }
|
||||
|
||||
// if (ret.error())
|
||||
// ERROR_LOG() << ret();
|
||||
// ERROR_LOG(m_logger) << ret();
|
||||
|
||||
// m_ddsHandler->fts()->exerciseChangeStateReply(cookie, ret);
|
||||
//}
|
||||
@@ -530,7 +530,7 @@ void HandlerExercise::onGetExerciseImageRequest(const rti::core::SampleIdentity
|
||||
int32_t exerciseId = request.exerciseId();
|
||||
reply.id(exerciseId);
|
||||
|
||||
DEBUG_LOG() << "onGetExerciseImageRequest id = " << exerciseId;
|
||||
DEBUG_LOG(m_logger) << "onGetExerciseImageRequest id = " << exerciseId;
|
||||
|
||||
Database::ExmExerciseImage exmImg;
|
||||
if (!m_db->selectExmExerciseImage(exerciseId, exmImg))
|
||||
@@ -566,7 +566,7 @@ void HandlerExercise::onGetExerciseImageRequest(const rti::core::SampleIdentity
|
||||
// reply.imageData(LtsUtils::fromPixmap(excPx));
|
||||
// }
|
||||
// else
|
||||
// ERROR_LOG() << "image isNull for exercise " << exerciseId;
|
||||
// ERROR_LOG(m_logger) << "image isNull for exercise " << exerciseId;
|
||||
}
|
||||
|
||||
/* test behaviour on bad network speeds
|
||||
@@ -582,7 +582,7 @@ void HandlerExercise::onExerciseImageModifyRequest(const rti::core::SampleIdenti
|
||||
{
|
||||
qint32 exerciseId = request.id();
|
||||
|
||||
DEBUG_LOG() << "onExerciseImageModifyRequest id = " << exerciseId << ", image size = " << request.image().size();
|
||||
DEBUG_LOG(m_logger) << "onExerciseImageModifyRequest id = " << exerciseId << ", image size = " << request.image().size();
|
||||
|
||||
Database::ExmExerciseImage exImg;
|
||||
exImg.exerciseId = exerciseId;
|
||||
@@ -639,7 +639,7 @@ void HandlerExercise::onExerciseRemoveRequest(const rti::core::SampleIdentity &c
|
||||
|
||||
if (ret.error())
|
||||
{
|
||||
ERROR_LOG() << ret();
|
||||
ERROR_LOG(m_logger) << ret();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -657,13 +657,13 @@ void HandlerExercise::onExerciseRemoveRequest(const rti::core::SampleIdentity &c
|
||||
void HandlerExercise::onStartGroupReply(const Core::FunctionReplyObject &replyObject)
|
||||
{
|
||||
if (replyObject.error())
|
||||
WARNING_LOG() << "Error starting group: " << replyObject();
|
||||
WARNING_LOG(m_logger) << "Error starting group: " << replyObject();
|
||||
}
|
||||
|
||||
|
||||
bool HandlerExercise::checkEquipmentNumbersOnAllExercises(int exerciseIdToBeStarted, QString &mesgOut)
|
||||
{
|
||||
INFO_LOG() << Q_FUNC_INFO <<" START, exerciseIdTobeStarted: " << exerciseIdToBeStarted;
|
||||
INFO_LOG(m_logger) << Q_FUNC_INFO <<" START, exerciseIdTobeStarted: " << exerciseIdToBeStarted;
|
||||
|
||||
// only one exercise, about to start
|
||||
if (m_exeObjMap.size() <= 1)
|
||||
@@ -684,7 +684,7 @@ bool HandlerExercise::checkEquipmentNumbersOnAllExercises(int exerciseIdToBeStar
|
||||
|
||||
if (!ppmDtcForEx)
|
||||
{
|
||||
WARNING_LOG() << Q_FUNC_INFO << " no ppmDtcForEx (" << exerciseIdToBeStarted << ")";
|
||||
WARNING_LOG(m_logger) << Q_FUNC_INFO << " no ppmDtcForEx (" << exerciseIdToBeStarted << ")";
|
||||
return true;
|
||||
}
|
||||
ppmDtcForEx->enableParticipant();
|
||||
@@ -704,7 +704,7 @@ bool HandlerExercise::checkEquipmentNumbersOnAllExercises(int exerciseIdToBeStar
|
||||
std::shared_ptr<ParticipantManagement::Interface::Dtc> ppmDtc = m_ddsHandler->ppmDtc();
|
||||
if (!ppmDtc)
|
||||
{
|
||||
WARNING_LOG() << Q_FUNC_INFO << " no ppmDtc";
|
||||
WARNING_LOG(m_logger) << Q_FUNC_INFO << " no ppmDtc";
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -723,7 +723,7 @@ bool HandlerExercise::checkEquipmentNumbersOnAllExercises(int exerciseIdToBeStar
|
||||
ObjectExercise *ifs = m_exeObjMap.value(exerciseId);
|
||||
if (!ifs)
|
||||
{
|
||||
ERROR_LOG() << Q_FUNC_INFO << " Exercise not found, exId = " << exerciseId;
|
||||
ERROR_LOG(m_logger) << Q_FUNC_INFO << " Exercise not found, exId = " << exerciseId;
|
||||
return;
|
||||
}
|
||||
if ((ifs->exerciseState() == ExerciseState::Started) ||
|
||||
@@ -733,7 +733,7 @@ bool HandlerExercise::checkEquipmentNumbersOnAllExercises(int exerciseIdToBeStar
|
||||
for (const auto &eq2p : std::as_const(mapping))
|
||||
if (eqNoForEx.contains(eq2p.equipmentNumber()))
|
||||
{
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " !!! eq = " << eq2p.equipmentNumber() << " is already used in exercise =" << exerciseId;
|
||||
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " !!! eq = " << eq2p.equipmentNumber() << " is already used in exercise =" << exerciseId;
|
||||
usedEqNumbers[exerciseId].insert(eq2p.equipmentNumber());
|
||||
}
|
||||
}
|
||||
@@ -767,7 +767,7 @@ bool HandlerExercise::checkEquipmentNumbersOnAllExercises(int exerciseIdToBeStar
|
||||
}
|
||||
} // while
|
||||
|
||||
WARNING_LOG() << Q_FUNC_INFO << " state change request not allowed: mesgOut:" << mesgOut;
|
||||
WARNING_LOG(m_logger) << Q_FUNC_INFO << " state change request not allowed: mesgOut:" << mesgOut;
|
||||
|
||||
// limit length:
|
||||
if (mesgOut.size()>200)
|
||||
|
||||
Reference in new issue
Block a user