...
This commit is contained in:
parent
7ad31a539a
commit
6836182e53
@ -7,6 +7,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}")
|
||||
|
||||
find_package(Threads REQUIRED)
|
||||
find_package(spdlog REQUIRED)
|
||||
|
||||
find_package(CFITSIO REQUIRED)
|
||||
@ -24,7 +25,7 @@ target_compile_definitions(${RAPTOR_EAGLEV_LIB} PRIVATE USE_SPDLOG_LIBRARY)
|
||||
# !!!!! TEMPORARY !!!!!
|
||||
target_include_directories(${RAPTOR_EAGLEV_LIB} PRIVATE "../ADC/")
|
||||
target_include_directories(${RAPTOR_EAGLEV_LIB} PRIVATE ${XCLIB_INCLUDE_DIR})
|
||||
target_link_libraries(${RAPTOR_EAGLEV_LIB} PUPLIC spdlog::spdlog)
|
||||
target_link_libraries(${RAPTOR_EAGLEV_LIB} PUPLIC Threads::Threads spdlog::spdlog)
|
||||
|
||||
add_executable(RaptorEagleV main.cpp)
|
||||
|
||||
|
||||
@ -1022,24 +1022,27 @@ void RaptorEagleCCD::initAttrComm()
|
||||
_permanentFitsKeywords.push_back(key);
|
||||
}
|
||||
},
|
||||
[this]() { // serialize as "USER_FITS_KEY_SEP_SEQ" separated char sequences
|
||||
[this](const std::vector<std::string>& keys) { // serialize as "USER_FITS_KEY_SEP_SEQ" separated char sequences
|
||||
attribute_t::serialized_t res;
|
||||
|
||||
if (_permanentFitsKeywords.size() > 1) {
|
||||
for (auto& key : _permanentFitsKeywords) {
|
||||
if (keys.size() > 1) {
|
||||
for (auto& key : keys) {
|
||||
std::ranges::copy(key, std::back_inserter(res));
|
||||
std::ranges::copy(USER_FITS_KEY_SEP_SEQ, std::back_inserter(res));
|
||||
}
|
||||
} else {
|
||||
std::ranges::copy(_permanentFitsKeywords.front(), std::back_inserter(res));
|
||||
std::ranges::copy(keys.front(), std::back_inserter(res));
|
||||
}
|
||||
|
||||
return res;
|
||||
},
|
||||
[this](const attribute_t::serialized_t& char_seq) {
|
||||
std::vector<std::string> keys;
|
||||
for (auto const& key : char_seq | std::views::split(USER_FITS_KEY_SEP_SEQ)) {
|
||||
_permanentFitsKeywords.push_back({key.begin(), key.end()});
|
||||
keys.push_back({key.begin(), key.end()});
|
||||
}
|
||||
|
||||
return keys;
|
||||
});
|
||||
|
||||
|
||||
@ -1059,24 +1062,27 @@ void RaptorEagleCCD::initAttrComm()
|
||||
_currentFitsKeywords.push_back(key);
|
||||
}
|
||||
},
|
||||
[this]() { // serialize as "USER_FITS_KEY_SEP_SEQ" separated char sequences
|
||||
[this](const std::vector<std::string>& keys) { // serialize as "USER_FITS_KEY_SEP_SEQ" separated char sequences
|
||||
attribute_t::serialized_t res;
|
||||
|
||||
if (_currentFitsKeywords.size() > 1) {
|
||||
for (auto& key : _currentFitsKeywords) {
|
||||
if (keys.size() > 1) {
|
||||
for (auto& key : keys) {
|
||||
std::ranges::copy(key, std::back_inserter(res));
|
||||
std::ranges::copy(USER_FITS_KEY_SEP_SEQ, std::back_inserter(res));
|
||||
}
|
||||
} else {
|
||||
std::ranges::copy(_currentFitsKeywords.front(), std::back_inserter(res));
|
||||
std::ranges::copy(keys.front(), std::back_inserter(res));
|
||||
}
|
||||
|
||||
return res;
|
||||
},
|
||||
[this](const attribute_t::serialized_t& char_seq) {
|
||||
std::vector<std::string> keys;
|
||||
for (auto const& key : char_seq | std::views::split(USER_FITS_KEY_SEP_SEQ)) {
|
||||
_currentFitsKeywords.push_back({key.begin(), key.end()});
|
||||
keys.push_back({key.begin(), key.end()});
|
||||
}
|
||||
|
||||
return keys;
|
||||
});
|
||||
|
||||
|
||||
@ -1365,6 +1371,18 @@ void RaptorEagleCCD::initAttrComm()
|
||||
} else {
|
||||
logWarn("Invalid TEC state string value! Ignore!");
|
||||
}
|
||||
},
|
||||
adc::utils::AdcDefaultValueConverter<>::serialize<attribute_t::serialized_t, std::string_view>,
|
||||
[](const attribute_t::serialized_t& v) {
|
||||
auto comp_case_ignore = [](const auto& v1, const auto& v2) { return std::toupper(v1) == v2; };
|
||||
|
||||
if (std::ranges::equal(v, CAMERA_ATTR_TECSTATE_ON, comp_case_ignore)) {
|
||||
return CAMERA_ATTR_TECSTATE_ON;
|
||||
} else if (std::ranges::equal(v, CAMERA_ATTR_TECSTATE_OFF, comp_case_ignore)) {
|
||||
return CAMERA_ATTR_TECSTATE_OFF;
|
||||
}
|
||||
|
||||
return CAMERA_ATTR_STR_INVALID;
|
||||
});
|
||||
|
||||
/* CCD and PCB temperature (read-only) */
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef USE_SPDLOG_LIBRARY
|
||||
#include <spdlog/sinks/null_sink.h>
|
||||
#endif
|
||||
|
||||
#include <common/adc_spdlog.h>
|
||||
#include <device/adc_device.h>
|
||||
@ -17,7 +19,7 @@
|
||||
class RaptorEagleCCD : public adc::AdcGenericDevice<std::string,
|
||||
adc::AdcDeviceAttribute<std::string_view>,
|
||||
adc::AdcDeviceCommand<std::string_view>>,
|
||||
adc::AdcSpdlogLogger
|
||||
public adc::AdcSpdlogLogger
|
||||
{
|
||||
typedef adc::AdcGenericDevice<std::string,
|
||||
adc::AdcDeviceAttribute<std::string_view>,
|
||||
|
||||
@ -132,12 +132,12 @@ struct XCLIBErrorCategory : std::error_category {
|
||||
};
|
||||
|
||||
|
||||
namespace std
|
||||
{
|
||||
// namespace std
|
||||
// {
|
||||
|
||||
inline std::error_code make_error_code(RaptorEagleCCDError ec)
|
||||
{
|
||||
return std::error_code(static_cast<int>(ec), RaptorEagleCCDErrorCategory::get());
|
||||
}
|
||||
|
||||
} // namespace std
|
||||
// } // namespace std
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user