moved kdeaccessibility kdeaddons kdeadmin kdeartwork kdebindings kdeedu kdegames...
[kdeedu.git] / kstars / kstars / indidevice.h
blob84596905b429c77e1fb34dc8f07a0fa3f6b843d0
1 /* INDI Device
2 Copyright (C) 2003 Jasem Mutlaq (mutlaqja@ikarustech.com)
3 Elwood C. Downey
5 This application is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9 */
11 #ifndef INDIDEVICE_H
12 #define INDIDEVICE_H
14 #include <kdialogbase.h>
15 #include <unistd.h>
16 #include <qptrlist.h>
18 #include "indielement.h"
20 class DeviceManager;
21 class INDI_D;
22 class INDI_P;
23 class INDI_G;
24 class INDI_E;
25 class INDIMenu;
26 class INDIStdDevice;
27 class SkyObject;
29 class KLed;
30 class KLineEdit;
31 class KComboBox;
32 class KDoubleSpinBox;
33 class KPushButton;
34 class KPopupMenu;
36 class QTable;
37 class QLabel;
38 class QHBoxLayout;
39 class QVBoxLayout;
40 class QFrame;
41 class QLineEdit;
42 class QString;
43 class QTextEdit;
44 class QListView;
45 class QTabWidget;
46 class QSpacerItem;
47 class QGridLayout;
48 class QButtonGroup;
49 class QCheckBox;
50 class QScrollView;
51 class QSocketNotifier;
52 class QVBox;
54 /*************************************************************************
55 ** The INDI Tree
57 ** INDI_ELEMENT <----------------------------------------
58 ** | |
59 ** -----> INDI_PROPERTY |
60 ** | |
61 ** -----> INDI_GROUP |
62 ** | |
63 ** -----> INDI_DEVICE
64 ** | |
65 Device Manager INDI Menu
66 **************************************************************************/
69 /* INDI device */
70 class INDI_D : public KDialogBase
72 Q_OBJECT
73 public:
74 INDI_D(INDIMenu *parentMenu, DeviceManager *parentManager, QString inName, QString inLabel);
75 ~INDI_D();
77 QString name; /* device name */
78 QString label; /* device label */
79 QVBox *deviceVBox; /* device tab frame */
80 QTabWidget *groupContainer; /* Groups within the device */
81 QTextEdit *msgST_w; /* scrolled text for messages */
82 unsigned char *dataBuffer; /* Generic buffer */
83 //QScrollView *sv; /* Scroll view */
84 //QVBoxLayout *mainLayout;
85 //QVBox *propertyLayout;
86 //QSpacerItem *vSpacer;
87 //QSpacerItem *hSpacer;
89 //QPushButton *clear;
90 //QHBoxLayout *buttonLayout;
91 INDIStdDevice *stdDev;
93 QPtrList<INDI_G> gl; /* list of pointers to groups */
95 INDI_G *curGroup;
96 bool INDIStdSupport;
98 INDIMenu *parent;
99 DeviceManager *parentMgr;
101 enum DTypes { DATA_FITS, DATA_STREAM, DATA_OTHER };
103 /*****************************************************************
104 * Build
105 ******************************************************************/
106 int buildTextGUI (XMLEle *root, char errmsg[]);
107 int buildNumberGUI (XMLEle *root, char errmsg[]);
108 int buildSwitchesGUI(XMLEle *root, char errmsg[]);
109 int buildMenuGUI (INDI_P *pp, XMLEle *root, char errmsg[]);
110 int buildLightsGUI (XMLEle *root, char errmsg[]);
111 int buildBLOBGUI (XMLEle *root, char errmsg[]);
113 /*****************************************************************
114 * Add
115 ******************************************************************/
116 INDI_P * addProperty (XMLEle *root, char errmsg[]);
118 /*****************************************************************
119 * Find
120 ******************************************************************/
121 INDI_P * findProp (QString name);
122 INDI_E * findElem (QString name);
123 INDI_G * findGroup (QString grouptag, int create, char errmsg[]);
124 int findPerm (INDI_P *pp , XMLEle *root, PPerm *permp, char errmsg[]);
126 /*****************************************************************
127 * Set/New
128 ******************************************************************/
129 int setValue (INDI_P *pp, XMLEle *root, char errmsg[]);
130 int setLabelState (INDI_P *pp, XMLEle *root, char errmsg[]);
131 int setTextValue (INDI_P *pp, XMLEle *root, char errmsg[]);
132 int setBLOB (INDI_P *pp, XMLEle * root, char errmsg[]);
134 int newValue (INDI_P *pp, XMLEle *root, char errmsg[]);
135 int newTextValue (INDI_P *pp, XMLEle *root, char errmsg[]);
137 int setAnyCmd (XMLEle *root, char errmsg[]);
138 int newAnyCmd (XMLEle *root, char errmsg[]);
140 int removeProperty(INDI_P *pp);
142 /*****************************************************************
143 * Crack
144 ******************************************************************/
145 int crackLightState (char *name, PState *psp);
146 int crackSwitchState (char *name, PState *psp);
148 /*****************************************************************
149 * Data processing
150 ******************************************************************/
151 int processBlob(INDI_E *blobEL, XMLEle *ep, char errmsg[]);
153 /*****************************************************************
154 * INDI standard property policy
155 ******************************************************************/
156 bool isOn();
157 void registerProperty(INDI_P *pp);
158 bool isINDIStd(INDI_P *pp);
162 #endif