Commit 685945d6 authored by Andreas Persson's avatar Andreas Persson

whitespace cleanup

parent b52848bf
......@@ -48,126 +48,122 @@ namespace PointGrey
* \class Camera
* \brief object controlling the Point Grey camera via FlyCapture driver
*******************************************************************/
class VideoCtrlObj;
class Camera : public HwMaxImageSizeCallbackGen
{
friend class Interface;
DEB_CLASS_NAMESPC(DebModCamera, "Camera", "PointGrey");
DEB_CLASS_NAMESPC(DebModCamera, "Camera", "PointGrey");
friend class VideoCtrlObj;
friend class Interface;
public:
enum Status {
Ready, Exposure, Readout, Latency, Fault
};
enum Status {
Ready, Exposure, Readout, Latency, Fault
};
Camera(const int camera_serial,
const int packet_size = -1,
const int packet_delay = -1);
~Camera();
Camera(const int camera_serial,
const int packet_size = -1,
const int packet_delay = -1);
~Camera();
// hw interface
void prepareAcq();
void startAcq();
void stopAcq();
// hw interface
void prepareAcq();
void startAcq();
void stopAcq();
void getStatus(Camera::Status& status);
void getStatus(Camera::Status& status);
// buffer control object
HwBufferCtrlObj* getBufferCtrlObj();
// buffer control object
HwBufferCtrlObj* getBufferCtrlObj();
// detector info object
void getDetectorType(std::string& type);
void getDetectorModel(std::string& model);
void getDetectorImageSize(Size& size);
// detector info object
void getDetectorType(std::string& type);
void getDetectorModel(std::string& model);
void getDetectorImageSize(Size& size);
void getImageType(ImageType& type);
void setImageType(ImageType type);
void getImageType(ImageType& type);
void setImageType(ImageType type);
// synch control object
void getTrigMode(TrigMode& mode);
void setTrigMode(TrigMode mode);
// 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);
void getExpTime(double& exp_time);
void setExpTime(double exp_time);
void getExpTimeRange(double& min_exp_time, double& max_exp_time);
void getNbFrames(int& nb_frames);
void setNbFrames(int nb_frames);
void getNbHwAcquiredFrames(int &nb_acq_frames);
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);
// 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);
// bin control object
void checkBin(Bin&);
void getBin(Bin& bin);
void setBin(const Bin& bin);
// camera specific
void getPacketSize(int& packet_size);
void setPacketSize(int packet_size);
// camera specific
void getPacketSize(int& packet_size);
void setPacketSize(int packet_size);
void getPacketDelay(int& packet_delay);
void setPacketDelay(int packet_delay);
void getPacketDelay(int& packet_delay);
void setPacketDelay(int packet_delay);
void getGain(double& gain);
void setGain(double gain);
void getGainRange(double& min_gain, double& max_gain);
void getGain(double& gain);
void setGain(double gain);
void getGainRange(double& min_gain, double& max_gain);
void getFrameRate(double& frame_rate);
void setFrameRate(double frame_rate);
void getFrameRateRange(double& min_frame_rate, double& max_frame_rate);
void getFrameRate(double& frame_rate);
void setFrameRate(double frame_rate);
void getFrameRateRange(double& min_frame_rate, double& max_frame_rate);
void getAutoExpTime(bool& auto_frame_rate);
void setAutoExpTime(bool auto_exp_time);
void getAutoExpTime(bool& auto_frame_rate);
void setAutoExpTime(bool auto_exp_time);
void getAutoGain(bool& auto_gain);
void setAutoGain(bool auto_gain);
void getAutoGain(bool& auto_gain);
void setAutoGain(bool auto_gain);
void getAutoFrameRate(bool& auto_frame_rate);
void setAutoFrameRate(bool auto_frame_rate);
void getAutoFrameRate(bool& auto_frame_rate);
void setAutoFrameRate(bool auto_frame_rate);
protected:
// property management
void _getPropertyValue(FlyCapture2::PropertyType type, double& value);
void _setPropertyValue(FlyCapture2::PropertyType type, double value);
void _getPropertyRange(FlyCapture2::PropertyType type, double& min_value, double& max_value);
void _getPropertyAutoMode(FlyCapture2::PropertyType type, bool& auto_mode);
void _setPropertyAutoMode(FlyCapture2::PropertyType type, bool auto_mode);
void _getImageSettingsInfo();
void _applyImageSettings();
// property management
void _getPropertyValue(FlyCapture2::PropertyType type, double& value);
void _setPropertyValue(FlyCapture2::PropertyType type, double value);
void _getPropertyRange(FlyCapture2::PropertyType type, double& min_value, double& max_value);
void _getPropertyAutoMode(FlyCapture2::PropertyType type, bool& auto_mode);
void _setPropertyAutoMode(FlyCapture2::PropertyType type, bool auto_mode);
void _getImageSettingsInfo();
void _applyImageSettings();
private:
class _AcqThread;
friend class _AcqThread;
class _AcqThread;
friend class _AcqThread;
void _setStatus(Camera::Status status,bool force);
void _stopAcq(bool internalFlag);
void _forcePGRY16Mode();
void _setStatus(Camera::Status status, bool force);
void _stopAcq(bool internalFlag);
void _forcePGRY16Mode();
SoftBufferCtrlObj m_buffer_ctrl_obj;
SoftBufferCtrlObj m_buffer_ctrl_obj;
Camera::Status m_status;
int m_nb_frames;
int m_image_number;
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;
_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;
Camera_t *m_camera;
FlyCapture2::CameraInfo m_camera_info;
FlyCapture2::Error m_error;
ImageSettingsInfo_t m_image_settings_info;
ImageSettings_t m_image_settings;
ImageSettingsInfo_t m_image_settings_info;
ImageSettings_t m_image_settings;
};
} // namespace PointGrey
} // namespace lima
#endif // POINTGREYCAMERA_H
......@@ -28,40 +28,38 @@ 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");
DEB_CLASS_NAMESPC(DebModCamera, "DetInfoCtrlObj", "PointGrey");
public:
DetInfoCtrlObj(Camera& cam);
virtual ~DetInfoCtrlObj() {};
DetInfoCtrlObj(Camera& cam);
virtual void getMaxImageSize(Size& max_image_size);
virtual void getDetectorImageSize(Size& det_image_size);
virtual ~DetInfoCtrlObj() {};
virtual void getDefImageType(ImageType& def_image_type);
virtual void getCurrImageType(ImageType& curr_image_type);
virtual void setCurrImageType(ImageType curr_image_type);
virtual void getMaxImageSize(Size& max_image_size);
virtual void getDetectorImageSize(Size& det_image_size);
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 getDefImageType(ImageType& def_image_type);
virtual void getCurrImageType(ImageType& curr_image_type);
virtual void setCurrImageType(ImageType curr_image_type);
virtual void registerMaxImageSizeCallback(HwMaxImageSizeCallback& cb);
virtual void unregisterMaxImageSizeCallback(HwMaxImageSizeCallback& cb);
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;
Camera& m_cam;
};
} // namespace PointGrey
} // namespace lima
......
......@@ -28,43 +28,39 @@ namespace lima
{
namespace PointGrey
{
class Camera;
class DetInfoCtrlObj;
class SyncCtrlObj;
class VideoCtrlObj;
/*******************************************************************
* \class Interface
* \brief PointGrey hardware interface
*******************************************************************/
class Interface : public HwInterface
{
DEB_CLASS_NAMESPC(DebModCamera, "PointGreyInterface", "PointGrey");
DEB_CLASS_NAMESPC(DebModCamera, "PointGreyInterface", "PointGrey");
public:
Interface(Camera& cam);
virtual ~Interface();
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();
//- 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();
Camera& getCamera(){ return m_cam; }
Camera& getCamera() { return m_cam; }
private:
Camera& m_cam;
CapList m_cap_list;
DetInfoCtrlObj *m_det_info;
SyncCtrlObj *m_sync;
Camera& m_cam;
CapList m_cap_list;
DetInfoCtrlObj *m_det_info;
SyncCtrlObj *m_sync;
};
} // namespace PointGrey
} // namespace lima
......
......@@ -28,47 +28,45 @@ 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");
DEB_CLASS_NAMESPC(DebModCamera, "SyncCtrlObj", "PointGrey");
public:
SyncCtrlObj(Camera& cam);
virtual ~SyncCtrlObj() {};
SyncCtrlObj(Camera& cam);
virtual ~SyncCtrlObj() {};
virtual bool checkTrigMode(TrigMode trig_mode);
virtual void setTrigMode(TrigMode trig_mode);
virtual void getTrigMode(TrigMode& trig_mode);
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 setExpTime(double exp_time);
virtual void getExpTime(double& exp_time);
virtual void setLatTime(double lat_time);
virtual void getLatTime(double& lat_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 setNbHwFrames(int nb_frames);
virtual void getNbHwFrames(int& nb_frames);
virtual void getValidRanges(ValidRangesType& valid_ranges);
virtual void getValidRanges(ValidRangesType& valid_ranges);
private:
void _adjustFrameRate();
Camera& m_cam;
double m_exp_time;
double m_lat_time;
double m_max_acq_period;
ValidRangesType m_valid_ranges;
};
void _adjustFrameRate();
Camera& m_cam;
double m_exp_time;
double m_lat_time;
double m_max_acq_period;
ValidRangesType m_valid_ranges;
};
} // namespace PointGrey
} // namespace lima
......
......@@ -23,101 +23,101 @@ namespace PointGrey
// packet size control
void getPacketSize(int& packet_size /Out/);
%MethodCode
sipCpp->getCamera().getPacketSize(a0);
sipCpp->getCamera().getPacketSize(a0);
%End
void setPacketSize(int packet_size);
%MethodCode
sipCpp->getCamera().setPacketSize(a0);
sipCpp->getCamera().setPacketSize(a0);
%End
// packet delay control
void getPacketDelay(int& packet_delay /Out/);
%MethodCode
sipCpp->getCamera().getPacketDelay(a0);
sipCpp->getCamera().getPacketDelay(a0);
%End
void setPacketDelay(int packet_delay);
%MethodCode
sipCpp->getCamera().setPacketDelay(a0);
sipCpp->getCamera().setPacketDelay(a0);
%End
// gain control
void getGain(double& gain /Out/);
%MethodCode
sipCpp->getCamera().getGain(a0);
sipCpp->getCamera().getGain(a0);
%End
void setGain(double gain);
%MethodCode
sipCpp->getCamera().setGain(a0);
sipCpp->getCamera().setGain(a0);
%End
void getAutoGain(bool& auto_gain /Out/);
%MethodCode
sipCpp->getCamera().getAutoGain(a0);
sipCpp->getCamera().getAutoGain(a0);
%End
void setAutoGain(bool auto_gain);
%MethodCode
sipCpp->getCamera().setAutoGain(a0);
sipCpp->getCamera().setAutoGain(a0);
%End
void getGainRange(double& min_gain /Out/, double& max_gain /Out/);
%MethodCode
sipCpp->getCamera().getGainRange(a0, a1);
sipCpp->getCamera().getGainRange(a0, a1);
%End
// exposure control
void getExpTime(double& exp_time /Out/);
%MethodCode
sipCpp->getCamera().getExpTime(a0);
sipCpp->getCamera().getExpTime(a0);
%End
void setExpTime(double exp_time);
%MethodCode
sipCpp->getCamera().setExpTime(a0);
sipCpp->getCamera().setExpTime(a0);
%End
void getAutoExpTime(bool& auto_exp_time /Out/);
%MethodCode
sipCpp->getCamera().getAutoExpTime(a0);
sipCpp->getCamera().getAutoExpTime(a0);
%End
void setAutoExpTime(bool auto_exp_time);
%MethodCode
sipCpp->getCamera().setAutoExpTime(a0);
sipCpp->getCamera().setAutoExpTime(a0);
%End
void getExpTimeRange(double& min_exp_time /Out/, double& max_exp_time /Out/);
%MethodCode
sipCpp->getCamera().getExpTimeRange(a0, a1);
sipCpp->getCamera().getExpTimeRange(a0, a1);
%End
// frame rate control
void getFrameRate(double& frame_rate /Out/);
%MethodCode
sipCpp->getCamera().getFrameRate(a0);
sipCpp->getCamera().getFrameRate(a0);
%End
void setFrameRate(double frame_rate);
%MethodCode
sipCpp->getCamera().setFrameRate(a0);
sipCpp->getCamera().setFrameRate(a0);
%End
void getAutoFrameRate(bool& auto_frame_rate /Out/);
%MethodCode
sipCpp->getCamera().getAutoFrameRate(a0);
sipCpp->getCamera().getAutoFrameRate(a0);
%End
void setAutoFrameRate(bool auto_frame_rate);
%MethodCode
sipCpp->getCamera().setAutoFrameRate(a0);
sipCpp->getCamera().setAutoFrameRate(a0);
%End
void getFrameRateRange(double& min_frame_rate /Out/, double& max_frame_rate /Out/);
%MethodCode
sipCpp->getCamera().getFrameRateRange(a0, a1);
sipCpp->getCamera().getFrameRateRange(a0, a1);
%End
};
......
This diff is collapsed.
......@@ -29,33 +29,32 @@ using namespace lima;
using namespace lima::PointGrey;
using namespace std;
/*******************************************************************
* \brief Hw Interface constructor
*******************************************************************/
Interface::Interface(Camera& cam)
: m_cam(cam)
: m_cam(cam)
{
DEB_CONSTRUCTOR();
m_det_info = new DetInfoCtrlObj(cam);
m_sync = new SyncCtrlObj(cam);
DEB_CONSTRUCTOR();
m_det_info = new DetInfoCtrlObj(cam);
m_sync = new SyncCtrlObj(cam);
m_cap_list.push_back(HwCap(m_det_info));
m_cap_list.push_back(HwCap(m_sync));
m_cap_list.push_back(HwCap(m_det_info));
m_cap_list.push_back(HwCap(m_sync));
HwBufferCtrlObj *buffer = cam.getBufferCtrlObj();
m_cap_list.push_back(HwCap(buffer));
HwBufferCtrlObj *buffer = cam.getBufferCtrlObj();
m_cap_list.push_back(HwCap(buffer));
}
//-----------------------------------------------------
//
//-----------------------------------------------------
Interface::~Interface()
{
DEB_DESTRUCTOR();
delete m_det_info;
delete m_sync;
DEB_DESTRUCTOR();
delete m_det_info;
delete m_sync;
}
//-----------------------------------------------------
......@@ -63,8 +62,8 @@ Interface::~Interface()
//-----------------------------------------------------
void Interface::getCapList(HwInterface::CapList &cap_list) const
{
DEB_MEMBER_FUNCT();
cap_list = m_cap_list;
DEB_MEMBER_FUNCT();
cap_list = m_cap_list;
}
//-----------------------------------------------------
......@@ -72,10 +71,10 @@ void Interface::getCapList(HwInterface::CapList &cap_list) const
//-----------------------------------------------------
void Interface::reset(ResetLevel reset_level)
{
DEB_MEMBER_FUNCT();
DEB_PARAM() << DEB_VAR1(reset_level);
stopAcq();
m_cam._setStatus(Camera::Ready,true);
DEB_MEMBER_FUNCT();
DEB_PARAM() << DEB_VAR1(reset_level);
stopAcq();
m_cam._setStatus(Camera::Ready, true);
}
//-----------------------------------------------------
......@@ -83,8 +82,8 @@ void Interface::reset(ResetLevel reset_level)
//-----------------------------------------------------
void Interface::prepareAcq()
{
DEB_MEMBER_FUNCT();
m_cam.prepareAcq();
DEB_MEMBER_FUNCT();
m_cam.prepareAcq();
}
//-----------------------------------------------------
......@@ -92,8 +91,8 @@ void Interface::prepareAcq()
//-----------------------------------------------------
void Interface::startAcq()
{
DEB_MEMBER_FUNCT();
m_cam.startAcq();
DEB_MEMBER_FUNCT();
m_cam.startAcq();
}
//-----------------------------------------------------
......@@ -101,8 +100,8 @@ void Interface::startAcq()
//-----------------------------------------------------
void Interface::stopAcq()
{
DEB_MEMBER_FUNCT();
m_cam.stopAcq();
DEB_MEMBER_FUNCT();
m_cam.stopAcq();
}
//-----------------------------------------------------
......@@ -110,33 +109,33 @@ void Interface::stopAcq()
//-----------------------------------------------------
void Interface::getStatus(StatusType& status)
{
DEB_MEMBER_FUNCT();
Camera::Status pg_status = Camera::Ready;
m_cam.getStatus(pg_status);
switch (pg_status)
{
case Camera::Ready:
status.det = DetIdle;
status.acq = AcqReady;
break;
case Camera::Exposure:
status.det = DetExposure;
status.acq = AcqRunning;
break;
case Camera::Readout:
status.det = DetReadout;
status.acq = AcqRunning;
break;
case Camera::Latency:
status.det = DetLatency;
status.acq = AcqRunning;
break;
case Camera::Fault:
status.det = DetFault;
status.acq = AcqFault;
}
status.det_mask = DetExposure | DetReadout | DetLatency;
DEB_RETURN() << DEB_VAR1(status);
DEB_MEMBER_FUNCT();
Camera::Status pg_status = Camera::Ready;
m_cam.getStatus(pg_status);
switch (pg_status)
{
case Camera::Ready:
status.det = DetIdle;
status.acq = AcqReady;
break;
case Camera::Exposure:
status.det = DetExposure;
status.acq = AcqRunning;
break;
case Camera::Readout:
status.det = DetReadout;
status.acq = AcqRunning;
break;
case Camera::Latency:
status.det = DetLatency;
status.acq = AcqRunning;
break;
case Camera::Fault:
status.det = DetFault;
status.acq = AcqFault;
}
status.det_mask = DetExposure | DetReadout | DetLatency;
DEB_RETURN() << DEB_VAR1(status);
}
//-----------------------------------------------------
......@@ -144,8 +143,8 @@ void Interface::getStatus(StatusType& status)
//-----------------------------------------------------
int Interface::getNbHwAcquiredFrames()
{
DEB_MEMBER_FUNCT();
int acq_frames;
m_cam.getNbHwAcquiredFrames(acq_frames);
return acq_frames;
DEB_MEMBER_FUNCT();
int acq_frames;
m_cam.getNbHwAcquiredFrames(acq_frames);
return acq_frames;
}
......@@ -26,30 +26,29 @@
using namespace lima;
using namespace lima::PointGrey;
/*******************************************************************
* \brief SyncCtrlObj constructor
*******************************************************************/
SyncCtrlObj::SyncCtrlObj(Camera& cam)
: m_cam(cam)
: m_cam(cam)
{
DEB_CONSTRUCTOR();
double exp_time_ms, min_exp_time_ms, max_exp_time_ms;
double min_frame_rate, max_frame_rate;
m_cam.setAutoFrameRate(true);
m_cam.getExpTime(exp_time_ms);
m_cam.getExpTimeRange(min_exp_time_ms, max_exp_time_ms);
m_cam.getFrameRateRange(min_frame_rate, max_frame_rate);
m_exp_time = exp_time_ms * 1E-3;
m_lat_time = 0;
m_max_acq_period = 1.0 / min_frame_rate;
m_valid_ranges.min_exp_time = min_exp_time_ms * 1E-3;
m_valid_ranges.max_exp_time = m_max_acq_period;
m_valid_ranges.min_lat_time = 0;
m_valid_ranges.max_lat_time = m_max_acq_period - m_exp_time;