itom
Loading...
Searching...
No Matches
ito::AddInGrabber Class Referenceabstract

Inherit from AddInGrabber if you write a camera/grabber plugin. Please call the constructor of AddInGrabber within your plugin constructor. More...

Inheritance diagram for ito::AddInGrabber:
ito::AddInDataIO ito::AddInBase

Public Member Functions

 AddInGrabber ()
 constructor
 
 ~AddInGrabber ()
 destructor
 
- Public Member Functions inherited from ito::AddInDataIO
int getAutoGrabbing ()
 
- Public Member Functions inherited from ito::AddInBase
const Param getParamRec (const QString name, bool *nameCheckOk=NULL) const
 method to retrieve a parameter from the parameter map (m_params)
 
AddInInterfaceBasegetBasePlugin (void) const
 returns the interface of this instance.
 
ito::RetVal MoveToThread (void)
 creates new thread for the class instance and moves this instance to the new thread
 
const ito::RetVal getParamList (QMap< QString, Param > **paramNames)
 returns a map with the parameters of this plugin.
 
const ito::RetVal getExecFuncList (QMap< QString, ExecFuncParams > **funcs)
 returns list of registered additional functions
 
int getID () const
 retrieve the uniqueID of this instance
 
QString getIdentifier () const
 retrieve the unique identifier of this instance
 
virtual int hasConfDialog (void)
 determine if a configuration dialog is available
 
virtual const ito::RetVal showConfDialog (void)
 open configuration dialog
 
int createdByGUI () const
 returns true if this instance has firstly been created by the GUI
 
void setCreatedByGUI (int value)
 method to set whether this instance has been firstly created by the GUI (true) or by any other component (Python, C++, other plugin,..) (false)
 
int getRefCount (void) const
 Returns the reference counter of this instance.
 
bool hasDockWidget (void) const
 Returns true if this plugin provides a dock widget, that can be shown in the main window.
 
QDockWidget * getDockWidget (void) const
 Returns the reference to the dock widget of this plugin or NULL, if no dock widget is provided or if it is already deleted.
 
virtual void dockWidgetDefaultStyle (bool &floating, bool &visible, Qt::DockWidgetArea &defaultArea) const
 returns default style properties for dock-widget of plugin
 
int isAlive (void)
 returns the alive-flag of this plugin
 
void setAlive (void)
 sets the alive-flag to 1 ("still alive")
 
bool isInitialized (void) const
 returns in a thread-safe way the status of the m_initialized-member variable. This variable should be set to true at the end of the init-method.
 
void setInitialized (bool initialized)
 sets in a thread-safe way the status of the m_initialized-member
 
QVector< ito::AddInBase::AddInRef * > * getArgAddIns (void)
 returns vector of AddInRef instances.
 
QMutex & getUserMutex ()
 returns the user mutex of this plugin, that can be used for user-defined purposes.
 

Protected Member Functions

void timerEvent (QTimerEvent *event)
 if any live image has been connected to this camera, this event will be regularly fired.
 
virtual ito::RetVal checkData (ito::DataObject *externalDataObject=NULL)
 implement this method in order to check if m_image should be (re)allocated with respect to the current sizex, sizey, bpp...
 
virtual ito::RetVal retrieveData (ito::DataObject *externalDataObject=NULL)=0
 implement this method in your camera plugin. In this method the image is grabbed and stored in the m_image variable.
 
ito::RetVal sendDataToListeners (int waitMS)
 sends m_image to all registered listeners.
 
int grabberStartedCount ()
 
void incGrabberStarted ()
 
void decGrabberStarted ()
 
void setGrabberStarted (int value)
 
- Protected Member Functions inherited from ito::AddInDataIO
void runStatusChanged (bool deviceStarted)
 
- Protected Member Functions inherited from ito::AddInBase
 AddInBase ()
 Constructor.
 
virtual ~AddInBase ()
 Destructor.
 
void setIdentifier (const QString &identifier)
 sets the identifier of the plugin. The slot AbstractAddInDockWidget::identifierChanged is invoked if a corresponding dock widget is available.
 
void createDockWidget (QString title, QDockWidget::DockWidgetFeatures features, Qt::DockWidgetAreas allowedAreas=Qt::AllDockWidgetAreas, QWidget *content=NULL)
 Creates the dock-widget for this plugin.
 
ito::RetVal registerExecFunc (const QString funcName, const QVector< ito::Param > &paramsMand, const QVector< ito::Param > &paramsOpt, const QVector< ito::Param > &paramsOut, const QString infoString)
 Registers an additional function with specific name and default parameters.
 
void setBasePlugin (AddInInterfaceBase *base)
 sets the interface of this instance to base.
 
