File indexing completed on 2024-07-21 06:28:17

0001 /*
0002     SPDX-FileCopyrightText: 2018 Jasem Mutlaq <mutlaqja@ikarustech.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #ifdef USE_QT5_INDI
0010 #include <baseclientqt.h>
0011 #else
0012 #include <baseclient.h>
0013 #include <QObject>
0014 #endif
0015 
0016 class DeviceInfo;
0017 class DriverInfo;
0018 class ServerManager;
0019 
0020 /**
0021  * @class BlobManager
0022  * BlobManager manages connection to INDI server to handle a specific BLOB.
0023  *
0024  * BlobManager is a subclass of INDI::BaseClient class part of the INDI Library.
0025  *
0026  * @author Jasem Mutlaq
0027  * @version 1.0
0028  */
0029 #ifdef USE_QT5_INDI
0030 class BlobManager : public INDI::BaseClientQt
0031 #else
0032 class BlobManager : public QObject, public INDI::BaseClient
0033 #endif
0034 {
0035     Q_OBJECT
0036     Q_PROPERTY(QString device MEMBER m_Device)
0037     Q_PROPERTY(QString property MEMBER m_Property)
0038     Q_PROPERTY(bool enabled READ enabled WRITE setEnabled)
0039 
0040   public:
0041     BlobManager(QObject *parent, const QString &host, int port, const QString &device, const QString &prop);
0042     virtual ~BlobManager() override = default;
0043 
0044     bool enabled() { return m_Enabled; }
0045     void setEnabled(bool enabled);
0046 
0047   protected:
0048     virtual void newDevice(INDI::BaseDevice device) override;
0049     virtual void updateProperty(INDI::Property prop) override;
0050 
0051     virtual void serverConnected() override {}
0052     virtual void serverDisconnected(int exit_code) override;
0053 
0054   signals:   
0055     void propertyUpdated(INDI::Property prop);
0056     void connected();
0057     void connectionFailure();
0058 
0059   private:
0060     QString m_Device;
0061     QString m_Property;
0062     bool m_Enabled { true };
0063 };