Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
+122
@@ -0,0 +1,122 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Base for ExerciseState
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
#include "exercise_state_base.h"
|
||||
#include "logger.h"
|
||||
|
||||
#include <time.h>
|
||||
|
||||
|
||||
namespace ExerciseManagement
|
||||
{
|
||||
|
||||
//----------------------------------------
|
||||
|
||||
ExerciseStateBase::ExerciseStateBase(const QString &objectName, const ExerciseState &exerciseState, ObjectExercise *objExe)
|
||||
: QState()
|
||||
, m_exercise(objExe)
|
||||
, m_logger(getLogger(QLatin1String("State.") + objectName))
|
||||
, m_exerciseState(exerciseState)
|
||||
{
|
||||
setObjectName(QLatin1String("State.") + objectName);
|
||||
}
|
||||
|
||||
void ExerciseStateBase::onEntry(QEvent *event)
|
||||
{
|
||||
QState::onEntry(event);
|
||||
|
||||
DEBUG_LOG(m_logger) << "Ex " << exerciseId() << ": onEntry Base: write exerciseState: " << m_exerciseState;
|
||||
// write exerciseState to db
|
||||
m_exercise->setExerciseState(m_exerciseState);
|
||||
|
||||
m_exercise->sendStateToServiceManagement(m_exerciseState);
|
||||
}
|
||||
|
||||
//----------------------------------------
|
||||
Unknown::Unknown(ObjectExercise *objExe)
|
||||
: ExerciseStateBase(QLatin1String("Unknown"), ExerciseState::Unknown, objExe)
|
||||
{}
|
||||
|
||||
/*
|
||||
//----------------------------------------
|
||||
Free::Free(ObjectExercise *objExe)
|
||||
: ExerciseStateBase("Free", SYSTEM_FREI, objExe)
|
||||
{}
|
||||
*/
|
||||
|
||||
//----------------------------------------
|
||||
Creation::Creation(ObjectExercise *objExe)
|
||||
: ExerciseStateBase(QLatin1String("Creation"), ExerciseState::Created, objExe)
|
||||
{}
|
||||
|
||||
void Creation::onEntry(QEvent *event)
|
||||
{
|
||||
|
||||
// TODO: still needed?
|
||||
// fill durchgef_uebungen, before base because
|
||||
// we need a filled durchgef_uebungen there
|
||||
|
||||
DEBUG_LOG(m_logger) << "Ex " << exerciseId() << ": onEntry Creation ";
|
||||
ExerciseStateBase::onEntry(event);
|
||||
|
||||
// TODO
|
||||
/*
|
||||
// initialize shm
|
||||
m_db->initializeSharedMemory();
|
||||
// add first entry to aufz_zeiten (if not already there)
|
||||
m_db->insertInitialRecordingTime();
|
||||
*/
|
||||
}
|
||||
|
||||
//----------------------------------------
|
||||
Start::Start(ObjectExercise *objExe)
|
||||
: ExerciseStateBase(QLatin1String("Start"), ExerciseState::Started, objExe)
|
||||
{}
|
||||
|
||||
void Start::onEntry(QEvent *event)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Ex " << exerciseId() << ": onEntry Start: write exerciseState: started";
|
||||
ExerciseStateBase::onEntry(event);
|
||||
|
||||
// TODO:
|
||||
//m_db->updateRecordingTimes(true);
|
||||
}
|
||||
|
||||
void Start::onExit(QEvent *event)
|
||||
{
|
||||
ExerciseStateBase::onExit(event);
|
||||
|
||||
//TODO
|
||||
//m_db->updateRecordingTimes(false);
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------
|
||||
Pause::Pause(ObjectExercise *objExe)
|
||||
: ExerciseStateBase(QLatin1String("Pause"), ExerciseState::Paused, objExe)
|
||||
{}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------------------------------
|
||||
Stop::Stop(ObjectExercise *objExe)
|
||||
: ExerciseStateBase(QLatin1String("Stop"), ExerciseState::Stopped, objExe)
|
||||
{}
|
||||
|
||||
void Stop::onEntry(QEvent *event)
|
||||
{
|
||||
ExerciseStateBase::onEntry(event);
|
||||
|
||||
m_exercise->transferExerciseToEvaluationDb();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------------------------
|
||||
Terminate::Terminate(ObjectExercise *objExe)
|
||||
: ExerciseStateBase(QLatin1String("Resume"), ExerciseState::Terminated, objExe)
|
||||
{}
|
||||
|
||||
} // namespace ExerciseManagement
|
||||
Reference in new issue
Block a user