33 lines
718 B
C++
33 lines
718 B
C++
#pragma once
|
|
|
|
#include "item.h"
|
|
#include "../sensors/sensors.h"
|
|
#include "../microcontroller.h"
|
|
|
|
#include <QTimer>
|
|
|
|
class PowerItem: public Item
|
|
{
|
|
Q_OBJECT
|
|
private:
|
|
QApplication* a_;
|
|
|
|
signals:
|
|
|
|
void stateChanged(Sensor sensor);
|
|
|
|
private slots:
|
|
|
|
void timeout();
|
|
|
|
public slots:
|
|
|
|
virtual void setValue(uint8_t value);
|
|
|
|
public:
|
|
PowerItem(SensorStore* sensors, QApplication* a, uint32_t itemIdIn = QRandomGenerator::global()->generate(), QString name = "", uint8_t value = 0, QObject* parent = nullptr);
|
|
void emmitSensor(){stateChanged(Sensor(Sensor::TYPE_SHUTDOWN_IMMINENT, 0, 0));}
|
|
virtual void store(QJsonObject& json);
|
|
virtual void store(QString subsecton, QSettings* settings);
|
|
};
|