Stellarium  1.2
Data Structures
Telescope Control plug-in

The Telescope Control plug-in allows Stellarium to control a telescope on a computerized mount (a "Go To" or "Push To" telescope) and offers a graphical user interface for setting up the connection. More...

Data Structures

class  TelescopeControl
 This class manages the controlling of one or more telescopes by one instance of the stellarium program. More...
 

Detailed Description


Data Structure Documentation

◆ TelescopeControl

class TelescopeControl

"Controlling a telescope" means receiving position information from the telescope and sending GOTO commands to the telescope. No esoteric features like motor focus, electric heating and such. The actual controlling of a telescope is left to the implementation of the abstract base class TelescopeClient.

Main class of the Telescope Control plug-in.

Public Types

enum  ConnectionType {
  ConnectionNA = 0, ConnectionVirtual, ConnectionInternal, ConnectionLocal,
  ConnectionRemote, ConnectionRTS2, ConnectionINDI, ConnectionASCOM,
  ConnectionTypeCount
}
 
enum  TelescopeStatus {
  StatusNA = 0, StatusStarting, StatusConnecting, StatusConnected,
  StatusDisconnected, StatusStopped
}
 
enum  Equinox { EquinoxJ2000, EquinoxJNow }
 
- Public Types inherited from StelModule
enum  StelModuleSelectAction { AddToSelection, ReplaceSelection, RemoveFromSelection }
 Enum used when selecting objects to define whether to add to, replace, or remove from the existing selection list. More...
 
enum  StelModuleActionName {
  ActionDraw, ActionUpdate, ActionHandleMouseClicks, ActionHandleMouseMoves,
  ActionHandleKeys
}
 Define the possible action for which an order is defined. More...
 

Public Slots

void setFlagTelescopeReticles (bool b)
 Set display flag for telescope reticles. More...
 
bool getFlagTelescopeReticles () const
 Get display flag for telescope reticles. More...
 
void setFlagTelescopeLabels (bool b)
 Set display flag for telescope name labels. More...
 
bool getFlagTelescopeLabels () const
 Get display flag for telescope name labels. More...
 
void setFlagTelescopeCircles (bool b)
 Set display flag for telescope field of view circles. More...
 
bool getFlagTelescopeCircles () const
 Get display flag for telescope field of view circles. More...
 
void setReticleColor (const Vec3f &c)
 Set the telescope reticle color. More...
 
const Vec3fgetReticleColor () const
 Get the telescope reticle color. More...
 
const Vec3fgetLabelColor () const
 Get the telescope labels color. More...
 
void setLabelColor (const Vec3f &c)
 Set the telescope labels color. More...
 
void setCircleColor (const Vec3f &c)
 Set the field of view circles color. More...
 
const Vec3fgetCircleColor () const
 Get the field of view circles color. More...
 
void setFontSize (int fontSize)
 Define font size to use for telescope names display. More...
 
void slewTelescopeToSelectedObject (const int idx)
 slews a telescope at slot idx to the selected object. More...
 
void syncTelescopeWithSelectedObject (const int idx)
 sync a telescope at slot idx to the selected object. More...
 
void slewTelescopeToViewDirection (const int idx)
 slews a telescope at slot idx to the point of the celestial sphere currently in the center of the screen. More...
 
void abortTelescopeSlew (const int idx)
 abort the current slew command of a telescope at slot idx. More...
 
void centeringScreenByTelescope (const int idx)
 Centering screen by coordinates of a telescope at slot idx. More...
 
void setFlagUseTelescopeServerLogs (bool b)
 Used in the GUI.
 

Signals

void clientConnected (int slot, QString name)
 
void clientDisconnected (int slot)
 
void flagTelescopeReticlesChanged (bool b)
 
void flagTelescopeLabelsChanged (bool b)
 
void flagTelescopeCirclesChanged (bool b)
 
void reticleColorChanged (const Vec3f &c)
 
void labelColorChanged (const Vec3f &c)
 
void circleColorChanged (const Vec3f &c)
 
