#pragma once #include "mount.h" namespace mcc::traits { // template // concept mcc_mount_c = std::derived_from>; template concept mcc_mount_c = requires { typename T::mount_config_t; requires std::same_as; requires std::derived_from>; }; } // namespace mcc::traits namespace mcc { class MccMountAbstractState { std::function _getMountDataFunc{[]() {}}; public: typedef std::error_code mount_state_error_t; typedef std::function enter_callback_t; typedef std::function exit_callback_t; typedef std::function error_callback_t; // helper static constexpr auto mcc_noop_callback = [](const mount_state_error_t&) {}; MccMountAbstractState(traits::mcc_mount_c auto* mount_ptr, std::convertible_to auto&& enter_callback, std::convertible_to auto&& exit_callback, std::convertible_to auto&& error_callback) { _getMountDataFunc = [&mount_ptr, this]() { auto mstate = mount_ptr->getMountData(); }; } virtual ~MccMountAbstractState() = default; std::string_view ident() const { return "MCC-MOUNT-ABSTRACT-STATE"; } void enter() {} void exit() {} // #ifdef __cpp_explicit_this_parameter // #if __cpp_explicit_this_parameter >= 202110L // void aaa() {} // #endif // #endif protected: enter_callback_t _enterCallback{[](const mount_state_error_t&) {}}; exit_callback_t _exitCallback{[](const mount_state_error_t&) {}}; error_callback_t _errorCallback{[](const mount_state_error_t&) {}}; }; /* */ class MccMountStateIDLE { public: std::string_view ident() const { return "MCC-MOUNT-STATE-IDLE"; } }; /* */ class MccMountStateSlew { public: enum coords_kind_t { COORDS_KIND_RADEC_IRCS, COORDS_KIND_RADEC_APP, COORDS_KIND_HADEC_APP, COORDS_KIND_AZALT }; struct slew_state_params_t { coords_kind_t coordKind{COORDS_KIND_RADEC_APP}; MccAngle x, y; // according to 'coordKind' bool stop{false}; // stop after }; MccMountStateSlew() {} std::string_view ident() const { return "MCC-MOUNT-STATE-SLEW"; } }; } // namespace mcc