libretro.api.power

Types for exposing a frontend’s power status to a Core.

See also

PowerDriver

The Protocol that uses these types to expose power status to a Core.

libretro.drivers.power

libretro.py’s included PowerDriver implementations.

Module Attributes

retro_power_state

Corresponds to retro_power_state in libretro.h.

NO_ESTIMATE

Sentinel value indicating that the remaining time or charge is unknown.

Classes

PowerState

Enumeration of device power states.

retro_device_power

Reports the power status of the host device, or whatever lies that libretro.py tells it to report.

class PowerState[source]

Bases: IntEnum

Enumeration of device power states.

Corresponds to the RETRO_POWERSTATE_* constants in libretro.h.

>>> from libretro.api import PowerState
>>> PowerState.CHARGING
<PowerState.CHARGING: 2>
UNKNOWN = 0
DISCHARGING = 1
CHARGING = 2
CHARGED = 3
PLUGGED_IN = 4
__new__(value)
classmethod value in self

Return True if value is in cls.

value is in cls if: 1) value is a member of cls, or 2) value is the value of one of the cls’s members. 3) value is a pseudo-member (flags)

classmethod self[name]

Return the member matching name.

__init__()
classmethod iter(self)

Return members in definition order.

classmethod len(self)

Return the number of members (no aliases)

class retro_device_power[source]

Bases: Structure

Reports the power status of the host device, or whatever lies that libretro.py tells it to report.

Corresponds to retro_device_power in libretro.h.

state

Current power state of the device.

seconds

Estimated remaining battery time in seconds, or NO_ESTIMATE if unknown.

__init__(*args, **kwargs)
classmethod __new__(*args, **kwargs)
percent

Battery charge percentage (0-100), or NO_ESTIMATE if unknown.

__deepcopy__(_)[source]

Return a copy of this object. Intended for use with copy.deepcopy().

retro_power_state

Corresponds to retro_power_state in libretro.h.

NO_ESTIMATE = -1

Sentinel value indicating that the remaining time or charge is unknown.