Commit 194c491e authored by Andreas Persson's avatar Andreas Persson

split capabilities into separate files

parent e1c7fb18
......@@ -50,120 +50,120 @@ namespace PointGrey
class VideoCtrlObj;
class Camera : public HwMaxImageSizeCallbackGen
{
friend class Interface;
DEB_CLASS_NAMESPC(DebModCamera, "Camera", "PointGrey");
friend class VideoCtrlObj;
public:
enum Status {
Ready, Exposure, Readout, Latency, Fault
};
Camera(const int camera_serial,
const int packet_size = -1,
const int packet_delay = -1);
~Camera();
// hw interface
void prepareAcq();
void startAcq();
void stopAcq();
void getStatus(Camera::Status& status);
// detector info object
void getDetectorType(std::string& type);
void getDetectorModel(std::string& model);
void getDetectorImageSize(Size& size);
// synch control object
void getTrigMode(TrigMode& mode);
void setTrigMode(TrigMode mode);
void getExpTime(double& exp_time);
void setExpTime(double exp_time);
void getExpTimeRange(double& min_exp_time, double& max_exp_time) const;
void getLatTime(double& lat_time);
void setLatTime(double lat_time);
void getLatTimeRange(double& min_lat_time, double& max_lat_time) const;
void getNbFrames(int& nb_frames);
void setNbFrames(int nb_frames);
void getNbHwAcquiredFrames(int &nb_acq_frames);
// roi control object
void checkRoi(const Roi& set_roi, Roi& hw_roi);
void getRoi(Roi& hw_roi);
void setRoi(const Roi& set_roi);
// bin control object
void checkBin(Bin&);
void getBin(Bin& bin);
void setBin(const Bin& bin);
// video control object
void getVideoMode(VideoMode& mode) const;
void setVideoMode(VideoMode mode);
void getGain(double& gain);
void setGain(double gain);
// camera specific
void getPacketSize(int& packet_size);
void setPacketSize(int packet_size);
void getPacketDelay(int& packet_delay);
void setPacketDelay(int packet_delay);
void getAutoExpTime(bool& auto_frame_rate) const;
void setAutoExpTime(bool auto_exp_time);
void getAutoGain(bool& auto_gain) const;
void setAutoGain(bool auto_gain);
protected:
void _getPropertyInfo(FlyCapture2::PropertyInfo *property_info);
void _getProperty(FlyCapture2::Property *property);
void _setProperty(FlyCapture2::Property *property);
void _getImageSettingsInfo();
void _applyImageSettings();
private:
class _AcqThread;
friend class _AcqThread;
void _setStatus(Camera::Status status,bool force);
void _stopAcq(bool internalFlag);
void _forcePGRY16Mode();
VideoCtrlObj *m_video;
Camera::Status m_status;
int m_nb_frames;
int m_image_number;
_AcqThread *m_acq_thread;
Cond m_cond;
volatile bool m_quit;
volatile bool m_acq_started;
volatile bool m_thread_running;
Camera_t *m_camera;
FlyCapture2::CameraInfo m_camera_info;
FlyCapture2::Error m_error;
ImageSettingsInfo_t m_image_settings_info;
ImageSettings_t m_image_settings;
FlyCapture2::Property m_frame_rate_property,
m_exp_time_property,
m_gain_property;
FlyCapture2::PropertyInfo m_frame_rate_property_info,
m_exp_time_property_info,
m_gain_property_info;
friend class Interface;
DEB_CLASS_NAMESPC(DebModCamera, "Camera", "PointGrey");
friend class VideoCtrlObj;
public:
enum Status {
Ready, Exposure, Readout, Latency, Fault
};
Camera(const int camera_serial,
const int packet_size = -1,
const int packet_delay = -1);
~Camera();
// hw interface
void prepareAcq();
void startAcq();
void stopAcq();
void getStatus(Camera::Status& status);
// detector info object
void getDetectorType(std::string& type);
void getDetectorModel(std::string& model);
void getDetectorImageSize(Size& size);
// synch control object
void getTrigMode(TrigMode& mode);
void setTrigMode(TrigMode mode);
void getExpTime(double& exp_time);
void setExpTime(double exp_time);
void getExpTimeRange(double& min_exp_time, double& max_exp_time) const;
void getLatTime(double& lat_time);
void setLatTime(double lat_time);
void getLatTimeRange(double& min_lat_time, double& max_lat_time) const;
void getNbFrames(int& nb_frames);
void setNbFrames(int nb_frames);
void getNbHwAcquiredFrames(int &nb_acq_frames);
// roi control object
void checkRoi(const Roi& set_roi, Roi& hw_roi);
void getRoi(Roi& hw_roi);
void setRoi(const Roi& set_roi);
// bin control object
void checkBin(Bin&);
void getBin(Bin& bin);
void setBin(const Bin& bin);
// video control object
void getVideoMode(VideoMode& mode) const;
void setVideoMode(VideoMode mode);
void getGain(double& gain);
void setGain(double gain);
// camera specific
void getPacketSize(int& packet_size);
void setPacketSize(int packet_size);
void getPacketDelay(int& packet_delay);
void setPacketDelay(int packet_delay);
void getAutoExpTime(bool& auto_frame_rate) const;
void setAutoExpTime(bool auto_exp_time);
void getAutoGain(bool& auto_gain) const;
void setAutoGain(bool auto_gain);
protected:
void _getPropertyInfo(FlyCapture2::PropertyInfo *property_info);
void _getProperty(FlyCapture2::Property *property);
void _setProperty(FlyCapture2::Property *property);
void _getImageSettingsInfo();
void _applyImageSettings();
private:
class _AcqThread;
friend class _AcqThread;
void _setStatus(Camera::Status status,bool force);
void _stopAcq(bool internalFlag);
void _forcePGRY16Mode();
VideoCtrlObj *m_video;
Camera::Status m_status;
int m_nb_frames;
int m_image_number;
_AcqThread *m_acq_thread;
Cond m_cond;
volatile bool m_quit;
volatile bool m_acq_started;
volatile bool m_thread_running;
Camera_t *m_camera;
FlyCapture2::CameraInfo m_camera_info;
FlyCapture2::Error m_error;
ImageSettingsInfo_t m_image_settings_info;
ImageSettings_t m_image_settings;
FlyCapture2::Property m_frame_rate_property,
m_exp_time_property,
m_gain_property;
FlyCapture2::PropertyInfo m_frame_rate_property_info,
m_exp_time_property_info,
m_gain_property_info;
};
} // namespace PointGrey
} // namespace lima
......
//###########################################################################
// This file is part of LImA, a Library for Image Acquisition
//
// Copyright (C) : 2009-2011
// European Synchrotron Radiation Facility
// BP 220, Grenoble 38043
// FRANCE
//
// This is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// This software is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, see <http://www.gnu.org/licenses/>.
//###########################################################################
#ifndef POINTGREYDETINFOCTRLOBJ_H
#define POINTGREYDETINFOCTRLOBJ_H
#include "HwDetInfoCtrlObj.h"
namespace lima
{
namespace PointGrey
{
class Camera;
/*******************************************************************
* \class DetInfoCtrlObj
* \brief Control object providing PointGrey detector info interface
*******************************************************************/
class DetInfoCtrlObj : public HwDetInfoCtrlObj
{
DEB_CLASS_NAMESPC(DebModCamera, "DetInfoCtrlObj", "PointGrey");
public:
DetInfoCtrlObj(Camera& cam);
virtual ~DetInfoCtrlObj() {};
virtual void getMaxImageSize(Size& max_image_size);
virtual void getDetectorImageSize(Size& det_image_size);
virtual void getDefImageType(ImageType& def_image_type);
virtual void getCurrImageType(ImageType& curr_image_type);
virtual void setCurrImageType(ImageType curr_image_type);
virtual void getPixelSize(double& x_size,double &y_size);
virtual void getDetectorType(std::string& det_type);
virtual void getDetectorModel(std::string& det_model);
virtual void registerMaxImageSizeCallback(HwMaxImageSizeCallback& cb);
virtual void unregisterMaxImageSizeCallback(HwMaxImageSizeCallback& cb);
private:
Camera& m_cam;
};
} // namespace PointGrey
} // namespace lima
#endif // POINTGREYDETINFOCTRLOBJ_H
......@@ -23,150 +23,16 @@
#define POINTGREYINTERFACE_H
#include "HwInterface.h"
#include "PointGreyCamera.h"
namespace lima
{
namespace PointGrey
{
class Interface;
/*******************************************************************
* \class DetInfoCtrlObj
* \brief Control object providing PointGrey detector info interface
*******************************************************************/
class DetInfoCtrlObj : public HwDetInfoCtrlObj
{
DEB_CLASS_NAMESPC(DebModCamera, "DetInfoCtrlObj", "PointGrey");
public:
DetInfoCtrlObj(Camera& cam);
virtual ~DetInfoCtrlObj() {};
virtual void getMaxImageSize(Size& max_image_size);
virtual void getDetectorImageSize(Size& det_image_size);
virtual void getDefImageType(ImageType& def_image_type);
virtual void getCurrImageType(ImageType& curr_image_type);
virtual void setCurrImageType(ImageType curr_image_type);
virtual void getPixelSize(double& x_size,double &y_size);
virtual void getDetectorType(std::string& det_type);
virtual void getDetectorModel(std::string& det_model);
virtual void registerMaxImageSizeCallback(HwMaxImageSizeCallback& cb);
virtual void unregisterMaxImageSizeCallback(HwMaxImageSizeCallback& cb);
private:
Camera& m_cam;
};
/*******************************************************************
* \class SyncCtrlObj
* \brief Control object providing PointGrey synchronization interface
*******************************************************************/
class SyncCtrlObj : public HwSyncCtrlObj
{
DEB_CLASS_NAMESPC(DebModCamera, "SyncCtrlObj", "PointGrey");
public:
SyncCtrlObj(Camera& cam);
virtual ~SyncCtrlObj() {};
virtual bool checkTrigMode(TrigMode trig_mode);
virtual void setTrigMode(TrigMode trig_mode);
virtual void getTrigMode(TrigMode& trig_mode);
virtual void setExpTime(double exp_time);
virtual void getExpTime(double& exp_time);
virtual void setLatTime(double lat_time);
virtual void getLatTime(double& lat_time);
virtual void setNbHwFrames(int nb_frames);
virtual void getNbHwFrames(int& nb_frames);
virtual void getValidRanges(ValidRangesType& valid_ranges);
private:
Camera& m_cam;
};
/*******************************************************************
* \class RoiCtrlObj
* \brief Control object providing PointGrey Roi interface
*******************************************************************/
class RoiCtrlObj : public HwRoiCtrlObj
{
DEB_CLASS_NAMESPC(DebModCamera, "RoiCtrlObj", "PointGrey");
public:
RoiCtrlObj(Camera& cam);
virtual ~RoiCtrlObj() {};
virtual void setRoi(const Roi& set_roi);
virtual void getRoi(Roi& hw_roi);
virtual void checkRoi(const Roi& set_roi, Roi& hw_roi);
private:
Camera& m_cam;
};
/*******************************************************************
* \class BinCtrlObj
* \brief Control object providing PointGrey Bin interface
*******************************************************************/
class BinCtrlObj : public HwBinCtrlObj
{
DEB_CLASS_NAMESPC(DebModCamera, "BinCtrlObj", "PointGrey");
public:
BinCtrlObj(Camera& cam);
virtual ~BinCtrlObj() {}
virtual void setBin(const Bin& bin);
virtual void getBin(Bin& bin);
virtual void checkBin(Bin& bin);
private:
Camera& m_cam;
};
/*******************************************************************
* \class VideoCtrlObj
* \brief Control object providing PointGrey Video interface
*******************************************************************/
class VideoCtrlObj : public HwVideoCtrlObj
{
DEB_CLASS_NAMESPC(DebModCamera, "VideoCtrlObj", "PointGrey");
public:
VideoCtrlObj(Camera& cam);
virtual ~VideoCtrlObj() {};
virtual void getSupportedVideoMode(std::list<VideoMode> &aList) const;
virtual void getVideoMode(VideoMode&) const;
virtual void setVideoMode(VideoMode);
virtual void getLive(bool&) const;
virtual void setLive(bool);
virtual void getGain(double&) const;
virtual void setGain(double);
virtual void checkBin(Bin& bin){};
virtual void setBin(const Bin&){};
virtual void checkRoi(const Roi& set_roi, Roi& hw_roi){};
virtual void setRoi(const Roi&){};
private:
Camera& m_cam;
bool m_live;
};
class Camera;
class DetInfoCtrlObj;
class SyncCtrlObj;
class VideoCtrlObj;
/*******************************************************************
* \class Interface
......@@ -175,36 +41,34 @@ class VideoCtrlObj : public HwVideoCtrlObj
class Interface : public HwInterface
{
DEB_CLASS_NAMESPC(DebModCamera, "PointGreyInterface", "PointGrey");
public:
Interface(Camera& cam);
virtual ~Interface() {};
//- From HwInterface
virtual void getCapList(CapList&) const;
virtual void reset(ResetLevel reset_level);
virtual void prepareAcq();
virtual void startAcq();
virtual void stopAcq();
virtual void getStatus(StatusType& status);
virtual int getNbHwAcquiredFrames();
//- PointGrey Specific
void getAutoExpTime(bool &auto_frame_rate) const;
void setAutoExpTime(bool auto_exp_time);
void getAutoGain(bool& auto_gain) const;
void setAutoGain(bool auto_gain);
private:
Camera& m_cam;
CapList m_cap_list;
DetInfoCtrlObj m_det_info;
SyncCtrlObj m_sync;
BinCtrlObj m_bin;
RoiCtrlObj m_roi;
VideoCtrlObj m_video;
DEB_CLASS_NAMESPC(DebModCamera, "PointGreyInterface", "PointGrey");
public:
Interface(Camera& cam);
virtual ~Interface();
//- From HwInterface
virtual void getCapList(CapList&) const;
virtual void reset(ResetLevel reset_level);
virtual void prepareAcq();
virtual void startAcq();
virtual void stopAcq();
virtual void getStatus(StatusType& status);
virtual int getNbHwAcquiredFrames();
//- PointGrey Specific
void getAutoExpTime(bool &auto_frame_rate) const;
void setAutoExpTime(bool auto_exp_time);
void getAutoGain(bool& auto_gain) const;
void setAutoGain(bool auto_gain);
private:
Camera& m_cam;
CapList m_cap_list;
DetInfoCtrlObj *m_det_info;
SyncCtrlObj *m_sync;
VideoCtrlObj *m_video;
};
} // namespace PointGrey
......
//###########################################################################
// This file is part of LImA, a Library for Image Acquisition
//
// Copyright (C) : 2009-2011
// European Synchrotron Radiation Facility
// BP 220, Grenoble 38043
// FRANCE
//
// This is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// This software is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, see <http://www.gnu.org/licenses/>.
//###########################################################################
#ifndef POINTGREYSYNCCTRLOBJ_H
#define POINTGREYSYNCCTRLOBJ_H
#include "HwSyncCtrlObj.h"
namespace lima
{
namespace PointGrey
{
class Camera;
/*******************************************************************
* \class SyncCtrlObj
* \brief Control object providing PointGrey synchronization interface
*******************************************************************/
class SyncCtrlObj : public HwSyncCtrlObj
{
DEB_CLASS_NAMESPC(DebModCamera, "SyncCtrlObj", "PointGrey");
public:
SyncCtrlObj(Camera& cam);
virtual ~SyncCtrlObj() {};
virtual bool checkTrigMode(TrigMode trig_mode);
virtual void setTrigMode(TrigMode trig_mode);
virtual void getTrigMode(TrigMode& trig_mode);
virtual void setExpTime(double exp_time);
virtual void getExpTime(double& exp_time);
virtual void setLatTime(double lat_time);
virtual void getLatTime(double& lat_time);
virtual void setNbHwFrames(int nb_frames);
virtual void getNbHwFrames(int& nb_frames);
virtual void getValidRanges(ValidRangesType& valid_ranges);
private:
Camera& m_cam;
};
} // namespace PointGrey
} // namespace lima
#endif // POINTGREYSYNCCTRLOBJ_H
//###########################################################################
// This file is part of LImA, a Library for Image Acquisition
//
// Copyright (C) : 2009-2011
// European Synchrotron Radiation Facility
// BP 220, Grenoble 38043
// FRANCE
//
// This is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// This software is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, see <http://www.gnu.org/licenses/>.
//###########################################################################
#ifndef POINTGREYVIDEOCTRLOBJ_H
#define POINTGREYVIDEOCTRLOBJ_H
#include "HwVideoCtrlObj.h"
namespace lima
{
namespace PointGrey
{
class Camera;
/*******************************************************************
* \class VideoCtrlObj
* \brief Control object providing PointGrey Video interface
*******************************************************************/
class VideoCtrlObj : public HwVideoCtrlObj
{
DEB_CLASS_NAMESPC(DebModCamera, "VideoCtrlObj", "PointGrey");
public:
VideoCtrlObj(Camera& cam);
virtual ~VideoCtrlObj() {};
virtual void getSupportedVideoMode(std::list<VideoMode> &aList) const;
virtual void getVideoMode(VideoMode&) const;
virtual void setVideoMode(VideoMode);
virtual void getLive(bool&) const;
virtual void setLive(bool);
virtual void getGain(double&) const;
virtual void setGain(double);
virtual void checkBin(Bin& bin){};
virtual void setBin(const Bin&){};
virtual void checkRoi(const Roi& set_roi, Roi& hw_roi){};
virtual void setRoi(const Roi&){};
private:
Camera& m_cam;
bool m_live;
};
} // namespace PointGrey
} // namespace lima
#endif // POINTGREYVIDEOCTRLOBJ_H
pointgrey-objs = PointGreyCamera.o PointGreyInterface.o
pointgrey-objs = PointGreyCamera.o \
PointGreyInterface.o \
PointGreyDetInfoCtrlObj.o \
PointGreySyncCtrlObj.o \
PointGreyVideoCtrlObj.o
SRCS = $(pointgrey-objs:.o=.cpp)
......
This diff is collapsed.
//###########################################################################
// This file is part of LImA, a Library for Image Acquisition
//
// Copyright (C) : 2009-2011
// European Synchrotron Radiation Facility
// BP 220, Grenoble 38043
// FRANCE
//
// This is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// This software is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, see <http://www.gnu.org/licenses/>.
//###########################################################################
#include "PointGreyDetInfoCtrlObj.h"
#include "PointGreyCamera.h"
using namespace lima;
using namespace lima::PointGrey;
/*******************************************************************
* \brief DetInfoCtrlObj constructor
*******************************************************************/
DetInfoCtrlObj::DetInfoCtrlObj(Camera& cam)
: m_cam(cam)
{
DEB_CONSTRUCTOR();
}
//-----------------------------------------------------
//
//-----------------------------------------------------
void DetInfoCtrlObj::getMaxImageSize(Size& size)
{
DEB_MEMBER_FUNCT();
m_cam.getDetectorImageSize(size);
}
//-----------------------------------------------------
//
//-----------------------------------------------------
void DetInfoCtrlObj::getDetectorImageSize(Size& size)
{
DEB_MEMBER_FUNCT();
m_cam.getDetectorImageSize(size);
}
//-----------------------------------------------------
//
//-----------------------------------------------------
void DetInfoCtrlObj::<