void flagUseTelescopeServerLogsChanged (bool b)
 
void useTelescopeServerExecutables (bool b)
 
void getFlagUseServerExecutablesChanged (bool b)
 
void serverExecutablesDirectoryPathChanged (const QString &s)
 

Public Member Functions

void init () override
 Initialize itself. More...
 
void deinit () override
 Called before the module will be deleted, and before the OpenGL context is suppressed. More...
 
void update (double deltaTime) override
 Update the module with respect to the time. More...
 
void draw (StelCore *core) override
 Execute all the drawing functions for this module. More...
 
double getCallOrder (StelModuleActionName actionName) const override
 Return the value defining the order of call for the given action For example if stars.callOrder[ActionDraw] == 10 and constellation.callOrder[ActionDraw] == 11, the stars module will be drawn before the constellations. More...
 
QList< StelObjectPsearchAround (const Vec3d &v, double limitFov, const StelCore *core) const override
 Search for StelObject in an area around a specified point. More...
 
StelObjectP searchByNameI18n (const QString &nameI18n) const override
 Find a StelObject by name. More...
 
StelObjectP searchByName (const QString &name) const override
 Return the matching StelObject if exists or the empty StelObject if not found. More...
 
StelObjectP searchByID (const QString &id) const override
 Return the StelObject with the given ID if exists or the empty StelObject if not found. More...
 
QStringList listMatchingObjects (const QString &objPrefix, const int maxNbItem=5, bool useStartOfWords=false) const override
 Find and return the list of at most maxNbItem objects auto-completing the passed object name. More...
 
QStringList listAllObjects (bool) const override
 List all StelObjects. More...
 
QString getName () const override
 Gets a user-displayable name of the object category.
 
QString getStelObjectType () const override
 Returns the name that will be returned by StelObject::getType() for the objects this module manages.
 
bool configureGui (bool show=true) override
 Detect or show the configuration GUI elements for the module. More...
 
QSharedPointer< TelescopeClienttelescopeClient (int index) const
 
void deleteAllTelescopes ()
 Remove all currently registered telescopes.
 
const QHash< QString, DeviceModel > & getDeviceModels ()
 Safe access to the loaded list of telescope models.
 
void loadConfiguration ()
 Loads the module's configuration from the configuration file.
 
void saveConfiguration ()
 Saves the module's configuration to the configuration file.
 
void saveTelescopes ()
 Saves to telescopes.json a list of the parameters of the active telescope clients.
 
void loadTelescopes ()
 Loads from telescopes.json the parameters of telescope clients and initializes them. More...
 
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(), QString rts2Url=QString(), QString rts2Username=QString(), QString rts2Password=QString(), int rts2Refresh=-1, QString ascomDeviceId=QString(""), bool ascomUseDeviceEqCoordType=true)
 Adds a telescope description containing the given properties. More...
 
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, QString &rts2Url, QString &rts2Username, QString &rts2Password, int &rts2Refresh, QString &ascomDeviceId, bool &ascomUseDeviceEqCoordType)
 Retrieves a telescope description. More...
 
bool removeTelescopeAtSlot (int slot)
 Removes info from the tree. Should it include stopTelescopeAtSlot()?
 
bool startTelescopeAtSlot (int slot)
 Starts a telescope at the given slot, getting its description with getTelescopeAtSlot(). More...
 
bool stopTelescopeAtSlot (int slot)
 Stops the telescope at the given slot. More...
 
bool stopAllTelescopes ()
 Stops all telescopes, but without removing them like deleteAllTelescopes().
 
bool isExistingClientAtSlot (int slot)
 Checks if there's a TelescopeClient object at a given slot, i.e. More...
 
bool isConnectedClientAtSlot (int slot)
 Checks if the TelescopeClient object at a given slot is connected to a server.
 
QHash< int, QString > getConnectedClientsNames ()
 Returns a list of the currently connected clients.
 
bool getFlagUseServerExecutables () const
 
void setFlagUseServerExecutables (bool b)
 Forces a call of loadDeviceModels(). Stops all active telescopes.
 
