SEPIA
Software documentation for the APEX SEPIA receivers
selectmirror.h
Go to the documentation of this file.
1 /* Copyright 2017 Michael Olberg <michael.olberg@chalmers.se> */
2 #ifndef SELECTMIRROR_H
3 #define SELECTMIRROR_H
4 
5 #include <QThread>
6 #include <QTcpSocket>
7 #include <QByteArray>
8 #include <QString>
9 
10 #include "../GUI/calunit.h"
11 
21 class SelectMirror : public QThread {
22  Q_OBJECT
23 
24  public:
29  {
30  if (sm_instance == 0) sm_instance = new SelectMirror();
31  return sm_instance;
32  }
33 
38  bool moving() const { return m_moving; }
43  float currentAngle() const { return act; }
44 
45  public slots:
51  void run();
52 
53  signals:
54  void connected();
55  void disconnected();
56  void error();
57  void newPosition(float pos);
58 
59  private:
60  static SelectMirror *sm_instance;
61 
66  void gotoAngle(float angle);
67 
68  float getPosition();
69 
70  bool isMoving();
71 
75  void resetPosition();
76 
77  void sendCmd(const QString &command);
78  QString getResponse();
79  void dumpBuffer(QByteArray ba) const;
80  QTcpSocket *socket;
81 
82  float cmd;
83  float act;
84  bool m_moving;
85 
86  int commanded, actual;
87  bool stop;
88 };
89 
90 #endif // SELECTMIRROR_H
MirrorPosition
Possible positions for the selection mirror on the calibration unit.
Definition: calunit.h:31
void commandedPos(CalUnit::MirrorPosition n)
Set the new requested mirror positions.
Definition: selectmirror.cpp:125
bool moving() const
Check if mirror is moving.
Definition: selectmirror.h:38
A class to control the selection mirror of the calibration unit.
Definition: selectmirror.h:21
float currentAngle() const
Return the current position.
Definition: selectmirror.h:43
static SelectMirror * instance()
Get a pointer to a class SelectMirror instance.
Definition: selectmirror.h:28