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, &ConcreteDevice::Disconnected);
32 connect(parent, &GenericDevice::propertyDefined,
this, [
this](INDI::Property value)
35 m_ReadyTimer->start();
36 registerProperty(value);
38 connect(parent, &GenericDevice::propertyDeleted,
this, &ConcreteDevice::removeProperty);
39 connect(parent, &GenericDevice::propertyUpdated,
this, &ConcreteDevice::updateProperty);
44 connect(parent, &GenericDevice::propertyDefined,
this, &ConcreteDevice::propertyDefined);
45 connect(parent, &GenericDevice::propertyDeleted,
this, &ConcreteDevice::propertyDeleted);
46 connect(parent, &GenericDevice::propertyUpdated,
this, &ConcreteDevice::propertyUpdated);
49void ConcreteDevice::registeProperties()
52 for (
auto &oneProperty : m_Parent->getProperties())
53 registerProperty(oneProperty);
56void ConcreteDevice::updateProperty(INDI::Property prop)
58 switch (prop.getType())
79void ConcreteDevice::processProperties()
82 for (
auto &oneProperty : m_Parent->getProperties())
84 switch (oneProperty.getType())
87 processSwitch(oneProperty);
90 processNumber(oneProperty);
93 processText(oneProperty);
96 processLight(oneProperty);
99 processBLOB(oneProperty);
107INDI::PropertyView<INumber> *ConcreteDevice::getNumber(
const QString &name)
const
112INDI::PropertyView<IText> *ConcreteDevice::getText(
const QString &name)
const
117INDI::PropertyView<ISwitch> *ConcreteDevice::getSwitch(
const QString &name)
const
122INDI::PropertyView<ILight> *ConcreteDevice::getLight(
const QString &name)
const
127INDI::PropertyView<IBLOB> *ConcreteDevice::getBLOB(
const QString &name)
const
132void ConcreteDevice::sendNewProperty(INDI::Property prop)
134 m_Parent->sendNewProperty(prop);
137QString ConcreteDevice::getMessage(
int id)
const
142INDI::Property ConcreteDevice::getProperty(
const QString &name)
const
144 return m_Parent->getProperty(name);
149 return m_Parent->getDriverInfo();
152bool ConcreteDevice::setConfig(INDIConfig tConfig)
154 return m_Parent->setConfig(tConfig);
157Properties ConcreteDevice::getProperties()
const
159 return m_Parent->getProperties();
162bool ConcreteDevice::getMinMaxStep(
const QString &propName,
const QString &elementName,
double *min,
double *max,
165 return m_Parent->getMinMaxStep(propName, elementName, min, max, step);
168IPState ConcreteDevice::getState(
const QString &propName)
const
170 return m_Parent->getState(propName);
173IPerm ConcreteDevice::getPermission(
const QString &propName)
const
175 return m_Parent->getPermission(propName);
GenericDevice is the Generic Device for INDI devices.
ISD is a collection of INDI Standard Devices.
const char * constData() const const
QString fromStdString(const std::string &str)
QByteArray toLatin1() const const
QFuture< ArgsType< Signal > > connect(Sender *sender, Signal signal)