• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

kstars

  • sources
  • kde-4.12
  • kdeedu
  • kstars
  • kstars
  • indi
driverinfo.cpp
Go to the documentation of this file.
1 /* INDI Device
2  Copyright (C) 2012 Jasem Mutlaq (mutlaqja@ikarustech.com)
3 
4  This application is free software; you can redistribute it and/or
5  modify it under the terms of the GNU General Public
6  License as published by the Free Software Foundation; either
7  version 2 of the License, or (at your option) any later version.
8 
9  */
10 
11 #include <QDebug>
12 #include <basedevice.h>
13 
14 #include "driverinfo.h"
15 #include "deviceinfo.h"
16 
17 #include "servermanager.h"
18 
19 
20 DriverInfo::DriverInfo(const QString &inName)
21 {
22  uniqueLabel.clear();
23  name = inName;
24 
25  driverSource = PRIMARY_XML;
26 
27  // Initially off
28  serverState = false;
29  clientState = false;
30 
31  serverManager = NULL;
32 
33  hostname = "localhost";
34  port = "-1";
35  userPort = "-1";
36 
37 }
38 
39 DriverInfo::~DriverInfo()
40 {
41  qDeleteAll(devices);
42 }
43 
44 void DriverInfo::clear()
45 {
46  //managed = false;
47  serverState = false;
48  clientState = false;
49  serverManager = NULL;
50 
51  uniqueLabel.clear();
52  qDeleteAll(devices);
53  devices.clear();
54 }
55 
56 QString DriverInfo::getServerBuffer()
57 {
58  if (serverManager != NULL)
59  return serverManager->getLogBuffer();
60 
61  return QString();
62 }
63 
64 void DriverInfo::setServerState(bool inState)
65 {
66  if (inState == serverState)
67  return;
68 
69  serverState = inState;
70 
71  if (serverState == false)
72  serverManager = NULL;
73 
74  emit deviceStateChanged(this);
75 }
76 
77 void DriverInfo::setClientState(bool inState)
78 {
79  //qDebug() << "Request to change " << name << " client status to " << (inState ? "True" : "False") << endl;
80 
81  if (inState == clientState)
82  return;
83 
84 
85  clientState = inState;
86 
87  if (clientState == false)
88  clientManager = NULL;
89 
90  //qDebug() << "Client state for this device changed, calling device state changed signal " << endl;
91 
92  emit deviceStateChanged(this);
93 }
94 
95 void DriverInfo::setUserPort(const QString &inUserPort)
96 {
97  if (inUserPort.isEmpty() == false)
98  userPort = inUserPort;
99  else
100  userPort = "-1";
101 }
102 
103 void DriverInfo::addDevice(DeviceInfo *idv)
104 {
105  devices.append(idv);
106 }
107 
108 DeviceInfo* DriverInfo::getDevice(const QString &deviceName)
109 {
110  foreach(DeviceInfo *idv, devices)
111  {
112  if (idv->getBaseDevice()->getDeviceName() == deviceName)
113  return idv;
114  }
115 
116  return NULL;
117 
118 }
119 
120 #include "driverinfo.moc"
DriverInfo::setUserPort
void setUserPort(const QString &inUserPort)
Definition: driverinfo.cpp:95
DriverInfo::getDevice
DeviceInfo * getDevice(const QString &deviceName)
Definition: driverinfo.cpp:108
deviceinfo.h
DriverInfo::deviceStateChanged
void deviceStateChanged(DriverInfo *)
ServerManager::getLogBuffer
const QString & getLogBuffer()
Definition: servermanager.h:41
servermanager.h
DriverInfo::addDevice
void addDevice(DeviceInfo *idv)
Definition: driverinfo.cpp:103
DeviceInfo::getBaseDevice
INDI::BaseDevice * getBaseDevice()
Definition: deviceinfo.h:24
driverinfo.h
DriverInfo::setClientState
void setClientState(bool inState)
Definition: driverinfo.cpp:77
DriverInfo::DriverInfo
DriverInfo(const QString &inName)
Definition: driverinfo.cpp:20
DriverInfo::~DriverInfo
~DriverInfo()
Definition: driverinfo.cpp:39
DriverInfo::getServerBuffer
QString getServerBuffer()
Definition: driverinfo.cpp:56
DriverInfo::clear
void clear()
Definition: driverinfo.cpp:44
DeviceInfo
Definition: deviceinfo.h:18
DriverInfo::setServerState
void setServerState(bool inState)
Definition: driverinfo.cpp:64
PRIMARY_XML
Definition: indicommon.h:15
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:36:19 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kstars

Skip menu "kstars"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal