Libkpower Specification
Jump to navigation
Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
LibTUPower API
PROPOSED
TUPower
Instance Type: Single Global
Instantiated by: TUComputer
Enum Types
Type Name | Value | Description |
---|---|---|
PowerProfile::None | 0 | Undefined or Unsupported Power Level |
PowerProfile::Dynamic | 1 | Automatic Power Level |
PowerProfile::Powersave | 2 | Lowest (slowest) Power Level |
PowerProfile::Performance | 255 | Highest (fastest) Power Level |
SleepMode::SuspendDisk | 0 | Suspend to disk |
SleepMode::SuspendRAM | 1 | Suspend to RAM |
SleepMode::Standby | 2 | Standby mode |
TPowerDevice::Battery | 0 | Power source is battery |
TPowerDevice::Line | 1 | Power source is line voltage |
TPowerDevice::UPS | 2 | Power source is battery-backed line voltage |
TBatteryDevice::Idle | 1 | Battery is online and is not charging |
TBatteryDevice::Charging | 3 | Battery is online and charging |
TBatteryDevice::Discharging | 4 | Battery is online and charging |
TBatteryDevice::Charged | 8 | Battery is fully charged |
Member Data Structures
Structure Name | Description | Member Name | Member Type | Member Description |
---|
Member Methods
Method Name | Parameters | Return Type | Description |
---|---|---|---|
currentSessionIsActive | None | bool | Check if the current session is active |
suspend | TMainboardDevice*, SleepMode sleep_type | bool | Place the machine into sleep mode sleep_type. Returns TRUE if successful |
setDisplayBrightness | TDisplayDevice*, int level | bool | Sets display brightness to specified level. Returns TRUE if successful |
setDisplayBrightnessDown | TDisplayDevice*, int step | bool | Dims display by specified step. Returns TRUE if successful |
setDisplayBrightnessUp | TDisplayDevice*, int step | bool | Brightens display by specified step. Returns TRUE if successful |
setPowerPolicy | TPhysicalDevice*, PowerProfile::Mode | bool | Sets device power policy to mode. Returns TRUE if successful |
setBatteryThresholds | TBatteryDevice*, int power_source_low_charge, int power_source_warning_charge, int power_source_critical_charge | bool | Sets battery low/warning/critical thresholds for battery power_source. Returns TRUE if successful |
Member Signals
Signal Name | Parameters | Description |
---|---|---|
dbusConnected | None | Emitted whenever a new DBUS connection is established |
batteryCharged | TPowerDevice* | Emitted whenever a battery reaches a fully charged state |
batteryLow | TPowerDevice* | Emitted whenever a battery reaches the low threshold |
batteryWarning | TPowerDevice* | Emitted whenever a battery reaches the warning threshold |
batteryCritical | TPowerDevice* | Emitted whenever a battery reaches the critical threshold |
powerACStatusChanged | TPowerDevice* | Emitted whenever the AC status of a power source or power sources changes |
powerOnlineStatusChanged | TPowerDevice* | Emitted whenever the online status of a power source or power sources changes |
cpuModeChanged | TCPUDevice* | Emitted whenever the power management mode of the CPU changes |
cpuFrequencyChanged | TCPUDevice* | Emitted whenever any of the CPU cores change frequency |
cpuTemperatureChanged | TCPUDevice* | Emitted whenever any of the CPU cores change temperature |
gpuModeChanged | TGPUDevice* | Emitted whenever the power management mode of the GPU changes |
gpuFrequencyChanged | TGPUDevice* | Emitted whenever any of the GPU cores change frequency |
gpuTemperatureChanged | TGPUDevice* | Emitted whenever any of the GPU cores change temperature |
displayBrightnessChanged | TDisplayDevice* | Emitted whenever the display brightness changes |
temperatureChanged | TPhysicalDevice* | Emitted whenever the temperature of a physical device changes |
voltageChanged | TPhysicalDevice* | Emitted whenever the voltage of a physical device changes |
currentChanged | TPhysicalDevice* | Emitted whenever the current of a physical device changes |
Member Slots
Slot Name | Parameters | Description |
---|
Objects
TMainBoardDevice
Instance Type: Same as base TPhysicalDevice
Subclass of TPhysicalDevice
Member Data Structures
Structure Name | Description | Member Name | Member Type | Member Description |
---|---|---|---|---|
Capabilities | Lists available hardware capabilities | suspend_disk | char | 0 = = Lacks suspend to disk capability 1 = = Has capability and is enabled 2 = = Has capability but is disabled |
suspend_ram | char | 0 = = Lacks suspend to RAM capability 1 = = Has capability and is enabled 2 = = Has capability but is disabled | ||
suspend_standby | char | 0 = = Lacks standby capability 1 = = Has capability and is enabled 2 = = Has capability but is disabled | ||
has_apm | bool | 0 = = Lacks APM interface 1 = = Has interface and is in use 2 = = Has interface but is disabled | ||
has_acpi | bool | 0 = = Lacks ACPI interface 1 = = Has interface and is in use 2 = = Has interface but is disabled | ||
has_pmu | bool | 0 = = Lacks PMU interface 1 = = Has interface and is in use 2 = = Has interface but is disabled | ||
system_type | char | 0 = = Server 1 = = Desktop 2 = = Laptop 3 = = Tablet 4 = = Smartphone | ||
manufacturer | TQString | System/mainboard manufacturer | ||
model | TQString | System/mainboard model number | ||
serial | TQString | System/mainboard serial number | ||
bios_rev | TQString | System/mainboard BIOS revision | ||
has_lid_switch | bool | 0 = = Lacks lid switch 1 = = Has switch and is in use 2 = = Has switch but is disabled | ||
has_power_switch | bool | 0 = = Lacks power switch 1 = = Has switch and is in use 2 = = Has switch but is disabled | ||
has_sleep_switch | bool | 0 = = Lacks sleep switch 1 = = Has switch and is in use 2 = = Has switch but is disabled | ||
has_suspend_ram_switch | bool | 0 = = Lacks suspend-to-RAM switch 1 = = Has switch and is in use 2 = = Has switch but is disabled | ||
has_suspend_disk_switch | bool | 0 = = Lacks suspend-to-disk switch 1 = = Has switch and is in use 2 = = Has switch but is disabled |
Member Methods
Method Name | Parameters | Return Type | Description |
---|---|---|---|
class | None | int | Always returns KDevice::Physical |
type | None | int | Always returns TPhysicalDevice::Mainboard |
TCPUDevice
Subclass of TPhysicalDevice
Instance Type: Same as base TPhysicalDevice
Member Data Structures
Structure Name | Description | Member Name | Member Type | Member Description |
---|---|---|---|---|
Capabilities | Lists CPU capabilities | power_modes | char | Bitwise OR of available powersave modes 0 = = Not available 1 == Available |
Information | Lists CPU information | manufacturer | TQString | CPU Manufacturer |
model | TQString | CPU Model String/Number | ||
stepping | TQString | CPU Stepping | ||
serial | TQString | CPU Serial Number | ||
frequency_table | int[255] | CPU frequency for specified power mode 0 = = current frequency 1 = = Lowest supported frequency 255 = = Highest supported frequency | ||
power_profile | char | Current CPU power profile |
Member Methods
Method Name | Parameters | Return Type | Description |
---|---|---|---|
class | None | int | Always returns KDevice::Physical |
type | None | int | Always returns TPhysicalDevice::CPU |
powerProfile | None | virtual PowerProfile::Mode | Returns the current power profile |
setPowerProfile | None | virtual void | Sets the current power profile |
TGPUDevice
Subclass of TPhysicalDevice
Instance Type: Same as base TPhysicalDevice
Member Data Structures
Structure Name | Description | Member Name | Member Type | Member Description |
---|---|---|---|---|
Capabilities | Lists GPU capabilities | power_modes | char | Bitwise OR of available powersave modes 0 = = Not available 1 == Available |
Information | Lists GPU information | manufacturer | TQString | GPU Manufacturer |
model | TQString | GPU Model String/Number | ||
stepping | TQString | GPU Stepping | ||
serial | TQString | GPU Serial Number | ||
frequency_table | int[255] | GPU frequency for specified power mode 0 = = current frequency 1 = = Lowest supported frequency 255 = = Highest supported frequency | ||
power_profile | char | Current GPU power profile |
Member Methods
Method Name | Parameters | Return Type | Description |
---|---|---|---|
class | None | int | Always returns KDevice::Physical |
type | None | int | Always returns TPhysicalDevice::GPU |
powerProfile | None | virtual PowerProfile::Mode | Returns the current power profile |
setPowerProfile | None | virtual void | Sets the current power profile |
TDisplayDevice
Subclass of TPhysicalDevice
Instance Type: Same as base TPhysicalDevice
Member Data Structures
Structure Name | Description | Member Name | Member Type | Member Description |
---|---|---|---|---|
Capabilities | Lists display control capabilities | has_brightness_adjust | bool | 0 = = Lacks brightness control interface 1 = = Has interface and is enabled 2 = = Has interface but is disabled |
min_brightness | int | Minimum hardware display brightness level | ||
max_brightness | int | Maximum hardware display brightness level | ||
Information | Lists display information NOTE: This structure is invalid until initialized with queryHardwareInformation() |
current_brightness | int | Current display brightness level |
power_profile | char | Current display power profile |
Member Methods
Method Name | Parameters | Return Type | Description |
---|---|---|---|
class | None | int | Always returns KDevice::Physical |
type | None | int | Always returns TPhysicalDevice::Display |
powerProfile | None | virtual PowerProfile::Mode | Returns the current power profile |
setPowerProfile | None | virtual void | Sets the current power profile |
TPowerDevice
Subclass of TPhysicalDevice
Instance Type: Same as base TPhysicalDevice
Member Data Structures
Structure Name | Description | Member Name | Member Type | Member Description |
---|---|---|---|---|
Information | Lists hardware power information/status Up to 255 separate sources of power are supported NOTE: This structure is invalid until initialized with queryHardwareInformation() |
available_power_sources | char | Bitwise OR of available power sources 0 = = Source unable to provide power 1 = = Source available to provide power on demand or is currently providing power |
online | char | 0 = = Source not providing power 1 = = Source currently providing power | ||
primary | char | 0 = = Source is auxiliary or not providing power 1 = = Source is primary/critical | ||
name | TQString | Friendly name(s) of power source(s) | ||
type | char | Power source type 0 = = Direct line connection 1 = = Battery 2 = = Battery-backed line (UPS) | ||
status | char | Power source status 0 = = No information (e.g. permanent line connection) 1 = = Online/not charging 3 = = Online/charging 4 = = Discharging 8 = = Charged | ||
voltage | int | Power source voltage | ||
time_remaining | int | Power source time remaining until complete discharge or disconnection -1 == Never (Infinite time remaining) |
Member Methods
Method Name | Parameters | Return Type | Description |
---|---|---|---|
class | None | int | Always returns KDevice::Physical |
type | None | int | Always returns TPhysicalDevice::Power |
powerType | None | pure virtual int | Returns a TPowerDevice::Type value specifying the current device type |
TBatteryDevice
Subclass of TPowerDevice
Instance Type: Same as base TPhysicalDevice
Member Data Structures
Structure Name | Description | Member Name | Member Type | Member Description |
---|---|---|---|---|
current_charge | int | Power source current charge value | ||
max_charge | int | Battery maximum charge value | ||
low_charge | int | Battery source low charge value | ||
warning_charge | int | Battery source warning charge value | ||
critical_charge | int | Battery source critical charge value |
Member Methods
Method Name | Parameters | Return Type | Description |
---|---|---|---|
class | None | int | Always returns KDevice::Physical |
type | None | int | Always returns TPhysicalDevice::Power |
powerType | None | int | Always returns TPowerDevice::Battery |
TLinePowerDevice
Subclass of TPowerDevice
Instance Type: Same as base TPhysicalDevice
Member Methods
Method Name | Parameters | Return Type | Description |
---|---|---|---|
class | None | int | Always returns KDevice::Physical |
type | None | int | Always returns TPhysicalDevice::Power |
powerType | None | int | Always returns TPowerDevice::Line |
TUPSDevice
Subclass of TPowerDevice
Instance Type: Same as base TPhysicalDevice
Member Data Structures
Structure Name | Description | Member Name | Member Type | Member Description |
---|---|---|---|---|
current_charge | int | Power source current charge value | ||
max_charge | int | Battery maximum charge value | ||
low_charge | int | Battery source low charge value | ||
warning_charge | int | Battery source warning charge value | ||
critical_charge | int | Battery source critical charge value |
Member Methods
Method Name | Parameters | Return Type | Description |
---|---|---|---|
class | None | int | Always returns KDevice::Physical |
type | None | int | Always returns TPhysicalDevice::Power |
powerType | None | int | Always returns TPowerDevice::UPS |