Kstars

blobmanager.cpp
1 /*
2  SPDX-FileCopyrightText: 2012 Jasem Mutlaq <[email protected]>
3 
4  SPDX-License-Identifier: GPL-2.0-or-later
5 */
6 
7 #include "clientmanager.h"
8 
9 #include "deviceinfo.h"
10 #include "drivermanager.h"
11 #include "guimanager.h"
12 #include "indilistener.h"
13 #include "Options.h"
14 #include "servermanager.h"
15 
16 #include <indi_debug.h>
17 
18 BlobManager::BlobManager(QObject *parent, const QString &host, int port, const QString &device,
19  const QString &prop) : QObject(parent), m_Device(device), m_Property(prop)
20 {
21  // Set INDI server params
22  setServer(host.toLatin1().constData(), port);
23 
24  // We're only interested in a particular device
25  watchDevice(m_Device.toLatin1().constData());
26 
27  // Connect immediately
28  connectServer();
29 }
30 
31 void BlobManager::serverDisconnected(int exit_code)
32 {
33  qCDebug(KSTARS_INDI) << "INDI server disconnected from BLOB manager for Device:" << m_Device << "Property:" << m_Property <<
34  "Exit code:" << exit_code;
35 }
36 
37 void BlobManager::newBLOB(IBLOB *bp)
38 {
39  emit newINDIBLOB(bp);
40 }
41 
42 void BlobManager::newDevice(INDI::BaseDevice *device)
43 {
44  // Got out target device, let's now set to BLOB ONLY for the particular property we want
45  if (QString(device->getDeviceName()) == m_Device)
46  {
47  setBLOBMode(B_ONLY, m_Device.toLatin1().constData(), m_Property.toLatin1().constData());
48  // enable Direct Blob Access for faster BLOB loading.
49 #if INDI_VERSION_MAJOR >= 1 && INDI_VERSION_MINOR >= 9 && INDI_VERSION_RELEASE >= 7
50  enableDirectBlobAccess(m_Device.toLatin1().constData(), m_Property.toLatin1().constData());
51 #endif
52  emit connected();
53  }
54 }
55 
56 void BlobManager::setEnabled(bool enabled)
57 {
58  m_Enabled = enabled;
59  setBLOBMode(enabled ? B_ONLY : B_NEVER, m_Device.toLatin1().constData(), m_Property.toLatin1().constData());
60 }
QByteArray toLatin1() const const
ScriptableExtension * host() const
const char * constData() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Mon Aug 8 2022 04:13:18 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.