## org.freedesktop.UPower org.freedesktop.UPower — UPower interface |

## Methods

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

## Signals

    DeviceAdded('o'device)
    DeviceRemoved('o'device)
    DeviceChanged('o'device)
    Changed()
    Sleeping()
    NotifySleep('s'action)
    Resuming()
    NotifyResume('s'action)

## 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'
    'LidForceSleep'read'b'
    'IsDocked'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`.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    $ 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 (in's'action)

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.

`action`: | The sleep action type, e.g. `suspend` or `hibernate`.

### Suspend ()

    Suspend ()

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

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

If AboutToSleep() 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 AboutToSleep() has not been called then UPower will send the Sleeping() signal and block for one second.

If AboutToSleep() 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.

This signal is DEPRECATED. Use NotifySleep() instead.

### The NotifySleep signal

    NotifySleep ('s'action)

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).

`action`: | The sleep action type, e.g. suspend, hibernate or hybrid.

### The Resuming signal

    Resuming ()

This signal is sent when the session has just returned from Suspend() or Hibernate().

This signal is DEPRECATED. Use NotifyResume() instead.

### The NotifyResume signal

    NotifyResume ('s'action)

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).

`action`: | The sleep action type, e.g. suspend, hibernate or hybrid.

## 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.

### The "LidForceSleep" property

    'LidForceSleep'read'b'

If the system really has to sleep when the lid is closed. Some laptops actually melt (!) if the lid is closed and the computer keeps running. We blacklist those, and do something sane for the other machines.

This allows us to set the default session policy to not suspend on lid close if the laptop is docked, and be sure the machine is not going to melt.

### The "IsDocked" property

    'IsDocked'read'b'

If the system is currently docked. Note: the "is-docked" value is the result of a heuristic, which may involve testing the display output.