Stellarium 0.12.3
TelescopeControlGlobals.hpp
1 /*
2  * Stellarium TelescopeControl Plug-in
3  *
4  * Copyright (C) 2009-2010 Bogdan Marinov (this file)
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
19 */
20 
21 #ifndef _TELESCOPE_CONTROL_GLOBALS_
22 #define _TELESCOPE_CONTROL_GLOBALS_
23 
24 #include <QString>
25 #include <QStringList>
26 
27 namespace TelescopeControlGlobals {
28  const int MIN_SLOT_NUMBER = 1;
29  const int SLOT_COUNT = 9;
30  const int SLOT_NUMBER_LIMIT = MIN_SLOT_NUMBER + SLOT_COUNT;
31  const int MAX_SLOT_NUMBER = SLOT_NUMBER_LIMIT - 1;
32 
33  const int BASE_TCP_PORT = 10000;
34  #define DEFAULT_TCP_PORT_FOR_SLOT(X) (BASE_TCP_PORT + X)
35  const int DEFAULT_TCP_PORT = DEFAULT_TCP_PORT_FOR_SLOT(MIN_SLOT_NUMBER);
36 
37  const int MAX_CIRCLE_COUNT = 10;
38 
39  #ifdef Q_OS_WIN32
40  const QString TELESCOPE_SERVER_PATH = QString("/%1.exe");
41  const QString SERIAL_PORT_PREFIX = QString("COM");
42  #else
43  const QString TELESCOPE_SERVER_PATH = QString("/%1");
44  const QString SERIAL_PORT_PREFIX = QString("/dev/");
45  #endif
46 
47  const int DEFAULT_DELAY = 500000; //Microseconds; == 0.5 seconds
48  #define MICROSECONDS_FROM_SECONDS(X) (X * 1000000)
49  #define SECONDS_FROM_MICROSECONDS(X) ((double) X / 1000000)
50 
51  enum ConnectionType {
52  ConnectionNA = 0,
53  ConnectionVirtual,
54  ConnectionInternal,
55  ConnectionLocal,
56  ConnectionRemote,
57  ConnectionCount
58  };
59 
60  struct DeviceModel
61  {
62  QString name;
63  QString description;
64  QString server;
65  int defaultDelay;
66  bool useExecutable;
67  };
68 
69 
70  #ifdef Q_OS_WIN32
71  const QStringList SERIAL_PORT_NAMES = QString("COM1 COM2 COM3 COM4").split(' ', QString::SkipEmptyParts);
72  #elif defined(Q_OS_MAC)
73  const QStringList SERIAL_PORT_NAMES = QString("/dev/ ").split(' ', QString::SkipEmptyParts);
74  #else
75  const QStringList SERIAL_PORT_NAMES = QString("/dev/ttyS0 /dev/ttyS1 /dev/ttyS2 /dev/ttyS3 /dev/ttyUSB0 /dev/ttyUSB1 /dev/ttyUSB2 /dev/ttyUSB3").split(' ', QString::SkipEmptyParts);
76  #endif
77 
79  const QStringList EMBEDDED_TELESCOPE_SERVERS = QString("TelescopeServerDummy TelescopeServerLx200 TelescopeServerNexStar").split(' ', QString::SkipEmptyParts);
80 };
81 
82 #endif //_TELESCOPE_CONTROL_GLOBALS_