Commit bdea8434 authored by Laurent Claustre's avatar Laurent Claustre

- Now acqThread stops properly when calling stopAcq

- renamed SoftBufferCtrlMgr in SoftBufferCtrlObj
parent fce17699
......@@ -77,7 +77,7 @@ namespace lima
void getDetectorImageSize(Size& size);
// -- Buffer control object
HwBufferCtrlObj* getBufferMgr();
HwBufferCtrlObj* getBufferCtrlObj();
//-- Synch control object
bool checkTrigMode(TrigMode trig_mode);
......@@ -156,7 +156,7 @@ namespace lima
Cond m_cond;
//- lima stuff
SoftBufferCtrlMgr m_buffer_ctrl_mgr;
SoftBufferCtrlObj m_buffer_ctrl_obj;
int m_nb_frames;
Camera::Status m_status;
volatile bool m_wait_flag;
......
......@@ -30,7 +30,7 @@ namespace Andor
void getDetectorType(std::string& type /Out/);
void getDetectorModel(std::string& model /Out/);
void getDetectorImageSize(Size& size /Out/);
HwBufferCtrlObj* getBufferMgr();
HwBufferCtrlObj* getBufferCtrlObj();
void setTrigMode(TrigMode mode);
void getTrigMode(TrigMode& mode /Out/);
......
......@@ -309,7 +309,7 @@ void Camera::startAcq()
while(!m_thread_running)
m_cond.wait();
StdBufferCbMgr& buffer_mgr = m_buffer_ctrl_mgr.getBuffer();
StdBufferCbMgr& buffer_mgr = m_buffer_ctrl_obj.getBuffer();
buffer_mgr.setStartTimestamp(Timestamp::now());
if (andorError(StartAcquisition()))
{
......@@ -338,6 +338,7 @@ void Camera::_stopAcq(bool internalFlag)
{
while(!internalFlag && m_thread_running)
{
// signal the acq. thread to stop acquiring and to return the wait state
m_wait_flag = true;
m_cond.wait();
}
......@@ -363,7 +364,7 @@ void Camera::_AcqThread::threadFunction()
{
DEB_MEMBER_FUNCT();
AutoMutex aLock(m_cam.m_cond.mutex());
StdBufferCbMgr& buffer_mgr = m_cam.m_buffer_ctrl_mgr.getBuffer();
StdBufferCbMgr& buffer_mgr = m_cam.m_buffer_ctrl_obj.getBuffer();
while(!m_cam.m_quit)
{
......@@ -385,6 +386,12 @@ void Camera::_AcqThread::threadFunction()
bool continueAcq = true;
while(continueAcq && (!m_cam.m_nb_frames || m_cam.m_image_number < m_cam.m_nb_frames))
{
// Check first if acq. has been stopped
if (m_cam.m_wait_flag)
{
continueAcq = false;
continue;
}
// --- Get the available images in cicular buffer
int first, last;
if (m_cam.andorError(GetNumberNewImages(&first, &last)))
......@@ -538,10 +545,10 @@ void Camera::getDetectorModel(string& type)
//-----------------------------------------------------
// @brief return the internal buffer manager
//-----------------------------------------------------
HwBufferCtrlObj* Camera::getBufferMgr()
HwBufferCtrlObj* Camera::getBufferCtrlObj()
{
DEB_MEMBER_FUNCT();
return &m_buffer_ctrl_mgr;
return &m_buffer_ctrl_obj;
}
......@@ -595,8 +602,8 @@ void Camera::setTrigMode(TrigMode mode)
if (andorError(SetTriggerMode(m_trig_mode_maps[mode])))
{
DEB_ERROR() << "Cannot get detector size" << " : error code = " << m_camera_error_str;
THROW_HW_ERROR(Error) << "Cannot get detector size";
DEB_ERROR() << "Cannot set trigger mode" << " : error code = " << m_camera_error_str;
THROW_HW_ERROR(Error) << "Cannot set trigger mode";
}
m_trig_mode = mode;
}
......
......@@ -40,7 +40,7 @@ Interface::Interface(Camera& cam)
HwDetInfoCtrlObj *det_info = &m_det_info;
m_cap_list.push_back(HwCap(det_info));
m_cap_list.push_back(HwCap(cam.getBufferMgr()));
m_cap_list.push_back(HwCap(cam.getBufferCtrlObj()));
HwSyncCtrlObj *sync = &m_sync;
m_cap_list.push_back(HwCap(sync));
......
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