Scanframe Modular Application 0.1.0
Loading...
Searching...
No Matches
RsaInterface.h
Go to the documentation of this file.
1#pragma once
3#include <misc/gen/Value.h>
5#include <rsa/iface/global.h>
6
7namespace sf
8{
9
10// Forward declaration.
12
17{
18 public:
23 {
24 explicit Parameters(int mode)
25 : _mode(mode)
26 {}
27
28 int _mode;
29 };
30
34 explicit RsaInterface(const Parameters&);
35
39 virtual ~RsaInterface();
40
45 bool initialize();
46
52
57 [[nodiscard]] EAcquisitionType getType() const;
58
64 bool storeSettings(bool read);
65
69 [[nodiscard]] int getError() const;
70
74 unsigned getChannelCount();
75
81 unsigned getGateCount(unsigned channel);
82
89 std::string getGateName(unsigned int gate, unsigned int channel = 0);
90
97 bool setPopManual(int channel, EPopManual pm);
98
104 [[nodiscard]] EPopManual getPopManual(int channel) const;
105
112 bool getParamInfo(IdType id, ParamInfo& info) const;
113
121 bool getParam(IdType id, Value& value) const;
122
131 bool setParam(IdType id, const Value& value, bool skip_event);
132
140 bool paramSetGet(IdType id, Value& value, bool skip_event);
141
153 virtual bool handleParam(IdType id, ParamInfo* info, const Value* setval, Value* getval) = 0;
154
158 bool setParam(EDefaultParam param, unsigned gate, unsigned ch, const Value& value, bool skip_event);
159
163 bool getParam(EDefaultParam param, unsigned gate, unsigned ch, Value& value) const;
164
171 virtual bool setRunMode(bool on, bool clear) = 0;
172
176 virtual bool getRunMode() const = 0;
177
185 virtual IdType getParamId(EDefaultParam param, unsigned gate = UINT_MAX, unsigned channel = UINT_MAX) const = 0;
186
192 virtual bool enumParamIds(IdList& ids) = 0;
193
198 void setParamHook(NotifyProc proc, void* data);
199
203 void setResultHook(NotifyProc proc, void* data);
204
212 [[nodiscard]] virtual IdType getResultId(EDefaultResult result, unsigned gate = UINT_MAX, unsigned channel = UINT_MAX) const = 0;
213
219 virtual bool enumResultIds(IdList& ids) = 0;
220
225
229 virtual bool handleResult(IdType id, ResultInfo* info, BufferInfo* bufInfo) = 0;
230
236
241 [[nodiscard]] bool isInitialized() const;
242
247 [[nodiscard]] std::string getProfilePath() const;
248
254
255 protected:
263 virtual bool doInitialize(bool init)
264 {
265 return true;
266 }
267
274
281
290
291 private:
292 // Holds the pointer to the parameter change procedure.
293 NotifyProc _paramNotifyProcedure;
294 // Holds the pointer to the result change procedure.
295 NotifyProc _resultNotifyProcedure;
296 // Holds the data set with the hook.
297 void* _paramNotifyData;
298 // Holds the data set with the hook.
299 void* _resultNotifyData;
300 // Holds flag of implementation initialization.
301 bool _initialized;
302 // Holds the implementation type.
303 EAcquisitionType _acquisitionType;
304
305 // Declarations of static functions and data members to be able to create registered RSA implementations.
307};
308
310{
311 return _initialized;
312}
313
314}// namespace sf
#define SF_DECL_IFACE(InterfaceType, ParamType, FuncName)
Declares a public static function in the class where it is used. Where: InterfaceType: Global typenam...
Definition TClassRegistration.h:71
Dialog containing multiple property pages.
Definition qt/PropertySheetDialog.h:14
Base class for the repetitive signal acquisition interface.
Definition RsaInterface.h:17
std::string getGateName(unsigned int gate, unsigned int channel=0)
Gets the name of the passed gate and channel.
unsigned getGateCount(unsigned channel)
Gets the amount of gates for this channels' implementation.
bool uninitialize()
Un-initializes the implementation. Calls doInitialize.
bool storeSettings(bool read)
Writes the non exported parameters to profile.
virtual IdType getParamId(EDefaultParam param, unsigned gate=UINT_MAX, unsigned channel=UINT_MAX) const =0
Gets the ID of the parameter for the specified gate.
virtual void addPropertyPages(PropertySheetDialog *sheet)
Adds controller specific property pages to the passed sheet.
bool getParamInfo(IdType id, ParamInfo &info) const
bool getParam(IdType id, Value &value) const
Gets the value of the specified parameter id. When the ID does not exist it returns false.
bool paramSetGet(IdType id, Value &value, bool skip_event)
Sets and immediately gets the same value again clipped or not.
unsigned getChannelCount()
Gets the amount of channels for this implementation.
bool getResultBuffer(IdType id, BufferInfo &bufInfo)
Gets the result buffer associated with the result id passed in the result hook at the time of the cal...
bool setParam(EDefaultParam param, unsigned gate, unsigned ch, const Value &value, bool skip_event)
Same as setParam() but the ID is formed by getParamId()
int getError() const
Gets the error value.
EAcquisitionType getType() const
bool initialize()
Initializes the implementation for operation. Calls doInitialize.
void callParamHook(IdType id)
Calls the hooked function when it exists.
bool isInitialized() const
For testing initialization by the implementation.
Definition RsaInterface.h:309
virtual bool handleParam(IdType id, ParamInfo *info, const Value *setval, Value *getval)=0
Pure virtual method to be overridden in a derived class. This method handles the interface parameters...
bool getResultInfo(IdType id, ResultInfo &info)
Retrieve information about the passed id.
virtual bool getRunMode() const =0
Gets the current run mode of a derived class.
bool getParam(EDefaultParam param, unsigned gate, unsigned ch, Value &value) const
Same as getParam() but the ID is formed by getParamId()
virtual bool handleResult(IdType id, ResultInfo *info, BufferInfo *bufInfo)=0
Handles results.
virtual bool doInitialize(bool init)
Must be overridden by a derived class. Should check the hardware configuration.
Definition RsaInterface.h:263
bool setPopManual(int channel, EPopManual pm)
Sets the pop manual state for a channel.
void setParamHook(NotifyProc proc, void *data)
Sets a procedure hook for the interface implementation to be called when the value changes as a resul...
virtual ~RsaInterface()
Virtual destructor for derived classes.
bool setType(EAcquisitionType at)
Sets the implementation type of the implementation used by the server side. Only allowed before and d...
EPopManual getPopManual(int channel) const
Gets the pop-manual state on a channel.
virtual bool setRunMode(bool on, bool clear)=0
Sets the implementation in hold or Run mode.
void setResultHook(NotifyProc proc, void *data)
Sets a procedure hook for the interface implementation to be called when there ias data result has da...
bool setParam(IdType id, const Value &value, bool skip_event)
Sets the value of the specified parameter id. When the ID does not exist it returns false.
virtual IdType getResultId(EDefaultResult result, unsigned gate=UINT_MAX, unsigned channel=UINT_MAX) const =0
Returns the ID of the result for the specified gate.
RsaInterface(const Parameters &)
Constructor for passing general structure for derived classes.
std::string getProfilePath() const
Returns the path of the static configuration of the driver.
void callResultHook(IdType id)
Calls the hooked function when it exists.
virtual bool enumParamIds(IdList &ids)=0
Gets all interface parameters ids.
virtual bool enumResultIds(IdList &ids)=0
Gets interface results ids.
Counted vector having additional methods and operators for ease of usage. This template class extends...
Definition TVector.h:20
Value container class able to performing arithmetic functions.
Definition Value.h:19
Definition Application.h:10
class _MISC_CLASS PropertySheetDialog
Definition gen/PropertySheetDialog.h:18
#define _RSA_CLASS
Definition rsa/iface/global.h:35
Parameters structure passed to an RSA implementation class.
Definition RsaInterface.h:23
Parameters(int mode)
Definition RsaInterface.h:24
int _mode
Definition RsaInterface.h:28
Definition RsaTypes.h:329
Structure to hold parameter information.
Definition RsaTypes.h:122
Definition RsaTypes.h:233
Type holding all types for the RsaInterface in a single namespaced structure.
Definition RsaTypes.h:22
EDefaultResult
Definition RsaTypes.h:472
EDefaultParam
Definition RsaTypes.h:385
unsigned long long IdType
Type for gathering parameter ID's.
Definition RsaTypes.h:26
EAcquisitionType
Definition RsaTypes.h:373
EPopManual
Enumerate for the pop manual function.
Definition RsaTypes.h:507