libsolidcontrol
Solid::Control::PowerManager Namespace Reference
Detailed Description
This namespace allows to query the underlying system to obtain information about the hardware available.It's the unique entry point for power management. Applications should use it to control or query the power management features of the system.
Note that it's implemented as a singleton and encapsulates the backend logic.
Typedef Documentation
Definition at line 119 of file powermanager.h.
Enumeration Type Documentation
This enum type defines the different states of the AC adapter.
- UnknownAcAdapterState: The AC adapter has an unknown state
- Plugged: The AC adapter is plugged
- Unplugged: The AC adapter is unplugged
Definition at line 65 of file powermanager.h.
This enum type defines the different states of the system battery.
- NoBatteryState: No battery available
- Normal: The battery is at its normal charge level
- Warning: The battery is at its warning charge level
- Low: The battery is at its low charge level
- Critical: The battery is at its critical charge level
Definition at line 56 of file powermanager.h.
This type stores an OR combination of CpuFreqPolicy values.
This enum defines the different types of brightness controls.
- UnknownBrightnessControl: Unknown
- Screen: Brightness control for a monitor or laptop panel
- Keyboard: Brightness control for a keyboard backlight
Definition at line 117 of file powermanager.h.
This enum type defines the types of system button events.
- UnknownButtonType: An unknown button
- PowerButton: A power button pressed event, generally used to turn on or off the system
- SleepButton: A sleep button pressed event, generally used to make the system asleep
- LidOpen: A laptop lid open event
- LidClose: A laptop lid close event
Definition at line 76 of file powermanager.h.
This type stores an OR combination of SuspendMethod values.
This enum type defines the different CPU frequency policies.
- UnknownCpuFreqPolicy: The name says it all
- OnDemand: Frequency is changed by the kernel depending on the processor load
- Conservative: Frequency is changed by the kernel depending on the processor load; the stepping is less aggressive than OnDemand. This may be equivalent to OnDemand depending on the operating system.
- Userspace: Frequency is changed by a userspace agent depending on the processor load
- Powersave: Frequency is always set to the lowest available
- Performance: Frequency is always set to the highest available
Definition at line 103 of file powermanager.h.
This enum type defines the different suspend methods.
- UnknownSuspendMethod: The name says it all
- Standby: Processes are stopped, some hardware is deactivated (ACPI S1)
- ToRam: Most devices are deactivated, only RAM is powered (ACPI S3)
- ToDisk: State of the machine is saved to disk, and it's powered down (ACPI S4)
Definition at line 86 of file powermanager.h.
Function Documentation
SOLIDCONTROL_EXPORT AcAdapterState Solid::Control::PowerManager::acAdapterState | ( | ) |
Retrieves the current state of the system AC adapter.
- Returns:
- the current AC adapter state
Definition at line 88 of file powermanager.cpp.
SOLIDCONTROL_EXPORT int Solid::Control::PowerManager::batteryChargePercent | ( | ) |
Retrieves the current charge percentage of the system batteries.
- Returns:
- the current global battery charge percentage
Definition at line 82 of file powermanager.cpp.
SOLIDCONTROL_EXPORT BatteryState Solid::Control::PowerManager::batteryState | ( | ) |
Retrieves the current state of the system battery.
- Returns:
- the current battery state
Definition at line 76 of file powermanager.cpp.
SOLIDCONTROL_EXPORT float Solid::Control::PowerManager::brightness | ( | const QString & | device = QString() |
) |
Gets the screen brightness.
- Parameters:
-
device the name of the device that you would like to control
- Returns:
- the brightness of the device, as a percentage
Definition at line 168 of file powermanager.cpp.
SOLIDCONTROL_EXPORT BrightnessControlsList Solid::Control::PowerManager::brightnessControlsAvailable | ( | ) |
Checks if brightness controls are enabled on this system.
- Returns:
- a list of the devices available to control
Definition at line 136 of file powermanager.cpp.
SOLIDCONTROL_EXPORT bool Solid::Control::PowerManager::canDisableCpu | ( | int | cpuNum | ) |
Checks if a CPU can be disabled.
- Parameters:
-
cpuNum the number of the CPU we want to check
- Returns:
- true if the given CPU can be disabled, false otherwise
Definition at line 124 of file powermanager.cpp.
SOLIDCONTROL_EXPORT CpuFreqPolicy Solid::Control::PowerManager::cpuFreqPolicy | ( | ) |
Retrieves the current CPU frequency policy of the system.
- Returns:
- the current CPU frequency policy used by the system
Definition at line 112 of file powermanager.cpp.
SOLIDCONTROL_EXPORT Notifier * Solid::Control::PowerManager::notifier | ( | ) |
Definition at line 190 of file powermanager.cpp.
SOLIDCONTROL_EXPORT QString Solid::Control::PowerManager::scheme | ( | ) |
Retrieves the name of the current power management scheme used by the system.
- Returns:
- the current scheme
Definition at line 65 of file powermanager.cpp.
SOLIDCONTROL_EXPORT QString Solid::Control::PowerManager::schemeDescription | ( | const QString & | schemeName | ) |
Retrieves a localized description corresponding to the given scheme.
- Parameters:
-
schemeName the name of the scheme we request the description for
- Returns:
- the associated description
Definition at line 59 of file powermanager.cpp.
SOLIDCONTROL_EXPORT bool Solid::Control::PowerManager::setBrightness | ( | float | brightness, | |
const QString & | device = QString() | |||
) |
Sets the screen brightness.
- Parameters:
-
brightness the desired screen brightness, as a percentage device the name of the device that you would like to control
- Returns:
- true if the brightness change succeeded, false otherwise
Definition at line 142 of file powermanager.cpp.
SOLIDCONTROL_EXPORT bool Solid::Control::PowerManager::setCpuEnabled | ( | int | cpuNum, | |
bool | enabled | |||
) |
Enables or disables a CPU.
- Parameters:
-
cpuNum the number of the CPU we want to enable or disable enabled the new state of the CPU
- Returns:
- true if the state change succeeded, false otherwise
Definition at line 130 of file powermanager.cpp.
SOLIDCONTROL_EXPORT bool Solid::Control::PowerManager::setCpuFreqPolicy | ( | CpuFreqPolicy | newPolicy | ) |
Changes the current CPU frequency policy of the system.
- Parameters:
-
newPolicy the new policy
- Returns:
- true if the policy change succeeded, false otherwise
Definition at line 118 of file powermanager.cpp.
SOLIDCONTROL_EXPORT bool Solid::Control::PowerManager::setScheme | ( | const QString & | name | ) |
Changes the current power management scheme.
- Parameters:
-
name the name of the new scheme
- Returns:
- true if the scheme change succeeded, false otherwise
Definition at line 70 of file powermanager.cpp.
SOLIDCONTROL_EXPORT CpuFreqPolicies Solid::Control::PowerManager::supportedCpuFreqPolicies | ( | ) |
Retrieves the set of CPU frequency policies supported by the system.
- Returns:
- the CPU frequency policies supported by this system
- See also:
- Solid::Control::PowerManager::CpuFreqPolicy
Solid::Control::PowerManager::CpuFreqPolicies
Definition at line 106 of file powermanager.cpp.
SOLIDCONTROL_EXPORT QStringList Solid::Control::PowerManager::supportedSchemes | ( | ) |
Retrieves the list of power management schemes available on this system.
- Returns:
- the available power management schemes
Definition at line 53 of file powermanager.cpp.
SOLIDCONTROL_EXPORT SuspendMethods Solid::Control::PowerManager::supportedSuspendMethods | ( | ) |
Retrieves the set of suspend methods supported by the system.
- Returns:
- the suspend methods supported by this system
- See also:
- Solid::Control::PowerManager::SuspendMethod
Solid::Control::PowerManager::SuspendMethods
Definition at line 94 of file powermanager.cpp.
SOLIDCONTROL_EXPORT KJob * Solid::Control::PowerManager::suspend | ( | SuspendMethod | method | ) |
Requests a suspend of the system.
- Parameters:
-
method the suspend method to use
- Returns:
- the job handling the operation
Definition at line 100 of file powermanager.cpp.