Scanframe Modular Application 0.1.0
Loading...
Searching...
No Matches
GmiServer.h
Go to the documentation of this file.
1#pragma once
3#include <gii/gen/Variable.h>
6#include <gmi/iface/global.h>
8
9namespace sf
10{
11
13{
14 public:
20 explicit GmiServer(id_type device_number, const std::string& server_name);
21
26
30 std::string getServerName() const;
31
35 std::string getImplementationName() const;
36
40 bool createImplementation(const std::string& name = {});
41
46
51
57 const Variable& getVariable(int pid);
58
64
70
75 bool isLocked() const
76 {
77 return _lock;
78 }
79
84 void setLocked(bool flag);
85
86 protected:
90 unsigned getAxisCount();
96 std::string getAxisName(int axis);
97
102
107
114
122 bool createVariable(Variable*& var, const gmi::ParamInfo& info, const std::string& setup);
128
135 std::string createSetupString(const gmi::ParamInfo& info, gmi::IdType vid);
136
141
147 std::string GetNameOfs(const gmi::ParamInfo& info);
148
155
162 ResultData* CreateResultData(const gmi::ResultInfo& info, const std::string& setup);
163
169
176 std::string createSetupString(const gmi::ResultInfo& info, gmi::IdType vid);
177
182
188 std::string GetNameOfs(const gmi::ResultInfo& info);
189
194 {
198 unsigned Axis;
206 std::string SetupString;
210 int Flags;
211 };
212
218
224
229
242
246 void serverVariableHandler(Variable::EEvent event, const Variable& caller, Variable& linker, bool same_inst);
255
259 void serverResultDataHandler(ResultData::EEvent event, const ResultData& caller, ResultData& link, const Range& rng, bool same_inst);
260
272 std::string _serverName;
276 bool _lock;
293
299
305
310
314 Variable _zero{0, false};
315
316 static void paramNotifyProc(void* data, gmi::IdType id);
317
318 static void resultNotifyProc(void* data, gmi::IdType id);
319
320 protected:
321 friend class MotionVariablePropertyPage;
322};
323
324}// namespace sf
Definition GmiServer.h:13
bool createVariable(Variable *&var, const gmi::ParamInfo &info, const std::string &setup)
Creates a variable with an extra info structure attached.
TVariableHandler< GmiServer > _serverVariableHandler
Callback hook for variable events.
Definition GmiServer.h:241
std::string getImplementationName() const
Gets the name of the current implementation.
gmi::Controller * getController()
Gets the created controller pointer.
void serverResultDataHandler(ResultData::EEvent event, const ResultData &caller, ResultData &link, const Range &rng, bool same_inst)
Event handler for results.
std::string getServerName() const
Gets the name given at the constructor.
const Variable * _vMoveVel
Holds the pointer to a velocity motion status variable.
Definition GmiServer.h:292
const Variable * _vMovePos
Holds the pointer to a position motion status variable.
Definition GmiServer.h:288
static void paramNotifyProc(void *data, gmi::IdType id)
GmiServer(id_type device_number, const std::string &server_name)
Constructor.
void destroyResultData(ResultData *var)
Destroys a variable including the attached extra info structure.
std::string createSetupString(const gmi::ParamInfo &info, gmi::IdType vid)
Creates a setup string from the passed parameter info structure.
bool _lock
Variable indicating lock status.
Definition GmiServer.h:276
void destroyImplementation()
Destroys the created implementation.
static void resultNotifyProc(void *data, gmi::IdType id)
std::string createSetupString(const gmi::ResultInfo &info, gmi::IdType vid)
Creates a setup string from the passed result info structure.
gmi::IdType _handledParamId
The id of the interface parameter being processed by the param hook.
Definition GmiServer.h:280
void setLocked(bool flag)
Locks the variables by making them all read only.
int _varHandlerEntryCount
Holds the variable handler entry count.
Definition GmiServer.h:284
void evaluateInterfaceResults()
Evaluate results after the configuration has changed.
std::string GetNameOfs(const gmi::ResultInfo &info)
Returns the name of the channel using the device name.
Variable::PtrVector::size_type variableListFind(id_type id) const
Looks up a parameter which is represented the interface by the given id.
ResultData * CreateResultData(const gmi::ResultInfo &info, const std::string &setup)
Creates a variable with an extra info structure attached.
void evaluateInterfaceParams()
Evaluate parameters after the configuration has changed.
void destroyVariable(Variable *var)
Destroys a variable including the attached extra info structure.
std::string getAxisName(int axis)
Gets the axis name of the given axis.
std::string _serverName
Holds the device name for creating the variable names.
Definition GmiServer.h:272
bool createImplementation(const std::string &name={})
Creates an attached implementation by name.
void clearValidations()
Clears the committed ranges of the attached results if there are any.
gmi::Controller * _controller
Holds the controller implementation.
Definition GmiServer.h:233
ResultData::PtrVector::size_type resultListFind(id_type id) const
Looks up a result data which is represented the interface id.
int _deviceNumber
Holds the device number for this server.
Definition GmiServer.h:268
const Variable::PtrVector & getVariables() const
Gets all associated variables of the implementation.
void paramNotify(id_type id)
Hook function for parameter indirectly called from the implementation.
TResultDataHandler< GmiServer > _serverResultDataHandler
Callback hook for result events.
Definition GmiServer.h:254
const Variable & getVariable(int pid)
Gets the owner variable that corresponds the motion interfaces parameter id.
void serverVariableHandler(Variable::EEvent event, const Variable &caller, Variable &linker, bool same_inst)
Event handler for variables.
Variable _vImplementation
Variable for selecting an implementation.
Definition GmiServer.h:237
void createInterface()
Create interface parameters at construction once.
Variable::PtrVector _variableVector
Holds all created variables for the selected implementation.
Definition GmiServer.h:250
ExtraInfo * castExtraInfo(ResultData *var) const
Easy to use function to access the extra info from a result data. TODO: Use ResultData::getData<type>...
ExtraInfo * castExtraInfo(Variable *var) const
Easy to use function to access the extra info from a variable. TODO: Use Variable::getData<type>() te...
ResultData::PtrVector _resultVector
Holds all created results for this instance.
Definition GmiServer.h:264
void checkReadOnly()
Sets the variables to readonly based on the flags and lock status.
void destroyInterface()
Remove all parameters and results.
~GmiServer()
Destructor.
bool isLocked() const
Returns true when all parameters are locked.
Definition GmiServer.h:75
unsigned getAxisCount()
Gets the amount of axes for this implementation.
void addPropertyPages(PropertySheetDialog *sheet)
Add the property sheets for this server to the given dialog.
std::string GetNameOfs(const gmi::ParamInfo &info)
Gets the name of the channel using the device name.
void resultNotify(id_type id)
Hook function for parameter indirectly called from the implementation.
Base class for all generic information objects to be able to put them in a typed list together.
Definition InformationBase.h:25
unsigned long long id_type
Type used for the identifying integer (64-bits).
Definition InformationBase.h:30
Dialog containing multiple property pages.
Definition qt/PropertySheetDialog.h:14
Class to manage 64-bit integer ranges.
Definition Range.h:53
EEvent
Event enumerate values used in broadcasting where global events have a negative value.
Definition ResultDataTypes.h:46
Class for creating and referencing global created data called result data. This class allows linking ...
Definition ResultData.h:20
Definition ResultDataHandler.h:33
Template for linking pointers of member function to Variable instances.
Definition VariableHandler.h:38
base_type::size_type size_type
Size type of this template.
Definition TVector.h:29
EEvent
Events send to the handler set with sf::Variable::setHandler.
Definition VariableTypes.h:130
Class for creating and referencing global or local created parameters or settings called variables....
Definition Variable.h:16
Pure virtual class for implementation of motion controllers.
Definition Controller.h:13
#define _GMI_CLASS
Definition gmi/iface/global.h:35
unsigned long long IdType
Type for gathering parameter ID's.
Definition GmiTypes.h:19
Definition Application.h:10
Structure placed in the TVariable's Data field for fast access to information.
Definition GmiServer.h:194
gmi::IdType Id
Holds the interface id.
Definition GmiServer.h:202
int Flags
Flags copied from the TParamInfo structure.
Definition GmiServer.h:210
std::string SetupString
Holds the last setup string for comparison.
Definition GmiServer.h:206
unsigned Axis
Holds the channel number.
Definition GmiServer.h:198
Structure to hold parameter information.
Definition GmiInterface.h:107
Structure to hold parameter information.
Definition GmiInterface.h:171