SEPIA
Software documentation for the APEX SEPIA receivers
agilent.h
Go to the documentation of this file.
1 /* Copyright 2017 Michael Olberg <michael.olberg@chalmers.se> */
2 #ifndef GENERATOR_H
3 #define GENERATOR_H
4 
5 #include <QTcpSocket>
6 #include <QByteArray>
7 #include <QString>
8 
18 class Generator : public QTcpSocket {
19  Q_OBJECT
20  Q_PROPERTY(double MHz READ MHz WRITE setMHz )
21  Q_PROPERTY(double dBm READ dBm WRITE setdBm )
22 
23  public:
27  static Generator *instance()
28  {
29  if (gen_instance == 0) gen_instance = new Generator();
30  return gen_instance;
31  }
32 
36  ~Generator();
37 
43  bool isOn() const { return m_on; }
44 
50  void connectToServer();
51 
59  bool isValid();
60 
66  double MHz() const { return m_mhz; }
67 
73  double dBm() const { return m_dbm; }
74 
75  public slots:
81  void powerOn(bool flag);
82 
93  void setSignal(double mhz, double dbm);
94 
95  private slots:
96  void setMHz(double mhz) { m_mhz = mhz; }
97  void setdBm(double dbm) { m_dbm = dbm; }
98 
99  private:
100  static Generator *gen_instance;
101  Generator();
102 
103  QString getResponse();
104  void sendCmd(const QString &command);
105  void dumpBuffer(QByteArray ba) const;
106 
107  bool m_on;
108  double m_mhz;
109  double m_dbm;
110 };
111 
112 #endif // AGILENT_H
void powerOn(bool flag)
Enable/disable signal generation.
Definition: agilent.cpp:56
double MHz() const
Get current frequency setting.
Definition: agilent.h:66
double dBm() const
Get current level setting.
Definition: agilent.h:73
bool isOn() const
Check if signal generator is powered on.
Definition: agilent.h:43
void connectToServer()
Establish tcp/ip connection with the actual hardware.
Definition: agilent.cpp:19
~Generator()
Destructor.
Definition: agilent.cpp:15
A class to control the Agilent signal generator.
Definition: agilent.h:18
void setSignal(double mhz, double dbm)
Set frequency and level of the signal to be generated.
Definition: agilent.cpp:138
static Generator * instance()
Get a pointer to a class Generator instance.
Definition: agilent.h:27
bool isValid()
Check if connection is valid.
Definition: agilent.cpp:35