bool hasGuiSupport ()
 check if we have gui support
 

Protected Attributes

ito::DataObject m_data
 
- Protected Attributes inherited from ito::AddInDataIO
QSet< QObject * > m_autoGrabbingListeners
 
int m_timerID
 
int m_timerIntervalMS
 
bool m_autoGrabbingEnabled
 
- Protected Attributes inherited from ito::AddInBase
QMap< QString, Paramm_params
 map of the available parameters
 
QString m_identifier
 unique identifier (serial number, com-port...)
 

Private Attributes

int m_started
 counter indicating how many times startDevice has been called
 
AddInGrabberPrivatedd
 

Additional Inherited Members

- Public Slots inherited from ito::AddInDataIO
virtual ito::RetVal startDevice (ItomSharedSemaphore *waitCond)
 method to start the device - i.e. get ready to record data
 
virtual ito::RetVal stopDevice (ItomSharedSemaphore *waitCond)
 method to stop the device, it is no longer possible to acquire data
 
virtual ito::RetVal acquire (const int trigger, ItomSharedSemaphore *waitCond=NULL)
 freeze the current data and prepare it for retrieval
 
virtual ito::RetVal stop (ItomSharedSemaphore *waitCond=NULL)
 stops a continuous acquisition (usually only required by AD/DA converters). This method has not to be implemented in every plugin. New from itom.AddIn.Interface/4.0.0 on
 
virtual ito::RetVal getVal (void *data, ItomSharedSemaphore *waitCond=NULL)
 read data from the device into a dataObject (which is passed as void pointer actually). Output is a shallow-copy to the grabber internal buffer-object.
 
virtual ito::RetVal getVal (QSharedPointer< char > data, QSharedPointer< int > length, ItomSharedSemaphore *waitCond=NULL)
 read data from the device into a "raw data pointer" (in this case a char * is passed, pointing to the start of the preallocated memory)
 
virtual ito::RetVal copyVal (void *dObj, ItomSharedSemaphore *waitCond)
 read data from the device into a dataObject (which is passed as void pointer actually). Output is a deep-copy to the grabber internal object.
 
virtual ito::RetVal setVal (const char *data, const int length, ItomSharedSemaphore *waitCond=NULL)
 write data, e.g. to the DA part of an ADDA card
 
ito::RetVal enableAutoGrabbing (ItomSharedSemaphore *waitCond=NULL)
 enables the timer for auto grabbing (live image), if any live image has signed on (usually this method must not be overwritten)
 
ito::RetVal disableAutoGrabbing (ItomSharedSemaphore *waitCond=NULL)
 disables the timer for auto grabbing (live image) (usually this method must not be overwritten)
 
ito::RetVal setAutoGrabbingInterval (QSharedPointer< int > interval, ItomSharedSemaphore *waitCond=NULL)
 sets a new interval for the auto-grabbing timer (in ms). If interval <= 0 is passed, nothing is changed, but the current interval is returned. This method does not enable or disable the timer.
 
ito::RetVal startDeviceAndRegisterListener (QObject *obj, ItomSharedSemaphore *waitCond=NULL)
 starts device and registers obj as listener (live image). This listener must have a slot void setSource(QSharedPointer<ito::DataObject>, ItomSaredSemaphore).
 
ito::RetVal stopDeviceAndUnregisterListener (QObject *obj, ItomSharedSemaphore *waitCond=NULL)
 stops device and unregisters obj (live image).
 
- Public Slots inherited from ito::AddInBase
virtual ito::RetVal init (QVector< ito::ParamBase > *paramsMand, QVector< ito::ParamBase > *paramsOpt, ItomSharedSemaphore *waitCond=NULL)=0
 method for the initialisation of a new instance of the class (must be overwritten)
 
virtual ito::RetVal close (ItomSharedSemaphore *waitCond)=0
 method for closing an instance (must be overwritten)
 
virtual ito::RetVal getParam (QSharedPointer< ito::Param > val, ItomSharedSemaphore *waitCond=NULL)=0
 method for the retrieval of a parameter. The actual value is always passed as ito::Param (must be overwritten). See also setParam
 
virtual ito::RetVal setParam (QSharedPointer< ito::ParamBase > val, ItomSharedSemaphore *waitCond=NULL)=0
 method to set a parameter. The actual value is always passed as ito::ParamBase (must be overwritten). See also getParam
 
ito::RetVal setParamVector (const QVector< QSharedPointer< ito::ParamBase > > values, ItomSharedSemaphore *waitCond=NULL)
 method for setting various parameters (can be used instead of multiple calls to setParam, this can safe multiple invocations)
 
