13#ifndef HLCC_TELIF_TELIF_TELIFCMDSIMPL_HPP
14#define HLCC_TELIF_TELIF_TELIFCMDSIMPL_HPP
16#include <rad/exceptions.hpp>
17#include <rad/smAdapter.hpp>
19#include "telif/telifCmds.rad.hpp"
35 virtual elt::mal::future<std::string>
MoveToNamedPos(
const std::string& position_name)
override {
38 LOG4CPLUS_INFO(
GetLogger(),
"Received MoveToNamedPos with: position_name " << position_name);
39 auto ev = std::make_shared<TelifCmds::MoveToNamedPos>(position_name);
40 m_sm.RegisterDefaultRequestRejectHandler<TelifCmds::MoveToNamedPos>();
44 return ev->GetPayload().GetReplyFuture();
48 virtual elt::mal::future<std::string>
MoveToAltAzPos(
const std::shared_ptr<ccsinsif::AltAz>& axes_position)
override {
51 LOG4CPLUS_INFO(
GetLogger(),
"Received MoveToAltAzPos with: Alt " << axes_position->getAlt()
52 <<
", Az " << axes_position->getAz());
53 auto ev = std::make_shared<TelifCmds::MoveToAltAzPos>(axes_position->clone());
54 m_sm.RegisterDefaultRequestRejectHandler<TelifCmds::MoveToAltAzPos>();
57 return ev->GetPayload().GetReplyFuture();
63 LOG4CPLUS_INFO(
GetLogger(),
"Received StopTracking");
64 auto ev = std::make_shared<TelifCmds::StopTracking>();
65 m_sm.RegisterDefaultRequestRejectHandler<TelifCmds::StopTracking>();
68 return ev->GetPayload().GetReplyFuture();
73 LOG4CPLUS_INFO(
GetLogger(),
"Received SetPresetSequenceMode with: sequence_mode " << sequence_mode);
74 auto ev = std::make_shared<TelifCmds::SetPresetSequenceMode>(sequence_mode);
75 m_sm.RegisterDefaultRequestRejectHandler<TelifCmds::SetPresetSequenceMode>();
77 return ev->GetPayload().GetReplyFuture();
80 virtual ::elt::mal::future<std::string>
SetPresetSequence(
const std::string& sequence)
override {
82 LOG4CPLUS_INFO(
GetLogger(),
"Received SetPresetSequence with: sequence " << sequence);
83 auto ev = std::make_shared<TelifCmds::SetPresetSequence>(sequence);
84 m_sm.RegisterDefaultRequestRejectHandler<TelifCmds::SetPresetSequence>();
86 return ev->GetPayload().GetReplyFuture();
91 LOG4CPLUS_INFO(
GetLogger(),
"Received SetOffsetSequenceMode with: sequence_mode " << sequence_mode);
92 auto ev = std::make_shared<TelifCmds::SetOffsetSequenceMode>(sequence_mode);
93 m_sm.RegisterDefaultRequestRejectHandler<TelifCmds::SetOffsetSequenceMode>();
95 return ev->GetPayload().GetReplyFuture();
98 virtual ::elt::mal::future<std::string>
SetOffsetSequence(
const std::string& sequence)
override {
100 LOG4CPLUS_INFO(
GetLogger(),
"Received SetOffsetSequence with: sequence " << sequence);
101 auto ev = std::make_shared<TelifCmds::SetOffsetSequence>(sequence);
102 m_sm.RegisterDefaultRequestRejectHandler<TelifCmds::SetOffsetSequence>();
104 return ev->GetPayload().GetReplyFuture();
107 virtual ::elt::mal::future<std::string>
SetGuideProbe(
const std::shared_ptr<pfsif::GuideStarArgs>& guide_star_args)
override {
109 LOG4CPLUS_INFO(
GetLogger(),
"Received SetGuideProbe with: id " << guide_star_args->getId() <<
", Ra "
110 << guide_star_args->getRa() <<
", Dec " << guide_star_args->getDec() <<
", Epoch "
111 << guide_star_args->getEpoch() <<
", Band " << guide_star_args->getBand() <<
", Rshift "
112 << guide_star_args->getRshift() <<
", Radvel " << guide_star_args->getRadvel()
113 <<
", Magnitude " << guide_star_args->getMagnitude() <<
", Parallax "
114 << guide_star_args->getParallax() <<
", Proper_motion_ra " << guide_star_args->getProper_motion_ra()
115 <<
", Proper_motion_dec " << guide_star_args->getProper_motion_dec());
116 auto ev = std::make_shared<TelifCmds::SetGuideProbe>(guide_star_args->clone());
118 m_sm.RegisterDefaultRequestRejectHandler<TelifCmds::SetGuideProbe>();
122 return ev->GetPayload().GetReplyFuture();
125 virtual ::elt::mal::future<std::string>
SetGpHierarchy(
const std::shared_ptr<pfsif::GpHierarchyArgs>& gp_hierarchy_args)
override {
127 LOG4CPLUS_INFO(
GetLogger(),
"Received SetGpHierarchy with: A " << gp_hierarchy_args->getA() <<
", B "
128 << gp_hierarchy_args->getB() <<
", C " << gp_hierarchy_args->getC());
129 auto ev = std::make_shared<TelifCmds::SetGpHierarchy>(gp_hierarchy_args->clone());
131 m_sm.RegisterDefaultRequestRejectHandler<TelifCmds::SetGpHierarchy>();
135 return ev->GetPayload().GetReplyFuture();
138 virtual ::elt::mal::future<std::string>
StopGuideProbe(
const pfsif::GuideProbeId guide_probe_id)
override {
140 LOG4CPLUS_INFO(
GetLogger(),
"Received StopGuideProbe with: id " << guide_probe_id );
141 auto ev = std::make_shared<TelifCmds::StopGuideProbe>(guide_probe_id);
143 m_sm.RegisterDefaultRequestRejectHandler<TelifCmds::StopGuideProbe>();
147 return ev->GetPayload().GetReplyFuture();
151 rad::SMAdapter& m_sm;
153 static std::string ContinuationCheckRejection(elt::mal::future<std::string> future, std::string method_name) {
154 std::string reply = future.get();
155 if (reply.find(
"Request rejected in state") != std::string::npos) {
156 LOG4CPLUS_INFO(
GetLogger(), method_name <<
" command rejected by eltpk: " << reply);
Definition telifCmdsImpl.hpp:25
virtual ::elt::mal::future< std::string > SetOffsetSequenceMode(telifif::SequenceMode sequence_mode) override
Definition telifCmdsImpl.hpp:89
virtual ::elt::mal::future< std::string > StopGuideProbe(const pfsif::GuideProbeId guide_probe_id) override
Definition telifCmdsImpl.hpp:138
virtual ::elt::mal::future< std::string > SetPresetSequence(const std::string &sequence) override
Definition telifCmdsImpl.hpp:80
virtual elt::mal::future< std::string > MoveToAltAzPos(const std::shared_ptr< ccsinsif::AltAz > &axes_position) override
Definition telifCmdsImpl.hpp:48
virtual ::elt::mal::future< std::string > SetGpHierarchy(const std::shared_ptr< pfsif::GpHierarchyArgs > &gp_hierarchy_args) override
Definition telifCmdsImpl.hpp:125
virtual elt::mal::future< std::string > StopTracking() override
Definition telifCmdsImpl.hpp:60
virtual ::elt::mal::future< std::string > SetPresetSequenceMode(telifif::SequenceMode sequence_mode) override
Definition telifCmdsImpl.hpp:71
virtual ::elt::mal::future< std::string > SetGuideProbe(const std::shared_ptr< pfsif::GuideStarArgs > &guide_star_args) override
Definition telifCmdsImpl.hpp:107
virtual ~TelifCmdsImpl()
Definition telifCmdsImpl.hpp:31
virtual ::elt::mal::future< std::string > SetOffsetSequence(const std::string &sequence) override
Definition telifCmdsImpl.hpp:98
virtual elt::mal::future< std::string > MoveToNamedPos(const std::string &position_name) override
Definition telifCmdsImpl.hpp:35
TelifCmdsImpl(rad::SMAdapter &sm)
Definition telifCmdsImpl.hpp:27
Definition configTest.cpp:22
log4cplus::Logger & GetLogger()
Definition logger.cpp:21