Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix attribute datatypes in TIFF plugin #520

Merged
merged 4 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading