Modularized backlight information retrieval
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include "Brightness.h"
|
||||
|
||||
Brightness::Brightness()
|
||||
{
|
||||
}
|
||||
|
||||
void Brightness::grabBrightness()
|
||||
{
|
||||
std::fstream input;
|
||||
input.open("/sys/class/backlight/intel_backlight/brightness", std::ios::in);
|
||||
|
||||
input >> currentBrightness;
|
||||
|
||||
input.close();
|
||||
}
|
||||
void Brightness::grabMaxBrightness()
|
||||
{
|
||||
std::fstream input;
|
||||
input.open("/sys/class/backlight/intel_backlight/max_brightness", std::ios::in);
|
||||
|
||||
input >> maxBrightness;
|
||||
|
||||
input.close();
|
||||
}
|
||||
|
||||
unsigned Brightness::getCurrentBrightness() const
|
||||
{
|
||||
return currentBrightness;
|
||||
}
|
||||
unsigned Brightness::getMaxBrightness() const
|
||||
{
|
||||
return maxBrightness;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
#ifndef BRIGHTNESS_H
|
||||
#define BRIGHTNESS_H
|
||||
|
||||
class Brightness
|
||||
{
|
||||
public:
|
||||
Brightness();
|
||||
|
||||
void grabBrightness();
|
||||
void grabMaxBrightness();
|
||||
|
||||
unsigned getCurrentBrightness() const;
|
||||
unsigned getMaxBrightness() const;
|
||||
|
||||
private:
|
||||
unsigned currentBrightness;
|
||||
unsigned maxBrightness;
|
||||
};
|
||||
#endif
|
||||
Reference in New Issue
Block a user