tderootsystemdevice.h
00001 /* This file is part of the TDE libraries 00002 Copyright (C) 2012 Timothy Pearson <kb9vqf@pearsoncomputing.net> 00003 (C) 2013 Golubev Alexander <fatzer2@gmail.com> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License version 2 as published by the Free Software Foundation. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to 00016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 Boston, MA 02110-1301, USA. 00018 */ 00019 00020 #ifndef _TDEROOTSYSTEMDEVICE_H 00021 #define _TDEROOTSYSTEMDEVICE_H 00022 00023 #include "tdegenericdevice.h" 00024 #include "tdehwcommontypes.h" 00025 00026 namespace TDESystemFormFactor { 00027 enum TDESystemFormFactor { 00028 Unclassified, 00029 Desktop, 00030 Laptop, 00031 Server, 00032 Other = 0x80000000 00033 }; 00034 }; 00035 00036 namespace TDESystemPowerState { 00037 enum TDESystemPowerState { 00038 Active, 00039 Standby, 00040 Freeze, 00041 Suspend, 00042 Hibernate, 00043 PowerOff, 00044 Reboot 00045 }; 00046 }; 00047 00048 namespace TDESystemHibernationMethod { 00049 enum TDESystemHibernationMethod { 00050 Unsupported, 00051 Platform, 00052 Shutdown, 00053 Reboot, 00054 TestProc, 00055 Test 00056 }; 00057 }; 00058 00059 typedef TQValueList<TDESystemPowerState::TDESystemPowerState> TDESystemPowerStateList; 00060 typedef TQValueList<TDESystemHibernationMethod::TDESystemHibernationMethod> TDESystemHibernationMethodList; 00061 00062 class TDECORE_EXPORT TDERootSystemDevice : public TDEGenericDevice 00063 { 00064 public: 00069 TDERootSystemDevice(TDEGenericDeviceType::TDEGenericDeviceType dt, TQString dn=TQString::null); 00070 00074 ~TDERootSystemDevice(); 00075 00079 TDESystemFormFactor::TDESystemFormFactor formFactor(); 00080 00084 TDESystemPowerStateList powerStates(); 00085 00089 TDESystemHibernationMethodList hibernationMethods(); 00090 00094 TDESystemHibernationMethod::TDESystemHibernationMethod hibernationMethod(); 00095 00099 unsigned long diskSpaceNeededForHibernation(); 00100 00104 bool canSetHibernationMethod(); 00105 00109 bool canStandby(); 00110 00114 bool canFreeze(); 00115 00119 bool canSuspend(); 00120 00124 bool canHibernate(); 00125 00129 bool canPowerOff(); 00130 00134 bool canReboot(); 00135 00139 void setHibernationMethod(TDESystemHibernationMethod::TDESystemHibernationMethod hm); 00140 00145 bool setPowerState(TDESystemPowerState::TDESystemPowerState ps); 00146 00147 protected: 00152 void internalSetFormFactor(TDESystemFormFactor::TDESystemFormFactor ff); 00153 00158 void internalSetPowerStates(TDESystemPowerStateList ps); 00159 00164 void internalSetHibernationMethods(TDESystemHibernationMethodList hm); 00165 00170 void internalSetHibernationMethod(TDESystemHibernationMethod::TDESystemHibernationMethod hm); 00171 00176 void internalSetDiskSpaceNeededForHibernation(unsigned long sz); 00177 00178 private: 00179 TDESystemFormFactor::TDESystemFormFactor m_formFactor; 00180 TDESystemPowerStateList m_powerStates; 00181 TDESystemHibernationMethodList m_hibernationMethods; 00182 TDESystemHibernationMethod::TDESystemHibernationMethod m_hibernationMethod; 00183 unsigned long m_hibernationSpace; 00184 00185 friend class TDEHardwareDevices; 00186 }; 00187 00188 #endif // _TDEROOTSYSTEMDEVICE_H