#include <pm_interface.h>
Inheritance diagram for PM_Interface:
Public Member Functions | |
PM_Interface () | |
constructor setting up the object | |
virtual | ~PM_Interface () |
destructor freeing all members | |
BATTERY_STATES | batteryState () |
get the current state the battery is in | |
void | sleep_wrapper (const string &) |
internal action which is executed directly before and after do_suspend_* should go into this function | |
int | executeScript (const string &script, const string ¶m) |
used to execute scripts in INT_SCRIPT_PATH | |
int | screenlock (const string ¶m) |
triggers a screenlock either from a client or script | |
int | x_notification (const string ¶m) |
triggers a notification for the user | |
void | ignore_buttons (bool) |
sets if we ignore button events | |
virtual int | start () |
starts the pm_object | |
virtual void | checkTemperatureStateChanges () |
checks for temperature events and executes appropriate events | |
virtual void | checkBatteryStateChanges () |
Checks for Battery State changes (when AC adapter is not plugged in) and throws appropriate event. | |
virtual int | checkACStateChanges () |
Checks for AC state changes and throws appropraite events. | |
virtual int | updateTemperatureState () |
update temperature state | |
virtual int | updateACState () |
updates ACState | |
virtual bool | checkThrottling () |
updates the cpu state and throws appropriate events | |
void | checkDevice (char *udi, bool added) |
check if a removed/added device belongs to us | |
virtual int | activateScheme (const string &scheme_name) |
switches settings to a possibly new scheme and activates them | |
virtual int | activateScheme (AC_ADAPTER_STATE ac_state) |
switches scheme according to ac_state | |
virtual void | activateSettings () |
Activate scheme settings. | |
virtual int | rereadConfig () |
reread config files. | |
virtual void | throttle (int percent=-1) |
throttles the cpu | |
virtual void | dethrottle () |
dethrottles the cpu | |
virtual void | resume () |
called when coming back from suspend | |
DBUS_ERROR | handleDBusRequest (DBusMessage *req, DBusMessage *reply, POWERSAVE_MESSAGE_TYPE type) |
handles a dbus request | |
virtual int | suspend_to_ram ()=0 |
triggers suspend to ram | |
virtual int | standby ()=0 |
triggers standby | |
virtual int | openHWEventFD ()=0 |
opens the event fd | |
virtual int | openAcpidSocket ()=0 |
opens the acpid socket | |
virtual int | handleHWEventRequest (int fd=-1)=0 |
handles a request on the event socket/fd | |
void | suspendNetworkManager () |
sends a sleep signal to the networkmanager | |
void | resumeNetworkManager () |
sends a wake signal to the networkmanager | |
bool | haveSuspend2 () |
check whether we have a suspend2 enabled kernel | |
Public Attributes | |
ClientConnection * | _cC |
object to manage clients connected to the daemon | |
EventManagement * | _eM |
object to manage running events | |
Brightness * | _brightness |
object implementing brightness functionality on some laptops | |
Protected Attributes | |
bool | _cooling_mode_supported |
defines whether cooling mode is supported | |
bool | _thermal_trip_points_supported |
defines whether thermal trip points are supported | |
PM_STATE | _cur_state |
the current pm state contianing e.g. battery, thermal and cpu info | |
int64_t | _supported_sleeping_states |
defines the supported sleeping states | |
ThrottleInterface | _throttleInterface |
object caring about throttling | |
Battery | _battery |
battery object represention one single battery | |
Static Protected Attributes | |
static PSD_SLEEP_STATE_REQUESTS | _requested_sleep_state = PSD_NO_SLEEP_REQUEST |
used for workaround for apm to remembemer triggered sleep state, for ACPI to discard button events during resume | |
static bool | _sleep_triggered = false |
defines whether sleep was triggered before | |
Private Member Functions | |
DBUS_ERROR | handleManagerMessage (DBusMessage *msg) |
handles a message on the manager interface | |
DBUS_ERROR | handleScriptsMessage (DBusMessage *msg) |
handles a message on the events interface | |
DBUS_ERROR | handleRequestMessage (DBusMessage *msg, DBusMessage *reply) |
handles a message on the request interface | |
DBUS_ERROR | handleActionMessage (DBusMessage *msg) |
handles a message on the request interface | |
Private Attributes | |
DeviceManagement | _devices |
object caring about powermanagable devices |
mainly an abstraction of apm/acpi but contains other things like ac adapter handling which maybe moves to own class in future.
|
constructor setting up the object
|
|
destructor freeing all members
|
|
switches scheme according to ac_state
|
|
switches settings to a possibly new scheme and activates them
|
|
Activate scheme settings. Inheriting functions in APM_Interface and ACPI_Interface set them specifically for APM/ACPI Add additional code that is needed after activating a new scheme or after re-reading configurations here (e.g. brightness?) Be aware that first the inhereting functions in the ACPI/APM_Interface layer are called Reimplemented in ACPI_Interface, and APM_Interface. |
|
get the current state the battery is in
|
|
Checks for AC state changes and throws appropraite events. if AC changes to offline, also battery state changes will be checked
|
|
Checks for Battery State changes (when AC adapter is not plugged in) and throws appropriate event. Be careful in ACPI you have to check whether the battery alarm also needs to be set |
|
check if a removed/added device belongs to us calls the appropriate functions out of DeviceManagement
|
|
checks for temperature events and executes appropriate events
|
|
updates the cpu state and throws appropriate events
|
|
dethrottles the cpu Only dethrottle if temperature is in unknown, ok or active state. Otherwise kernel may have throttled ... |
|
used to execute scripts in INT_SCRIPT_PATH
|
|
handles a message on the request interface
|
|
handles a dbus request
|
|
handles a request on the event socket/fd has to be implemented in derived classes (only acpi) Implemented in ACPI_Interface, and APM_Interface. |
|
handles a message on the manager interface
|
|
handles a message on the request interface
|
|
handles a message on the events interface
|
|
check whether we have a suspend2 enabled kernel
|
|
sets if we ignore button events
|
|
opens the acpid socket has to be implemented in derived classes (only acpi) Implemented in ACPI_Interface, and APM_Interface. |
|
opens the event fd has to be implemented in derived classes (apm/acpi) Implemented in ACPI_Interface, and APM_Interface. |
|
reread config files.
|
|
called when coming back from suspend updates ac state, battery state and adjust speeds |
|
sends a wake signal to the networkmanager it only sends the signal if the NetworkManager can be found |
|
triggers a screenlock either from a client or script emits a screenlock signal over the bus and checks if a client with capability screenlock is connected. If not, execute script to lock the screen |
|
internal action which is executed directly before and after do_suspend_* should go into this function
|
|
triggers standby has to be implemented in derived classes (apm/acpi) Implemented in ACPI_Interface, and APM_Interface. |
|
starts the pm_object throws appropriate ac adapter/battery events and initializes the active scheme |
|
triggers suspend to ram has to be implemented in derived classes (apm/acpi) Implemented in ACPI_Interface, and APM_Interface. |
|
sends a sleep signal to the networkmanager it only sends the signal if the NetworkManager can be found |
|
throttles the cpu Only throttle if temperature is in unknown, ok or active state. Otherwise kernel may have throttled ... |
|
updates ACState
|
|
update temperature state
|
|
triggers a notification for the user emits a notification signal over the bus and checks if a client with capability notifications is connected. If not, execute script to display the notification |
|
battery object represention one single battery
|
|
object implementing brightness functionality on some laptops
|
|
object to manage clients connected to the daemon
|
|
defines whether cooling mode is supported
|
|
the current pm state contianing e.g. battery, thermal and cpu info
|
|
object caring about powermanagable devices
|
|
object to manage running events
|
|
used for workaround for apm to remembemer triggered sleep state, for ACPI to discard button events during resume
|
|
defines whether sleep was triggered before
|
|
defines the supported sleeping states
|
|
defines whether thermal trip points are supported
|
|
object caring about throttling
|