Skip to content

Commit

Permalink
Merge pull request #520 from areaDetector/fix_tiff_plugin
Browse files Browse the repository at this point in the history
Fix attribute datatypes in TIFF plugin
  • Loading branch information
MarkRivers authored Nov 18, 2024
2 parents 0ed979a + b675fb4 commit 5b71539
Show file tree
Hide file tree
Showing 2 changed files with 120 additions and 6 deletions.
112 changes: 111 additions & 1 deletion ADApp/ADSrc/myAttributeFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
Expand Down
14 changes: 9 additions & 5 deletions ADApp/pluginSrc/NDFileTIFF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,15 +296,19 @@ asynStatus NDFileTIFF::openFile(const char *fileName, NDFileOpenMode_t openMode,

switch (attrDataType) {
case NDAttrInt8:
case NDAttrUInt8:
case NDAttrInt16:
case NDAttrUInt16:
case NDAttrInt32:
case NDAttrInt64: {
pAttribute->getValue(NDAttrInt64, &value.i64);
epicsSnprintf(tagString, sizeof(tagString)-1, "%s:%lld", attributeName, value.i64);
break;
}
case NDAttrUInt8:
case NDAttrUInt16:
case NDAttrUInt32:
case NDAttrInt64:
case NDAttrUInt64: {
pAttribute->getValue(attrDataType, &value.i64);
epicsSnprintf(tagString, sizeof(tagString)-1, "%s:%lld", attributeName, value.i64);
pAttribute->getValue(NDAttrUInt64, &value.ui64);
epicsSnprintf(tagString, sizeof(tagString)-1, "%s:%llu", attributeName, value.ui64);
break;
}
case NDAttrFloat32: {
Expand Down

0 comments on commit 5b71539

Please sign in to comment.