28 #ifndef _TELESCOPE_CONTROL_HPP_
29 #define _TELESCOPE_CONTROL_HPP_
31 #include "StelFader.hpp"
32 #include "StelGui.hpp"
33 #include "StelJsonParser.hpp"
34 #include "StelObjectModule.hpp"
36 #include "TelescopeControlGlobals.hpp"
37 #include "VecMath.hpp"
46 #include <QStringList>
47 #include <QTextStream>
56 using namespace TelescopeControlGlobals;
58 typedef QSharedPointer<TelescopeClient> TelescopeClientP;
78 virtual void deinit();
79 virtual void update(
double deltaTime);
85 virtual QList<StelObjectP> searchAround(
const Vec3d& v,
double limitFov,
const StelCore* core)
const;
86 virtual StelObjectP searchByNameI18n(
const QString& nameI18n)
const;
87 virtual StelObjectP searchByName(
const QString& name)
const;
88 virtual QStringList listMatchingObjectsI18n(
const QString& objPrefix,
int maxNbItem=5)
const;
89 virtual QStringList listMatchingObjects(
const QString& objPrefix,
int maxNbItem=5)
const;
91 virtual QStringList listAllObjects(
bool inEnglish)
const { Q_UNUSED(inEnglish)
return QStringList(); }
92 virtual QString getName()
const {
return "Telescope Control"; }
93 virtual bool configureGui(
bool show =
true);
100 void telescopeGoto(
int telescopeNr,
const Vec3d &j2000Pos);
103 void deleteAllTelescopes();
106 const QHash<QString, DeviceModel>& getDeviceModels();
109 void loadConfiguration();
111 void saveConfiguration();
114 void saveTelescopes();
116 void loadTelescopes();
121 bool addTelescopeAtSlot(
int slot, ConnectionType connectionType, QString name, QString equinox, QString host = QString(
"localhost"),
int portTCP = DEFAULT_TCP_PORT,
int delay = DEFAULT_DELAY,
bool connectAtStartup =
false, QList<double> circles = QList<double>(), QString serverName = QString(), QString portSerial = QString());
123 bool getTelescopeAtSlot(
int slot, ConnectionType& connectionType, QString& name, QString& equinox, QString& host,
int& portTCP,
int& delay,
bool& connectAtStartup, QList<double>& circles, QString& serverName, QString& portSerial);
125 bool removeTelescopeAtSlot(
int slot);
128 bool startTelescopeAtSlot(
int slot);
130 bool stopTelescopeAtSlot(
int slot);
132 bool stopAllTelescopes();
135 bool isExistingClientAtSlot(
int slot);
137 bool isConnectedClientAtSlot(
int slot);
140 QHash<int, QString> getConnectedClientsNames();
142 bool getFlagUseServerExecutables() {
return useServerExecutables;}
144 void setFlagUseServerExecutables(
bool b);
145 const QString& getServerExecutablesDirectoryPath();
147 bool setServerExecutablesDirectoryPath(
const QString& newPath);
149 bool getFlagUseTelescopeServerLogs () {
return useTelescopeServerLogs;}
183 void setFontSize(
int fontSize);
188 void slewTelescopeToSelectedObject();
194 void slewTelescopeToViewDirection();
200 void clientConnected(
int slot, QString name);
201 void clientDisconnected(
int slot);
204 void setStelStyle(
const QString& section);
206 void translateActionDescriptions();
213 void communicate(
void);
225 Vec3f reticleNormalColor;
227 Vec3f reticleNightColor;
229 Vec3f labelNormalColor;
231 Vec3f labelNightColor;
233 Vec3f circleNormalColor;
235 Vec3f circleNightColor;
241 QPixmap* pixmapHover;
242 QPixmap* pixmapOnIcon;
243 QPixmap* pixmapOffIcon;
252 QMap<int, TelescopeClientP> telescopeClients;
254 QHash<int, QProcess*> telescopeServerProcess;
255 QStringList telescopeServers;
256 QVariantMap telescopeDescriptions;
257 QHash<QString, DeviceModel> deviceModels;
259 QHash<ConnectionType, QString> connectionTypeNames;
261 bool useTelescopeServerLogs;
262 QHash<int, QFile*> telescopeServerLogFiles;
263 QHash<int, QTextStream*> telescopeServerLogStreams;
265 bool useServerExecutables;
266 QString serverExecutablesDirectoryPath;
273 bool isValidSlotNumber(
int slot);
274 bool isValidPort(uint port);
275 bool isValidDelay(
int delay);
281 bool startServerAtSlot(
int slot, QString serverName,
int tcpPort, QString serialPort);
283 bool stopServerAtSlot(
int slot);
286 bool startClientAtSlot(
int slot, ConnectionType connectionType, QString name, QString equinox, QString host,
int portTCP,
int delay, QList<double> circles, QString serverName = QString(), QString portSerial = QString());
289 bool stopClientAtSlot(
int slot);
292 void loadTelescopeServerExecutables();
295 void loadDeviceModels();
299 bool restoreDeviceModelsListTo(QString deviceModelsListPath);
301 void addLogAtSlot(
int slot);
302 void logAtSlot(
int slot);
303 void removeLogAtSlot(
int slot);
305 QString actionGroupId;
306 QString moveToSelectedActionId;
307 QString moveToCenterActionId;
313 #include "StelPluginInterface.hpp"