From 59343dfc9f0e1644e3b9b663b13e0ce9bead3177 Mon Sep 17 00:00:00 2001 From: keenanlang Date: Tue, 10 May 2022 13:41:18 -0500 Subject: [PATCH 1/3] Add CONST type to NDAttributes --- ADApp/ADSrc/NDAttribute.cpp | 6 +++++- ADApp/ADSrc/NDAttribute.h | 1 + ADApp/ADSrc/asynNDArrayDriver.cpp | 7 ++++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ADApp/ADSrc/NDAttribute.cpp b/ADApp/ADSrc/NDAttribute.cpp index 3c6cc9b80..49f84ea7a 100644 --- a/ADApp/ADSrc/NDAttribute.cpp +++ b/ADApp/ADSrc/NDAttribute.cpp @@ -17,7 +17,8 @@ static const char *NDAttrSourceStrings[] = { "DRIVER", "PARAM", "EPICS_PV", - "FUNCTION" + "FUNCTION", + "CONST" }; const char *NDAttribute::attrSourceString(NDAttrSource_t type) @@ -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"; diff --git a/ADApp/ADSrc/NDAttribute.h b/ADApp/ADSrc/NDAttribute.h index fc6023b1d..ed1c28050 100644 --- a/ADApp/ADSrc/NDAttribute.h +++ b/ADApp/ADSrc/NDAttribute.h @@ -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; diff --git a/ADApp/ADSrc/asynNDArrayDriver.cpp b/ADApp/ADSrc/asynNDArrayDriver.cpp index 7f61b6e98..2d4d6bb24 100644 --- a/ADApp/ADSrc/asynNDArrayDriver.cpp +++ b/ADApp/ADSrc/asynNDArrayDriver.cpp @@ -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, pSource); +#endif + } else { asynPrint(pasynUserSelf, ASYN_TRACE_ERROR, "%s:%s: unknown attribute type = %s for attribute %s\n", driverName, functionName, pAttrType, pName); return asynError; From 9765d1696b88ce0746771058b574c7bc0e331251 Mon Sep 17 00:00:00 2001 From: keenanlang Date: Wed, 25 May 2022 13:41:16 -0500 Subject: [PATCH 2/3] Cast pointer --- ADApp/ADSrc/asynNDArrayDriver.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ADApp/ADSrc/asynNDArrayDriver.cpp b/ADApp/ADSrc/asynNDArrayDriver.cpp index 2d4d6bb24..3740270cc 100644 --- a/ADApp/ADSrc/asynNDArrayDriver.cpp +++ b/ADApp/ADSrc/asynNDArrayDriver.cpp @@ -460,7 +460,7 @@ asynStatus asynNDArrayDriver::readNDAttributesFile() } else if (strcmp(pAttrType, NDAttribute::attrSourceString(NDAttrSourceConst)) == 0) { #ifndef EPICS_LIBCOM_ONLY - this->pAttributeList->add(pName, pDescription, NDAttrString, pSource); + this->pAttributeList->add(pName, pDescription, NDAttrString, (void*) pSource); #endif } else { asynPrint(pasynUserSelf, ASYN_TRACE_ERROR, From f22f0698f1e4c599397ac9d79a2be5cd2f93ff4f Mon Sep 17 00:00:00 2001 From: keenanlang Date: Wed, 25 May 2022 13:44:49 -0500 Subject: [PATCH 3/3] whitespacing --- ADApp/ADSrc/NDAttribute.cpp | 2 +- ADApp/ADSrc/asynNDArrayDriver.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ADApp/ADSrc/NDAttribute.cpp b/ADApp/ADSrc/NDAttribute.cpp index 49f84ea7a..132a9c47c 100644 --- a/ADApp/ADSrc/NDAttribute.cpp +++ b/ADApp/ADSrc/NDAttribute.cpp @@ -18,7 +18,7 @@ static const char *NDAttrSourceStrings[] = { "PARAM", "EPICS_PV", "FUNCTION", - "CONST" + "CONST" }; const char *NDAttribute::attrSourceString(NDAttrSource_t type) diff --git a/ADApp/ADSrc/asynNDArrayDriver.cpp b/ADApp/ADSrc/asynNDArrayDriver.cpp index 3740270cc..961055533 100644 --- a/ADApp/ADSrc/asynNDArrayDriver.cpp +++ b/ADApp/ADSrc/asynNDArrayDriver.cpp @@ -460,7 +460,7 @@ asynStatus asynNDArrayDriver::readNDAttributesFile() } else if (strcmp(pAttrType, NDAttribute::attrSourceString(NDAttrSourceConst)) == 0) { #ifndef EPICS_LIBCOM_ONLY - this->pAttributeList->add(pName, pDescription, NDAttrString, (void*) pSource); + this->pAttributeList->add(pName, pDescription, NDAttrString, (void*) pSource); #endif } else { asynPrint(pasynUserSelf, ASYN_TRACE_ERROR,