42 lines
		
	
	
	
		
			910 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			42 lines
		
	
	
	
		
			910 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| #pragma once
 | |
| #include "actor.h"
 | |
| #include "../sensors/sensor.h"
 | |
| 
 | |
| class SensorActor : public Actor
 | |
| {
 | |
|     Q_OBJECT
 | |
| public:
 | |
| 
 | |
|     static constexpr uint8_t SLOPE_UP   = 0;
 | |
|     static constexpr uint8_t SLOPE_DOWN = 1;
 | |
|     static constexpr uint8_t SLOPE_BOTH = 2;
 | |
| 
 | |
| private:
 | |
|     Sensor sensor_;
 | |
|     uint8_t sloap_ = SLOPE_UP;
 | |
|     float threshold_ = 0;
 | |
| 
 | |
| public slots:
 | |
|     
 | |
|     void sensorEvent(Sensor sensor);
 | |
| 
 | |
|     void setSloap(uint8_t sloap);
 | |
|     void setSensor(const Sensor sensor);
 | |
|     void setThreshold( float threshold );
 | |
| 
 | |
| public:
 | |
| 
 | |
|     SensorActor(const Sensor sensor, QObject* parent = nullptr);
 | |
|     SensorActor(QObject* parent = nullptr);
 | |
|     Sensor getSensor(){return sensor_;}
 | |
|     virtual QString getName() const;
 | |
|     virtual ~SensorActor(){}
 | |
| 
 | |
|     float getThreshold();
 | |
|     uint8_t getSloap();
 | |
|     
 | |
|     virtual void store(QJsonObject& json);
 | |
|     virtual void load(const QJsonObject& json, bool preserve);
 | |
| };
 | |
| 
 | |
| 
 |