...
This commit is contained in:
parent
610d09ee98
commit
66e0b6c71e
@ -1,5 +1,6 @@
|
|||||||
#include <fitsio.h>
|
#include <fitsio.h>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <filesystem>
|
||||||
#include "raptor_eagle_ccd.h"
|
#include "raptor_eagle_ccd.h"
|
||||||
|
|
||||||
|
|
||||||
@ -241,7 +242,9 @@ void RaptorEagleCCD::AcquisitionProcess::start(const std::shared_ptr<acq_params_
|
|||||||
fits_update_key_str(fitsFilePtr, "ORIGIN", "SAO RAS", NULL, &status);
|
fits_update_key_str(fitsFilePtr, "ORIGIN", "SAO RAS", NULL, &status);
|
||||||
fits_update_key_str(fitsFilePtr, "CREATOR", "RaptorEagleV control software", NULL, &status);
|
fits_update_key_str(fitsFilePtr, "CREATOR", "RaptorEagleV control software", NULL, &status);
|
||||||
|
|
||||||
fits_update_key_str(fitsFilePtr, "FILE", _acqParams->filename.c_str(), "Original filename", &status);
|
// fits_update_key_str(fitsFilePtr, "FILE", _acqParams->filename.c_str(), "Original filename", &status);
|
||||||
|
std::filesystem::path pt = _acqParams->filename;
|
||||||
|
fits_update_key_str(fitsFilePtr, "FILE", pt.filename().c_str(), "Original filename", &status);
|
||||||
fits_write_date(fitsFilePtr, &status);
|
fits_write_date(fitsFilePtr, &status);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -965,6 +965,35 @@ void RaptorEagleCCD::startAquisition()
|
|||||||
throw std::system_error(RaptorEagleCCDError::ERROR_EXT_TRIGGER_MODE);
|
throw std::system_error(RaptorEagleCCDError::ERROR_EXT_TRIGGER_MODE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check filesystem permissions
|
||||||
|
std::string fname = (*this)[CAMERA_ATTR_FITS_FILENAME];
|
||||||
|
|
||||||
|
std::error_code ec;
|
||||||
|
std::filesystem::path pt(fname);
|
||||||
|
|
||||||
|
if (pt.filename().empty()) {
|
||||||
|
fname = "";
|
||||||
|
} else {
|
||||||
|
pt = pt.parent_path();
|
||||||
|
if (pt.empty()) {
|
||||||
|
pt = ".";
|
||||||
|
}
|
||||||
|
|
||||||
|
auto pt_cn = std::filesystem::canonical(pt, ec);
|
||||||
|
if (ec) {
|
||||||
|
logError("Invalid FITS-image filename path: {}", pt.c_str());
|
||||||
|
throw std::system_error(RaptorEagleCCDError::ERROR_INVALID_PATH);
|
||||||
|
}
|
||||||
|
|
||||||
|
// still only for POSIX OSes
|
||||||
|
int res = access(pt_cn.c_str(), W_OK | X_OK);
|
||||||
|
if (res == -1) {
|
||||||
|
logError("Invalid FITS-image path! Insufficient filesystem permissions!");
|
||||||
|
throw std::system_error(RaptorEagleCCDError::ERROR_INSUFFICIENT_FILESYSTEM_PERMISSIONS);
|
||||||
|
}
|
||||||
|
|
||||||
|
fname = pt_cn; // use canonical file path
|
||||||
|
}
|
||||||
|
|
||||||
logInfo("Start acquisition process ...");
|
logInfo("Start acquisition process ...");
|
||||||
|
|
||||||
@ -988,32 +1017,13 @@ void RaptorEagleCCD::startAquisition()
|
|||||||
.tecSetPoint = (*this)[CAMERA_ATTR_TECPOINT],
|
.tecSetPoint = (*this)[CAMERA_ATTR_TECPOINT],
|
||||||
.tecState = (*this)[CAMERA_ATTR_TECSTATE] == CAMERA_ATTR_TECSTATE_ON ? true : false,
|
.tecState = (*this)[CAMERA_ATTR_TECSTATE] == CAMERA_ATTR_TECSTATE_ON ? true : false,
|
||||||
.pcbTemp = (*this)[CAMERA_ATTR_PCB_TEMP],
|
.pcbTemp = (*this)[CAMERA_ATTR_PCB_TEMP],
|
||||||
.filename = (*this)[CAMERA_ATTR_FITS_FILENAME],
|
// .filename = (*this)[CAMERA_ATTR_FITS_FILENAME],
|
||||||
|
.filename = fname,
|
||||||
.templateFilename = (*this)[CAMERA_ATTR_FITS_TEMPLATE],
|
.templateFilename = (*this)[CAMERA_ATTR_FITS_TEMPLATE],
|
||||||
.permanentKeywords = _permanentFitsKeywords, // copy
|
.permanentKeywords = _permanentFitsKeywords, // copy
|
||||||
.currentKeywords = std::move(_currentFitsKeywords) // move!!!
|
.currentKeywords = std::move(_currentFitsKeywords) // move!!!
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// check filesystem permissions
|
|
||||||
std::error_code ec;
|
|
||||||
std::filesystem::path pt(acq_pars->filename);
|
|
||||||
pt = pt.parent_path();
|
|
||||||
if (pt.empty()) {
|
|
||||||
pt = ".";
|
|
||||||
}
|
|
||||||
|
|
||||||
auto pt_cn = std::filesystem::canonical(pt, ec);
|
|
||||||
if (ec) {
|
|
||||||
logError("Invalid FITS-image filename path: {}", pt.c_str());
|
|
||||||
throw std::system_error(RaptorEagleCCDError::ERROR_INVALID_PATH);
|
|
||||||
}
|
|
||||||
|
|
||||||
int res = access(pt_cn.c_str(), W_OK | X_OK);
|
|
||||||
if (res == -1) {
|
|
||||||
logError("Invalid FITS-image path! Insufficient filesystem permissions!");
|
|
||||||
throw std::system_error(RaptorEagleCCDError::ERROR_INSUFFICIENT_FILESYSTEM_PERMISSIONS);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// adjust geometry
|
// adjust geometry
|
||||||
@ -1222,10 +1232,10 @@ void RaptorEagleCCD::initAttrComm()
|
|||||||
auto sptr = it->lock();
|
auto sptr = it->lock();
|
||||||
auto st = sptr->status();
|
auto st = sptr->status();
|
||||||
if (st.substr(0, 3) == "ACQ") { // if the camera is acquiring then
|
if (st.substr(0, 3) == "ACQ") { // if the camera is acquiring then
|
||||||
s_head = st + ", "; // return it at the beginning of the status string
|
s_head = st + ","; // return it at the beginning of the status string
|
||||||
} else {
|
} else {
|
||||||
std::ranges::copy(st, std::back_inserter(s));
|
std::ranges::copy(st, std::back_inserter(s));
|
||||||
s += ", ";
|
s += ",";
|
||||||
}
|
}
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
@ -1235,7 +1245,7 @@ void RaptorEagleCCD::initAttrComm()
|
|||||||
if (!s.empty() || !s_head.empty()) {
|
if (!s.empty() || !s_head.empty()) {
|
||||||
s = s_head + s;
|
s = s_head + s;
|
||||||
if (_acqProcesses.size() == 1) {
|
if (_acqProcesses.size() == 1) {
|
||||||
s.resize(s.size() - 2); // delete trailing ", "
|
s.resize(s.size() - 1); // delete trailing ","
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
s = std::string{CAMERA_ATTR_CAMERA_STATUS_IDLE.begin(), CAMERA_ATTR_CAMERA_STATUS_IDLE.end()};
|
s = std::string{CAMERA_ATTR_CAMERA_STATUS_IDLE.begin(), CAMERA_ATTR_CAMERA_STATUS_IDLE.end()};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user