Scanframe Modular Application 0.1.0
Loading...
Searching...
No Matches
GmiServer.h
Go to the documentation of this file.
1#pragma once
4#include <gii/gen/Variable.h>
6#include <gmi/iface/global.h>
8
9namespace sf
10{
12{
13 public:
20 explicit TMotionServer(gmi::Controller* controller, int device_nr = -1, const char* dev_name = nullptr);
34 const Variable& GetVariable(int pid);
39 bool IsLocked() const
40 {
41 return FLock;
42 }
47 void SetLocked(bool flag);
48
49 protected:
53 unsigned GetAxisCount();
59 std::string GetAxisName(int axis);
60
69
75 unsigned VarListFind(int id) const;
83 bool CreateVariable(Variable*& var, gmi::ParamInfo& info, std::string setup);
95 std::string CreateSetupString(const gmi::ParamInfo& info, long vid);
105 std::string GetNameOfs(const gmi::ParamInfo& info);
106
112 unsigned ResListFind(int id) const;
113
120 ResultData* CreateResultData(gmi::ResultInfo& info, std::string setup);
121
127
134 std::string CreateSetupString(const gmi::ResultInfo& info, long vid);
135
140
146 std::string GetNameOfs(const gmi::ResultInfo& info);
147
152 {
156 unsigned Axis;
160 int Id;
164 std::string SetupString;
168 int Flags;
169 };
173 ExtraInfo* Cast(Variable* var) const;
190 // -------------------------------------------------
191 // Callback hook for variable events.
192 VariableLinkHandler<TMotionServer> SrvVarLink;
193 // Event handler for variables.
194 void ServerVarHandler(Variable::EEvent event, const Variable& caller, Variable& linker, bool sameinst);
195 // Holds all created variables for the selected implementation.
196 TVariable::TPtrVector VarList;
197 // -------------------------------------------------
198 // Callback hook for result events.
199 TResultDataLinkHandler<TMotionServer> SrvResLink;
200 // Event handler for results.
201 void ServerResHandler(ResultData::EEvent event, const ResultData& caller, ResultData& link, const Range& rng, bool same_inst);
202 // Holds all created results for this instance.
203 TResultData::TPtrVector ResList;
204
205 // -------------------------------------------------
206 // Device number for this server.
208 // Holds the count of this kind of interfaces.
209 static unsigned ServerMap;
210 // Holds the device name for creating the variable names.
211 mstring DeviceName;
212 // -------------------------------------------------
213 // Variable indicating lock status.
214 bool FLock;
215 // ID of interface parameter being processed by the param hook.
217 // -------------------------------------------------
218 // Holds the variable handler entry count.
220 // Holds the id for the position motion status.
221 const TVariable* VMovePos;
222 // Holds the id for the velocity motion status.
223 const TVariable* VMoveVel;
224 // -------------------------------------------------
225
226 // Hook function indirectly called from the AQ implemntation.
227 void ParamNotify(int id);
228 void ResultNotify(int id);
229 // Setst the variables to readonly based on the flags and lock status.
231
232 // Hook function called directly by the implementation.
233 static void ParamNotifyProc(void* data, int id);
234 static void ResultNotifyProc(void* data, int id);
235
236 friend class MotionVariablePropertyPage;
237};
238
239}// namespace sf
Dialog containing multiple property pages.
Definition qt/PropertySheetDialog.h:14
Class to manage 64-bit integer ranges.
Definition Range.h:52
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 GmiServer.h:12
void EvaluateInterfaceResults()
Evaluate results after the configuration has changed.
unsigned GetAxisCount()
Gets the amount of axes for this implementation.
TResultDataLinkHandler< TMotionServer > SrvResLink
Definition GmiServer.h:199
ResultData * CreateResultData(gmi::ResultInfo &info, std::string setup)
Creates a variable with an extra info structure attached.
static void ParamNotifyProc(void *data, int id)
int VarHandlerEntryCount
Definition GmiServer.h:219
void EvaluateInterfaceParams()
Evaluate parameters after the configuration has changed.
void DestroyInterface()
Remove all parameters and results.
Variable VImplementation
Variable for selecting an implementation.
Definition GmiServer.h:189
void DestroyResultData(ResultData *var)
Destroys a variable including the attached extra info structure.
unsigned ResListFind(int id) const
Looks up a result data which is represented the interface id.
void ResultNotify(int id)
void CreateInterface()
Create interface parameters at construction once.
ExtraInfo * Cast(ResultData *var) const
Easy to use function to access the extra info from a result data.
void DestroyVariable(Variable *var)
Destroys a variable including the attached extra info structure.
TMotionServer(gmi::Controller *controller, int device_nr=-1, const char *dev_name=nullptr)
Constructor.
bool IsLocked() const
Returns true when all parameters are locked.
Definition GmiServer.h:39
void ParamNotify(int id)
~TMotionServer()
Destructor.
std::string GetNameOfs(const gmi::ResultInfo &info)
Returns the name of the channel using the device name.
bool CreateVariable(Variable *&var, gmi::ParamInfo &info, std::string setup)
Creates a variable with an extra info structure attached.
ExtraInfo * Cast(Variable *var) const
Easy to use function to access the extra info from a variable.
std::string CreateSetupString(const gmi::ParamInfo &info, long vid)
Creates a setup string from the passed parameter info structure.
void ServerVarHandler(Variable::EEvent event, const Variable &caller, Variable &linker, bool sameinst)
long FHandledParamId
Definition GmiServer.h:216
static unsigned ServerMap
Definition GmiServer.h:209
const Variable & GetVariable(int pid)
Gets the owner variable that corresponds the motion interfaces parameter id.
std::string CreateSetupString(const gmi::ResultInfo &info, long vid)
Creates a setup string from the passed result info structure.
const TVariable * VMoveVel
Definition GmiServer.h:223
std::string GetNameOfs(const gmi::ParamInfo &info)
Gets the name of the channel using the device name.
bool FLock
Definition GmiServer.h:214
void SetLocked(bool flag)
Locks the variables by making them all read only.
static void ResultNotifyProc(void *data, int id)
void ClearValidations()
Overloaded from InfoServer.
mstring DeviceName
Definition GmiServer.h:211
void ServerResHandler(ResultData::EEvent event, const ResultData &caller, ResultData &link, const Range &rng, bool same_inst)
TVariable::TPtrVector VarList
Definition GmiServer.h:196
void AddPropertyPages(PropertySheetDialog *sheet)
Add the property sheets for this server to the given dialog.
unsigned VarListFind(int id) const
Looks up a parameter which is represented the interface by the given id.
gmi::Controller * Controller
Holds the acquisition implementation.
Definition GmiServer.h:185
const TVariable * VMovePos
Definition GmiServer.h:221
std::string GetAxisName(int axis)
Gets the axis name of the given axis.
TResultData::TPtrVector ResList
Definition GmiServer.h:203
int DeviceNr
Definition GmiServer.h:207
VariableLinkHandler< TMotionServer > SrvVarLink
Definition GmiServer.h:192
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
Definition Application.h:10
Structure placed in the TVariable's Data field for fast access to information.
Definition GmiServer.h:152
int Id
Holds the interface id.
Definition GmiServer.h:160
unsigned Axis
Holds the channel number.
Definition GmiServer.h:156
int Flags
Flags copied from the TParamInfo structure.
Definition GmiServer.h:168
std::string SetupString
Definition GmiServer.h:164
Structure to hold parameter information.
Definition GmiInterface.h:107
Structure to hold parameter information.
Definition GmiInterface.h:171