43 lines
886 B
C++
43 lines
886 B
C++
#ifndef RELAY_H
|
|
#define RELAY_H
|
|
|
|
#include<stdint.h>
|
|
#include<QObject>
|
|
#include<QString>
|
|
#include<vector>
|
|
#include<memory>
|
|
|
|
#include"actor.h"
|
|
|
|
class Microcontroller;
|
|
|
|
class Relay : public QObject
|
|
{
|
|
Q_OBJECT
|
|
private:
|
|
Microcontroller* micro_;
|
|
QString name_;
|
|
bool state_ = false;
|
|
uint8_t id_;
|
|
uint16_t address_;
|
|
std::vector< std::unique_ptr<Actor> > actors_;
|
|
bool actorsActive_ = true;
|
|
|
|
public slots:
|
|
void on();
|
|
void off();
|
|
void toggle();
|
|
|
|
public:
|
|
Relay(Microcontroller* micro, uint8_t id, QString name = "", uint16_t address = 0, QObject *parent = nullptr);
|
|
void addActor(std::unique_ptr<Actor> actor);
|
|
void setState(bool state);
|
|
bool hasActors();
|
|
void setActorsActive(bool in);
|
|
QString getName();
|
|
void setName(QString name);
|
|
std::vector< std::unique_ptr<Actor> >* getActors();
|
|
~Relay();
|
|
};
|
|
#endif // RELAY_H
|