blob: 8caa77ed537e7926f04aac3e12c3e645a944b6ea (
plain)
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
/*
* GraphLCD driver library
*
* config.h - config file classes
*
* This file is released under the GNU General Public License. Refer
* to the COPYING file distributed with this package.
*
* (c) 2004 Andreas Regel <andreas.regel AT powarman.de>
*/
#ifndef _GLCDDRIVERS_CONFIG_H_
#define _GLCDDRIVERS_CONFIG_H_
#include <string>
#include <vector>
namespace GLCD
{
const int kWaitUsleep = 0;
const int kWaitNanosleep = 1;
const int kWaitNanosleepRR = 2;
const int kWaitGettimeofday = 3;
struct tOption
{
std::string name;
std::string value;
};
class cDriverConfig
{
public:
std::string name;
std::string driver;
int id;
std::string device;
int port;
int width;
int height;
bool upsideDown;
bool invert;
int brightness;
int contrast;
bool backlight;
int adjustTiming;
int refreshDisplay;
std::vector <tOption> options;
public:
cDriverConfig();
cDriverConfig(const cDriverConfig & rhs);
~cDriverConfig();
cDriverConfig & operator=(const cDriverConfig & rhs);
bool Parse(const std::string & line);
int GetInt(const std::string & value);
bool GetBool(const std::string & value);
};
class cConfig
{
public:
int waitMethod;
int waitPriority;
std::vector <cDriverConfig> driverConfigs;
public:
cConfig();
~cConfig();
bool Load(const std::string & filename);
bool Save(const std::string & filename);
bool Parse(const std::string & line);
int GetInt(const std::string & value);
bool GetBool(const std::string & value);
int GetConfigIndex(const std::string & name);
};
extern cConfig Config;
} // end of namespace
#endif
|