Function

IOPMAssertionCreateWithName

Dynamically requests a system behavior from the power management system.

Declaration

IOReturn IOPMAssertionCreateWithName(CFStringRef AssertionType, IOPMAssertionLevel AssertionLevel, CFStringRef AssertionName, IOPMAssertionID *AssertionID);

Parameters

AssertionType

The CFString assertion type to request from the PM system.

AssertionLevel

Pass kIOPMAssertionLevelOn or kIOPMAssertionLevelOff.

AssertionName

A string that describes the name of the caller and the activity being handled by this assertion (e.g. "Mail Compacting Mailboxes"). Name may be no longer than 128 characters.

AssertionID

On success, a unique id will be returned in this parameter.

Return Value

Returns kIOReturnSuccess on success, any other return indicates PM could not successfully activate the specified assertion.

Discussion

No special privileges are necessary to make this call - any process may activate a power assertion. Caller must specify an AssertionName - NULL is not a valid input.

See Also

Assertions

IOPMAssertionCopyProperties

Copies details about an IOPMAssertion

IOPMAssertionCreate

Dynamically requests a system behavior from the power management system.

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

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software