00001 /*************************************************************************** 00002 * * 00003 * Powersave Daemon * 00004 * * 00005 * Copyright (C) 2004,2005 SUSE Linux Products GmbH * 00006 * * 00007 * Author(s): Holger Macht <hmacht@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 BATTERY_H 00026 #define BATTERY_H 00027 00028 #include "powerlib.h" 00029 00030 class EventManagement; 00031 00037 enum BATTERY_STATES { BAT_CRIT_STATE, BAT_LOW_STATE, BAT_WARN_STATE, BAT_NORM_STATE, BAT_NONE_STATE }; 00038 00040 class Battery { 00041 public: 00043 Battery(); 00044 00049 BATTERY_STATES batteryState(); 00050 00059 int updateBatteryState(int ac_state, EventManagement *eM); 00060 00065 int chargingState(); 00066 00071 int remainingTime(); 00072 00077 int remainingPercent(); 00078 00083 int remainingChargingTime(); 00084 00089 void resetState(); 00090 00091 private: 00093 BATTERY_STATES _battery_state; 00094 00096 BatteryGeneral _bg; 00097 00103 unsigned _msecs_last_battery_read; 00104 }; 00105 00106 #endif // BATTERY_H