Commit 2313bc40 authored by Damien Naudet's avatar Damien Naudet

Added calls to camera::setNbHwFrames from SyncCtrlObj::setHwNbFrame

parent 7b45cad7
......@@ -33,7 +33,7 @@ namespace lima
friend class Interface;
DEB_CLASS_NAMESPC(DebModCamera, "SyncCtrlObj", "V4L2");
public:
SyncCtrlObj(int fd);
SyncCtrlObj(Camera& cam);
virtual ~SyncCtrlObj();
virtual bool checkTrigMode(TrigMode trig_mode);
......@@ -53,7 +53,7 @@ namespace lima
virtual void getValidRanges(ValidRangesType& valid_ranges);
private:
int m_fd;
Camera& m_cam;
int m_nb_frames;
};
}
......
......@@ -384,11 +384,13 @@ void Camera::setExpTime(double exp_time)
void Camera::setNbHwFrames(int nb_frames)
{
DEB_MEMBER_FUNCT();
m_nb_frames = nb_frames;
}
void Camera::getNbHwFrames(int &nb_frames)
{
DEB_MEMBER_FUNCT();
nb_frames = m_nb_frames;
}
......@@ -402,12 +404,14 @@ void Camera::reset(HwInterface::ResetLevel)
void Camera::prepareAcq()
{
DEB_MEMBER_FUNCT();
m_acq_frame_id = -1;
for(int i = 0;
i < sizeof(m_buffers) / sizeof(unsigned char*);++i)
{
m_buffer.index = i;
//this will fail when calling prepareAcq a second time
// maybe some fields in m_buffer have to be reset first.
int ret = v4l2_ioctl(m_fd,VIDIOC_QBUF,&m_buffer);
if(ret == -1)
THROW_HW_ERROR(Error) << "Error queue buff " << strerror(errno);
......@@ -454,6 +458,7 @@ Camera::_AcqThread::_AcqThread(Camera& aCam) :
{
pthread_attr_setscope(&m_thread_attr,PTHREAD_SCOPE_PROCESS);
}
//---------------------------
//- Camera::_AcqThread::threadFunction()
//---------------------------
......@@ -479,6 +484,7 @@ void Camera::_AcqThread::threadFunction()
if(m_cam.m_quit) return;
bool continueAcq = true;
while(continueAcq &&
(!m_cam.m_nb_frames || m_cam.m_acq_frame_id < (m_cam.m_nb_frames - 1)))
{
......
......@@ -55,7 +55,7 @@ Interface::Interface(const char* dev_path)
m_cbk = new _Callback(*this);
m_cam = new Camera(m_cbk,dev_path);
m_det_info = new DetInfoCtrlObj(m_cam->getV4l2Fd());
m_sync = new SyncCtrlObj(m_cam->getV4l2Fd());
m_sync = new SyncCtrlObj(*m_cam);
m_cap_list.push_back(HwCap(m_sync));
m_cap_list.push_back(HwCap(m_det_info));
......@@ -85,7 +85,6 @@ void Interface::reset(ResetLevel reset_level)
void Interface::prepareAcq()
{
DEB_MEMBER_FUNCT();
m_cam->prepareAcq();
}
......
......@@ -27,8 +27,8 @@
using namespace lima;
using namespace lima::V4L2;
SyncCtrlObj::SyncCtrlObj(int fd) :
m_fd(fd),
SyncCtrlObj::SyncCtrlObj(Camera& cam) :
m_cam(cam),
m_nb_frames(1)
{
}
......@@ -79,7 +79,7 @@ void SyncCtrlObj::getExpTime(double& exp_time)
struct v4l2_control ctrl;
ctrl.id = V4L2_CID_EXPOSURE_ABSOLUTE;
int ret = v4l2_ioctl(m_fd,VIDIOC_G_CTRL,&ctrl);
int ret = v4l2_ioctl(m_cam.getV4l2Fd(),VIDIOC_G_CTRL,&ctrl);
if(ret == -1)
THROW_HW_ERROR(Error) << "Can't get exposure time " << strerror(errno);
......@@ -119,13 +119,15 @@ void SyncCtrlObj::setNbHwFrames(int nb_frames)
DEB_MEMBER_FUNCT();
DEB_PARAM() << DEB_VAR1(nb_frames);
m_nb_frames = nb_frames;
m_cam.setNbHwFrames(nb_frames);
}
void SyncCtrlObj::getNbHwFrames(int& nb_frames)
{
DEB_MEMBER_FUNCT();
nb_frames = m_nb_frames;
// nb_frames = m_nb_frames;
m_cam.getNbHwFrames(nb_frames);
DEB_RETURN() << DEB_VAR1(nb_frames);
}
......@@ -139,7 +141,7 @@ void SyncCtrlObj::getValidRanges(ValidRangesType& valid_ranges)
struct v4l2_queryctrl query;
query.id = V4L2_CID_EXPOSURE_ABSOLUTE;
int ret = v4l2_ioctl(m_fd,VIDIOC_QUERYCTRL,&query);
int ret = v4l2_ioctl(m_cam.getV4l2Fd(),VIDIOC_QUERYCTRL,&query);
if(ret == -1)
THROW_HW_ERROR(Error) << "Can't get exposure time range " << strerror(errno);
......
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