Kstars

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

KDE's Doxygen guidelines are available online.