Commit b893e54e authored by Yuelong Yu's avatar Yuelong Yu
Browse files

removed unsed files and cleaned cmake files

parent c69d2f59
......@@ -54,7 +54,7 @@ if(CMAKE_COMPILER_IS_GNUCXX)
if("${CMAKE_BUILD_TYPE}" STREQUAL "RELEASE")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -std=c++11 -fPIC -pthread -D_REENTRANT")
elseif("${CMAKE_BUILD_TYPE}" STREQUAL "DEBUG")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -std=c++11 -fPIC -pthread -D_REENTRANT")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -std=c++11 -fPIC -pthread -D_REENTRANT")
endif()
endif()
......
......@@ -4,31 +4,49 @@
namespace PcoNS
{
sptr_ipco PcoAPILoader::GetCamera(std::string& lib_path)
//SLLoaderNS::SharedLibLoader<PcoInterfaces> pco_loader;
// PcoAPILoader::PcoAPILoader()
// :pco_loader()
// {
// }
// PcoAPILoader::~PcoAPILoader()
// {
// pco_loader.CloseLib();
// }
sptr_ipco PcoAPILoader::GetCamera(std::string& lib_path, int det_type)
{
sptr_ipco pco;
SLLoaderNS::SharedLibLoader<PcoInterfaces> pco_loader;
// try pcome4 first
std::string libpcome4 = lib_path + "/" + libname_pcome4;
if((pco_loader.OpenLib(libpcome4)) &&
(pco = pco_loader.GetInstance()) &&
(pco->OpenCamera() == 0))
return pco;
else
pco_loader.CloseLib();
//try pco clhs then
std::string libpcoclhs = lib_path + "/" + libname_pcoclhs;
if((pco_loader.OpenLib(libpcoclhs)) &&
(pco = pco_loader.GetInstance()) &&
(pco->OpenCamera() == 0))
return pco;
else
pco_loader.CloseLib();
if(det_type == 0) //clhs
{
//try pco clhs then
std::string libpcoclhs = lib_path + "/" + libname_pcoclhs;
if((pco_loader.OpenLib(libpcoclhs)) &&
(pco = pco_loader.GetInstance()) &&
(pco->OpenCamera() == 0))
return pco;
else
pco_loader.CloseLib();
}
if(det_type == 1)
{
// try pcome4 first
std::string libpcome4 = lib_path + "/" + libname_pcome4;
if((pco_loader.OpenLib(libpcome4)) &&
(pco = pco_loader.GetInstance()) &&
(pco->OpenCamera() == 0))
return pco;
else
pco_loader.CloseLib();
}
return nullptr;
}
}
\ No newline at end of file
......@@ -17,6 +17,9 @@ namespace PcoNS
class PcoAPILoader
{
public:
sptr_ipco GetCamera(std::string& lib_path);
PcoAPILoader() = default;
~PcoAPILoader() = default;
sptr_ipco GetCamera(std::string& lib_path, int det_type = 0);
};
}
\ No newline at end of file
......@@ -33,6 +33,7 @@ namespace SLLoaderNS
{
if(dlclose(m_handle) != 0)
return false;
return true;
}
......@@ -47,7 +48,8 @@ namespace SLLoaderNS
auto deleteFunc = reinterpret_cast<deleteClass>(
dlsym(m_handle, m_destructor.c_str()));
if (!allocFunc || !deleteFunc) {
if (!allocFunc || !deleteFunc)
{
CloseLib();
std::cerr << dlerror() << std::endl;
}
......@@ -57,7 +59,6 @@ namespace SLLoaderNS
[deleteFunc](T *p){ deleteFunc(p); });
}
private:
void* m_handle;
string m_constructor,m_destructor;
......
#include "PcoCLHSInterfaces.h"
#include "PcoCLHSImpl.h"
namespace PcoCLHSNS
{
//unique_ptr<PcoCLHSInterfaces> PcoCLHSInterfaces::uptrPcoInterface;
unique_ptr<PcoCLHSInterfaces> Instance()
{
// if it is empty create
//if(!uptrPcoInterface)
auto uptrPcoInterface = unique_ptr<PcoCLHSInterfaces>(new PcoCLHSImpl());
return std::move(uptrPcoInterface);
}
}
#pragma once
#include <iostream>
#include <memory>
#include <vector>
namespace PcoCLHSNS
{
using namespace std;
/**
* @brief error code
*/
enum ERROR_PCO
{
OK, /* 0 */
DOES_NOT_SUPPORT, /* 1 */
OPEN_ERROR, /* 2 */
CLOSE_ERROR, /* 3 */
GET_ERROR, /* 4 */
SET_ERROR, /* 5 */
START_ERROR, /* 6 */
RECORD_ERROR, /* 7 */
STOP_ERROR, /* 8 */
INVALID_VALUE /* 9 */
};
class PcoCLHSInterfaces;
unique_ptr<PcoCLHSInterfaces> Instance();
/**
* @brief pco interfaces
* wrapper of pco lib interfaces
* Now it only supports PCO camera with camlink interface
*/
class PcoCLHSInterfaces
{
public:
/**
* @brief create pco instance
* Singleton implemntation. Only one pco instance is initialized.
* @return pco instance
*/
//static unique_ptr<PcoCLHSInterfaces> Instance();
/**
* @brief destructor
*/
virtual ~PcoCLHSInterfaces() = default;
/**
* @brief open camera
* @return error code. 0 is OK see @ERROR
*/
virtual int OpenCamera() = 0;
/**
* @brief close camera
* @return error code. 0 is OK. see @ERROR
*/
virtual int CloseCamera() = 0;
/**
* @brief get module name
* @return name of module
*/
virtual const string GetModuleName() = 0;
/**
* @brief get recording state
* @param recording state
* @return error code. 0 is OK. see @ERROR
*/
virtual int GetRecordingState(short& shRecordingState) = 0;
/**
* @brief set recording state
* @param recording state
* @return error code. 0 is OK. see @ERROR
*/
virtual int SetRecordingState(short shRecordingState) = 0;
/**
* @brief request the current camera and power supply temperatures.
* Power supply temperature is not available with all cameras.
* If it is not available, the temperature will show 0.
* In case the sensor temperature is not available it will show 0x8000.
* @param ccd temperature
* @param camera temperature
* @param power device temperature
* @return error code. 0 is OK. see @ERROR
*/
virtual int GetTemperature(short& shCCDTemperature,
short& shCameraTemperature,
short& shPowerDeviceTemperature) = 0;
/**
* @brief get/set the temperature set point for cooling the image sensor
* (only available for cooled cameras).
* If min. cooling set point (in ◦ C)
* and max. cooling set point (in ◦ C) are zero,
* then cooling is not available.
* @param temperature in Celsius
* @return error code. 0 is OK. see @ERROR
*/
virtual int GetCoolingSetpointTemperature(short& shTemperature) = 0;
virtual int SetCoolingSetpointTemperature(short shTemperature) = 0;
/**
* @brief get/set binning
* @param bin horizontal
* @param bin vertical
* @return error code. 0 is OK. see @ERROR
*/
virtual int GetBinning(short& shBinHorz,short& shBinVert) = 0;
virtual int SetBinning(short shBinHorz,short shBinVert) = 0;
/**
* @brief get/set ROI
* @param X0
* @param Y0
* @param X1
* @param Y1
* @return error code. 0 is OK. see @ERROR
*/
virtual int GetROI(short& shX0,short& shY0,short& shX1,short& shY1) = 0;
virtual int SetROI(short shX0,short shY0,short shX1,short shY1) = 0;
/**
* @brief get step of ROI
* @param step on X dimension
* @param step on Y dimension
*/
virtual int GetROIStep(short& shXstep,short& shYstep) = 0;
/**
* @brief get/set active loopup table in the camera, if available.
* only available with pco.edge
* @param define LUT to be activated,0x0000 for no LUT
* @param offset:11bit value for fixed offset substraction
* before transferrring the data via the lookuptable
* @return error code. 0 is OK. see @ERROR
*/
virtual int GetLUT(short& shIdentifier,short& shParam) = 0;
virtual int SetLUT(short shIdentifier,short shParam) = 0;
/**
* @brief get the actual size of images.
* @param size X
* @param size Y
* @return error code. 0 is OK. see @ERROR
*/
virtual int GetSizes(short& shX,short& shY) = 0;
/**
* @brief get/set trigger mode
* @param trigger mode
* 0x0000: auto trigger
* 0x0001: software trigger
* 0x0002: external exposure and software trigger
* 0x0003: external exposure control
* @return error code. 0 is OK. see @ERROR
*/
virtual int GetTriggerMode(short& shTriggerMode) = 0;
virtual int SetTriggerMode(short shTriggerMode) = 0;
/**
* @brief get/set pixel rate of the camera
* @param pixel rate MHz
* @return error code. 0 is OK. see @ERROR
*/
virtual int GetPixelRate(int& nPixelRate) = 0;
virtual int SetPixelRate(int nPixelRate) = 0;
/**
* @brief set the adc operation mode of the camera, if available
* @param adc operation mode
* 0x0001: 1 ADC
* 0x0002: 2 ADCs
* @return error code. 0 is OK. see @ERROR
*/
virtual int GetADCOperation(short& shADCNum) = 0;
virtual int SetADCOperation(short shADCNum) = 0;
/**
* @brief get/set time stamp mode
* @param mode of time stamp
* 0x0000:no time stamp
* 0x0001:BCD coded stamp in the first 14pixel
* 0x0002:BCD coded stamp in the first 14pixel+ASCIItext
* 0x0003:ASCII text only
* @return error code. 0 is OK. see @ERROR
*/
virtual int GetTimestampMode(short& shMode) = 0;
virtual int SetTimestampMode(short shMode) = 0;
/**
* @brief get/set exposure time
* @param exposure time. unit:second
* @return error code. 0 is OK. see @ERROR
*/
virtual int GetExposureTime(double& dExpTime) = 0;
virtual int SetExposureTime(double dExpTime) = 0;
/**
* @brief get/set delay time
* @param delay time. unit:second
* @return error code. 0 is OK. see @ERROR
*/
virtual int GetDelayTime(double& dDelayTime) = 0;
virtual int SetDelayTime(double dDelayTime) = 0;
/**
* @brief get run time for each image
* @return run time for each image unit:second
*/
virtual double GetCOCRuntime() = 0;
/**
* @brief Gets the busy state of the camera.
* @return error code. 0 is OK. see @ERROR
*/
virtual int GetCameraBusyStatus(short& shCameraBusyStatus) = 0;
/**
* @brief force a software trigger to the camera
* @param whether a trigger occurred or not
* @return error code. 0 is OK. see @ERROR
*/
virtual int ForceTrigger(short& shTrigger) = 0;
/**
* @brief set storage mode.
* Not all camera support this
* @param storage mode
* - 0 : Recorder
* - images are recorded and stored within the
* internal camera memory camRAM
* - live View transfers the most recent image
* to the PC (for viewing/monitoring)
* - indexed or total image readout after the
* recording has been stopped
* - 1 : FIFO
* - all images taken are transferred to the PC
* in chronological order
* - camera memory (camRAM) is used as a huge FIFO buffer to
* bypass short data transmission bottlenecks
* - if buffer overflows, the oldest images are overwritten
* - if set recorder = [stop] is sent, recording
* is stopped and the transfer of the current
* image to the PC is finished. Images not
* read are stored within the segment and
* can be read with the ReadImageFrom-Segment command.
* @return error code. 0 is OK. see @ERROR
*/
virtual int SetStorageMode(short shStorageMode) = 0;
/**
* @brief clear ram segment
Not all camera support this
* @return error code. 0 is OK. see @ERROR
*/
virtual int ClearRAMSegment() = 0;
/**
* @brief start acquisition
* @param frame numbers to acquire. Default value is 0.
* @return error code. 0 is OK. see @ERROR
*/
virtual int StartAcq(int nFrameNumbers = 0) = 0;
/**
* @brief stop acquisition
* @param frame numbers to acquire
* @return error code. 0 is OK. see @ERROR
*/
virtual int StopAcq() = 0;
/**
* @brief get one image
* @param image data
* @param image width
* @param image height
* @return error code. 0 is OK. see @ERROR
*/
virtual int GetImageData(vector<short>& vImg,int& nX,int& nY) = 0;
protected:
PcoCLHSInterfaces() = default;
// private:
// static unique_ptr<PcoCLHSInterfaces> uptrPcoInterface;
};
}
#include "PcoMe4Interfaces.h"
#include "PcoMe4Impl.h"
namespace PcoMe4NS
{
//unique_ptr<PcoMe4Interfaces> PcoMe4Interfaces::uptrPcoInterface;
unique_ptr<PcoMe4Interfaces> Instance()
{
// if it is empty create
//if(!uptrPcoInterface)
auto uptrPcoInterface = unique_ptr<PcoMe4Interfaces>(new PcoMe4Impl());
return std::move(uptrPcoInterface);
}
}
#pragma once
#include <iostream>
#include <memory>
#include <vector>
namespace PcoMe4NS
{
using namespace std;
/**
* @brief error code
*/
enum ERROR_PCO
{
OK, /* 0 */
DOES_NOT_SUPPORT, /* 1 */
OPEN_ERROR, /* 2 */
CLOSE_ERROR, /* 3 */
GET_ERROR, /* 4 */
SET_ERROR, /* 5 */
START_ERROR, /* 6 */
RECORD_ERROR, /* 7 */
STOP_ERROR, /* 8 */
INVALID_VALUE /* 9 */
};
/**
* @brief roi of the image
*/
struct ROI
{
short x0,y0,x1,y1;
};
/**
* @brief binning
*/
struct Binning
{
short binx,biny;
};
class PcoMe4Interfaces;
unique_ptr<PcoMe4Interfaces> Instance();
/**
* @brief pco interfaces
* wrapper of pco lib interfaces
* Now it only supports PCO camera with camlink interface
*/
class PcoMe4Interfaces
{
public:
/**
* @brief create pco instance
* Singleton implemntation. Only one pco instance is initialized.
* @return pco instance
*/
//static unique_ptr<PcoMe4Interfaces> Instance();
/**
* @brief destructor
*/
virtual ~PcoMe4Interfaces() = default;
/**
* @brief open camera
* @return error code. 0 is OK see @ERROR
*/
virtual int OpenCamera() = 0;
/**
* @brief close camera
* @return error code. 0 is OK. see @ERROR
*/
virtual int CloseCamera() = 0;
/**
* @brief get module name
* @return name of module
*/
virtual const string GetModuleName() = 0;
/**
* @brief get camera max size
* @param x width
* @param y height
* @return error code. 0 is OK. see @ERROR
*/
virtual int GetCameraMaxSize(int& x, int& y) = 0;
/**
* @brief get recording state
* @param recording state
* @return error code. 0 is OK. see @ERROR
*/
virtual int GetRecordingState(short& shRecordingState) = 0;
/**
* @brief set recording state
* @param recording state
* @return error code. 0 is OK. see @ERROR
*/
virtual int SetRecordingState(short shRecordingState) = 0;
/**
* @brief request the current camera and power supply temperatures.
* Power supply temperature is not available with all cameras.
* If it is not available, the temperature will show 0.
* In case the sensor temperature is not available it will show 0x8000.
* @param ccd temperature
* @param camera temperature
* @param power device temperature
* @return error code. 0 is OK. see @ERROR
*/
virtual int GetTemperature(short& shCCDTemperature,short& shCameraTemperature,short& shPowerDeviceTemperature) = 0;
/**
* @brief get/set the temperature set point for cooling the image sensor
* (only available for cooled cameras).
* If min. cooling set point (in ◦ C)
* and max. cooling set point (in ◦ C) are zero,
* then cooling is not available.
* @param temperature in Celsius
* @return error code. 0 is OK. see @ERROR
*/
virtual int GetCoolingSetpointTemperature(short& shTemperature) = 0;
virtual int SetCoolingSetpointTemperature(short shTemperature) = 0;
/**
* @brief get/set binning
* @param bin horizontal
* @param bin vertical
* @return error code. 0 is OK. see @ERROR
*/
virtual int GetBinning(short& shBinHorz,short& shBinVert) = 0;
virtual int SetBinning(short shBinHorz,short shBinVert) = 0;
/**
* @brief get/set ROI
* @param X0
* @param Y0
* @param X1
* @param Y1
* @return error code. 0 is OK. see @ERROR
*/
virtual int GetROI(short& shX0,short& shY0,short& shX1,short& shY1) = 0;
virtual int SetROI(short shX0,short shY0,short shX1,short shY1) = 0;
/**
* @brief get step of ROI
* @param step on X dimension
* @param step on Y dimension
*/
virtual int GetROIStep(short& shXstep,short& shYstep) = 0;
/**
* @brief get/set active loopup table in the camera, if available.
* only available with pco.edge
* @param define LUT to be activated,0x0000 for no LUT
* @param offset:11bit value for fixed offset substraction
* before transferrring the data via the lookuptable
* @return error code. 0 is OK. see @ERROR
*/
virtual int GetLUT(short& shIdentifier,short& shParam) = 0;
virtual int SetLUT(short shIdentifier,short shParam) = 0;
/**
* @brief get the actual size of images.
* @param size X
* @param size Y
* @return error code. 0 is OK. see @ERROR
*/
virtual int GetSizes(short& shX,short& shY) = 0;
/**
* @brief get/set trigger mode
* @param trigger mode
* 0x0000: auto trigger
* 0x0001: software trigger
* 0x0002: external exposure and software trigger
* 0x0003: external exposure control
* @return error code. 0 is OK. see @ERROR
*/
virtual int GetTriggerMode(short& shTriggerMode) = 0;
virtual int SetTriggerMode(short shTriggerMode) = 0;
/**
* @brief get/set pixel rate of the camera
* @param pixel rate
* @return error code. 0 is OK. see @ERROR