-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlights.h
62 lines (47 loc) · 1.54 KB
/
lights.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#ifndef LIGHTS_H
#define LIGHTS_H
#include "qqml.h"
#include <QObject>
//#include <gpiod.h>
class Lights : public QObject
{
Q_OBJECT
Q_PROPERTY(bool stopState READ stop WRITE setStopState NOTIFY stopStateChanged)
Q_PROPERTY(bool temperatureState READ temperature WRITE setTemperatureState NOTIFY temperatureStateChanged)
Q_PROPERTY(bool oilPressureState READ oilPressure WRITE setOilPressureState NOTIFY oilPressureStateChanged)
Q_PROPERTY(bool batteryState READ battery WRITE setBatteryState NOTIFY batteryStateChanged)
QML_ELEMENT
signals:
void stopStateChanged() ;
void temperatureStateChanged();
void oilPressureStateChanged();
void batteryStateChanged();
public slots:
void updateStopLight();
void updateOilPressureLight();
void updateTemperatureLight();
void updateBatteryLight();
public:
explicit Lights(QObject *parent = nullptr);
~Lights();
bool stop();
bool temperature();
bool oilPressure();
bool battery();
void setStopState(const bool state);
void setTemperatureState(const bool state);
void setOilPressureState(const bool state);
void setBatteryState(const bool state);
private:
bool stopState = false;
bool temperatureState = false;
bool oilPressureState = false;
bool batteryState = false;
const char *chipname = "gpiochip0";
struct gpiod_chip *chip;
struct gpiod_line *lineStop;
struct gpiod_line *lineTemperature;
struct gpiod_line *lineOilPressure;
struct gpiod_line *lineBattery;
};
#endif // LIGHTS_H