org.freedesktop.UPower

org.freedesktop.UPower — UPower interface

Methods

EnumerateDevices (out 'ao' devices)
AboutToSleep     ()
Suspend          ()
SuspendAllowed   (out 'b'  allowed)
Hibernate        ()
HibernateAllowed (out 'b'  allowed)

Signals

DeviceAdded   ('o' device)
DeviceRemoved ('o' device)
DeviceChanged ('o' device)
Changed       ()
Sleeping      ()
Resuming      ()

Implemented Interfaces

Objects implementing org.freedesktop.UPower also implements org.freedesktop.DBus.Introspectable, org.freedesktop.DBus.Properties

Properties

'DaemonVersion' read      's'
'CanSuspend'    read      'b'
'CanHibernate'  read      'b'
'OnBattery'     read      'b'
'OnLowBattery'  read      'b'
'LidIsClosed'   read      'b'
'LidIsPresent'  read      'b'

Description

The UPower service is available via the system message bus. To access the service, use the org.freedesktop.UPower interface on the /org/freedesktop/UPower object on the D-Bus system bus service with the well-known name org.freedesktop.UPower.

$ dbus-send --print-reply \
            --system \
            --dest=org.freedesktop.UPower \
            /org/freedesktop/UPower \
            org.freedesktop.UPower.EnumerateDevices

method return sender=:1.386 -> dest=:1.451 reply_serial=2
   array [
      object path "/org/freedesktop/UPower/devices/line_power_AC"
      object path "/org/freedesktop/UPower/devices/battery_BAT0"
   ]
            

Details

EnumerateDevices ()

EnumerateDevices (out 'ao' devices)

Enumerate all power objects on the system.

devices:

An array of object paths for devices.

AboutToSleep ()

AboutToSleep ()

This method tells UPower that the Suspend() or Hibernate() method is about to be called. This allows UPower to emit the Suspending signal whilst session activities are happening that have to be done before the suspend process is started.

This method would typically be called by the session power management daemon, before it locks the screen and waits for the screen to fade to black. The session power management component would then call Suspend() or Hibernate() when these syncronous tasks have completed.

If this method is not called than nothing bad will happen and Suspend() or Hibernate() will block for the required second.


Suspend ()

Suspend ()

Suspends the computer into a low power state. System state is not preserved if the power is lost.

If AboutToRequestSleep() has not been called then UPower will send the Sleeping() signal and block for one second.

If AboutToRequestSleep() has been called less than one second before this method is called then UPower will block for the remaining time to complete one second of delay.


SuspendAllowed ()

SuspendAllowed (out 'b' allowed)

Check if the caller has (or can get) the PolicyKit privilege to call Suspend.

allowed:

TRUE if allowed, otherwise FALSE

Hibernate ()

Hibernate ()

Hibernates the computer into a low power state. System state is preserved if the power is lost.

If AboutToRequestSleep() has not been called then UPower will send the Sleeping() signal and block for one second.

If AboutToRequestSleep() has been called less than one second before this method is called then UPower will block for the remaining time to complete one second of delay.


HibernateAllowed ()

HibernateAllowed (out 'b' allowed)

Check if the caller has (or can get) the PolicyKit privilege to call Hibernate.

allowed:

TRUE if allowed, otherwise FALSE

Signal Details

The DeviceAdded signal

DeviceAdded ('o' device)

Emitted when a device is added.

device:

Object path of device that was added.

The DeviceRemoved signal

DeviceRemoved ('o' device)

Emitted when a device is removed.

device:

Object path of device that was removed.

The DeviceChanged signal

DeviceChanged ('o' device)

Emitted when a device changed.

device:

Object path of device that was changed.

The Changed signal

Changed ()

Emitted when one or more properties on the object changes.


The Sleeping signal

Sleeping ()

This signal is sent when the session is about to be suspended or hibernated. Session and system programs have one second to do anything required before the sleep action is taken (such as sending out Avahi or Jabber messages).


The Resuming signal

Resuming ()

This signal is sent when the session has just returned from Suspend() or Hibernate(). Session and system programs can then do anything required (such as sending out Avahi or Jabber messages).

Property Details

The "DaemonVersion" property

'DaemonVersion'  read      's'

Version of the running daemon, e.g. 002.


The "CanSuspend" property

'CanSuspend'  read      'b'

Whether the system is able to suspend.


The "CanHibernate" property

'CanHibernate'  read      'b'

Whether the system is able to hibernate.


The "OnBattery" property

'OnBattery'  read      'b'

Indicates whether the system is running on battery power. This property is provided for convenience.


The "OnLowBattery" property

'OnLowBattery'  read      'b'

Indicates whether the system is running on battery power and if the battery is critically low. This property is provided for convenience.


The "LidIsClosed" property

'LidIsClosed'  read      'b'

Indicates if the laptop lid is closed where the display cannot be seen.


The "LidIsPresent" property

'LidIsPresent'  read      'b'

If the system has a lid device.