SEPIA
Software documentation for the APEX SEPIA receivers
vacuum.h
Go to the documentation of this file.
1 /* Copyright 2017 Michael Olberg <michael.olberg@chalmers.se> */
2 #ifndef VACUUMCONTROLLER_H
3 #define VACUUMCONTROLLER_H
4 
5 #include <QObject>
6 #include <QTcpSocket>
7 #include <QByteArray>
8 #include <QString>
9 
20 class VacuumController : public QObject {
21  Q_OBJECT
22 
23  public:
24  explicit VacuumController(QObject *parent = 0);
26 
27  void selectGauge(int gauge);
28  float reading();
29  bool isConnected() { return m_connected; }
30 
31  signals:
32  // void error();
33  void connectionStatus(bool ok);
34  void newReading(float p);
35 
36  private:
37  void connectToServer();
38  void closeConnection();
39  int tcpSendReceive(QString command, bool interactive);
40  void dumpBuffer(QByteArray ba) const;
41 
42  void dumpBuffer(bool out, char* buf) const;
43 
44  double current;
45  QByteArray sendBuffer;
46  QByteArray recvBuffer;
47  QTcpSocket socket;
48  bool m_connected;
49  int m_gauge;
50 };
51 
52 #endif // VACUUMCONTROLLER_H
float reading()
Get one reading from the selected gauge.
Definition: vacuum.cpp:93
bool isConnected()
Return connection status.
Definition: vacuum.h:29
A class to control the vacuum monitor.
Definition: vacuum.h:20
void selectGauge(int gauge)
Select the gauge to monitor.
Definition: vacuum.cpp:79