This is a subtype of DataIO for camera / framegrabber communication. The data acquisition is managed as followed:
A typical sequence in python is
1 2 3 4 5 6 | device.startDevice()
device.acquire()
device.getVal(dObj)
device.acquire()
device.getVal(dObj)
device.stopDevice()
|
A sample header file of the DataIO’s plugin class is illustrated in the following code snippet:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | #include "../../common/addInGrabber.h"
#include "dialogFireGrabber.h"
#include <qsharedpointer.h>
class FireGrabber : public ito::AddInGrabber
{
Q_OBJECT
protected:
~MyDataIO(); /*! < Destructor*/
MyDataIO(); /*! < Constructor*/
ito::RetVal checkData(ito::DataObject *externalDataObject = NULL); /*!< Check if objekt has to be reallocated */
ito::RetVal retrieveData(ito::DataObject *externalDataObject = NULL); /*!< Wait for acquired picture */
public:
friend class MyDataIOInterface;
const ito::RetVal showConfDialog(void); //! Open the config nonmodal dialog to set camera parameters
int hasConfDialog(void) { return 1; }; //!< indicates that this plugin has got a configuration dialog
private:
cv::Mat m_pDataMatBuffer;
int m_CCD_ID; /*!< Camera ID */
bool m_isgrabbing; /*!< Check if acquire was called */
static int m_numberOfInstances;
ito::RetVal AlliedChkError(int errornumber); /*!< Map Allied-Error-Number to ITOM-Errortype and Message */
const char* errmsg;
UINT8 *m_pImage; // Pointer to actual image
public slots:
//!< Get Camera-Parameter
ito::RetVal getParam(QSharedPointer<ito::tParam> val, ItomSharedSemaphore *waitCond);
//!< Set Camera-Parameter
ito::RetVal setParam(QSharedPointer<ito::tParam> val, ItomSharedSemaphore *waitCond);
//!< Initialise board, load dll, allocate buffer
ito::RetVal init(QVector<ito::tParam> *paramsMand, QVector<ito::tParam> *paramsOpt, ItomSharedSemaphore *waitCond = NULL);
//!< Free buffer, delete board, unload dll
ito::RetVal close(ItomSharedSemaphore *waitCond);
//!< Start the camera to enable acquire-commands
ito::RetVal startDevice(ItomSharedSemaphore *waitCond);
//!< Stop the camera to disable acquire-commands
ito::RetVal stopDevice(ItomSharedSemaphore *waitCond);
//!< Softwaretrigger for the camera
ito::RetVal acquire(const int trigger, ItomSharedSemaphore *waitCond = NULL);
//!< Wait for acquired picture, copy the picture to dObj of right type and size
ito::RetVal getVal(void *vpdObj, ItomSharedSemaphore *waitCond);
ito::RetVal copyVal(void *vpdObj, ItomSharedSemaphore *waitCond);
ito::RetVal ConvertY16(UINT32 XSize,UINT32 YSize,UINT8 *pBuf,UINT8 *pBGR);
void updateParameters(QMap<QString, ito::tParam> params);
private slots:
};
//----------------------------------------------------------------------------------------------------------------------------------
class DataIOInterface : public ito::AddInInterfaceBase
{
Q_OBJECT
Q_INTERFACES(ito::AddInInterfaceBase)
protected:
public:
DataIOInterface();
~DataIOInterface();
ito::RetVal getAddInInst(ito::AddInBase **addInInst);
private:
ito::RetVal closeThisInst(ito::AddInBase **addInInst);
signals:
public slots:
};
|
To achieve a unified interface and allow fast exchange between the different plugIns all dataIO have to follow the predefined conventions.