9#include "indiconcretedevice.h"
10#include "clientmanager.h"
15uint8_t ConcreteDevice::m_ID = 1;
17ConcreteDevice::ConcreteDevice(
ISD::GenericDevice *parent) : GDInterface(parent), m_Parent(parent),
18 m_Name(parent->getDeviceName())
21 connect(parent, &GenericDevice::Connected,
this, [
this]()
23 m_ReadyTimer.reset(
new QTimer(
this));
24 m_ReadyTimer->setInterval(250);
25 m_ReadyTimer->setSingleShot(
true);
29 connect(parent, &GenericDevice::Disconnected,
this, [
this]()
37 connect(parent, &GenericDevice::propertyDefined,
this, [
this](INDI::Property value)
40 m_ReadyTimer->start();
41 registerProperty(value);
43 connect(parent, &GenericDevice::propertyDeleted,
this, &ConcreteDevice::removeProperty);
44 connect(parent, &GenericDevice::propertyUpdated,
this, &ConcreteDevice::updateProperty);
49 connect(parent, &GenericDevice::propertyDefined,
this, &ConcreteDevice::propertyDefined);
50 connect(parent, &GenericDevice::propertyDeleted,
this, &ConcreteDevice::propertyDeleted);
51 connect(parent, &GenericDevice::propertyUpdated,
this, &ConcreteDevice::propertyUpdated);
54void ConcreteDevice::registeProperties()
57 for (
auto &oneProperty : m_Parent->getProperties())
58 registerProperty(oneProperty);
61void ConcreteDevice::updateProperty(INDI::Property prop)
63 switch (prop.getType())
84void ConcreteDevice::processProperties()
87 for (
auto &oneProperty : m_Parent->getProperties())
89 switch (oneProperty.getType())
92 processSwitch(oneProperty);
95 processNumber(oneProperty);
98 processText(oneProperty);
101 processLight(oneProperty);
104 processBLOB(oneProperty);
112INDI::PropertyView<INumber> *ConcreteDevice::getNumber(
const QString &name)
const
117INDI::PropertyView<IText> *ConcreteDevice::getText(
const QString &name)
const
122INDI::PropertyView<ISwitch> *ConcreteDevice::getSwitch(
const QString &name)
const
127INDI::PropertyView<ILight> *ConcreteDevice::getLight(
const QString &name)
const
132INDI::PropertyView<IBLOB> *ConcreteDevice::getBLOB(
const QString &name)
const
137void ConcreteDevice::sendNewProperty(INDI::Property prop)
139 m_Parent->sendNewProperty(prop);
142QString ConcreteDevice::getMessage(
int id)
const
147INDI::Property ConcreteDevice::getProperty(
const QString &name)
const
149 return m_Parent->getProperty(name);
154 return m_Parent->getDriverInfo();
157bool ConcreteDevice::setConfig(INDIConfig tConfig)
159 return m_Parent->setConfig(tConfig);
162Properties ConcreteDevice::getProperties()
const
164 return m_Parent->getProperties();
167bool ConcreteDevice::getMinMaxStep(
const QString &propName,
const QString &elementName,
double *min,
double *max,
170 return m_Parent->getMinMaxStep(propName, elementName, min, max, step);
173IPState ConcreteDevice::getState(
const QString &propName)
const
175 return m_Parent->getState(propName);
178IPerm ConcreteDevice::getPermission(
const QString &propName)
const
180 return m_Parent->getPermission(propName);
GenericDevice is the Generic Device for INDI devices.
ISD is a collection of INDI Standard Devices.
QCA_EXPORT void setProperty(const QString &name, const QVariant &value)
const char * constData() const const
QString fromStdString(const std::string &str)
QByteArray toLatin1() const const
QFuture< ArgsType< Signal > > connect(Sender *sender, Signal signal)