15#include "../../libMagAOX/libMagAOX.hpp"
16#include "../../magaox_git_version.h"
104 const std::string & com
149 static_cast<void>(_config);
228 elevatedPrivileges
elPriv(
this);
273 elevatedPrivileges
elPriv(
this);
303 in[
sizeof(
in)-1] =
'\0';
461 in[
sizeof(
in)-1] =
'\0';
530 float ll =
m_lspd/9600.*60. * (12.7/12.0);
542 int h = (12.0/12.7) / 60. * 9600 *
fabs(
ws);
565 std::string
com =
"EO=1";
625 std::string
com =
"EO=0";
666 std::string
com =
"EO=0";
693 if(
ipRecv.find(
"current"))
695 ws =
ipRecv[
"current"].get<
double>();
700 ws =
ipRecv[
"target"].get<
double>();
703 if(ws == 0)
return 0;
705 std::lock_guard<std::mutex> guard(m_indiMutex);
709 return windSpeed(ws);
719 if(!
ipRecv.find(
"request"))
return 0;
721 std::unique_lock<std::mutex>
lock(m_indiMutex);
723 if(
ipRecv[
"request"].getSwitchState() == pcf::IndiElement::On)
735 if(!
ipRecv.find(
"request"))
return 0;
737 std::unique_lock<std::mutex>
lock(m_indiMutex);
739 if(
ipRecv[
"request"].getSwitchState() == pcf::IndiElement::On)
751 if(!
ipRecv.find(
"request"))
return 0;
753 std::unique_lock<std::mutex>
lock(m_indiMutex);
755 if(
ipRecv[
"request"].getSwitchState() == pcf::IndiElement::On)
The base-class for MagAO-X applications.
void updateIfChanged(pcf::IndiProperty &p, const std::string &el, const T &newVal, pcf::IndiProperty::PropertyStateType ipState=pcf::IndiProperty::Ok)
Update an INDI property element value if it has changed.
int createStandardIndiRequestSw(pcf::IndiProperty &prop, const std::string &name, const std::string &label="", const std::string &group="")
Create a standard R/W INDI switch with a single request element.
stateCodes::stateCodeT state()
Get the current state code.
int registerIndiPropertyNew(pcf::IndiProperty &prop, int(*)(void *, const pcf::IndiProperty &))
Register an INDI property which is exposed for others to request a New Property for.
int m_powerState
Current power state, 1=On, 0=Off, -1=Unk.
int stateLogged()
Updates and returns the value of m_stateLogged. Will be 0 on first call after a state change,...
static int log(const typename logT::messageT &msg, logPrioT level=logPrio::LOG_DEFAULT)
Make a log entry.
std::mutex m_indiMutex
Mutex for locking INDI communications.
int m_powerTargetState
Current target power state, 1=On, 0=Off, -1=Unk.
virtual void loadConfig()
int sendRecv(std::string &sout, const std::string &com)
virtual int appStartup()
Startup function.
virtual void setupConfig()
pcf::IndiProperty m_indiP_start
int loadConfigImpl(mx::app::appConfigurator &_config)
Implementation of loadConfig logic, separated for testing.
INDI_NEWCALLBACK_DECL(acesxeCtrl, m_indiP_windspeed)
friend class acesxeCtrl_test
pcf::IndiProperty m_indiP_windspeed
virtual int appLogic()
Implementation of the FSM for acesxeCtrl.
acesxeCtrl()
Default c'tor.
~acesxeCtrl() noexcept
D'tor, declared and defined for noexcept.
INDI_NEWCALLBACK_DECL(acesxeCtrl, m_indiP_start)
pcf::IndiProperty m_indiP_abort
virtual int appShutdown()
Shutdown the app.
pcf::IndiProperty m_indiP_stop
INDI_NEWCALLBACK_DECL(acesxeCtrl, m_indiP_abort)
INDI_NEWCALLBACK_DECL(acesxeCtrl, m_indiP_stop)
#define INDI_NEWCALLBACK_DEFN(class, prop)
Define the callback for a new property request.
#define INDI_NEWCALLBACK(prop)
Get the name of the static callback wrapper for a new property.
@ OPERATING
The device is operating, other than homing.
@ POWEROFF
The device power is off.
@ NODEVICE
No device exists for the application to control.
@ ERROR
The application has encountered an error, from which it is recovering (with or without intervention)
@ READY
The device is ready for operation, but is not operating.
@ CONNECTED
The application has connected to the device or service.
@ NOTCONNECTED
The application is not connected to the device or service.
@ POWERON
The device power is on.
#define INDI_VALIDATE_CALLBACK_PROPS(prop1, prop2)
Standard check for matching INDI properties in a callback.
const pcf::IndiProperty & ipRecv
updateIfChanged(m_indiP_angle, "target", m_angle)
std::unique_lock< std::mutex > lock(m_indiMutex)
static constexpr logPrioT LOG_NOTICE
A normal but significant condition.
static constexpr logPrioT LOG_CRITICAL
The process can not continue and will shut down (fatal)