Commit 64cdfd84 authored by Sebastien Petitdemange's avatar Sebastien Petitdemange Committed by Laurent Claustre

simulator: add IntTrigMulti capability

parent 09e3bca6
......@@ -45,6 +45,7 @@ class LIBSIMULATOR_API Camera
HwBufferCtrlObj *getBufferCtrlObj();
FrameBuilder *getFrameBuilder();
void prepareAcq();
void startAcq();
void stopAcq();
......@@ -57,6 +58,8 @@ class LIBSIMULATOR_API Camera
void setLatTime(double lat_time);
void getLatTime(double& lat_time);
void setTrigMode(TrigMode trig_mode) {m_trig_mode = trig_mode;};
void getTrigMode(TrigMode& trig_mode) {trig_mode = m_trig_mode;};
void setBin(const Bin& bin);
void getBin(Bin& bin);
void checkBin(Bin& bin);
......@@ -93,16 +96,14 @@ class LIBSIMULATOR_API Camera
virtual void start();
int getNbAcquiredFrames();
bool m_force_stop;
int m_acq_frame_nb;
protected:
virtual void init();
virtual void execCmd(int cmd);
private:
void execStartAcq();
Camera* m_simu;
int m_acq_frame_nb;
};
friend class SimuThread;
......@@ -113,7 +114,7 @@ class LIBSIMULATOR_API Camera
double m_exp_time;
double m_lat_time;
int m_nb_frames;
TrigMode m_trig_mode;
SimuThread m_thread;
};
......
......@@ -77,9 +77,9 @@ void Camera::SimuThread::execStartAcq()
FrameBuilder& frame_builder = m_simu->m_frame_builder;
frame_builder.resetFrameNr();
int nb_frames = m_simu->m_nb_frames;
int nb_frames = m_simu->m_trig_mode == IntTrig ? m_simu->m_nb_frames : m_acq_frame_nb + 1;
int& frame_nb = m_acq_frame_nb;
for (frame_nb = 0; (frame_nb < nb_frames)||(nb_frames==0); frame_nb++) {
for (;(frame_nb < nb_frames)||(nb_frames==0); frame_nb++) {
double req_time;
if(m_force_stop)
{
......@@ -111,13 +111,6 @@ void Camera::SimuThread::execStartAcq()
setStatus(Ready);
}
int Camera::SimuThread::getNbAcquiredFrames()
{
DEB_MEMBER_FUNCT();
return m_acq_frame_nb;
}
Camera::Camera() :
m_thread(*this)
{
......@@ -244,6 +237,10 @@ HwInterface::StatusType::Basic Camera::getStatus()
throw LIMA_HW_EXC(Error, "Invalid thread status");
}
}
void Camera::prepareAcq()
{
m_thread.m_acq_frame_nb = 0;
}
void Camera::startAcq()
{
......@@ -267,7 +264,7 @@ void Camera::stopAcq()
int Camera::getNbAcquiredFrames()
{
return m_thread.getNbAcquiredFrames();
return m_thread.m_acq_frame_nb;
}
ostream& lima::Simulator::operator <<(ostream& os, Camera& simu)
......
......@@ -95,6 +95,7 @@ void Interface::reset(ResetLevel reset_level)
void Interface::prepareAcq()
{
m_simu.prepareAcq();
}
void Interface::startAcq()
......
......@@ -41,18 +41,26 @@ SyncCtrlObj::~SyncCtrlObj()
bool SyncCtrlObj::checkTrigMode(TrigMode trig_mode)
{
return (trig_mode == IntTrig);
switch(trig_mode)
{
case IntTrig:
case IntTrigMult:
return true;
default:
return false;
}
}
void SyncCtrlObj::setTrigMode(TrigMode trig_mode)
{
if (!checkTrigMode(trig_mode))
throw LIMA_HW_EXC(InvalidValue, "Invalid (external) trigger");
m_simu.setTrigMode(trig_mode);
}
void SyncCtrlObj::getTrigMode(TrigMode& trig_mode)
{
trig_mode = IntTrig;
m_simu.getTrigMode(trig_mode);
}
void SyncCtrlObj::setExpTime(double exp_time)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment