Add initial version of Sensors plugin, see #96
This commit is contained in:
parent
7738dc69d0
commit
51e87ffa88
10 changed files with 342 additions and 0 deletions
97
telldus-gui/Plugins/Sensors/sensor.cpp
Normal file
97
telldus-gui/Plugins/Sensors/sensor.cpp
Normal file
|
@ -0,0 +1,97 @@
|
|||
#include "sensor.h"
|
||||
|
||||
class Sensor::PrivateData {
|
||||
public:
|
||||
bool hasTemperature, hasHumidity;
|
||||
int id;
|
||||
QString model, name, protocol, temperature, humidity;
|
||||
QDateTime lastUpdated;
|
||||
};
|
||||
|
||||
Sensor::Sensor(QObject *parent) :
|
||||
QObject(parent)
|
||||
{
|
||||
d = new PrivateData;
|
||||
d->hasTemperature = false;
|
||||
d->hasHumidity = false;
|
||||
d->id = 0;
|
||||
}
|
||||
|
||||
Sensor::~Sensor() {
|
||||
delete d;
|
||||
}
|
||||
|
||||
QString Sensor::humidity() const {
|
||||
return d->humidity;
|
||||
}
|
||||
|
||||
void Sensor::setHumidity(const QString &humidity) {
|
||||
d->humidity = humidity;
|
||||
d->hasHumidity = true;
|
||||
emit humidityChanged();
|
||||
emit hasHumidityChanged();
|
||||
}
|
||||
|
||||
bool Sensor::hasHumidity() const {
|
||||
return d->hasHumidity;
|
||||
}
|
||||
|
||||
int Sensor::id() const {
|
||||
return d->id;
|
||||
}
|
||||
|
||||
void Sensor::setId(int id) {
|
||||
d->id = id;
|
||||
emit idChanged();
|
||||
}
|
||||
|
||||
QDateTime Sensor::lastUpdated() const {
|
||||
return d->lastUpdated;
|
||||
}
|
||||
|
||||
void Sensor::setLastUpdated(const QDateTime &lastUpdated) {
|
||||
d->lastUpdated = lastUpdated;
|
||||
emit lastUpdatedChanged();
|
||||
}
|
||||
|
||||
QString Sensor::model() const {
|
||||
return d->model;
|
||||
}
|
||||
|
||||
void Sensor::setModel(const QString &model) {
|
||||
d->model = model;
|
||||
emit modelChanged();
|
||||
}
|
||||
|
||||
QString Sensor::name() const {
|
||||
return d->name;
|
||||
}
|
||||
|
||||
void Sensor::setName(const QString &name) {
|
||||
d->name = name;
|
||||
emit nameChanged();
|
||||
}
|
||||
|
||||
QString Sensor::protocol() const {
|
||||
return d->protocol;
|
||||
}
|
||||
|
||||
void Sensor::setProtocol(const QString &protocol) {
|
||||
d->protocol = protocol;
|
||||
emit protocolChanged();
|
||||
}
|
||||
|
||||
QString Sensor::temperature() const {
|
||||
return d->temperature;
|
||||
}
|
||||
|
||||
void Sensor::setTemperature(const QString &temperature) {
|
||||
d->temperature = temperature;
|
||||
d->hasTemperature = true;
|
||||
emit temperatureChanged();
|
||||
emit hasTemperatureChanged();
|
||||
}
|
||||
|
||||
bool Sensor::hasTemperature() const {
|
||||
return d->hasTemperature;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue