moved kdeaccessibility kdeaddons kdeadmin kdeartwork kdebindings kdeedu kdegames...
[kdeedu.git] / kstars / kstars / indidriver.h
blobfe63fae31b27f91260c00816fa37b7a38d65bc54
1 /***************************************************************************
2 INDI Driver
3 -------------------
4 begin : Wed May 7th 2003
5 copyright : (C) 2001 by Jasem Mutlaq
6 email : mutlaqja@ikarustech.com
7 ***************************************************************************/
8 /***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
17 #ifndef INDIDRIVER_H
18 #define INDIDRIVER_H
20 #include <qstringlist.h>
21 #include <kdialogbase.h>
22 #include <unistd.h>
23 #include <vector>
25 #include "indi/lilxml.h"
26 #include "devmanager.h"
28 class KStars;
30 class KListView;
31 class KPopupMenu;
32 class KProcess;
34 struct INDIHostsInfo
36 QString name;
37 QString hostname;
38 QString portnumber;
39 bool isConnected;
40 int mgrID;
43 class IDevice : public QObject
45 Q_OBJECT
47 public:
48 IDevice(QString inLabel, QString inDriver, QString inExec, QString inVersion);
49 ~IDevice();
51 enum ServeMODE { M_LOCAL, M_SERVER };
52 QString label;
53 QString driver;
54 QString exec;
55 QString version;
56 QStringList serverBuffer;
57 int state;
58 int mode;
59 int indiPort;
60 bool managed;
61 int mgrID;
62 int deviceType;
63 KProcess *proc;
65 void restart();
67 public slots:
68 void processstd(KProcess *proc, char* buffer, int buflen);
70 signals:
71 void newServerInput();
75 class INDIDriver : public devManager
78 Q_OBJECT
80 public:
82 INDIDriver(QWidget * parent = 0);
83 ~INDIDriver();
85 KListView* deviceContainer;
87 bool readXMLDriver();
89 bool buildDeviceGroup (XMLEle *root, char errmsg[]);
90 bool buildDriverElement(XMLEle *root, QListViewItem *DGroup, int groupType, char errmsg[]);
92 QListViewItem *lastGroup;
93 QListViewItem *lastDevice;
95 QPixmap runningPix;
96 QPixmap stopPix;
97 QPixmap connected;
98 QPixmap disconnected;
99 QPixmap establishConnection;
100 QPixmap localMode;
101 QPixmap serverMode;
103 KPopupMenu *ClientpopMenu;
104 KPopupMenu *LocalpopMenu;
106 int lastPort;
108 bool runDevice(IDevice *dev);
109 void removeDevice(IDevice *dev);
110 void removeDevice(QString deviceLabel);
111 int getINDIPort();
112 int activeDriverCount();
113 bool isDeviceRunning(QString deviceLabel);
115 void saveHosts();
117 std::vector <IDevice *> devices;
119 KStars *ksw;
122 public slots:
123 void updateMenuActions();
124 void ClientprocessRightButton( QListViewItem *, const QPoint &, int );
125 void LocalprocessRightButton( QListViewItem *, const QPoint &, int );
126 void processDeviceStatus(int);
127 void processHostStatus(int);
128 void addINDIHost();
129 void modifyINDIHost();
130 void removeINDIHost();
131 void shutdownHost(int mgrID);
132 void updateLocalButtons();
133 void updateClientButtons();
134 void activateRunService();
135 void activateStopService();
136 void activateHostConnection();
137 void activateHostDisconnection();
140 #endif