forked from droidian-lavender/droidian-sysfs-torch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsysfstorch.h
36 lines (28 loc) · 915 Bytes
/
sysfstorch.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
#ifndef SYSFSTORCH_H
#define SYSFSTORCH_H
#include <QObject>
#include <QDebug>
#include <QFile>
#include <QTextStream>
#include <QString>
#include <QVariantMap>
#include <QStringList>
#include <QtDBus/QDBusConnection>
class SysfsTorch : public QObject
{
Q_OBJECT
public:
SysfsTorch(QObject *parent = nullptr);
~SysfsTorch();
void start();
private:
void sysfsWrite(QString path, int value);
QByteArray sysfsRead(QString path);
const static int m_sysfsSwitchSize = 1;
char* m_sysfsSwitch[m_sysfsSwitchSize] = {"/sys/class/leds/led:switch/brightness"};
const static int m_sysfsPathSize = 2;
char* m_sysfsPath[m_sysfsPathSize] = {"/sys/class/leds/led:torch_0/brightness", "/sys/class/leds/led:torch_1/brightness"};
protected slots:
void propertyChanged(QString interface, QVariantMap changed_properties, QStringList invalidated_properties);
};
#endif // SYSFSTORCH_H