itom  4.1.0
pluginThreadCtrl.h
1 /* ********************************************************************
2  itom software
3  URL: http://www.uni-stuttgart.de/ito
4  Copyright (C) 2020, Institut fuer Technische Optik (ITO),
5  Universitaet Stuttgart, Germany
6 
7  This file is part of itom and its software development toolkit (SDK).
8 
9  itom is free software; you can redistribute it and/or modify it
10  under the terms of the GNU Library General Public Licence as published by
11  the Free Software Foundation; either version 2 of the Licence, or (at
12  your option) any later version.
13 
14  In addition, as a special exception, the Institut fuer Technische
15  Optik (ITO) gives you certain additional rights.
16  These rights are described in the ITO LGPL Exception version 1.0,
17  which can be found in the file LGPL_EXCEPTION.txt in this package.
18 
19  itom is distributed in the hope that it will be useful, but
20  WITHOUT ANY WARRANTY; without even the implied warranty of
21  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
22  General Public Licence for more details.
23 
24  You should have received a copy of the GNU Library General Public License
25  along with itom. If not, see <http://www.gnu.org/licenses/>.
26 *********************************************************************** */
27 
28 #ifndef PLUGINTHREADCTRL_H
29 #define PLUGINTHREADCTRL_H
30 
31 #include "typeDefs.h"
32 #include "addInInterface.h"
33 #include "sharedStructures.h"
34 
35 #if !defined(Q_MOC_RUN) || defined(ITOMCOMMONQT_MOC) //only moc this file in itomCommonQtLib but not in other libraries or executables linking against this itomCommonQtLib
36 
37 namespace ito
38 {
39 
40 //----------------------------------------------------------------------------------------------------------------------------------
49 class ITOMCOMMONQT_EXPORT PluginThreadCtrl
50 {
51 protected:
55 public:
58 
60 
71  PluginThreadCtrl(const ito::ParamBase &pluginParameter, ito::RetVal *retval = NULL);
72 
74 
83  PluginThreadCtrl(ito::AddInBase *plugin, ito::RetVal *retval = NULL);
84 
86  PluginThreadCtrl(const PluginThreadCtrl &other);
87 
89  virtual ~PluginThreadCtrl();
90 
92  PluginThreadCtrl& operator =(const PluginThreadCtrl &other);
93 
94  ito::RetVal getParam(ito::Param &val, int timeOutMS = PLUGINWAIT);
95  ito::RetVal setParam(ito::ParamBase val, int timeOutMS = PLUGINWAIT);
97  ito::RetVal waitForSemaphore(int timeOutMS = PLUGINWAIT);
98 };
99 
100 
101 //-----------------------------------------------------------------------------------
149 class ITOMCOMMONQT_EXPORT DataIOThreadCtrl : public PluginThreadCtrl
150 {
151 public:
154 
156 
167  DataIOThreadCtrl(const ito::ParamBase &pluginParameter, ito::RetVal *retval = NULL);
168 
170 
179  DataIOThreadCtrl(ito::AddInDataIO *plugin, ito::RetVal *retval = NULL);
180 
182  DataIOThreadCtrl(const DataIOThreadCtrl &other);
183 
185  virtual ~DataIOThreadCtrl();
186 
187  ito::RetVal startDevice(int timeOutMS = PLUGINWAIT);
188  ito::RetVal stopDevice(int timeOutMS = PLUGINWAIT);
189  ito::RetVal acquire(const int trigger = 0, int timeOutMS = PLUGINWAIT);
190  ito::RetVal getVal(ito::DataObject &dObj, int timeOutMS = PLUGINWAIT);
191  ito::RetVal copyVal(ito::DataObject &dObj, int timeOutMS = PLUGINWAIT);
192  ito::RetVal enableAutoGrabbing(int timeOutMS = PLUGINWAIT);
193  ito::RetVal disableAutoGrabbing(int timeOutMS = PLUGINWAIT);
194  ito::RetVal setAutoGrabbingInterval(QSharedPointer<int> interval, int timeOutMS = PLUGINWAIT);
195  bool getAutoGrabbing();
197  ito::RetVal getImageParams(int &bpp, int &sizex, int &sizey, int timeOutMS = PLUGINWAIT);
198 };
199 
200 //-----------------------------------------------------------------------------------
239 class ITOMCOMMONQT_EXPORT ActuatorThreadCtrl : public PluginThreadCtrl
240 {
241 protected:
242  int m_numAxes;
243 
244 public:
247 
249 
260  ActuatorThreadCtrl(const ito::ParamBase &pluginParameter, ito::RetVal *retval = NULL);
261 
263 
272  ActuatorThreadCtrl(ito::AddInActuator *plugin, ito::RetVal *retval = NULL);
273 
276 
278  virtual ~ActuatorThreadCtrl();
279 
280  ito::RetVal setPosRel(const QVector<int> &axes, const QVector<double> &relPositions, int timeOutMS = PLUGINWAIT);
281  ito::RetVal setPosAbs(const QVector<int> &axes, const QVector<double> &absPositions, int timeOutMS = PLUGINWAIT);
282  ito::RetVal setPosRel(int axis, double relPosition, int timeOutMS = PLUGINWAIT);
283  ito::RetVal setPosAbs(int axis, double absPosition, int timeOutMS = PLUGINWAIT);
285  ito::RetVal getPos(QVector<int> axes, QVector<double> &positions, int timeOutMS = PLUGINWAIT);
286  ito::RetVal getPos(int axis, double &position, int timeOutMS = PLUGINWAIT);
289  ito::RetVal checkAxis(int axisNum);
290 };
291 
292 } // end namespace ito
293 
294 #endif //#if !defined(Q_MOC_RUN) || defined(ITOMCOMMONQT_MOC)
295 #endif //PLUGINTHREADCTRL_H
PyObject * setParam(ito::AddInBase *addInObj, PyObject *args)
Definition: pythonPlugins.cpp:1347
base class for all actuator plugin classes
Definition: addInInterface.h:738
dataObject contains a n-dimensional matrix
Definition: dataobj.h:511
Locker-class for ItomSharedSemaphore. The functionality is equal to QMutexLocker in Qt...
Definition: sharedStructuresQt.h:232
Class for managing status values (like errors or warning)
Definition: retVal.h:54
class for parameter handling e.g. to pass paramters to plugins
Definition: param.h:283
base class for all dataIO plugin classes
Definition: addInInterface.h:661
Base class for all plugins.
Definition: addInInterface.h:385
Base class for DataIOThreadCtrl and ActuatorThreadCtrl.
Definition: pluginThreadCtrl.h:49
PyObject * getParam(ito::AddInBase *addInObj, PyObject *args)
Definition: pythonPlugins.cpp:868
Definition: apiFunctionsGraph.cpp:39
Helper class to give plugin developers an easy access to cameras in other threads.
Definition: pluginThreadCtrl.h:149
Helper class to give plugin developers an easy access to actuators in other threads.
Definition: pluginThreadCtrl.h:239
ito::AddInBase * m_pPlugin
Definition: pluginThreadCtrl.h:52
Definition: param.h:67
ItomSharedSemaphoreLocker m_semaphoreLocker
Definition: pluginThreadCtrl.h:53