You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tdelibs/tdecore/tdehw/tderootsystemdevice.h

207 lines
5.6 KiB

/* 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,
Freeze,
Suspend,
Hibernate,
PowerOff,
Reboot,
HybridSuspend,
Mem, // Used temporarily to detect suspend-to-RAM capability
Disk // Used temporarily to detect hibernation and hybrid suspend capability
};
};
namespace TDESystemSuspendMode {
enum TDESystemSuspendMode {
SuspendToIdle, // a.k.a. Freeze
Standby,
SuspendToRAM // a.k.a. Suspend
};
};
namespace TDESystemHibernationMethod {
enum TDESystemHibernationMethod {
Unsupported,
Platform,
Shutdown,
Reboot,
TestProc,
Test,
Suspend
};
};
typedef TQValueList<TDESystemPowerState::TDESystemPowerState> TDESystemPowerStateList;
typedef TQValueList<TDESystemSuspendMode::TDESystemSuspendMode> TDESystemSuspendModeList;
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 freeze state, FALSE if not
*/
bool canFreeze();
/**
* @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 hybrid suspended, FALSE if not
*/
bool canHybridSuspend();
/**
* @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