const QString & getServerExecutablesDirectoryPath () const
 
bool setServerExecutablesDirectoryPath (const QString &newPath)
 Forces a call of loadDeviceModels(). Stops all active telescopes.
 
bool getFlagUseTelescopeServerLogs () const
 
- Public Member Functions inherited from StelObjectModule
virtual QStringList listAllObjectsByType (const QString &objType, bool inEnglish) const
 List all StelObjects by type. More...
 
bool matchObjectName (const QString &objName, const QString &objPrefix, bool useStartOfWords) const
 Auxiliary method of listMatchingObjects() More...
 
- Public Member Functions inherited from StelModule
 StelModule ()
 Constructor. Every derived class MUST call setObjectName(className) in its constructor.
 
virtual QSettings * getSettings ()
 Return module-specific settings. More...
 
virtual QString getModuleVersion () const
 Get the version of the module, default is stellarium main version.
 
virtual QString getAuthorName () const
 Get the name of the module author.
 
virtual QString getAuthorEmail () const
 Get the email address of the module author.
 
virtual void handleMouseClicks (class QMouseEvent *)
 Handle mouse clicks. More...
 
virtual void handleMouseWheel (class QWheelEvent *)
 Handle mouse wheel. More...
 
virtual bool handleMouseMoves (int x, int y, Qt::MouseButtons b)
 Handle mouse moves. More...
 
virtual void handleKeys (class QKeyEvent *e)
 Handle key events. More...
 
virtual bool handlePinch (qreal scale, bool started)
 Handle pinch gesture events. More...
 

Static Public Attributes

static constexpr int MIN_SLOT_NUMBER = 1
 
static constexpr int SLOT_COUNT = 9
 
static constexpr int SLOT_NUMBER_LIMIT = MIN_SLOT_NUMBER + SLOT_COUNT
 
static constexpr int MAX_SLOT_NUMBER = SLOT_NUMBER_LIMIT - 1
 
static constexpr int BASE_TCP_PORT = 10000
 
static constexpr int DEFAULT_TCP_PORT = DEFAULT_TCP_PORT_FOR_SLOT(MIN_SLOT_NUMBER)
 
static constexpr int MAX_CIRCLE_COUNT = 10
 
static const QString TELESCOPE_SERVER_PATH
 
static constexpr int DEFAULT_DELAY = 500000
 
static const QStringList EMBEDDED_TELESCOPE_SERVERS
 

Properties

bool flagTelescopeReticles
 
bool flagTelescopeLabels
 
bool flagTelescopeCircles
 
Vec3f reticleColor
 Colour currently used to draw telescope reticles.
 
Vec3f labelColor
 Colour currently used to draw telescope text labels.
 
Vec3f circleColor
 Colour currently used to draw field of view circles.
 
bool useTelescopeServerLogs
 
bool useTelescopeServerExecutables
 
QString serverExecutablesDirectoryPath
 

Additional Inherited Members

- Protected Member Functions inherited from StelModule
class StelActionaddAction (const QString &id, const QString &groupId, const QString &text, QObject *target, const char *slot, const QString &shortcut="", const QString &altShortcut="")
 convenience methods to add an action (call to slot) to the StelActionMgr object. More...
 
class StelActionaddAction (const QString &id, const QString &groupId, const QString &text, const char *slot, const QString &shortcut="", const QString &altShortcut="")
 convenience methods to add an action (call to own slot) to the StelActionMgr object. More...
 
StelActionaddAction (const QString &id, const QString &groupId, const QString &text, QObject *contextObject, std::function< void()> lambda, const QString &shortcut="", const QString &altShortcut="")
 convenience methods to add an action (call to Lambda functor) to the StelActionMgr object. More...
 

Member Function Documentation

◆ abortTelescopeSlew

void TelescopeControl::abortTelescopeSlew ( const int  idx)
slot
// example of usage in scripts
TelescopeControl.syncTelescopeToSelectedObject(1);

◆ addTelescopeAtSlot()