ito::RetVal getParamVector (const QVector< QSharedPointer< ito::Param > > values, ItomSharedSemaphore *waitCond=NULL)
 method for getting various parameters (can be used instead of multiple calls to getParam, this can safe multiple invocations)
 
virtual ito::RetVal execFunc (const QString funcName, QSharedPointer< QVector< ito::ParamBase > > paramsMand, QSharedPointer< QVector< ito::ParamBase > > paramsOpt, QSharedPointer< QVector< ito::ParamBase > > paramsOut, ItomSharedSemaphore *waitCond=NULL)
 overwrite this function if you registered exec funcs. Once the exec function is called, this method is executed.
 
ito::RetVal moveBackToApplicationThread (ItomSharedSemaphore *waitCond=NULL)
 method invoked by AddInManager if the plugin should be pulled back to the main thread of itom. (not for direct use in plugins)
 
void sendParameterRequest ()
 immediately emits the signal parametersChanged
 
- Signals inherited from ito::AddInBase
void parametersChanged (QMap< QString, ito::Param > params)
 This signal usually is emitted if the vector m_params is changed.
 
- Static Public Member Functions inherited from ito::AddInBase
static int getMaximumThreadCount ()
 
static RetVal setMaximumThreadCount (int threadCount)
 

Detailed Description

Inherit from AddInGrabber if you write a camera/grabber plugin. Please call the constructor of AddInGrabber within your plugin constructor.

This class contains important variables and helper methods which simplify the creation of a camera plugin. Please consider that you should implement the methods checkImage() and retriveImage() (pure virtual in this class) in your own class.

See also
checkImage(), retrieveImage()

Member Function Documentation

◆ checkData()

ito::RetVal ito::AddInGrabber::checkData ( ito::DataObject * externalDataObject = NULL)
protectedvirtual

implement this method in order to check if m_image should be (re)allocated with respect to the current sizex, sizey, bpp...

Call this method if the size or bitdepth of your camera has changed (e.g. in your constructor, too). In this method, compare if the new size is equal to the old one. If this is not the case, use the following example to set m_image to a newly allocated dataObject. The old dataObject is deleted automatically with respect to its internal reference counter:

m_image = ito::DataObject(futureHeight,futureWidth,futureType);

See also
m_image

◆ decGrabberStarted()

void ito::AddInGrabber::decGrabberStarted ( )
inlineprotected

sets the number of started devices to a given value

See also
m_started

◆ grabberStartedCount()

int ito::AddInGrabber::grabberStartedCount ( )
inlineprotected

returns the number of started devices

See also
m_started increments the number of started devices
m_started

◆ incGrabberStarted()

void ito::AddInGrabber::incGrabberStarted ( )
inlineprotected

decrements the number of started devices

See also
m_started

◆ retrieveData()

virtual ito::RetVal ito::AddInGrabber::retrieveData ( ito::DataObject * externalDataObject = NULL)
protectedpure virtual

implement this method in your camera plugin. In this method the image is grabbed and stored in the m_image variable.

Call this method in getVal(...) in order to get the image from the camera and deeply copy it the the m_image variable. This method is equally called from timerEvent.

Returns
retOk if copy operation was successful, else retWarning or retError
See also
getVal, timerEvent

◆ sendDataToListeners()

ito::RetVal ito::AddInGrabber::sendDataToListeners ( int waitMS)
protected

sends m_image to all registered listeners.

sends m_data to all registered listeners.

This method is continuously called from timerEvent. Also call this method from your getVal-Method (usually with 0-timeout)

Parameters
[in]waitMSindicates the time (in ms) that should be waiting until every registered live image source node received m_image. 0: no wait, -1: infinite waiting time, else time in milliseconds
Returns
retOk if everything was ok, retWarning if live image could not be invoked

◆ timerEvent()

void ito::AddInGrabber::timerEvent ( QTimerEvent * event)
protected

if any live image has been connected to this camera, this event will be regularly fired.

this method is called every time when the auto-grabbing-timer is fired. Usually you don't have to overwrite this method.

This event is continoulsy fired if auto grabbing is enabled. At first, the image is acquired (method acquire). Then the image is retrieved (retrieveImage) and finally the newly grabbed image is send to all registered listeners (sendImagetoListeners)

Member Data Documentation

◆ m_data

ito::DataObject ito::AddInGrabber::m_data
protected

variable for the recently grabbed image

◆ m_started

int ito::AddInGrabber::m_started
private

counter indicating how many times startDevice has been called

increment this variable every time startDevice is called (by incGrabberStarted()) decrement this variable every time stopDevice is called (by decGrabberStarted())

See also
grabberStartedCount, incGrabberStarted, decGrabberStarted, setGrabberStarted

The documentation for this class was generated from the following files: