45 input.c_str(), output.c_str());
73 if (m_InputReady && m_OutputReady && m_ConnectionCallback)
76 m_ConnectionCallback(
true);
94 m_InputReady = m_OutputReady =
false;
104 if (!m_InputReady || !m_OutputReady)
108 auto toggled =
property.getSwitch()->at(0)->getState() ==
ISS_ON;
110 m_InputReady = toggled;
112 m_OutputReady = toggled;
114 if (m_InputReady && m_OutputReady && m_ConnectionCallback)
117 m_ConnectionCallback(
true);
124 auto fullyOpenedUpdated =
false, fullyClosedUpdated =
false;
125 for (
const auto &value : m_InputFullyOpened)
127 const auto name =
"DIGITAL_INPUT_" + std::to_string(value);
130 fullyOpenedUpdated =
true;
135 if (fullyOpenedUpdated)
138 for (
const auto &value : m_InputFullyClosed)
140 const auto name =
"DIGITAL_INPUT_" + std::to_string(value);
143 fullyClosedUpdated =
true;
148 if (fullyClosedUpdated)
167 for (
const auto &value : m_OutputOpenRoof)
169 const auto name =
"DIGITAL_OUTPUT_" + std::to_string(value);
170 auto property =
device.getSwitch(name.c_str());
175 property[1].setState(
ISS_ON);
201 for (
const auto &value : m_OutputCloseRoof)
203 const auto name =
"DIGITAL_OUTPUT_" + std::to_string(value);
204 auto property =
device.getSwitch(name.c_str());
209 property[1].setState(
ISS_ON);
237 for (
const auto &value : m_OutputCloseRoof)
239 const auto name =
"DIGITAL_OUTPUT_" + std::to_string(value);
240 auto property =
device.getSwitch(name.c_str());
241 if (property && property[0].getState() !=
ISS_ON)
245 property[0].setState(
ISS_ON);
251 for (
const auto &value : m_OutputOpenRoof)
253 const auto name =
"DIGITAL_OUTPUT_" + std::to_string(value);
254 auto property =
device.getSwitch(name.c_str());
255 if (property && property[0].getState() !=
ISS_ON)
259 property[0].setState(
ISS_ON);
282 std::vector<bool> fullyOpenedStates;
283 for (
const auto &value : m_InputFullyOpened)
285 const auto name =
"DIGITAL_INPUT_" + std::to_string(value);
286 auto property =
device.getSwitch(name.c_str());
289 auto toggled =
property[1].getState() ==
ISS_ON;
291 fullyOpenedStates.push_back(toggled);
300 auto on = std::all_of(fullyOpenedStates.begin(), fullyOpenedStates.end(), [](
bool value)
305 m_FullyOpenedCallback(on);
325 std::vector<bool> fullyClosedStates;
326 for (
const auto &value : m_InputFullyClosed)
328 const auto name =
"DIGITAL_INPUT_" + std::to_string(value);
329 auto property =
device.getSwitch(name.c_str());
332 auto toggled =
property[1].getState() ==
ISS_ON;
334 fullyClosedStates.push_back(toggled);
343 auto on = std::all_of(fullyClosedStates.begin(), fullyClosedStates.end(), [](
bool value)
348 m_FullyClosedCallback(on);
INDI::BaseDevice getDevice(const char *deviceName)
void sendNewSwitch(INDI::Property pp)
Send new Switch command to server.
Class to provide basic INDI device functionality.
bool isDeviceNameMatch(const char *otherName) const
Check that the device name matches the argument.
Provides generic container for INDI properties.
bool isDeviceNameMatch(const char *otherDeviceName) const
bool isNameMatch(const char *otherName) const
bool syncFullyOpenedState()
Checks fully opened state properties.
bool syncFullyClosedState()
virtual void serverDisconnected(int exitCode) override
Emmited when the server gets disconnected.
bool stop()
Sets both Close & Open roof outputs to OFF.
virtual void newDevice(INDI::BaseDevice dp) override
Emmited when a new device is created from INDI server.
UniversalRORClient(const std::string &input, const std::string &output)
virtual void newProperty(INDI::Property property) override
Emmited when a new property is created for an INDI driver.
virtual void updateProperty(INDI::Property property) override
Check if any of the relevant digital inputs are for the fully opened or closed states.
#define DEBUGDEVICE(device, priority, msg)
#define DEBUGFDEVICE(device, priority, msg,...)