bool TelescopeControl::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(),
QString  rts2Url = QString(),
QString  rts2Username = QString(),
QString  rts2Password = QString(),
int  rts2Refresh = -1,
QString  ascomDeviceId = QString(""),
bool  ascomUseDeviceEqCoordType = true 
)

DOES NOT VALIDATE its parameters. If serverName is specified, portSerial should be specified too. Call saveTelescopes() to write the modified configuration to disc. Call startTelescopeAtSlot() to start this telescope.

Parameters
portSerialmust be a valid serial port name for the particular platform, e.g. "COM1" for Microsoft Windows of "/dev/ttyS0" for Linux

◆ centeringScreenByTelescope

void TelescopeControl::centeringScreenByTelescope ( const int  idx)
slot
// example of usage in scripts

◆ configureGui()

bool TelescopeControl::configureGui ( bool  show = true)
overridevirtual

This is to be used with plugins to display a configuration dialog from the plugin list window.

Parameters
showif true, make the configuration GUI visible. If false, hide the config GUI if there is one.
Returns
true if the module has a configuration GUI, else false.

Reimplemented from StelModule.

◆ deinit()

void TelescopeControl::deinit ( )
overridevirtual

Deinitialize all OpenGL texture in this method.

Reimplemented from StelModule.

◆ draw()

void TelescopeControl::draw ( StelCore core)
overridevirtual
Parameters
corethe core to use for the drawing

Reimplemented from StelModule.

◆ getCallOrder()

double TelescopeControl::getCallOrder ( StelModuleActionName  actionName) const
overridevirtual
Parameters
actionNamethe name of the action for which we want the call order
Returns
the value defining the order. The closer to 0 the earlier the module's action will be called

Reimplemented from StelModule.

◆ getCircleColor

const Vec3f& TelescopeControl::getCircleColor ( ) const
inlineslot
Returns
the field of view circles color
// example of usage in scripts

◆ getFlagTelescopeCircles

bool TelescopeControl::getFlagTelescopeCircles ( ) const
inlineslot
Returns
true if telescope field of view circles is visible
// example of usage in scripts

◆ getFlagTelescopeLabels

bool TelescopeControl::getFlagTelescopeLabels ( ) const
inlineslot
Returns
true if telescope name labels is visible
// example of usage in scripts

◆ getFlagTelescopeReticles

bool TelescopeControl::getFlagTelescopeReticles ( ) const
inlineslot
Returns
true if telescope reticles is visible
// example of usage in scripts

◆ getLabelColor

const Vec3f& TelescopeControl::getLabelColor ( ) const
inlineslot
Returns
the telescope labels color
// example of usage in scripts

◆ getReticleColor

const Vec3f& TelescopeControl::getReticleColor ( ) const
inlineslot
Returns
the telescope reticle color
// example of usage in scripts

◆ getTelescopeAtSlot()

bool TelescopeControl::getTelescopeAtSlot ( int  slot,
ConnectionType &  connectionType,
QString &  name,
QString &  equinox,
QString &  host,
int &  portTCP,
int &  delay,
bool &  connectAtStartup,
QList< double > &  circles,
QString &  serverName,
QString &  portSerial,
QString &  rts2Url,
QString &  rts2Username,
QString &  rts2Password,
int &  rts2Refresh,
QString &  ascomDeviceId,
bool &  ascomUseDeviceEqCoordType 
)

Returns false if the slot is empty. Returns empty serverName and portSerial if the description contains no server.

◆ init()

void TelescopeControl::init ( )
overridevirtual

If the initialization takes significant time, the progress should be displayed on the loading bar.

Implements StelModule.

◆ isExistingClientAtSlot()

bool TelescopeControl::isExistingClientAtSlot ( int  slot)

if there's an active telescope at that slot.

◆ listAllObjects()

QStringList TelescopeControl::listAllObjects ( bool  inEnglish) const
inlineoverridevirtual
Parameters
inEnglishlist names in English (true) or translated (false)
Returns
a list of matching object name by order of relevance, or an empty list if nothing matches

Implements StelObjectModule.

◆ listMatchingObjects()

