SEPIA
Software documentation for the APEX SEPIA receivers
ups.h
Go to the documentation of this file.
1 /* Copyright 2017 Michael Olberg <michael.olberg@chalmers.se> */
2 #ifndef UPSUNIT_H
3 #define UPSUNIT_H
4 
5 #include <QObject>
6 #include <QNetworkAccessManager>
7 #include <QNetworkReply>
8 #include <QString>
9 #include <QMutex>
10 
20 class UPSunit : public QObject {
21  Q_OBJECT
22  public:
23  explicit UPSunit(QObject *parent = 0);
24  bool isConnected() { return _connected; }
25  bool onBattery() { return _battery; }
26  bool getUpsStatus();
27 
28  public slots:
29  void replyFinished(QNetworkReply *reply);
30 
31  signals:
32  void newStatus(QString &, QString &);
33 
34  private:
35  QMutex mutex;
36  QNetworkAccessManager *manager;
37  QString powerSource;
38  QString batteryStatus;
39  bool _connected;
40  bool _battery;
41 };
42 
43 #endif // UPS_H
void replyFinished(QNetworkReply *reply)
Function to be called with reply from UPS web server.
Definition: ups.cpp:38
bool isConnected()
Return connection status.
Definition: ups.h:24
bool onBattery()
Get UPS status.
Definition: ups.h:25
A class to retrieve status from the Eaton UPS.
Definition: ups.h:20