84 lines
2.2 KiB
C++
84 lines
2.2 KiB
C++
#include <xcliball.h>
|
|
#include <cstring>
|
|
|
|
#include "raptor_eagle_cameralink.h"
|
|
#include "raptor_eagle_ccd.h"
|
|
#include "raptor_eagle_exception.h"
|
|
|
|
|
|
#define DEFAULT_EPIX_VIDEO_FMT_FILE "raptor_eagle-v.fmt"
|
|
|
|
/* CONSTRUCTORS AND DESTRUCTOR */
|
|
|
|
RaptorEagleCCD::RaptorEagleCCD(const adc::traits::adc_input_char_range auto& epix_video_fmt_filename,
|
|
std::shared_ptr<spdlog::logger> logger)
|
|
: base_t("EagleCCD"), adc::AdcSpdlogLogger(logger)
|
|
{
|
|
addMarkToPattern("EAGLE-CCD");
|
|
|
|
std::ranges::copy(epix_video_fmt_filename, std::back_inserter(_epixFmtVideoFilename));
|
|
|
|
logDebug("CTOR: Create RaptorEagleCCD class instance");
|
|
if (_epixFmtVideoFilename.empty()) {
|
|
logDebug("Video format filename is not set! Use of default: {}", DEFAULT_EPIX_VIDEO_FMT_FILE);
|
|
} else {
|
|
logDebug("Set video format filename: {}", _epixFmtVideoFilename);
|
|
}
|
|
}
|
|
|
|
|
|
RaptorEagleCCD::RaptorEagleCCD(std::shared_ptr<spdlog::logger> logger)
|
|
: RaptorEagleCCD(std::string_view(), std::move(logger))
|
|
{
|
|
}
|
|
|
|
|
|
RaptorEagleCCD::~RaptorEagleCCD()
|
|
{
|
|
logDebug("DTOR: Delete RaptorEagleCCD class instance");
|
|
}
|
|
|
|
|
|
/* PRIVATE METHODS */
|
|
|
|
void RaptorEagleCCD::initCamera(int unitmap)
|
|
{
|
|
logInfo("Try to init camera with unitmap: {} ...", unitmap);
|
|
|
|
if (unitmap < 0) {
|
|
throw std::system_error(RaptorEagleCCDError::ERROR_INVALID_UNITMAP);
|
|
}
|
|
|
|
_cameraUnitmap = unitmap;
|
|
|
|
logInfo("Camera with unit '{}' is initialized", _cameraUnitmap);
|
|
}
|
|
|
|
|
|
void RaptorEagleCCD::openPIXCI()
|
|
{
|
|
if (_epixFmtVideoFilename.size()) {
|
|
xclibApiCall(pxd_PIXCIopen("", nullptr, _epixFmtVideoFilename.c_str()),
|
|
std::format("pxd_PIXCIopen(\"\", NULL, {})", _epixFmtVideoFilename));
|
|
} else {
|
|
xclibApiCall(pxd_PIXCIopen("", "DEFAULT", ""), "pxd_PIXCIopen(\"\", \"DEFAULT\", \"\")");
|
|
|
|
#include DEFAULT_EPIX_VIDEO_FMT_FILE // exported from XCAP (Linux 64-bit!): bin 1x1, full CCD frame
|
|
pxd_videoFormatAsIncludedInit(0);
|
|
xclibApiCall(pxd_videoFormatAsIncluded(0), "pxd_videoFormatAsIncluded(0)");
|
|
}
|
|
}
|
|
|
|
|
|
void RaptorEagleCCD::closePIXCI()
|
|
{
|
|
// no exception here!!!
|
|
xclibApiCall<true>(pxd_PIXCIclose(), "pxd_PIXCIclose()");
|
|
}
|
|
|
|
|
|
void RaptorEagleCCD::initAttrComm()
|
|
{
|
|
addAttribute(CAMERA_ATTR_EXPTIME, []() {});
|
|
}
|