kstars
indidriver.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef INDIDRIVER_H
00018 #define INDIDRIVER_H
00019
00020 #include <qstringlist.h>
00021 #include <kdialogbase.h>
00022 #include <unistd.h>
00023 #include <vector>
00024
00025 #include "indi/lilxml.h"
00026 #include "devmanager.h"
00027
00028 class KStars;
00029
00030 class KListView;
00031 class KPopupMenu;
00032 class KProcess;
00033
00034 struct INDIHostsInfo
00035 {
00036 QString name;
00037 QString hostname;
00038 QString portnumber;
00039 bool isConnected;
00040 int mgrID;
00041 };
00042
00043 class IDevice : public QObject
00044 {
00045 Q_OBJECT
00046
00047 public:
00048 IDevice(QString inLabel, QString inDriver, QString inVersion);
00049 ~IDevice();
00050
00051 enum ServeMODE { M_LOCAL, M_SERVER };
00052 QString label;
00053 QString driver;
00054 QString version;
00055 QStringList serverBuffer;
00056 int state;
00057 int mode;
00058 int indiPort;
00059 bool managed;
00060 int mgrID;
00061 int deviceType;
00062 KProcess *proc;
00063
00064
00065 double focal_length;
00066 double aperture;
00067
00068 void restart();
00069
00070 public slots:
00071 void processstd(KProcess *proc, char* buffer, int buflen);
00072
00073 signals:
00074 void newServerInput();
00075
00076 };
00077
00078 class INDIDriver : public devManager
00079 {
00080
00081 Q_OBJECT
00082
00083 public:
00084
00085 INDIDriver(QWidget * parent = 0);
00086 ~INDIDriver();
00087
00088 KListView* deviceContainer;
00089
00090 bool readXMLDriver();
00091
00092 bool buildDriversList( XMLEle *root, char errmsg[]);
00093 bool buildDeviceGroup (XMLEle *root, char errmsg[]);
00094 bool buildDriverElement(XMLEle *root, QListViewItem *DGroup, int groupType, char errmsg[]);
00095
00096 QListViewItem *lastGroup;
00097 QListViewItem *lastDevice;
00098
00099 QStringList driversList;
00100
00101 QPixmap runningPix;
00102 QPixmap stopPix;
00103 QPixmap connected;
00104 QPixmap disconnected;
00105 QPixmap establishConnection;
00106 QPixmap localMode;
00107 QPixmap serverMode;
00108
00109 KPopupMenu *ClientpopMenu;
00110 KPopupMenu *LocalpopMenu;
00111
00112 int lastPort;
00113
00114 bool runDevice(IDevice *dev);
00115 void removeDevice(IDevice *dev);
00116 void removeDevice(QString deviceLabel);
00117 void saveDevicesToDisk();
00118 int getINDIPort();
00119 int activeDriverCount();
00120 bool isDeviceRunning(QString deviceLabel);
00121
00122 void saveHosts();
00123
00124 std::vector <IDevice *> devices;
00125
00126 KStars *ksw;
00127
00128
00129 public slots:
00130 void updateMenuActions();
00131 void ClientprocessRightButton( QListViewItem *, const QPoint &, int );
00132 void LocalprocessRightButton( QListViewItem *, const QPoint &, int );
00133 void processDeviceStatus(int);
00134 void processHostStatus(int);
00135 void addINDIHost();
00136 void modifyINDIHost();
00137 void removeINDIHost();
00138 void shutdownHost(int mgrID);
00139 void updateLocalButtons();
00140 void updateClientButtons();
00141 void activateRunService();
00142 void activateStopService();
00143 void activateHostConnection();
00144 void activateHostDisconnection();
00145 };
00146
00147 #endif