IOPMLib.h

IOPMLib provides access to common power management facilities, like initiating system sleep, getting current idle timer values, registering for sleep/wake notifications, and preventing system sleep.

Overview

See the Overview for header-level documentation.

Overview

Included Headers

  • <CoreFoundation/CFArray.h>

  • <IOKit/IOKitLib.h>

  • <IOKit/pwr_mgt/IOPMLibDefs.h>

  • <IOKit/pwr_mgt/IOPMKeys.h>

  • <Availability.h>

Symbols

ScheduledEvents

IOPMCancel​Scheduled​Power​Event

Cancel a previously scheduled power event.

IOPMCopy​Scheduled​Power​Events

List all scheduled system power events

IOPMSchedule​Power​Event

Schedule the machine to wake from sleep, power on, go to sleep, or shutdown.

Notifications

IOAllow​Power​Change

The caller acknowledges notification of a power state change on a device it has registered for notifications for via IORegisterForSystemPower or IORegisterApp.

IOCancel​Power​Change

The caller denies an idle system sleep power state change.

IODeregister​App

Disconnects the caller from an IOService after receiving power state change notifications from the IOService. (Caller must also release IORegisterApp's return io_connect_t and returned IONotificationPortRef for complete clean-up).

IODeregister​For​System​Power

Disconnects the caller from the Root Power Domain IOService after receiving system power state change notifications. (Caller must also destroy the IONotificationPortRef returned from IORegisterForSystemPower.)

IORegister​App

Connects the caller to an IOService for the purpose of receiving power state change notifications for the device controlled by the IOService.

Deprecated
IORegister​For​System​Power

Connects the caller to the Root Power Domain IOService for the purpose of receiving sleep & wake notifications for the system. Does not provide system shutdown and restart notifications.

IOSystemLoadAdvisory

IOCopy​System​Load​Advisory​Detailed

Indicates how user activity, battery level, and thermal level each contribute to the overall "SystemLoadAdvisory" level. In the future, this combined level may represent new levels as well.

IOGet​System​Load​Advisory

Returns a hint about whether now would be a good time to perform time-insensitive work.

CPU Power & Thermal

IOPMCopy​CPUPower​Status

Copy status of all current CPU power levels.

IOPMGet​Thermal​Warning​Level

Get thermal warning level of the system.

Assertions

IOPMAssertion​Copy​Properties

Copies details about an IOPMAssertion

IOPMAssertion​Create

Dynamically requests a system behavior from the power management system.

Deprecated
IOPMAssertion​Create​With​Name

Dynamically requests a system behavior from the power management system.

IOPMAssertion​Declare​User​Activity

Declares that the user is active on the system. This causes the display to power on and postpone display sleep up to the user's display sleep Energy Saver settings. If you prefer to hold the display awake for a longer period and you know how long you'd like to hold it, consider taking assertion k​IOPMAssertion​Type​Prevent​User​Idle​Display​Sleep using IOPMAssertion​Create​With​Description API instead.

IOPMAssertion​Release

Decrements the assertion's retain count.

IOPMAssertion​Retain

Increments the assertion's retain count.

IOPMAssertion​Set​Property

Sets a property in the assertion.

IOPMCopy​Assertions​By​Process

Returns a dictionary listing all assertions, grouped by their owning process.

IOPMCopy​Assertions​Status

Returns a list of available assertions and their system-wide levels.

Miscellaneous

IOPMAssertion​Types

Use as AssertionType argument to IOPMAssertion​Create. The idle display will not sleep when enabled, and consequently the system will not idle sleep.

IOPMCopy​Battery​Info

Request raw battery data from the system.

IOPMFind​Power​Management

Finds the Root Power Domain IOService.

IOPMGet​Aggressiveness

Retrieves the current value of one of the aggressiveness factors in IOKit Power Management.

IOPMSet​Aggressiveness

Sets one of the aggressiveness factors in IOKit Power Management.

IOPMSleep​Enabled

Tells whether the system supports full sleep, or just doze

IOPMSleep​System

Request that the system initiate sleep.

Data Types

See the Overview for header-level documentation.

IOPMAssertion​Level

Type for AssertionLevel argument to IOPMAssertionCreate

IOSystem​Load​Advisory​Level

Return type for IOGetSystemLoadAdvisory

Constants

See the Overview for header-level documentation.

Assertion

Level for an enabled assertion, passed as an argument to IOPMAssertionCreate.

k​IOPMNull​Assertion​ID

This value represents a non-initialized assertion ID