Kstars

linguider.h
1 /*
2  SPDX-FileCopyrightText: 2016 Jasem Mutlaq <[email protected]>
3 
4  SPDX-License-Identifier: GPL-2.0-or-later
5 */
6 
7 #pragma once
8 
9 #include "../guideinterface.h"
10 
11 #include <QAbstractSocket>
12 #include <QTimer>
13 
14 class QTcpSocket;
15 
16 namespace Ekos
17 {
18 /**
19  * @class LinGuider
20  * Uses external LinGuider for guiding.
21  *
22  * @author Jasem Mutlaq
23  * @version 1.0
24  */
25 class LinGuider : public GuideInterface
26 {
27  Q_OBJECT
28 
29  public:
30  typedef enum {
31  GET_VER = 1,
32  SET_GUIDER_SQUARE_POS,
33  SAVE_FRAME,
34  DITHER,
35  DITHER_NO_WAIT_XY,
36  GET_DISTANCE,
37  SAVE_FRAME_DECORATED,
38  GUIDER,
39  GET_GUIDER_STATE,
40  SET_GUIDER_OVLS_POS,
41  SET_GUIDER_RETICLE_POS,
42  FIND_STAR,
43  SET_DITHERING_RANGE,
44  GET_RA_DEC_DRIFT
45  } LinGuiderCommand;
46  typedef enum { IDLE, GUIDING } LinGuiderState;
47  typedef enum { DISCONNECTED, CONNECTING, CONNECTED } LinGuiderConnection;
48 
49  LinGuider();
50  virtual ~LinGuider() override = default;
51 
52  bool Connect() override;
53  bool Disconnect() override;
54  bool isConnected() override { return (connection == CONNECTED); }
55 
56  bool calibrate() override;
57  bool guide() override;
58  bool abort() override;
59  bool suspend() override;
60  bool resume() override;
61  bool dither(double pixels) override;
62  bool clearCalibration() override { return true;}
63 
64  private slots:
65 
66  void readLinGuider();
67  void onConnected();
68  void displayError(QAbstractSocket::SocketError socketError);
69 
70  private:
71  void sendCommand(LinGuiderCommand command, const QString &args = QString());
72  void processResponse(LinGuiderCommand command, const QString &reply);
73 
74  QTcpSocket *tcpSocket { nullptr };
75  QByteArray rawBuffer;
76 
77  LinGuiderState state { IDLE };
78  LinGuiderConnection connection { DISCONNECTED };
79 
80  QTimer deviationTimer;
81  QString starCenter;
82 };
83 }
Q_OBJECTQ_OBJECT
Ekos is an advanced Astrophotography tool for Linux. It is based on a modular extensible framework to...
Definition: align.cpp:70
Interface skeleton for implementation of different guiding applications and/or routines.
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu Aug 11 2022 04:00:01 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.