|
|
Log In | Not a Member? |
Contact ADC |
|
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.
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);
blobReturns 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);
blobpsReturns 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 *);
callbackcontextReturns NULL if an error was encountered, otherwise a CFRunLoopSource. Caller must release the CFRunLoopSource.
|