diff options
Diffstat (limited to 'tdecore/tdehw/tderootsystemdevice.h')
-rw-r--r-- | tdecore/tdehw/tderootsystemdevice.h | 182 |
1 files changed, 182 insertions, 0 deletions
diff --git a/tdecore/tdehw/tderootsystemdevice.h b/tdecore/tdehw/tderootsystemdevice.h new file mode 100644 index 000000000..1c94fe1eb --- /dev/null +++ b/tdecore/tdehw/tderootsystemdevice.h @@ -0,0 +1,182 @@ +/* This file is part of the TDE libraries + Copyright (C) 2012 Timothy Pearson <kb9vqf@pearsoncomputing.net> + (C) 2013 Golubev Alexander <fatzer2@gmail.com> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef _TDEROOTSYSTEMDEVICE_H +#define _TDEROOTSYSTEMDEVICE_H + +#include "tdegenericdevice.h" +#include "tdehwcommontypes.h" + +namespace TDESystemFormFactor { +enum TDESystemFormFactor { + Unclassified, + Desktop, + Laptop, + Server, + Other = 0x80000000 +}; +}; + +namespace TDESystemPowerState { +enum TDESystemPowerState { + Active, + Standby, + Suspend, + Hibernate, + PowerOff, + Reboot +}; +}; + +namespace TDESystemHibernationMethod { +enum TDESystemHibernationMethod { + Unsupported, + Platform, + Shutdown, + Reboot, + TestProc, + Test +}; +}; + +typedef TQValueList<TDESystemPowerState::TDESystemPowerState> TDESystemPowerStateList; +typedef TQValueList<TDESystemHibernationMethod::TDESystemHibernationMethod> TDESystemHibernationMethodList; + +class TDECORE_EXPORT TDERootSystemDevice : public TDEGenericDevice +{ + public: + /** + * Constructor. + * @param Device type + */ + TDERootSystemDevice(TDEGenericDeviceType::TDEGenericDeviceType dt, TQString dn=TQString::null); + + /** + * Destructor. + */ + ~TDERootSystemDevice(); + + /** + * @return a TDESystemFormFactor::TDESystemFormFactor with the system's form factor + */ + TDESystemFormFactor::TDESystemFormFactor formFactor(); + + /** + * @return a TDESystemPowerStateList with all available power states + */ + TDESystemPowerStateList powerStates(); + + /** + * @return a TDESystemHibernationMethodList with all available hibernation methods + */ + TDESystemHibernationMethodList hibernationMethods(); + + /** + * @return a TDESystemHibernationMethod::TDESystemHibernationMethod with the current hibernation method + */ + TDESystemHibernationMethod::TDESystemHibernationMethod hibernationMethod(); + + /** + * @return an unsigned long with the number of bytes required to hibernate + */ + unsigned long diskSpaceNeededForHibernation(); + + /** + * @return TRUE if permissions allow the hibernation method to be set, FALSE if not + */ + bool canSetHibernationMethod(); + + /** + * @return TRUE if hardware and permissions allow the system to enter standby, FALSE if not + */ + bool canStandby(); + + /** + * @return TRUE if hardware and permissions allow the system to be suspended, FALSE if not + */ + bool canSuspend(); + + /** + * @return TRUE if hardware and permissions allow the system to be hibernated, FALSE if not + */ + bool canHibernate(); + + /** + * @return TRUE if permissions allow the system to be powered down, FALSE if not + */ + bool canPowerOff(); + + /** + * @return TRUE if permissions allow the system to be rebooted, FALSE if not + */ + bool canReboot(); + + /** + * @param hm a TDESystemHibernationMethod::TDESystemHibernationMethod with the desired hibernation method + */ + void setHibernationMethod(TDESystemHibernationMethod::TDESystemHibernationMethod hm); + + /** + * @param ps a TDESystemPowerState::TDESystemPowerState with the desired power state + * @return TRUE if power state was set + */ + bool setPowerState(TDESystemPowerState::TDESystemPowerState ps); + + protected: + /** + * @param ff a TDESystemFormFactor::TDESystemFormFactor with the system's form factor + * @internal + */ + void internalSetFormFactor(TDESystemFormFactor::TDESystemFormFactor ff); + + /** + * @param ps a TDESystemPowerStateList with all available power states + * @internal + */ + void internalSetPowerStates(TDESystemPowerStateList ps); + + /** + * @param hm a TDESystemHibernationMethodList with all available hibernation methods + * @internal + */ + void internalSetHibernationMethods(TDESystemHibernationMethodList hm); + + /** + * @param hm a TDESystemHibernationMethod::TDESystemHibernationMethod with the current hibernation method + * @internal + */ + void internalSetHibernationMethod(TDESystemHibernationMethod::TDESystemHibernationMethod hm); + + /** + * @param sz an unsigned long with the number of bytes required to hibernate + * @internal + */ + void internalSetDiskSpaceNeededForHibernation(unsigned long sz); + + private: + TDESystemFormFactor::TDESystemFormFactor m_formFactor; + TDESystemPowerStateList m_powerStates; + TDESystemHibernationMethodList m_hibernationMethods; + TDESystemHibernationMethod::TDESystemHibernationMethod m_hibernationMethod; + unsigned long m_hibernationSpace; + + friend class TDEHardwareDevices; +}; + +#endif // _TDEROOTSYSTEMDEVICE_H |