00001 /*************************************************************************** 00002 * * 00003 * Powersave Daemon * 00004 * * 00005 * Copyright (C) 2004,2005 SUSE Linux Products GmbH * 00006 * * 00007 * This program is free software; you can redistribute it and/or modify it * 00008 * under the terms of the GNU General Public License as published by the * 00009 * Free Software Foundation; either version 2 of the License, or (at you * 00010 * option) any later version. * 00011 * * 00012 * This program is distributed in the hope that it will be useful, but * 00013 * WITHOUT ANY WARRANTY; without even the implied warranty of * 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00015 * General Public License for more details. * 00016 * * 00017 * You should have received a copy of the GNU General Public License along * 00018 * with this program; if not, write to the Free Software Foundation, Inc., * 00019 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * 00020 * * 00021 ***************************************************************************/ 00022 00023 #ifndef EVENT_MANAGEMENT_H 00024 #define EVENT_MANAGEMENT_H 00025 00026 #include <list> 00027 00028 class Event; 00029 00031 class EventManagement { 00032 public: 00034 EventManagement(); 00035 00036 virtual ~EventManagement(); 00037 00042 const std::string cur_prog(int id); 00043 00048 const std::string name(int id); 00049 00057 int moveOn(int id); 00058 00066 int registerEvent(Event & event, time_t timeout); 00067 00071 int count(); 00072 00077 bool remove(int id); 00078 00080 std::list < Event > Events; 00081 00088 Event* event(int id); 00089 00093 void adjustTimeouts(unsigned long sleep_time); 00094 00101 int eventIsRunning(const std::string &eventName); 00102 00106 void checkScriptReturn(int id, int returnValue, std::string &comment); 00107 00115 bool continueEvent(Event *event, std::string acpi_event_line); 00116 00125 bool executeEvent(const std::string &eventName, 00126 const char *acpi_event_line = ""); 00127 00130 void checkEventTimeouts(); 00131 00132 private: 00139 bool executeInternalAction(Event *event, std::string action); 00140 00142 unsigned int id_count; 00143 }; 00144 00145 #endif // EVENT_MANAGEMENT_H