hwmon.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. * Copyright (C) 2015 Malte Veerman <maldela@halloarsch.de>
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU Lesser General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU Lesser General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General Public License along
  15. * with this program; if not, write to the Free Software Foundation, Inc.,
  16. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  17. *
  18. */
  19. #ifndef HWMON_H
  20. #define HWMON_H
  21. #include <QtCore/QObject>
  22. #include <QtCore/QString>
  23. #include <QtCore/QList>
  24. #include "temp.h"
  25. #include "fan.h"
  26. #include "pwmfan.h"
  27. class Hwmon : public QObject
  28. {
  29. Q_OBJECT
  30. Q_PROPERTY(QString name READ name CONSTANT)
  31. Q_PROPERTY(QString path READ path CONSTANT)
  32. Q_PROPERTY(int index READ index CONSTANT)
  33. Q_PROPERTY(QList<QObject *> fans READ fans NOTIFY fansChanged)
  34. Q_PROPERTY(QList<QObject *> pwmFans READ pwmFans NOTIFY pwmFansChanged)
  35. Q_PROPERTY(QList<QObject *> temps READ temps NOTIFY tempsChanged)
  36. public:
  37. explicit Hwmon(const QString &, QObject *parent = Q_NULLPTR);
  38. void initialize();
  39. QString name() const { return m_name; }
  40. QString path() const { return m_path; }
  41. int index() const { return m_index; }
  42. QList<QObject *> fans() const;
  43. QList<QObject *> pwmFans() const;
  44. QList<QObject *> temps() const;
  45. Q_INVOKABLE void testFans();
  46. Fan * fan(int i) const;
  47. PwmFan * pwmFan(int i) const;
  48. Temp * temp(int i) const;
  49. public slots:
  50. void updateConfig() { emit configUpdateNeeded(); }
  51. void updateSensors() { emit sensorsUpdateNeeded(); }
  52. signals:
  53. void fansChanged();
  54. void pwmFansChanged();
  55. void tempsChanged();
  56. void configUpdateNeeded();
  57. void sensorsUpdateNeeded();
  58. private:
  59. QString m_name;
  60. const QString m_path;
  61. const int m_index;
  62. QList<Fan *> m_fans;
  63. QList<PwmFan *> m_pwmFans;
  64. QList<Temp *> m_temps;
  65. };
  66. #endif // HWMON_H