...
This commit is contained in:
@@ -108,16 +108,11 @@ inline std::error_code make_error_code(MccGenericMountErrorCode ec)
|
||||
|
||||
|
||||
|
||||
template <mcc_hardware_c HARDWARE_T,
|
||||
mcc_telemetry_c TELEMETRY_T,
|
||||
template <mcc_telemetry_c TELEMETRY_T,
|
||||
mcc_pzone_container_c PZONE_CONT_T,
|
||||
mcc_movement_controls_c MOVE_CNTRL_T,
|
||||
mcc_logger_c LOGGER_T = utils::MccSpdlogLogger>
|
||||
class MccGenericMount : protected HARDWARE_T,
|
||||
public TELEMETRY_T,
|
||||
public PZONE_CONT_T,
|
||||
public MOVE_CNTRL_T,
|
||||
public LOGGER_T
|
||||
class MccGenericMount : public TELEMETRY_T, public PZONE_CONT_T, public MOVE_CNTRL_T, public LOGGER_T
|
||||
{
|
||||
public:
|
||||
using LOGGER_T::logDebug;
|
||||
@@ -143,18 +138,15 @@ public:
|
||||
MOUNT_STATUS_TRACKING
|
||||
};
|
||||
|
||||
template <typename... HardwareCtorTs,
|
||||
typename... TelemetryCtorTs,
|
||||
template <typename... TelemetryCtorTs,
|
||||
typename... PzoneContCtorTs,
|
||||
typename... MoveCntrCtorTs,
|
||||
typename... LoggerCtorTs>
|
||||
MccGenericMount(std::tuple<HardwareCtorTs...> hw_ctor_args,
|
||||
std::tuple<TelemetryCtorTs...> telemetry_ctor_args,
|
||||
MccGenericMount(std::tuple<TelemetryCtorTs...> telemetry_ctor_args,
|
||||
std::tuple<PzoneContCtorTs...> pzone_cont_ctor_ars,
|
||||
std::tuple<MoveCntrCtorTs...> move_cntrl_ctor_ars,
|
||||
std::tuple<LoggerCtorTs...> logger_ctor_args)
|
||||
: HARDWARE_T(std::make_from_tuple<HARDWARE_T>(std::move(hw_ctor_args))),
|
||||
TELEMETRY_T(std::make_from_tuple<TELEMETRY_T>(std::move(telemetry_ctor_args))),
|
||||
: TELEMETRY_T(std::make_from_tuple<TELEMETRY_T>(std::move(telemetry_ctor_args))),
|
||||
PZONE_CONT_T(std::make_from_tuple<PZONE_CONT_T>(pzone_cont_ctor_ars)),
|
||||
MOVE_CNTRL_T(std::make_from_tuple<MOVE_CNTRL_T>(move_cntrl_ctor_ars)),
|
||||
LOGGER_T(std::make_from_tuple<LOGGER_T>(logger_ctor_args))
|
||||
@@ -163,19 +155,16 @@ public:
|
||||
logDebug("Create MccGenericMount class instance (thread: {})", std::this_thread::get_id());
|
||||
}
|
||||
|
||||
template <typename... HardwareCtorTs,
|
||||
typename... TelemetryCtorTs,
|
||||
template <typename... TelemetryCtorTs,
|
||||
typename... PzoneContCtorTs,
|
||||
typename... MoveCntrCtorTs,
|
||||
typename... LoggerCtorTs>
|
||||
requires std::derived_from<LOGGER_T, utils::MccSpdlogLogger>
|
||||
MccGenericMount(std::tuple<HardwareCtorTs...> hw_ctor_args,
|
||||
std::tuple<TelemetryCtorTs...> telemetry_ctor_args,
|
||||
MccGenericMount(std::tuple<TelemetryCtorTs...> telemetry_ctor_args,
|
||||
std::tuple<PzoneContCtorTs...> pzone_cont_ctor_ars,
|
||||
std::tuple<MoveCntrCtorTs...> move_cntrl_ctor_ars,
|
||||
LoggerCtorTs... logger_ctor_args)
|
||||
: HARDWARE_T(std::make_from_tuple<HARDWARE_T>(std::move(hw_ctor_args))),
|
||||
TELEMETRY_T(std::make_from_tuple<TELEMETRY_T>(std::move(telemetry_ctor_args))),
|
||||
: TELEMETRY_T(std::make_from_tuple<TELEMETRY_T>(std::move(telemetry_ctor_args))),
|
||||
PZONE_CONT_T(std::make_from_tuple<PZONE_CONT_T>(pzone_cont_ctor_ars)),
|
||||
MOVE_CNTRL_T(std::make_from_tuple<MOVE_CNTRL_T>(move_cntrl_ctor_ars)),
|
||||
mcc::utils::MccSpdlogLogger(logger_ctor_args...)
|
||||
@@ -207,22 +196,9 @@ public:
|
||||
{
|
||||
logInfo(std::format("Start MccGenericMount class initialization (thread: {}) ...", std::this_thread::get_id()));
|
||||
|
||||
*_lastMountError = MccGenericMountErrorCode::ERROR_OK;
|
||||
*_mountStatus = mount_status_t::MOUNT_STATUS_IDLE;
|
||||
|
||||
*_mountStatus = mount_status_t::MOUNT_STATUS_INITIALIZATION;
|
||||
|
||||
auto hw_err = this->hardwareInit();
|
||||
if (hw_err) {
|
||||
*_mountStatus = mount_status_t::MOUNT_STATUS_ERROR;
|
||||
|
||||
*_lastMountError = mcc_deduce_err(hw_err, MccGenericMountErrorCode::ERROR_HW_INIT);
|
||||
} else {
|
||||
logInfo("Generic mount initialization was performed");
|
||||
|
||||
*_mountStatus = mount_status_t::IDLE;
|
||||
}
|
||||
|
||||
return *_lastMountError;
|
||||
return *_lastMountError = MccGenericMountErrorCode::ERROR_OK;
|
||||
}
|
||||
|
||||
mount_status_t mountStatus() const
|
||||
|
||||
Reference in New Issue
Block a user