1#ifndef EURESYS_FEATURE_H
2#define EURESYS_FEATURE_H
9using namespace Euresys;
11static const char *className =
"EuresysFeature";
18 std::string
const & asynName, asynParamType asynType,
int asynIndex,
21 :
GenICamFeature(set, asynName, asynType, asynIndex, featureName, featureType),
22 mAsynUser(set->getUser()),
23 mFeatureName(featureName)
25 static const char *functionName =
"EuresysFeature";
30 mIsImplemented = mGrabber->getInteger<ModuleType>(query::implemented(mFeatureName)) ?
true :
false;
32 catch (std::exception &e) {
33 asynPrint(mAsynUser, ASYN_TRACE_ERROR,
"%s::%s query error for implemented=%s\n",
34 className, functionName, e.what());
40 return mIsImplemented;
44 static const char *functionName =
"isAvailable";
46 if (!mIsImplemented)
return value;
48 value = mGrabber->getInteger<ModuleType>(query::available(mFeatureName)) ?
true :
false;
50 catch (std::exception &e) {
51 reportError(functionName,
"query error for available", e.what());
57 static const char *functionName =
"isReadable";
59 if (!mIsImplemented)
return value;
61 value = mGrabber->getInteger<ModuleType>(query::readable(mFeatureName)) ?
true :
false;
63 catch (std::exception &e) {
64 reportError(functionName,
"query error for readable", e.what());
70 static const char *functionName =
"isWritable";
72 if (!mIsImplemented)
return value;
74 value = mGrabber->getInteger<ModuleType>(query::writeable(mFeatureName)) ?
true :
false;
76 catch (std::exception &e) {
77 reportError(functionName,
"query error for writeable", e.what());
83 static const char *functionName =
"readInteger";
86 value = mGrabber->getInteger<ModuleType>(mFeatureName);
88 catch (std::exception &e) {
89 reportError(functionName,
"error calling getInteger", e.what());
95 static const char *functionName =
"readIntegerMin";
98 value = mGrabber->getInteger<ModuleType>(mFeatureName+
".Min");
100 catch (std::exception &e) {
101 reportError(functionName,
"error calling getInteger", e.what());
107 static const char *functionName =
"readIntegerMax";
108 epicsInt64 value = 0;
110 value = mGrabber->getInteger<ModuleType>(mFeatureName+
".Max");
112 catch (std::exception &e) {
113 reportError(functionName,
"error calling getInteger", e.what());
119 static const char *functionName =
"readIncrement";
120 epicsInt64 value = 0;
122 value = mGrabber->getInteger<ModuleType>(mFeatureName+
".Inc");
124 catch (std::exception &e) {
125 reportError(functionName,
"error calling getInteger", e.what());
131 static const char *functionName =
"writeInteger";
133 mGrabber->setInteger<ModuleType>(mFeatureName, value);
135 catch (std::exception &e) {
136 reportError(functionName,
"error calling setInteger", e.what());
141 static const char *functionName =
"readBoolean";
142 epicsInt64 value = 0;
144 value = mGrabber->getInteger<ModuleType>(mFeatureName);
146 catch (std::exception &e) {
147 reportError(functionName,
"error calling getInteger", e.what());
149 return value ? true :
false;
153 static const char *functionName =
"writeBoolean";
154 epicsInt64 value = bval ? 1 : 0;
156 mGrabber->setInteger<ModuleType>(mFeatureName, value);
158 catch (std::exception &e) {
159 reportError(functionName,
"error calling setInteger", e.what());
166 static const char *functionName =
"readDouble";
167 epicsFloat64 value = 0;
169 value = mGrabber->getFloat<ModuleType>(mFeatureName);
171 catch (std::exception &e) {
172 reportError(functionName,
"error calling getFloat", e.what());
178 static const char *functionName =
"writeDouble";
180 mGrabber->setFloat<ModuleType>(mFeatureName, value);
182 catch (std::exception &e) {
183 reportError(functionName,
"error calling setFloat", e.what());
188 static const char *functionName =
"readDoubleMin";
189 epicsFloat64 value = 0;
191 value = mGrabber->getFloat<ModuleType>(mFeatureName+
".Min");
193 catch (std::exception &e) {
194 reportError(functionName,
"error calling getFloat", e.what());
200 static const char *functionName =
"readDoubleMax";
201 epicsFloat64 value = 0;
203 value = mGrabber->getFloat<ModuleType>(mFeatureName+
".Max");
205 catch (std::exception &e) {
206 reportError(functionName,
"error calling getFloat", e.what());
212 static const char *functionName =
"readEnumIndex";
215 value = mGrabber->getInteger<ModuleType>(mFeatureName);
217 catch (std::exception &e) {
218 reportError(functionName,
"error calling getInteger", e.what());
224 static const char *functionName =
"writeEnumIndex";
226 mGrabber->setInteger<ModuleType>(mFeatureName, (epicsInt64)value);
228 catch (std::exception &e) {
229 reportError(functionName,
"error calling setInteger", e.what());
234 static const char *functionName =
"readEnumString";
237 value = mGrabber->getString<ModuleType>(mFeatureName);
239 catch (std::exception &e) {
240 reportError(functionName,
"error calling getString", e.what());
249 static const char *functionName =
"readString";
252 value = mGrabber->getString<ModuleType>(mFeatureName);
254 catch (std::exception &e) {
255 reportError(functionName,
"error calling getString", e.what());
261 static const char *functionName =
"writeString";
263 mGrabber->setString<ModuleType>(mFeatureName, value);
265 catch (std::exception &e) {
266 reportError(functionName,
"error calling setString", e.what());
271 static const char *functionName =
"writeCommand";
273 mGrabber->execute<ModuleType>(mFeatureName);
275 catch (std::exception &e) {
276 reportError(functionName,
"error calling execute", e.what());
280 void readEnumChoices(std::vector<std::string>& enumStrings, std::vector<int>& enumValues) {
281 static const char *functionName =
"readEnumChoices";
282 std::vector<std::string> strs;
284 strs = mGrabber->getStringList<ModuleType>(query::enumEntries(mFeatureName));
286 catch (std::exception &e) {
287 reportError(functionName,
"error calling getStrings", e.what());
291 for (
size_t i=0; i<strs.size(); i++) {
293 ival = mGrabber->getInteger<ModuleType>(mFeatureName+
".Entry."+enumStrings[i]);
295 catch (std::exception &e) {
296 reportError(functionName,
"error calling getInteger", e.what());
298 enumValues.push_back((
int)ival);
303 void reportError(
const char *functionName,
const char *errorSource,
const char *errorWhat) {
304 asynPrint(mAsynUser, ASYN_TRACE_ERROR,
"%s::%s feature=%s %s=%s\n",
305 className, functionName, mFeatureName.c_str(), errorSource, errorWhat);
309 std::string mFeatureName;
EGrabber< CallbackSingleThread > EGRABBER_CALLBACK
Definition ADEuresys.h:11
GCFeatureType_t
Definition GenICamFeature.h:13
Main driver class inherited from areaDetectors ADDriver class.
Definition ADEuresys.h:30
EGRABBER_CALLBACK * getGrabber()
Definition ADEuresys.cpp:148
Definition EuresysFeature.h:14
bool readBoolean()
Definition EuresysFeature.h:140
std::string readString()
Definition EuresysFeature.h:248
EuresysFeature(GenICamFeatureSet *set, std::string const &asynName, asynParamType asynType, int asynIndex, std::string const &featureName, GCFeatureType_t featureType)
Definition EuresysFeature.h:17
double readDoubleMin()
Definition EuresysFeature.h:187
epicsInt64 readIntegerMin()
Definition EuresysFeature.h:94
void writeString(std::string const &value)
Definition EuresysFeature.h:260
void writeCommand()
Definition EuresysFeature.h:270
void writeDouble(double value)
Definition EuresysFeature.h:177
void writeBoolean(bool bval)
Definition EuresysFeature.h:152
epicsInt64 readIncrement()
Definition EuresysFeature.h:118
bool isImplemented()
Definition EuresysFeature.h:39
bool isReadable()
Definition EuresysFeature.h:56
bool isWritable()
Definition EuresysFeature.h:69
void writeInteger(epicsInt64 value)
Definition EuresysFeature.h:130
std::string readEnumString()
Definition EuresysFeature.h:233
epicsInt64 readIntegerMax()
Definition EuresysFeature.h:106
bool isAvailable()
Definition EuresysFeature.h:43
void readEnumChoices(std::vector< std::string > &enumStrings, std::vector< int > &enumValues)
Definition EuresysFeature.h:280
double readDoubleMax()
Definition EuresysFeature.h:199
epicsInt64 readInteger()
Definition EuresysFeature.h:82
void writeEnumString(std::string const &value)
Definition EuresysFeature.h:245
double readDouble()
Definition EuresysFeature.h:165
void writeEnumIndex(int value)
Definition EuresysFeature.h:223
int readEnumIndex()
Definition EuresysFeature.h:211
Definition GenICamFeature.h:41
GenICamFeatureSet * mSet
Definition GenICamFeature.h:65
Definition GenICamFeature.h:123
asynPortDriver * getPortDriver(void)
Definition GenICamFeature.cpp:587