summaryrefslogtreecommitdiffstats
path: root/src/hardware.h
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2013-09-22 14:56:47 +0200
committerSlávek Banko <slavek.banko@axis.cz>2013-09-22 14:56:47 +0200
commit160e6f21b8d578aeaba5105082cbb61f46811ef1 (patch)
tree62a3660023eefc4efc498c6025bde1759d6b2e1c /src/hardware.h
parente113ed917ca8d86e607c7fc70accd681cfefb0a4 (diff)
downloadtdepowersave-160e6f21b8d578aeaba5105082cbb61f46811ef1.tar.gz
tdepowersave-160e6f21b8d578aeaba5105082cbb61f46811ef1.zip
Add support for freeze suspend state
Diffstat (limited to 'src/hardware.h')
-rw-r--r--src/hardware.h112
1 files changed, 61 insertions, 51 deletions
diff --git a/src/hardware.h b/src/hardware.h
index a5c7d5e..6d0c741 100644
--- a/src/hardware.h
+++ b/src/hardware.h
@@ -16,14 +16,14 @@
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-
-/*!
+
+/*!
* \file hardware.h
* \brief Headerfile for hardwareinfo.cpp. This file collect/hold all
-* Hardware information as e.g. battery and ac state.
+* Hardware information as e.g. battery and ac state.
*/
-/*!
+/*!
* \class HardwareInfo
* \brief class for hardware information related funtionality
* \author Danny Kukawka, <dkukawka@suse.de>, <danny.kukawka@web.de>
@@ -55,6 +55,7 @@
enum suspend_type {
SUSPEND2DISK,
SUSPEND2RAM,
+ FREEZE,
STANDBY
};
@@ -76,7 +77,7 @@ enum device_type {
};
enum ERROR_MSG {
- DBUS_NO_RIGHTS,
+ DBUS_NO_RIGHTS,
DBUS_NOT_RUNNING,
DBUS_RUNNING
};
@@ -84,7 +85,7 @@ enum ERROR_MSG {
//! hold information if suspend/standby/pm actions are supported and allowed
/*!
* This dictionary contains information about the available pm capabilities and
-* the related interfaces in HAL.
+* the related interfaces in TDE hardware library.
*/
typedef struct SuspendStates {
//! true if the machine support suspend2ram and the interface is available
@@ -99,6 +100,12 @@ typedef struct SuspendStates {
bool suspend2disk_can;
//! true if the machine support suspend2disk and PolicyKit allow to call the interface
int suspend2disk_allowed;
+ //! true if the machine support freeze and the interface is available
+ bool freeze;
+ //! true if the machine support freeze, but no interface available
+ bool freeze_can;
+ //! true if the machine support freeze and PolicyKit allow to call the interface
+ int freeze_allowed;
//! true if the machine support standby and the interface is available
bool standby;
//! true if the machine support standby, but no interface available
@@ -106,13 +113,16 @@ typedef struct SuspendStates {
//! true if the machine support standby and PolicyKit allow to call the interface
int standby_allowed;
- SuspendStates () {
+ SuspendStates () {
suspend2ram = false;
suspend2ram_can = false;
suspend2ram_allowed = -1;
suspend2disk = false;
suspend2disk_can = false;
suspend2disk_allowed = -1;
+ freeze = false;
+ freeze_can = false;
+ freeze_allowed = -1;
standby = false;
standby_can = false;
standby_allowed = -1;
@@ -122,9 +132,9 @@ typedef struct SuspendStates {
class HardwareInfo : public TQObject{
Q_OBJECT
-
-private:
+
+private:
TDEHardwareDevices *m_hwdevices;
//! pointer to the dbusInterface connection class
@@ -143,15 +153,15 @@ private:
//! hold the UDIs of all hardware we handle atm
/*!
* This TQStringList contains the list of UDIs we handle at the moment in this
- * class. This should be used to handle device events from HAL for devices we
- * want to monitor
+ * class. This should be used to handle device events from TDE hardware library
+ * for devices we want to monitor
*/
TQStringList allUDIs;
//! hold information if suspend/standby/pm actions are supported and allowed
/*!
* This dictionary contains information about the available pm capabilities and
- * the related interfaces in HAL.
+ * the related interfaces in TDE hardware library.
*/
SuspendStates suspend_states;
@@ -173,65 +183,65 @@ private:
cpufreq_type currentCPUFreqPolicy;
//! the state of the ac adapter
- /*!
+ /*!
* This boolean represent information about the AC adapter state.
* \li true: if AC adapter is present
* \li false: it AC adapter is not present
*/
bool acadapter;
//! the state of the lidclose button
- /*!
+ /*!
* This boolean represent information about the Lid button state.
- * \li true: if lid is closed
+ * \li true: if lid is closed
* \li false: else
*/
bool lidclose;
//! if the machine support APM
- /*!
+ /*!
* This boolean represent information if the machine support APM or not.
* \li true: if APM supported
* \li false: else
*/
bool has_APM;
//! if the machine support ACPI
- /*!
+ /*!
* This boolean represent information if the machine support ACPI or not.
* \li true: if ACPI supported
* \li false: else
*/
bool has_ACPI;
//! if the machine support PMU (ppc power management)
- /*!
+ /*!
* This boolean represent information if the machine support PMU or not.
* \li true: if PMU supported
* \li false: else
*/
bool has_PMU;
- //! if the machine support change CPU Freq via HAL interface
- /*!
- * This boolean represent information if the machine support change the
- * CPU freqency via HAL.
+ //! if the machine support change CPU Freq via TDE hardware library
+ /*!
+ * This boolean represent information if the machine support change the
+ * CPU freqency via TDE hardware library.
* \li true: if supported
* \li false: else
*/
bool cpuFreq;
- //! if the machine support change *SchedPowerSavings methodes via HAL interface
- /*!
- * This boolean represent information if the machine support change the
- * SchedPowerSavings methodes via HAL.
+ //! if the machine support change *SchedPowerSavings methodes via TDE hardware library
+ /*!
+ * This boolean represent information if the machine support change the
+ * SchedPowerSavings methodes via TDE hardware library.
* \li true: if supported
* \li false: else
*/
bool schedPowerSavings;
//! if the machine support change brightness
- /*!
+ /*!
* This boolean represent information if the machine support brightness changes.
* \li true: if supported
* \li false: else
*/
bool brightness;
//! if brightness get controled via keyevents in hardware
- /*!
+ /*!
* This boolean represent information if the machine handle brightness button
* and keyevents in hardware. If so TDEPowersave should ignore key events.
* \li true: if handled in hardware
@@ -239,7 +249,7 @@ private:
*/
bool brightness_in_hardware;
//! if the machine is a laptop
- /*!
+ /*!
* This boolean represent information if the machine is a laptop.
* \li true: if the machine is a laptop
* \li false: else
@@ -247,7 +257,7 @@ private:
bool laptop;
//! if the current desktop session is active
- /*!
+ /*!
* This boolean represent information if the current desktop session in
* Which TDEPowersave runs is marked in ConsoleKit as active or not.
* \li true: if active
@@ -256,18 +266,18 @@ private:
bool sessionIsActive;
//! if the current user can use the CPU Freq interface
- /*!
- * This integer tell if the current user is allowed to change the
- * CPU Frequency policy via the HAL interface
+ /*!
+ * This integer tell if the current user is allowed to change the
+ * CPU Frequency policy via the TDE hardware library
* \li 1: if allowed
* \li 0: if not allowed
* \li -1: if unknown (e.g. there is no policy/PolicyKit)
*/
int cpuFreqAllowed;
//! if the current user can use the brightness interface
- /*!
- * This integer tell if the current user is allowed to change the
- * brightness via the HAL interface
+ /*!
+ * This integer tell if the current user is allowed to change the
+ * brightness via the TDE hardware library
* \li 1: if allowed
* \li 0: if not allowed
* \li -1: if unknown (e.g. there is no policy/PolicyKit)
@@ -294,7 +304,7 @@ private:
void checkPowermanagement();
//! check the possible suspend/standby states
void checkSuspend();
- //! check if the machine support change CPU Freq via HAL
+ //! check if the machine support change CPU Freq via TDE hardware library
void checkCPUFreq();
//! check the current brightness level
void checkCurrentBrightness();
@@ -311,9 +321,9 @@ private:
bool checkIfHandleDevice ( TQString _udi, int *type );
//! to set the CPUFreq governor
bool setCPUFreqGovernor( const char *governor );
- //! to get the state of SchedPowerSave setting of kernel/HAL
+ //! to get the state of SchedPowerSave setting of kernel/TDE hardware library
bool getSchedPowerSavings();
- //! to set the state of SchedPowerSave setting of kernel/HAL
+ //! to set the state of SchedPowerSave setting of kernel/TDE hardware library
bool setSchedPowerSavings( bool enable );
//! find and update a battery information
@@ -340,7 +350,7 @@ private slots:
//! TQT_SLOT to forward signal about changed battery warning state
void emitBatteryWARNState (int type, int state);
-
+
//! TQT_SLOT to handle resume and forward a signal for resume
void handleResumeSignal (int result);
@@ -387,7 +397,7 @@ signals:
//! signal if the D-Bus daemon terminate and restart
void dbusRunning( int );
- //! signal if the IsActive state of
+ //! signal if the IsActive state of
void desktopSessionIsActive (bool);
//! signal if we are back from resume
@@ -397,21 +407,21 @@ public:
// update related info --> need to be reset if the data was read
//! tells if the CPUFreq Policy changed
- /*!
+ /*!
* This boolean represent information about CPUFreq Policy changes.
* \li true: if something changed
* \li false: if nothing changed (or this is reset to false if the message was consumed)
*/
bool update_info_cpufreq_policy_changed;
//! tells if the AC status changed
- /*!
+ /*!
* This boolean represent information about AC status changes.
* \li true: if something changed
* \li false: if nothing changed (or this is reset to false if the message was consumed)
*/
bool update_info_ac_changed;
//! tells if the primary battery collection changed some values
- /*!
+ /*!
* This boolean represent information about primary battery changes.
* \li true: if something changed
* \li false: if nothing changed (or this is reset to false if the message was consumed)
@@ -433,14 +443,14 @@ public:
//! default destructor
~HardwareInfo();
- // to get private members
+ // to get private members
//! get info about support of suspend/standby
SuspendStates getSuspendSupport() const;
//! get a pointer to the primary batteries
BatteryCollection* getPrimaryBatteries() const;
//! get all batteries
TQPtrList<Battery> getAllBatteries() const;
-
+
//! check the currently set CPU Frequency Policy
cpufreq_type checkCurrentCPUFreqPolicy();
@@ -462,7 +472,7 @@ public:
bool getLidclose() const;
//! check if the machine is a latop
bool isLaptop() const;
- //! check if there is a connection to D-Bus _and_ HAL
+ //! check if there is a connection to TDE hardware library
bool isOnline() const;
//! check if the machine support ACPI
bool hasACPI() const;
@@ -477,10 +487,10 @@ public:
//! check if the current session is active
bool currentSessionIsActive() const;
- // --> functions to call a HAL interface and trigger an action
- //! execute/trigger a suspend via the HAL interface
+ // --> functions to call a TDE hardware library and trigger an action
+ //! execute/trigger a suspend via the TDE hardware library
bool suspend ( suspend_type suspend );
- //! set the brightness via HAL interface
+ //! set the brightness via TDE hardware library
bool setBrightness ( int level, int percent = -1);
//! to set the brightness down
bool setBrightnessDown(int percentageStep = -1);
@@ -488,7 +498,7 @@ public:
bool setBrightnessUp(int percentageStep = -1);
//! set the CPU frequency policy/speed
bool setCPUFreq ( cpufreq_type cpufreq, int limit = 51 );
- //! call SetPowerSave method on HAL.
+ //! call SetPowerSave method on TDE hardware library.
bool setPowerSave( bool on );
//! function to set warning states for the primary battery collection