brightness.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *                                                                         *
00003  *                         Powersave Daemon                                *
00004  *                                                                         *
00005  *          Copyright (C) 2004,2005 SUSE Linux Products GmbH               *
00006  *                                                                         *
00007  *               Author(s): Timo Hoenig <thoenig@suse.de>                  *
00008  *                                                                         *
00009  * This program is free software; you can redistribute it and/or modify it *
00010  * under the terms of the GNU General Public License as published by the   *
00011  * Free Software Foundation; either version 2 of the License, or (at you   *
00012  * option) any later version.                                              *
00013  *                                                                         *
00014  * This program is distributed in the hope that it will be useful, but     *
00015  * WITHOUT ANY WARRANTY; without even the implied warranty of              *
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU       *
00017  * General Public License for more details.                                *
00018  *                                                                         *
00019  * You should have received a copy of the GNU General Public License along *
00020  * with this program; if not, write to the Free Software Foundation, Inc., *
00021  * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA                  *
00022  *                                                                         *
00023  ***************************************************************************/
00024 
00025 #ifndef POWERSAVE_BRIGHTNESS_H
00026 #define POWERSAVE_BRIGHTNESS_H
00027 
00028 #define PANASONIC_BRIGHTNESS_INTERFACE_IS_DOG_SLOW
00029 
00030 #define ACPI_ASUS      "/proc/acpi/asus/brn"
00031 #define ACPI_IBM       "/proc/acpi/ibm/brightness"
00032 #define ACPI_SONY      "/proc/acpi/sony/brightness"
00033 #define ACPI_TOSHIBA   "/proc/acpi/toshiba/lcd"
00034 #define ACPI_PANASONIC "/proc/acpi/panasonic/"
00035 #define LCD_OMNIBOOK   "/proc/omnibook/lcd"
00036 #define DEV_PMU        "/dev/pmu"
00037 
00038 /* merge #include "powersaved.h" */
00039 
00040 class Brightness {
00041       protected:
00042         const char *iface;
00043         int fd;
00044         int last_percent;
00045         int PercentToLevel(int);
00046 
00047       public:
00048          virtual ~ Brightness();
00049         static Brightness *Probe();
00050 
00051         virtual void Init();
00052 
00053         virtual int Get();
00054         virtual void Set(int);
00055         int GetPercent();
00056         void SetPercent(int);
00057 
00058         /* those are driver-dependent, since e.g. setting the brightness
00059            to zero actually might switch the display off which might not
00060            be exactly what you want */
00061         virtual void Min();
00062         virtual void Med();
00063 
00064         /* those are generic */
00065         void Max();
00066         void Up();
00067         void Down();
00068 
00069         virtual int GetLevels();
00070 };
00071 
00072 class BrightnessASUS:public Brightness {
00073       public:
00074         void Init();
00075 
00076         int Get();
00077         void Set(int);
00078 
00079         void Min();
00080         void Med();
00081 
00082         int GetLevels();
00083 };
00084 
00085 class BrightnessIBM:public Brightness {
00086       public:
00087         void Init();
00088 
00089         int Get();
00090         void Set(int);
00091 
00092         void Min();
00093         void Med();
00094 
00095         int GetLevels();
00096 };
00097 
00098 class BrightnessSony:public Brightness {
00099       public:
00100         void Init();
00101 
00102         int Get();
00103         void Set(int);
00104 
00105         void Min();
00106         void Med();
00107 
00108         int GetLevels();
00109 };
00110 
00111 class BrightnessToshiba:public Brightness {
00112       public:
00113         void Init();
00114 
00115         int Get();
00116         void Set(int);
00117 
00118         void Min();
00119         void Med();
00120 
00121         int GetLevels();
00122 };
00123 
00124 class BrightnessPanasonic:public Brightness {
00125       protected:
00126 #ifndef PANASONIC_BRIGHTNESS_INTERFACE_IS_DOG_SLOW
00127         char *iface_dc;
00128 #endif
00129         int brt_max, brt_min, brt_scale;
00130 
00131       public:
00132         void Init();
00133 
00134         int Get();
00135         void Set(int);
00136 
00137         void Min();
00138         void Med();
00139 
00140         int GetLevels();
00141 };
00142 #endif                          /* POWERSAVE_BRIGHTNESS_H */
00143 
00144 class BrightnessOmnibook:public Brightness {
00145       public:
00146         void Init();
00147 
00148         int Get();
00149         void Set(int);
00150 
00151         void Min();
00152         void Med();
00153 
00154         int GetLevels();
00155 };
00156 
00157 class BrightnessPMU:public Brightness {
00158       public:
00159         void Init();
00160 
00161         int Get();
00162         void Set(int);
00163 
00164         void Min();
00165         void Med();
00166 
00167         int GetLevels();
00168 };
00169 

Generated on Mon Mar 27 09:27:19 2006 for Powersave Daemon by  doxygen 1.4.6