Commit a396116c authored by ics's avatar ics
Browse files

change to generic name

parent 4a031c49
#include "drivers/gigecam/photonics/CameraHandler.h"
#include "drivers/gigecam/genericam/CameraHandler.h"
#include <iostream>
#include <sstream>
#include <limits>
//#include "pylon/Platform.h"
//#include "pylon/api_autoconf.h"
#include "drivers/gigecam/photonics/BufferInformation.h"
#include "drivers/gigecam/photonics/DoubleBufferHandler.h"
#include "drivers/gigecam/genericam/BufferInformation.h"
#include "drivers/gigecam/genericam/DoubleBufferHandler.h"
// this function initializes the Baumer GAPI SDK and
// searches for connected cameras
......
#include "drivers/gigecam/photonics/DoubleBufferHandler.h"
#include "drivers/gigecam/genericam/DoubleBufferHandler.h"
#include <iostream>
#include <sstream>
#include "drivers/gigecam/photonics/BufferInformation.h"
#include "drivers/gigecam/genericam/BufferInformation.h"
CDoubleBufferHandler::CDoubleBufferHandler()
: buffer_read_(nullptr)
......
......@@ -16,13 +16,13 @@
* limitations under the Licence.
*/
#ifndef PHOTONICSDEF_H
#define PHOTONICSDEF_H
#ifndef GENERICCAMDEF_H
#define GENERICCAMDEF_H
#include <string>
#include <common/base/PropertyType.h>
namespace photonics {
namespace genericam {
static const std::string MILLISEC = "Millisec";
......
......@@ -16,33 +16,33 @@
* limitations under the Licence.
*/
#include "drivers/gigecam/photonics/PhotonicsDriver.h"
#include "drivers/gigecam/genericam/GenericCamDriver.h"
#include <math.h>
#include "drivers/gigecam/photonics/PerfectPhotonicsDriver.h"
#include "drivers/gigecam/photonics/PhotonicsDef.h"
#include "drivers/gigecam/photonics/PhotonicsState.h"
#include "drivers/gigecam/photonics/RealPhotonicsDriver.h"
#include "drivers/gigecam/photonics/SimulatedPhotonicsDriver.h"
#include "drivers/gigecam/genericam/PerfectGenericCamDriver.h"
#include "drivers/gigecam/genericam/GenericCamDef.h"
#include "drivers/gigecam/genericam/GenericCamState.h"
#include "drivers/gigecam/genericam/RealGenericCamDriver.h"
#include "drivers/gigecam/genericam/SimulatedGenericCamDriver.h"
using namespace std;
namespace photonics {
namespace genericam {
const std::string PhotonicsDriver::TYPE = "photonics";
const std::string PhotonicsDriver:: MODE[4] = {"Standard", "Average","Summation","Accumulation"};
const std::string GenericCamDriver::TYPE = "genericam";
const std::string GenericCamDriver:: MODE[4] = {"Standard", "Average","Summation","Accumulation"};
/*
* Constructor
*/
PhotonicsDriver::PhotonicsDriver(const string& name):
GenericCamDriver::GenericCamDriver(const string& name):
acquisition::NoTofAcquisitionCommon(name),acquisition::KineticAcquisitionCommon(name),
acquisition::TimeGateCommon(name),
acquisition::DetectorCommon(name)
{
registerStates(new RealPhotonicsDriver(this), new PerfectPhotonicsDriver(this), new SimulatedPhotonicsDriver(this));
registerStates(new RealGenericCamDriver(this), new PerfectGenericCamDriver(this), new SimulatedGenericCamDriver(this));
driver::SocketTcp::init(name);
......@@ -92,13 +92,13 @@ PhotonicsDriver::PhotonicsDriver(const string& name):
/*
* Destructor
*/
PhotonicsDriver::~PhotonicsDriver() {
GenericCamDriver::~GenericCamDriver() {
}
/*
* refreshDataSizeProperty
*/
void PhotonicsDriver::refreshDataSizeProperty(int32 value) throw (CannotSetValue) {
void GenericCamDriver::refreshDataSizeProperty(int32 value) throw (CannotSetValue) {
if (m_DataShort != NULL) {
delete[] m_DataShort;
}
......@@ -113,7 +113,7 @@ void PhotonicsDriver::refreshDataSizeProperty(int32 value) throw (CannotSetValue
/*
* refreshModeProperty
*/
void PhotonicsDriver::refreshModeProperty(int32 value) throw (CannotSetValue) {
void GenericCamDriver::refreshModeProperty(int32 value) throw (CannotSetValue) {
if (value != acquisition::GateCommon::TIME_MODE) {
throw CannotSetValue();
}
......@@ -122,13 +122,13 @@ void PhotonicsDriver::refreshModeProperty(int32 value) throw (CannotSetValue) {
/*
* execute
*/
void PhotonicsDriver::execute(const std::string& aCommand) {
void GenericCamDriver::execute(const std::string& aCommand) {
if ((aCommand != driver::PAUSE_COMMAND) && (aCommand != driver::STOP_COMMAND) && (aCommand != driver::STATUS_COMMAND)
&& (aCommand != driver::READ_COMMAND)) {
commandProgression = PROGRESSION_UNKNOWNSTATE_DEVICE_CONTAINER;
}
PhotonicsState* currentState = dynamic_cast<PhotonicsState*>(getCurrentState());
GenericCamState* currentState = dynamic_cast<GenericCamState*>(getCurrentState());
// Check command
if (aCommand == driver::INIT_COMMAND) {
// Init command
......@@ -187,7 +187,7 @@ void PhotonicsDriver::execute(const std::string& aCommand) {
/*
* calculateProgression
*/
void PhotonicsDriver::calculateProgression() {
void GenericCamDriver::calculateProgression() {
int32 progression = 0;
float64 setpoint = 0.0;
float64 actual = 0.0;
......@@ -210,9 +210,9 @@ void PhotonicsDriver::calculateProgression() {
}
/*
* PhotonicsDriver
* GenericCamDriver
*/
void PhotonicsDriver::computeGateStatus(int32 value) {
void GenericCamDriver::computeGateStatus(int32 value) {
int32 valueout = 0;
if (value == COUNTING) {
valueout |= GateCommon::RUNNING_STATUS;
......@@ -224,18 +224,18 @@ void PhotonicsDriver::computeGateStatus(int32 value) {
}
/*
* PhotonicsDriver
* GenericCamDriver
*/
void PhotonicsDriver::computeDetectorStatus(int32 value) {
void GenericCamDriver::computeDetectorStatus(int32 value) {
int32 valueout = 0;
detectorStatus.update(valueout);
}
/*
* PhotonicsDriver
* GenericCamDriver
*/
void PhotonicsDriver::computeAcquisitionStatus(int32 value) {
void GenericCamDriver::computeAcquisitionStatus(int32 value) {
int32 valueout = 0;
acquisitionStatus.update(valueout);
}
......
......@@ -16,8 +16,8 @@
* limitations under the Licence.
*/
#ifndef PHOTONICSDRIVER_H
#define PHOTONICSDRIVER_H
#ifndef GENERICCAMDRIVER_H
#define GENERICCAMDRIVER_H
#define _GNULINUX
#include <Driver.h>
......@@ -31,21 +31,21 @@
#include "drivers/legacy/def/DriverErrorDef.h"
//#include "/usr/local/src/baumer/inc/"
namespace photonics {
namespace genericam {
/**
* Global Implementation of the vme card called Psl made in Ill. It needs a board called Men A201.
*/
class PhotonicsDriver: public acquisition::NoTofAcquisitionCommon,
class GenericCamDriver: public acquisition::NoTofAcquisitionCommon,
public acquisition::TimeGateCommon,
public acquisition::KineticAcquisitionCommon,
public acquisition::DetectorCommon,
public driver::SocketTcp
{
friend class RealPhotonicsDriver;
friend class PerfectPhotonicsDriver;
friend class SimulatedPhotonicsDriver;
friend class RealGenericCamDriver;
friend class PerfectGenericCamDriver;
friend class SimulatedGenericCamDriver;
public:
static const std::string MODE[4];
......@@ -58,12 +58,12 @@ public:
* \brief Constructor
* \param[in] name the name of the device driver
*/
PhotonicsDriver(const std::string& name);
GenericCamDriver(const std::string& name);
/*!
* \brief Destructor
*/
virtual ~PhotonicsDriver();
virtual ~GenericCamDriver();
/*!
* \brief Method called for executing a command
......
......@@ -16,23 +16,23 @@
* limitations under the Licence.
*/
#ifndef PHOTONICSSTATE_H
#define PHOTONICSSTATE_H
#ifndef GENERICCAMSTATE_H
#define GENERICCAMSTATE_H
#include <Driver.h>
#include "drivers/gigecam/photonics/PhotonicsDriver.h"
#include "drivers/gigecam/genericam/GenericCamDriver.h"
namespace photonics {
namespace genericam {
/*!
* \class PhotonicsState
* \class GenericCamState
* \brief Virtual class for implement State pattern
*
* Define all methods that perfect, simulated and real classes have to implement
*/
class PhotonicsState: public DriverState<PhotonicsDriver> {
class GenericCamState: public DriverState<GenericCamDriver> {
public:
......@@ -40,13 +40,13 @@ public:
* \brief Constructor
* \param[in] owner The device driver main class link
*/
PhotonicsState(PhotonicsDriver* owner) :
DriverState<PhotonicsDriver>(owner) {
GenericCamState(GenericCamDriver* owner) :
DriverState<GenericCamDriver>(owner) {
}
/*!
* \brief Destructor
*/
virtual ~PhotonicsState() {
virtual ~GenericCamState() {
}
/*!
......@@ -107,4 +107,4 @@ public:
};
}
#endif //PHOTONICSSTATE_H
#endif //GENERICCAMSTATE_H
<module name="photonics">
<driver class="photonics::PhotonicsDriver"/>
<module name="genericam">
<driver class="genericam::GenericCamDriver"/>
<link path="/usr/local/lib/baumer" lib="bgapi2_genicam"/>
<link lib="opencv_core"/>
<link lib="opencv_calib3d"/>
......
......@@ -16,37 +16,37 @@
* limitations under the Licence.
*/
#include "drivers/gigecam/photonics/PerfectPhotonicsDriver.h"
#include "drivers/gigecam/genericam/PerfectGenericCamDriver.h"
#include <stdlib.h>
#include "drivers/gigecam/photonics/PhotonicsDef.h"
#include "drivers/gigecam/photonics/PhotonicsDriver.h"
#include "drivers/gigecam/genericam/GenericCamDef.h"
#include "drivers/gigecam/genericam/GenericCamDriver.h"
namespace photonics {
namespace genericam {
/*
* Constructor
*/
PerfectPhotonicsDriver::PerfectPhotonicsDriver(PhotonicsDriver* owner) :
PhotonicsState(owner) {
PerfectGenericCamDriver::PerfectGenericCamDriver(GenericCamDriver* owner) :
GenericCamState(owner) {
/* Empty */
}
/*
* Destructor
*/
PerfectPhotonicsDriver::~PerfectPhotonicsDriver() {
PerfectGenericCamDriver::~PerfectGenericCamDriver() {
/* Empty */
}
void PerfectPhotonicsDriver::init() {
void PerfectGenericCamDriver::init() {
}
/*
* clearvme/daugther/Photonics
* clearvme/daugther/GenericCam
*/
void PerfectPhotonicsDriver::clear() {
void PerfectGenericCamDriver::clear() {
// Read command
owner()->time = 0;
owner()->counts = 0;
......@@ -57,13 +57,13 @@ void PerfectPhotonicsDriver::clear() {
/*
* writeParam
*/
void PerfectPhotonicsDriver::writeParam() {
void PerfectGenericCamDriver::writeParam() {
}
/*
* synchroniseRead
*/
void PerfectPhotonicsDriver::synchroniseRead() {
void PerfectGenericCamDriver::synchroniseRead() {
read();
owner()->m_SynchroniseReadTerminated = true;
}
......@@ -71,7 +71,7 @@ void PerfectPhotonicsDriver::synchroniseRead() {
///*
// * regroup
// */
//void PerfectPhotonicsDriver::regroup() {
//void PerfectGenericCamDriver::regroup() {
// std::cout << owner()->xSize() << std::endl;
// std::cout << owner()->ySize() << std::endl;
//}
......@@ -79,7 +79,7 @@ void PerfectPhotonicsDriver::synchroniseRead() {
/*
* read
*/
void PerfectPhotonicsDriver::read() {
void PerfectGenericCamDriver::read() {
// Read command
int32 size = owner()->dataSize();
......@@ -109,35 +109,35 @@ void PerfectPhotonicsDriver::read() {
/*
* pause
*/
void PerfectPhotonicsDriver::pause() {
void PerfectGenericCamDriver::pause() {
}
/*
* continue
*/
void PerfectPhotonicsDriver::resume() {
void PerfectGenericCamDriver::resume() {
}
/*
* start
*/
void PerfectPhotonicsDriver::start() {
void PerfectGenericCamDriver::start() {
owner()->time = owner()->time.setpoint();
}
/*
* stop
*/
void PerfectPhotonicsDriver::stop() {
void PerfectGenericCamDriver::stop() {
}
/*
* readStatus
*/
void PerfectPhotonicsDriver::readStatus() {
void PerfectGenericCamDriver::readStatus() {
owner()->startActivated = false;
// Status command
owner()->computeGateStatus(photonics::READOUT_COMPLETE);
owner()->computeGateStatus(genericam::READOUT_COMPLETE);
owner()->computeAcquisitionStatus(0);
owner()->computeDetectorStatus(0);
if (owner()->m_SynchroniseReadActivated == true) {
......@@ -154,7 +154,7 @@ void PerfectPhotonicsDriver::readStatus() {
/*
* readInfos
*/
void PerfectPhotonicsDriver::readInfos() {
void PerfectGenericCamDriver::readInfos() {
}
}
......@@ -16,21 +16,21 @@
* limitations under the Licence.
*/
#ifndef PERFECTPHOTONICSDRIVER_H
#define PERFECTPHOTONICSDRIVER_H
#ifndef PERFECTGENERICCAMDRIVER_H
#define PERFECTGENERICCAMDRIVER_H
#include "drivers/gigecam/photonics/PhotonicsState.h"
#include "drivers/gigecam/genericam/GenericCamState.h"
namespace photonics {
namespace genericam {
/*!
* \class PerfectPhotonicsDriver
* \brief Perfect implementation class for the Photonics device driver
* \class PerfectGenericCamDriver
* \brief Perfect implementation class for the GenericCam device driver
*
* This class is a perfect implementation of Photonics device driver.
* This class is a perfect implementation of GenericCam device driver.
* On start command, all actual values become target's ones.
*/
class PerfectPhotonicsDriver: public PhotonicsState {
class PerfectGenericCamDriver: public GenericCamState {
public:
......@@ -38,12 +38,12 @@ public:
* \brief Constructor
* \param[in] owner The device driver main class link
*/
PerfectPhotonicsDriver(PhotonicsDriver* owner);
PerfectGenericCamDriver(GenericCamDriver* owner);
/*!
* \brief Destructor
*/
virtual ~PerfectPhotonicsDriver();
virtual ~PerfectGenericCamDriver();
/*!
* \brief Init command implementation
......@@ -108,4 +108,4 @@ public:
};
}
#endif //PERFECTPHOTONICSDRIVER_H
#endif //PERFECTGENERICCAMDRIVER_H
......@@ -16,7 +16,7 @@
* limitations under the Licence.
*/
#include "drivers/gigecam/photonics/RealPhotonicsDriver.h"
#include "drivers/gigecam/genericam/RealGenericCamDriver.h"
// Namespace for using pylon objects.
......@@ -24,24 +24,24 @@
#include "CImg.h"
#include "drivers/gigecam/photonics/PhotonicsDef.h"
#include "drivers/gigecam/photonics/PhotonicsDriver.h"
#include "drivers/gigecam/genericam/GenericCamDef.h"
#include "drivers/gigecam/genericam/GenericCamDriver.h"
using namespace cimg_library;
// Setting for using Basler GigE cameras.
using namespace std;
///
/// \namespace photonics
/// \namespace genericam
/// \brief camera namespace
///
namespace photonics {
namespace genericam {
/*
* Constructor
*/
RealPhotonicsDriver::RealPhotonicsDriver(PhotonicsDriver* owner) :
PhotonicsState(owner) {
RealGenericCamDriver::RealGenericCamDriver(GenericCamDriver* owner) :
GenericCamState(owner) {
m_return_code = 0;
m_finish_console_threads = false;
m_command_status = false;
......@@ -50,7 +50,7 @@ RealPhotonicsDriver::RealPhotonicsDriver(PhotonicsDriver* owner) :
/*
* Destructor
*/
RealPhotonicsDriver::~RealPhotonicsDriver() {
RealGenericCamDriver::~RealGenericCamDriver() {
if (m_return_code == 0) {
// set the cancel flag of status thread
m_finish_console_threads = true;
......@@ -61,7 +61,7 @@ RealPhotonicsDriver::~RealPhotonicsDriver() {
}
}
//string RealPhotonicsDriver::getConfigFile(BGAPI2::Device* device) {
//string RealGenericCamDriver::getConfigFile(BGAPI2::Device* device) {
// std::string confgFile;
// // BGAPI2::Node * pNode = NULL;
// // BGAPI2::NodeMap * pNodeTree = NULL;
......@@ -85,7 +85,7 @@ RealPhotonicsDriver::~RealPhotonicsDriver() {
/*
* init
*/
void RealPhotonicsDriver::init() {
void RealGenericCamDriver::init() {
// configure the camera handler to work the double buffer handler
// at this point it is possible to implement other buffer exchange strategies
m_camera_handler.Start(m_double_buffer);
......@@ -123,7 +123,7 @@ void RealPhotonicsDriver::init() {
m_return_code = 0;
}
//void RealPhotonicsDriver::InitCurrentBufferStruct(CCameraHandler *camera_handler, std::list<std::thread::id> thread_id_list) {
//void RealGenericCamDriver::InitCurrentBufferStruct(CCameraHandler *camera_handler, std::list<std::thread::id> thread_id_list) {
// const std::vector<CCameraControl*>* camera_vector = camera_handler->GetCameraControlVector();
// for (std::vector<CCameraControl*>::const_iterator camera_iter = camera_vector->begin();
// camera_iter != camera_vector->end();
......@@ -137,7 +137,7 @@ void RealPhotonicsDriver::init() {
//// the StatusThreadRoutine is left and the status thread finished, if the finish flag was set
//// the StatusThreadRoutine starts working if the status command was activated from within the main loop
//// the StatusThreadRoutine works with polling to detect an activated status command
//void RealPhotonicsDriver::StatusThreadRoutine(CCameraHandler* camera_handler) {
//void RealGenericCamDriver::StatusThreadRoutine(CCameraHandler* camera_handler) {
// // abort condition of the thread routine
// while (!m_finish_console_threads) {
// // check if the user activated the status command
......@@ -163,7 +163,7 @@ void RealPhotonicsDriver::init() {
//// and print this information to the console output
//// the PrintCameraStatus use the synchronisation functions for a synchronized buffer access
//// the PrintCameraStatus works only once on the same camera buffer on a camera (see HasDoubleBufferHandlerNewData)
//void RealPhotonicsDriver::PrintCameraStatus(CCameraControl * camera_control) {
//void RealGenericCamDriver::PrintCameraStatus(CCameraControl * camera_control) {
// std::cout << "status of camera " << camera_control->camera_pointer_->GetDisplayName() << std::endl;
// // check for a new camera buffer
// if (HasDoubleBufferHandlerNewData(&camera_control->buffer_handler_)) {
......@@ -213,7 +213,7 @@ void RealPhotonicsDriver::init() {
//// this function sets the new data flag for all connected cameras to true, if the buffer_ pointer is nullptr,
//// that means if all application threads have returned their camera buffer
//// and a new camera buffer is served by the buffer handler
//bool RealPhotonicsDriver::HasDoubleBufferHandlerNewData(CDoubleBufferHandler* buffer_handler) {
//bool RealGenericCamDriver::HasDoubleBufferHandlerNewData(CDoubleBufferHandler* buffer_handler) {
// std::lock_guard<std::mutex> lock(m_current_buffer[buffer_handler].lock_);
// if (m_current_buffer[buffer_handler].buffer_ == nullptr) {
// if (buffer_handler->HasNewData()) {
......@@ -226,7 +226,7 @@ void RealPhotonicsDriver::init() {
// return m_current_buffer[buffer_handler].new_data[std::this_thread::get_id()];
//}
//
//void RealPhotonicsDriver::PrintLoggingInformation(CCameraControl * camera_control) {
//void RealGenericCamDriver::PrintLoggingInformation(CCameraControl * camera_control) {
// while (!camera_control->LoggingListEmpty()) {
// std::cout << camera_control->LoggingString() << std::endl;
// };
......@@ -237,7 +237,7 @@ void RealPhotonicsDriver::init() {
//// the mutex is entered, when this function is called and when the lock is not
//// entered from FreeBufferToDoubleBufferHandler, in this case the current thread
//// stops execution on the mutex object until FreeBufferToDoubleBufferHandler was left
//BGAPI2::Buffer* RealPhotonicsDriver::PullBufferFromDoubleBufferHandler(CDoubleBufferHandler* buffer_handler) {
//BGAPI2::Buffer* RealGenericCamDriver::PullBufferFromDoubleBufferHandler(CDoubleBufferHandler* buffer_handler) {
// std::lock_guard<std::mutex> lock(m_current_buffer[buffer_handler].lock_);
// if (m_current_buffer[buffer_handler].buffer_ == nullptr) {
// m_current_buffer[buffer_handler].buffer_ = buffer_handler->PullBuffer();
......@@ -251,7 +251,7 @@ void RealPhotonicsDriver::init() {
//
//
//// vise versa to function PullBufferFromDoubleBufferHandler
//void RealPhotonicsDriver::FreeBufferToDoubleBufferHandler(CDoubleBufferHandler* buffer_handler, BGAPI2::Buffer* buffer) {
//void RealGenericCamDriver::FreeBufferToDoubleBufferHandler(CDoubleBufferHandler* buffer_handler, BGAPI2::Buffer* buffer) {
// std::lock_guard<std::mutex> lock(m_current_buffer[buffer_handler].lock_);
// if (buffer == m_current_buffer[buffer_handler].buffer_) {
// if (m_current_buffer[buffer_handler].ref_counter_ > 0) {
......@@ -267,13 +267,13 @@ void RealPhotonicsDriver::init() {
/*
* clear
*/
void RealPhotonicsDriver::clear() {
void RealGenericCamDriver::clear() {
}
/*
* writeParam
*/
void RealPhotonicsDriver::writeParam() {
void RealGenericCamDriver::writeParam() {
ostringstream buf_conf;
std::size_t found;
......@@ -286,7 +286,7 @@ void RealPhotonicsDriver::writeParam() {