Skip to content

Commit

Permalink
Merge pull request #480 from keenanlang/master
Browse files Browse the repository at this point in the history
Add Constant NDAttributes
  • Loading branch information
MarkRivers authored Jan 1, 2024
2 parents 0a02e36 + f22f069 commit 766565d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
6 changes: 5 additions & 1 deletion ADApp/ADSrc/NDAttribute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ static const char *NDAttrSourceStrings[] = {
"DRIVER",
"PARAM",
"EPICS_PV",
"FUNCTION"
"FUNCTION",
"CONST"
};

const char *NDAttribute::attrSourceString(NDAttrSource_t type)
Expand Down Expand Up @@ -57,6 +58,9 @@ const char *NDAttribute::attrSourceString(NDAttrSource_t type)
case NDAttrSourceFunct:
this->sourceTypeString_ = "NDAttrSourceFunct";
break;
case NDAttrSourceConst:
this->sourceTypeString_ = "NDAttrSourceConst";
break;
default:
this->sourceType_ = NDAttrSourceUndefined;
this->sourceTypeString_ = "Undefined";
Expand Down
1 change: 1 addition & 0 deletions ADApp/ADSrc/NDAttribute.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ typedef enum
NDAttrSourceParam, /**< Attribute is obtained from parameter library */
NDAttrSourceEPICSPV, /**< Attribute is obtained from an EPICS PV */
NDAttrSourceFunct, /**< Attribute is obtained from a user-specified function */
NDAttrSourceConst, /**< Attribute is obtained from a user-specified value in the xml file */
NDAttrSourceUndefined /**< Attribute source is undefined */
} NDAttrSource_t;

Expand Down
7 changes: 6 additions & 1 deletion ADApp/ADSrc/asynNDArrayDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,12 @@ asynStatus asynNDArrayDriver::readNDAttributesFile()
functAttribute *pFunctAttribute = new functAttribute(pName, pDescription, pSource, pParam);
this->pAttributeList->add(pFunctAttribute);
#endif
} else {
}
else if (strcmp(pAttrType, NDAttribute::attrSourceString(NDAttrSourceConst)) == 0) {
#ifndef EPICS_LIBCOM_ONLY
this->pAttributeList->add(pName, pDescription, NDAttrString, (void*) pSource);
#endif
} else {
asynPrint(pasynUserSelf, ASYN_TRACE_ERROR,
"%s:%s: unknown attribute type = %s for attribute %s\n", driverName, functionName, pAttrType, pName);
return asynError;
Expand Down

0 comments on commit 766565d

Please sign in to comment.