ADC Home > Reference Library > Reference > Hardware & Drivers > I/O Kit Framework Reference
|
IOPowerSources.h |
Include Path: | <IOKit/ps> |
Path: | /System/Library/Frameworks/IOKit.framework/Versions/A/Headers/ps/IOPowerSources.h |
See Also: | |
Includes: |
<sys/cdefs.h>
|
This header provides uniform access to the state of power sources attached to the system. You can receive a change notification when any power source data changes. "Power sources" currently include batteries and UPS devices.
The header follows CF semantics in that it is the caller's responsibility to CFRelease() anything returned by a "Copy" function, and the caller should not CFRelease() anything returned by a "Get" function.
Returns a blob of Power Source information in an opaque CFTypeRef.
Returns a CFArray of Power Source handles, each of type CFTypeRef.
Returns a CFDictionary with readable information about the specific power source.
Returns a CFRunLoopSourceRef that notifies the caller when power source information changes.
IOPSCopyPowerSourcesInfo |
Returns a blob of Power Source information in an opaque CFTypeRef.
CFTypeRef IOPSCopyPowerSourcesInfo( void);
NULL if errors were encountered, a CFTypeRef otherwise. Caller must CFRelease() the return value when done accessing it.
Clients should not directly access data in the returned CFTypeRef - they should use the accessor functions IOPSCopyPowerSourcesList and IOPSGetPowerSourceDescription, instead.
IOPSCopyPowerSourcesList |
Returns a CFArray of Power Source handles, each of type CFTypeRef.
CFArrayRef IOPSCopyPowerSourcesList( CFTypeRef blob);
blob
Takes the CFTypeRef returned by IOPSCopyPowerSourcesInfo()
Returns NULL if errors were encountered, otherwise a CFArray of CFTypeRefs. Caller must CFRelease() the returned CFArrayRef.
The caller shouldn't directly access the CFTypeRefs, but should use IOPSGetPowerSourceDescription on each member of the CFArrayRef.
IOPSGetPowerSourceDescription |
Returns a CFDictionary with readable information about the specific power source.
CFDictionaryRef IOPSGetPowerSourceDescription( CFTypeRef blob, CFTypeRef ps);
blob
The CFTypeRef returned by IOPSCopyPowerSourcesInfo()
ps
One of the CFTypeRefs in the CFArray returned by IOPSCopyPowerSourcesList()
Returns NULL if an error was encountered, otherwise a CFDictionary. Caller should NOT release the returned CFDictionary - it will be released as part of the CFTypeRef returned by IOPSCopyPowerSourcesInfo().
See the C-strings defined in IOPSKeys.h for specific keys into the dictionary. Don't expect all keys to be present in any dictionary. Some power sources, for example, may not support the "Time Remaining To Empty" key and it will not be present in their dictionaries.
IOPSNotificationCreateRunLoopSource |
Returns a CFRunLoopSourceRef that notifies the caller when power source information changes.
CFRunLoopSourceRef IOPSNotificationCreateRunLoopSource( IOPowerSourceCallbackType, void *);
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.
Returns NULL if an error was encountered, otherwise a CFRunLoopSource. Caller must release the CFRunLoopSource.
|
Last Updated: 2009-02-23