Function

IOPSNotificationCreateRunLoopSource

Returns a CFRunLoopSourceRef that notifies the caller when power source information changes.

Declaration

CFRunLoopSourceRef IOPSNotificationCreateRunLoopSource(IOPowerSourceCallbackType callback, void *context);

Parameters

callback

A function to be called whenever any power source is added, removed, or changes.

context

Any user-defined pointer, passed to the IOPowerSource callback.

Return Value

Returns NULL if an error was encountered, otherwise a CFRunLoopSource. Caller must release the CFRunLoopSource.

Discussion

Returns a CFRunLoopSourceRef for scheduling with your CFRunLoop. If your project does not use a CFRunLoop, you can alternatively receive notifications via mach port, dispatch, or signal, via notify.h using the name kIOPSTimeRemainingNotificationKey

See Also

Power Source Descriptions

IOPSCopyExternalPowerAdapterDetails

Returns a CFDictionary that describes the attached (AC) external power adapter (if any external power adapter is attached.

IOPSCopyPowerSourcesInfo

Returns a blob of Power Source information in an opaque CFTypeRef.

IOPSCopyPowerSourcesList

Returns a CFArray of Power Source handles, each of type CFTypeRef.

IOPSGetPowerSourceDescription

Returns a CFDictionary with readable information about the specific power source.

IOPSGetProvidingPowerSourceType(CFTypeRef)

Indicates the power source the computer is currently drawing from.