QStringList TelescopeControl::listMatchingObjects ( const QString &  objPrefix,
const int  maxNbItem = 5,
bool  useStartOfWords = false 
) const
overridevirtual
Parameters
objPrefixthe case insensitive first letters of the searched object
maxNbItemthe maximum number of returned object names
useStartOfWordsthe autofill mode for returned objects names
Returns
a list of matching object name by order of relevance, or an empty list if nothing match

Reimplemented from StelObjectModule.

◆ loadTelescopes()

void TelescopeControl::loadTelescopes ( )

If there are already any initialized telescope clients, they are removed.

◆ searchAround()

QList<StelObjectP> TelescopeControl::searchAround ( const Vec3d v,
double  limitFov,
const StelCore core 
) const
overridevirtual

The function searches in a disk of diameter limitFov centered on v. Only visible objects (i.e. currently displayed on screen) should be returned.

Parameters
vequatorial position at epoch J2000 (without aberration).
limitFovangular diameter of the searching zone in degree.
corethe StelCore instance to use.
Returns
the list of all the displayed objects contained in the defined zone.

Implements StelObjectModule.

◆ searchByID()

StelObjectP TelescopeControl::searchByID ( const QString &  id) const
inlineoverridevirtual
Parameters
namethe english object name

Implements StelObjectModule.

◆ searchByName()

StelObjectP TelescopeControl::searchByName ( const QString &  name) const
overridevirtual
Parameters
namethe english object name

Implements StelObjectModule.

◆ searchByNameI18n()

StelObjectP TelescopeControl::searchByNameI18n ( const QString &  nameI18n) const
overridevirtual
Parameters
nameI18nThe translated name for the current sky locale.
Returns
The matching StelObject if exists or the empty StelObject if not found.

Implements StelObjectModule.

◆ setCircleColor

void TelescopeControl::setCircleColor ( const Vec3f c)
inlineslot
// example of usage in scripts

◆ setFlagTelescopeCircles

void TelescopeControl::setFlagTelescopeCircles ( bool  b)
inlineslot
Parameters
bboolean flag
// example of usage in scripts

◆ setFlagTelescopeLabels

void TelescopeControl::setFlagTelescopeLabels ( bool  b)
inlineslot
Parameters
bboolean flag
// example of usage in scripts

◆ setFlagTelescopeReticles

void TelescopeControl::setFlagTelescopeReticles ( bool  b)
inlineslot
Parameters
bboolean flag
// example of usage in scripts

◆ setFontSize

void TelescopeControl::setFontSize ( int  fontSize)
slot
Parameters
fontSizesize of font
// example of usage in scripts

◆ setLabelColor

void TelescopeControl::setLabelColor ( const Vec3f c)
inlineslot
// example of usage in scripts

◆ setReticleColor

void TelescopeControl::setReticleColor ( const Vec3f c)
inlineslot
// example of usage in scripts

◆ slewTelescopeToSelectedObject

void TelescopeControl::slewTelescopeToSelectedObject ( const int  idx)
slot
// example of usage in scripts

◆ slewTelescopeToViewDirection

void TelescopeControl::slewTelescopeToViewDirection ( const int  idx)
slot
// example of usage in scripts

◆ startTelescopeAtSlot()

bool TelescopeControl::startTelescopeAtSlot ( int  slot)

Creates a TelescopeClient object and starts a server process if necessary.

◆ stopTelescopeAtSlot()

bool TelescopeControl::stopTelescopeAtSlot ( int  slot)

Destroys the TelescopeClient object and terminates the server process if necessary.

◆ syncTelescopeWithSelectedObject

void TelescopeControl::syncTelescopeWithSelectedObject ( const int  idx)
slot

The telescope client can decide what syncing means but usually its used to update the internal pointing model.

// example of usage in scripts
TelescopeControl.syncTelescopeToSelectedObject(1);

◆ update()

void TelescopeControl::update ( double  deltaTime)
overridevirtual
Parameters
deltaTimethe time increment in second since last call.

Reimplemented from StelModule.