Kstars

indilistener.h
1 /*
2  SPDX-FileCopyrightText: 2012 Jasem Mutlaq <[email protected]>
3 
4  SPDX-License-Identifier: GPL-2.0-or-later
5 
6  Handle INDI Standard properties.
7 */
8 
9 #pragma once
10 
11 #include "indi/indistd.h"
12 
13 #include <indiproperty.h>
14 
15 #include <QObject>
16 
17 class ClientManager;
18 class FITSViewer;
19 class DeviceInfo;
20 
21 /**
22  * @class INDIListener
23  * INDIListener is responsible for creating ISD::GDInterface generic devices as new devices arrive from
24  * ClientManager. It can support multiple ClientManagers and will first create a generic INDI device.
25  * Upon arrival of INDI properties, INDIListener can create specialized devices (e.g. Telescope) if it
26  * detects key Standard INDI property that signifies a particular device family. The generic device
27  * functionality is extended via the Decorator design pattern.
28  *
29  * INDIListener also delegates INDI properties as they are received from ClientManager to the appropriate
30  * device to be processed.
31  *
32  * @author Jasem Mutlaq
33  */
34 class INDIListener : public QObject
35 {
36  Q_OBJECT
37 
38  public:
39  static INDIListener *Instance();
40 
41  void addClient(ClientManager *cm);
42  void removeClient(ClientManager *cm);
43 
44  ISD::GenericDevice *getDevice(const QString &name) const;
45  const QList<ISD::GenericDevice *> getDevices() const
46  {
47  return devices;
48  }
49 
50  int size() const
51  {
52  return devices.size();
53  }
54 
55  public slots:
56 
57  void registerProperty(INDI::Property prop);
58  void removeProperty(const QString &device, const QString &name);
59  void processDevice(DeviceInfo *dv);
60  void processSwitch(ISwitchVectorProperty *svp);
61  void processText(ITextVectorProperty *tvp);
62  void processNumber(INumberVectorProperty *nvp);
63  void processLight(ILightVectorProperty *lvp);
64  void processBLOB(IBLOB *bp);
65  void processMessage(INDI::BaseDevice *dp, int messageID);
66  void processUniversalMessage(const QString &message);
67  void removeDevice(const QString &deviceName);
68 
69  private:
70  explicit INDIListener(QObject *parent);
71  ~INDIListener() override;
72 
73  static INDIListener *_INDIListener;
74 
75  QList<ClientManager *> clients;
77 
78  signals:
79  void newDevice(ISD::GenericDevice *);
80  void deviceRemoved(ISD::GenericDevice *);
81 };
Q_OBJECTQ_OBJECT
int size() const const
Primary window to view monochrome and color FITS images. The FITSviewer can open multiple images each...
Definition: fitsviewer.h:48
QObject * parent() const const
QString message
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Fri Aug 12 2022 04:00:54 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.