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

Support XML string as well as file path in NDAttributesFile #502

Closed
coretl opened this issue Jan 31, 2024 · 3 comments · Fixed by #503
Closed

Support XML string as well as file path in NDAttributesFile #502

coretl opened this issue Jan 31, 2024 · 3 comments · Fixed by #503

Comments

@coretl
Copy link
Contributor

coretl commented Jan 31, 2024

In bluesky we would like to configure an areaDetector without having to have a shared filesystem with the detector. This is almost possible at the moment, but if we need to set NDAttributesFile then we need to pass a filesystem path which is read here:

infile.open(fileName.c_str());
if (infile.fail()) {
asynPrint(pasynUserSelf, ASYN_TRACE_ERROR,
"%s::%s error opening file %s\n",
driverName, functionName, fileName.c_str());
setIntegerParam(NDAttributesStatus, NDAttributesFileNotFound);
return asynError;
}
buff << infile.rdbuf();
buffer = buff.str();

The pos plugin has a similar XML reading routine, but it supports the PV being either a blob of XML or a filename:

if (filename.find("<pos_layout>") != std::string::npos){
xmlreader = xmlReaderForMemory(filename.c_str(), (int)filename.length(), NULL, NULL, 0);
} else {
xmlreader = xmlReaderForFile(filename.c_str(), NULL, 0);
}

I propose we do something similar for NDAttributesFile:

if (fileName.find("<Attributes>") != std::string::npos){ 
    buffer = fileName;
} else {
    // The existing code
} 

Is this a reasonable thing to do? If so, then we can make a PR for it.

@MarkRivers
Copy link
Member

That seems reasonable to me.

@coretl
Copy link
Contributor Author

coretl commented Feb 1, 2024

@marcelldls please could you take a look at this?

@MarkRivers
Copy link
Member

Closed via #503

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants