Commit e2f9cf15 authored by Alejandro Homs Puron's avatar Alejandro Homs Puron Committed by operator for beamline
Browse files

Rename SlsDetector::State to AcqState

parent dda47ef7
......@@ -91,9 +91,9 @@ public:
void setRawMode(bool raw_mode);
void getRawMode(bool& raw_mode);
State getState();
void waitState(State state);
State waitNotState(State state);
AcqState getAcqState();
void waitAcqState(AcqState state);
AcqState waitNotAcqState(AcqState state);
ImageType getImageType() const
{ return m_image_type; }
......@@ -228,7 +228,7 @@ private:
Camera *m_cam;
Cond& m_cond;
State& m_state;
AcqState& m_state;
FrameQueue m_frame_queue;
};
......@@ -251,7 +251,7 @@ private:
static int64_t NSec(double x)
{ return int64_t(x * 1e9); }
State getEffectiveState();
AcqState getEffectiveState();
StdBufferCbMgr *getBufferCbMgr()
{ return &m_buffer_ctrl_obj->getBuffer(); }
......@@ -316,7 +316,7 @@ private:
PixelDepth m_pixel_depth;
ImageType m_image_type;
bool m_raw_mode;
State m_state;
AcqState m_state;
double m_new_frame_timeout;
double m_abort_sleep_time;
bool m_tol_lost_packets;
......
......@@ -234,7 +234,7 @@ std::ostream& operator <<(std::ostream& os, const PrettyList<T>& pl)
}
enum State {
enum AcqState {
Idle, Init, Starting, Running, StopReq, Stopping, Stopped,
};
......@@ -249,7 +249,7 @@ enum PixelDepth {
PixelDepth32 = 32,
};
std::ostream& operator <<(std::ostream& os, State state);
std::ostream& operator <<(std::ostream& os, AcqState state);
std::ostream& operator <<(std::ostream& os, Type type);
......
......@@ -49,9 +49,9 @@ public:
void setRawMode(bool raw_mode);
void getRawMode(bool& raw_mode /Out/);
SlsDetector::State getState();
void waitState(SlsDetector::State state);
SlsDetector::State waitNotState(SlsDetector::State state);
SlsDetector::AcqState getAcqState();
void waitAcqState(SlsDetector::AcqState state);
SlsDetector::AcqState waitNotAcqState(SlsDetector::AcqState state);
void getFrameDim(FrameDim& frame_dim /Out/, bool raw = false);
......
......@@ -297,7 +297,7 @@ enum NetworkParameter {
}; // namespace Defs
enum State {
enum AcqState {
Idle, Init, Starting, Running, StopReq, Stopping, Stopped,
};
......
......@@ -191,7 +191,7 @@ void Camera::AcqThread::threadFunction()
}
}
} while ((m_state != StopReq) && cont_acq);
State prev_state = m_state;
AcqState prev_state = m_state;
if (acq_end && m_cam->m_skip_frame_freq) {
AutoMutexUnlock u(l);
......@@ -248,7 +248,7 @@ void Camera::AcqThread::cleanUp(AutoMutex& l)
if ((m_state == Stopped) || (m_state == Idle))
return;
State prev_state = m_state;
AcqState prev_state = m_state;
if ((m_state == Running) || (m_state == StopReq)) {
m_state = Stopping;
AutoMutexUnlock u(l);
......@@ -506,7 +506,7 @@ void Camera::setTrigMode(TrigMode trig_mode)
{
DEB_MEMBER_FUNCT();
DEB_PARAM() << DEB_VAR1(trig_mode);
waitState(Idle);
waitAcqState(Idle);
TrigMode cam_trig_mode = trig_mode;
if (trig_mode == Defs::SoftTriggerExposure)
cam_trig_mode = Defs::TriggerExposure;
......@@ -535,7 +535,7 @@ void Camera::setNbFrames(FrameType nb_frames)
THROW_HW_ERROR(InvalidValue) << "too high "
<< DEB_VAR2(nb_frames, MaxFrames);
waitState(Idle);
waitAcqState(Idle);
FrameType det_nb_frames = nb_frames;
if (m_skip_frame_freq)
det_nb_frames += nb_frames / m_skip_frame_freq;
......@@ -576,7 +576,7 @@ void Camera::setExpTime(double exp_time)
{
DEB_MEMBER_FUNCT();
DEB_PARAM() << DEB_VAR1(exp_time);
waitState(Idle);
waitAcqState(Idle);
m_det->setExposureTime(NSec(exp_time));
m_exp_time = exp_time;
}
......@@ -619,7 +619,7 @@ void Camera::setFramePeriod(double frame_period)
time_ranges.max_frame_period);
}
waitState(Idle);
waitAcqState(Idle);
m_det->setExposurePeriod(NSec(frame_period));
m_frame_period = frame_period;
}
......@@ -698,10 +698,10 @@ void Camera::setPixelDepth(PixelDepth pixel_depth)
DEB_MEMBER_FUNCT();
DEB_PARAM() << DEB_VAR1(pixel_depth);
if (getState() != Idle)
if (getAcqState() != Idle)
THROW_HW_FATAL(Error) << "Camera is not idle";
waitState(Idle);
waitAcqState(Idle);
switch (pixel_depth) {
case PixelDepth4:
case PixelDepth8:
......@@ -749,16 +749,16 @@ void Camera::getRawMode(bool& raw_mode)
DEB_RETURN() << DEB_VAR1(raw_mode);
}
State Camera::getState()
AcqState Camera::getAcqState()
{
DEB_MEMBER_FUNCT();
AutoMutex l = lock();
State state = getEffectiveState();
AcqState state = getEffectiveState();
DEB_RETURN() << DEB_VAR1(state);
return state;
}
State Camera::getEffectiveState()
AcqState Camera::getEffectiveState()
{
if (m_state == Stopped) {
m_acq_thread = NULL;
......@@ -767,7 +767,7 @@ State Camera::getEffectiveState()
return m_state;
}
void Camera::waitState(State state)
void Camera::waitAcqState(AcqState state)
{
DEB_MEMBER_FUNCT();
DEB_PARAM() << DEB_VAR1(state);
......@@ -776,7 +776,7 @@ void Camera::waitState(State state)
m_cond.wait();
}
State Camera::waitNotState(State state)
AcqState Camera::waitNotAcqState(AcqState state)
{
DEB_MEMBER_FUNCT();
DEB_PARAM() << DEB_VAR1(state);
......@@ -798,8 +798,8 @@ void Camera::prepareAcq()
if (!m_model)
THROW_HW_ERROR(Error) << "No BufferCbMgr defined";
waitNotState(Stopping);
if (getState() != Idle)
waitNotAcqState(Stopping);
if (getAcqState() != Idle)
THROW_HW_ERROR(Error) << "Camera is not idle";
bool need_period = !m_lima_nb_frames || (m_lima_nb_frames > 1);
......
......@@ -570,7 +570,7 @@ FrameType lima::SlsDetector::getOldestFrame(const FrameArray& l)
return first_frame;
}
ostream& lima::SlsDetector::operator <<(ostream& os, State state)
ostream& lima::SlsDetector::operator <<(ostream& os, AcqState state)
{
const char *name = "Unknown";
switch (state) {
......
......@@ -403,7 +403,7 @@ void Interface::startAcq()
Defs::TrigMode trig_mode;
m_cam.getTrigMode(trig_mode);
bool int_trig_multi = (trig_mode == Defs::SoftTriggerExposure);
if (!int_trig_multi || (m_cam.getState() != Running))
if (!int_trig_multi || (m_cam.getAcqState() != Running))
m_cam.startAcq();
if (int_trig_multi)
m_cam.triggerFrame();
......@@ -419,7 +419,7 @@ void Interface::getStatus(StatusType& status)
{
DEB_MEMBER_FUNCT();
State state = m_cam.getState();
AcqState state = m_cam.getAcqState();
status.acq = (state == Idle) ? AcqReady : AcqRunning;
status.det = DetIdle;
......
......@@ -113,7 +113,7 @@ bool Receiver::getImage(ImageData& image_data)
try {
++image_data.frame;
int ret = m_recv->getImage(image_data);
if ((ret != 0) || (m_cam->getState() == Stopping))
if ((ret != 0) || (m_cam->getAcqState() == Stopping))
return false;
sls_receiver_header& header = image_data.header;
......
......@@ -169,9 +169,9 @@ void TestApp::run()
m_cam->prepareAcq();
m_last_msg_timestamp = Timestamp::now();
m_state.set(AcqState::Acquiring);
m_state.set(lima::AcqState::Acquiring);
m_cam->startAcq();
m_state.waitNot(AcqState::Acquiring);
m_state.waitNot(lima::AcqState::Acquiring);
int first = max(0, m_pars.nb_frames - nb_buffers);
int save_frames = min(m_pars.nb_frames, nb_buffers);
......@@ -194,7 +194,7 @@ bool TestApp::newFrameReady(const HwFrameInfoType& frame_info)
DEB_MEMBER_FUNCT();
if (frame_info.acq_frame_nb == m_pars.nb_frames - 1)
m_state.set(AcqState::Finished);
m_state.set(lima::AcqState::Finished);
Timestamp timestamp = Timestamp::now();
if (timestamp - m_last_msg_timestamp > WAIT_SLEEP_TIME) {
......
......@@ -164,7 +164,7 @@ class TestApp
AutoPtr<NumaSoftBufferCtrlObj> m_buffer_ctrl_obj;
AutoPtr<Camera> m_cam;
AutoPtr<Model> m_model;
AcqState m_state;
lima::AcqState m_state;
FrameCallback m_cb;
Timestamp m_last_msg_timestamp;
};
......
......@@ -43,7 +43,7 @@ class ImageStatusCallback : public CtControl::ImageStatusCallback
DEB_CLASS(DebModTest, "ImageStatusCallback");
public:
ImageStatusCallback(CtControl& ct, AcqState& acq_state);
ImageStatusCallback(CtControl& ct, lima::AcqState& acq_state);
virtual ~ImageStatusCallback();
protected:
......@@ -52,12 +52,12 @@ protected:
private:
CtControl& m_ct;
AcqState& m_acq_state;
lima::AcqState& m_acq_state;
int m_nb_frames;
};
ImageStatusCallback::ImageStatusCallback(CtControl& ct, AcqState& acq_state)
ImageStatusCallback::ImageStatusCallback(CtControl& ct, lima::AcqState& acq_state)
: m_ct(ct), m_acq_state(acq_state), m_nb_frames(0)
{
DEB_CONSTRUCTOR();
......@@ -85,14 +85,14 @@ void ImageStatusCallback::imageStatusChanged(
}
if ((last_acq_frame_nb == m_nb_frames - 1) &&
(m_acq_state.get() == AcqState::Acquiring)) {
(m_acq_state.get() == lima::AcqState::Acquiring)) {
DEB_ALWAYS() << "All frames acquired!";
m_acq_state.set(AcqState::Saving);
m_acq_state.set(lima::AcqState::Saving);
}
if (last_saved_frame_nb == m_nb_frames - 1) {
DEB_ALWAYS() << "All frames saved!";
m_acq_state.set(AcqState::Finished);
m_acq_state.set(lima::AcqState::Finished);
}
}
......@@ -127,7 +127,7 @@ private:
Camera m_cam;
Interface m_hw_inter;
AcqState m_acq_state;
lima::AcqState m_acq_state;
AutoPtr<Eiger> m_eiger;
AutoPtr<Eiger::Correction> m_corr;
......@@ -230,7 +230,7 @@ void SlsDetectorAcq::start()
DEB_MEMBER_FUNCT();
m_ct->prepareAcq();
m_acq_state.set(AcqState::Acquiring);
m_acq_state.set(lima::AcqState::Acquiring);
DEB_TRACE() << "Starting acquisition";
m_ct->startAcq();
}
......@@ -238,9 +238,9 @@ void SlsDetectorAcq::start()
void SlsDetectorAcq::wait()
{
DEB_MEMBER_FUNCT();
m_acq_state.waitNot(AcqState::Acquiring | AcqState::Saving);
m_acq_state.waitNot(lima::AcqState::Acquiring | lima::AcqState::Saving);
DEB_TRACE() << "Acquisition finished";
m_cam.waitState(Idle);
m_cam.waitAcqState(Idle);
DEB_TRACE() << "Camera finished";
}
......
......@@ -192,7 +192,7 @@ class SlsDetectorAcq:
time.sleep(self.m_sleep_time)
self.m_cam.waitState(SlsDetector.Idle);
self.m_cam.waitAcqState(SlsDetector.Idle);
deb.Trace("Camera finished");
pool_thread_mgr = processlib.PoolThreadMgr.get()
......
Supports Markdown
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