From 3feac92b1e02367b4fbb4a95213e0ec148be651f Mon Sep 17 00:00:00 2001 From: Mark Rivers Date: Thu, 14 Nov 2024 15:16:42 -0600 Subject: [PATCH 1/3] Fix attribute data type problem --- ADApp/pluginSrc/NDFileTIFF.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/ADApp/pluginSrc/NDFileTIFF.cpp b/ADApp/pluginSrc/NDFileTIFF.cpp index 2ad0d003e..44b1d01f5 100644 --- a/ADApp/pluginSrc/NDFileTIFF.cpp +++ b/ADApp/pluginSrc/NDFileTIFF.cpp @@ -296,17 +296,21 @@ asynStatus NDFileTIFF::openFile(const char *fileName, NDFileOpenMode_t openMode, switch (attrDataType) { case NDAttrInt8: - case NDAttrUInt8: case NDAttrInt16: - case NDAttrUInt16: case NDAttrInt32: - case NDAttrUInt32: - case NDAttrInt64: - case NDAttrUInt64: { + case NDAttrInt64: { pAttribute->getValue(attrDataType, &value.i64); epicsSnprintf(tagString, sizeof(tagString)-1, "%s:%lld", attributeName, value.i64); break; } + case NDAttrUInt8: + case NDAttrUInt16: + case NDAttrUInt32: + case NDAttrUInt64: { + pAttribute->getValue(attrDataType, &value.ui64); + epicsSnprintf(tagString, sizeof(tagString)-1, "%s:%llu", attributeName, value.ui64); + break; + } case NDAttrFloat32: { pAttribute->getValue(attrDataType, &value.f32); epicsSnprintf(tagString, sizeof(tagString)-1, "%s:%f", attributeName, value.f32); From 9d015653e3b0ded2fe8e753b32d1f94d3588fd43 Mon Sep 17 00:00:00 2001 From: Mark Rivers Date: Thu, 14 Nov 2024 17:11:42 -0600 Subject: [PATCH 2/3] Bug fix, wrong attribute type --- ADApp/pluginSrc/NDFileTIFF.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ADApp/pluginSrc/NDFileTIFF.cpp b/ADApp/pluginSrc/NDFileTIFF.cpp index 44b1d01f5..16596051f 100644 --- a/ADApp/pluginSrc/NDFileTIFF.cpp +++ b/ADApp/pluginSrc/NDFileTIFF.cpp @@ -299,7 +299,7 @@ asynStatus NDFileTIFF::openFile(const char *fileName, NDFileOpenMode_t openMode, case NDAttrInt16: case NDAttrInt32: case NDAttrInt64: { - pAttribute->getValue(attrDataType, &value.i64); + pAttribute->getValue(NDAttrInt64, &value.i64); epicsSnprintf(tagString, sizeof(tagString)-1, "%s:%lld", attributeName, value.i64); break; } @@ -307,7 +307,7 @@ asynStatus NDFileTIFF::openFile(const char *fileName, NDFileOpenMode_t openMode, case NDAttrUInt16: case NDAttrUInt32: case NDAttrUInt64: { - pAttribute->getValue(attrDataType, &value.ui64); + pAttribute->getValue(NDAttrUInt64, &value.ui64); epicsSnprintf(tagString, sizeof(tagString)-1, "%s:%llu", attributeName, value.ui64); break; } From b675fb4c23cc5b65c148f3aa3ae7af8fdd8fcd2f Mon Sep 17 00:00:00 2001 From: Mark Rivers Date: Thu, 14 Nov 2024 17:12:51 -0600 Subject: [PATCH 3/3] Add code to create attributes of all numeric data types for testing --- ADApp/ADSrc/myAttributeFunctions.cpp | 112 ++++++++++++++++++++++++++- 1 file changed, 111 insertions(+), 1 deletion(-) diff --git a/ADApp/ADSrc/myAttributeFunctions.cpp b/ADApp/ADSrc/myAttributeFunctions.cpp index 902c74406..020336cf2 100644 --- a/ADApp/ADSrc/myAttributeFunctions.cpp +++ b/ADApp/ADSrc/myAttributeFunctions.cpp @@ -19,7 +19,17 @@ typedef enum { functE, functTen, functGettysburg, - functTime64 + functTime64, + functInt8, + functUInt8, + functInt16, + functUInt16, + functInt32, + functUInt32, + functInt64, + functUInt64, + functFloat32, + functFloat64 } myFunct_t; static int myAttrFunct1(const char *paramString, void **functionPvt, functAttribute *pAttribute) @@ -55,6 +65,46 @@ static int myAttrFunct1(const char *paramString, void **functionPvt, functAttrib pAttribute->setDataType(NDAttrUInt64); *paramIndex = functTime64; } + else if (!strcmp(paramString, "INT8")) { + pAttribute->setDataType(NDAttrInt8); + *paramIndex = functInt8; + } + else if (!strcmp(paramString, "UINT8")) { + pAttribute->setDataType(NDAttrUInt8); + *paramIndex = functUInt8; + } + else if (!strcmp(paramString, "INT16")) { + pAttribute->setDataType(NDAttrInt16); + *paramIndex = functInt16; + } + else if (!strcmp(paramString, "UINT16")) { + pAttribute->setDataType(NDAttrUInt16); + *paramIndex = functUInt16; + } + else if (!strcmp(paramString, "INT32")) { + pAttribute->setDataType(NDAttrInt32); + *paramIndex = functInt32; + } + else if (!strcmp(paramString, "UINT32")) { + pAttribute->setDataType(NDAttrUInt32); + *paramIndex = functUInt32; + } + else if (!strcmp(paramString, "INT64")) { + pAttribute->setDataType(NDAttrInt64); + *paramIndex = functInt64; + } + else if (!strcmp(paramString, "UINT64")) { + pAttribute->setDataType(NDAttrUInt64); + *paramIndex = functUInt64; + } + else if (!strcmp(paramString, "FLOAT32")) { + pAttribute->setDataType(NDAttrFloat32); + *paramIndex = functFloat32; + } + else if (!strcmp(paramString, "FLOAT64")) { + pAttribute->setDataType(NDAttrFloat64); + *paramIndex = functFloat64; + } else { printf("Error, unknown parameter string = %s\n", paramString); free(paramIndex); @@ -90,6 +140,66 @@ static int myAttrFunct1(const char *paramString, void **functionPvt, functAttrib break; } + case functInt8: { + epicsInt8 val=-8; + pAttribute->setValue(&val); + break; + } + + case functUInt8: { + epicsUInt8 val=8; + pAttribute->setValue(&val); + break; + } + + case functInt16: { + epicsInt16 val=-16; + pAttribute->setValue(&val); + break; + } + + case functUInt16: { + epicsUInt16 val=16; + pAttribute->setValue(&val); + break; + } + + case functInt32: { + epicsInt32 val=-32; + pAttribute->setValue(&val); + break; + } + + case functUInt32: { + epicsUInt32 val=32; + pAttribute->setValue(&val); + break; + } + + case functInt64: { + epicsInt64 val=-64; + pAttribute->setValue(&val); + break; + } + + case functUInt64: { + epicsUInt64 val=64; + pAttribute->setValue(&val); + break; + } + + case functFloat32: { + epicsFloat32 val=32.0; + pAttribute->setValue(&val); + break; + } + + case functFloat64: { + epicsFloat64 val=64.0; + pAttribute->setValue(&val); + break; + } + default: return ND_ERROR; }