fan.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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 FAN_H
  20. #define FAN_H
  21. #include "sensor.h"
  22. class QTextStream;
  23. namespace Fancontrol
  24. {
  25. class Fan : public Sensor
  26. {
  27. Q_OBJECT
  28. Q_PROPERTY(int rpm READ rpm NOTIFY rpmChanged)
  29. public:
  30. explicit Fan(Hwmon *parent, uint index);
  31. virtual ~Fan();
  32. int rpm() const { return m_rpm; }
  33. QString name() const Q_DECL_OVERRIDE;
  34. void setName(const QString &name) Q_DECL_OVERRIDE;
  35. void reset() Q_DECL_OVERRIDE;
  36. virtual int pwm() const { return 255; }
  37. virtual bool setPwm(int, bool) { return false; }
  38. signals:
  39. void rpmChanged();
  40. public slots:
  41. void update();
  42. protected:
  43. int m_rpm;
  44. QTextStream *m_rpmStream;
  45. };
  46. }
  47. #endif // FAN_H