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

IOPMCancelScheduledPowerEvent

Cancel a previously scheduled power event.

IOPMCopyScheduledPowerEvents

List all scheduled system power events

IOPMSchedulePowerEvent

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

Notifications

IOAllowPowerChange

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

IOCancelPowerChange

The caller denies an idle system sleep power state change.

IODeregisterApp

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

IODeregisterForSystemPower

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

IORegisterApp

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

Deprecated
IORegisterForSystemPower

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

IOCopySystemLoadAdvisoryDetailed

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.

IOGetSystemLoadAdvisory

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

CPU Power & Thermal

IOPMCopyCPUPowerStatus

Copy status of all current CPU power levels.

IOPMGetThermalWarningLevel

Get thermal warning level of the system.

Assertions

IOPMAssertionCopyProperties

Copies details about an IOPMAssertion

IOPMAssertionCreate

Dynamically requests a system behavior from the power management system.

Deprecated
IOPMAssertionCreateWithName

Dynamically requests a system behavior from the power management system.

IOPMAssertionCreateWithProperties

Creates an IOPMAssertion with more flexibility than IOPMAssertionCreateWithDescription.

IOPMAssertionDeclareUserActivity

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 kIOPMAssertionTypePreventUserIdleDisplaySleep using IOPMAssertionCreateWithDescription API instead.

IOPMAssertionRelease

Decrements the assertion's retain count.

IOPMAssertionRetain

Increments the assertion's retain count.

IOPMAssertionSetProperty

Sets a property in the assertion.

IOPMCopyAssertionsByProcess

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

IOPMCopyAssertionsStatus

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

Miscellaneous

IOPMAssertionTypes

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

IOPMCopyBatteryInfo

Request raw battery data from the system.

IOPMFindPowerManagement

Finds the Root Power Domain IOService.

IOPMGetAggressiveness

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

IOPMSetAggressiveness

Sets one of the aggressiveness factors in IOKit Power Management.

IOPMSleepEnabled

Tells whether the system supports full sleep, or just doze

IOPMSleepSystem

Request that the system initiate sleep.

Data Types

See the Overview for header-level documentation.

IOPMAssertionLevel

Type for AssertionLevel argument to IOPMAssertionCreate

IOSystemLoadAdvisoryLevel

Return type for IOGetSystemLoadAdvisory

Constants

See the Overview for header-level documentation.

Assertion

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

kIOPMNullAssertionID

This value represents a non-initialized assertion ID