Mac Dev Center Mac OS X Reference Library Drivers, Kernel, & Hardware: User-Space Device Access I/O Kit Framework Reference
|
IOPowerSources.h |
Includes: |
<sys/cdefs.h>
|
IOPowerSources 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.
Indicates whether the system is at a low battery warning level.
Returns a CFDictionary that describes the attached (AC) external power adapter (if any external power adapter is attached.
Returns a blob of Power Source information in an opaque CFTypeRef.
Returns a CFArray of Power Source handles, each of type CFTypeRef.
Indicates whether the system is at a low battery warning level.
Returns a CFDictionary with readable information about the specific power source.
Returns a CFRunLoopSourceRef that notifies the caller when power source information changes.
IOPSCopyExternalPowerAdapterDetails |
Returns a CFDictionary that describes the attached (AC) external power adapter (if any external power adapter is attached.
Returns a CFDictionary on success. Caller must release the returned dictionary. If no adapter is attached, or if there's an error, returns NULL.
Use the kIOPSPowerAdapter... keys described in IOPSKeys.h to interpret the returned CFDictionary.
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.
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.
IOPSGetBatteryWarningLevel |
Indicates whether the system is at a low battery warning level.
IOPSLowBatteryWarningLevel IOPSGetBatteryWarningLevel( void);
If your app runs in full screen mode and occludes OS X's battery monitor's low battery warnings, you should alert the user at least when the system is in kIOPSLowBatteryWarnFinal.
IOPSGetPowerSourceDescription |
Returns a CFDictionary with readable information about the specific power source.
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.
The battery can provide no more than 10 minutes of runtime.
The battery can provide no more than 10 minutes of runtime.
kIOPSLowBatteryWarningFinal |
The battery can provide no more than 10 minutes of runtime.
See Also:kIOPSLowBatteryWarningNone = 1, kIOPSLowBatteryWarningEarly = 2, kIOPSLowBatteryWarningFinal = 3 } IOPSLowBatteryWarningLevel;
OS X makes no guarantees that the system shall remain in Final Warning for 10 minutes. Batteries are frequently calibrated differently and may provide runtime for more or less than the estimated 10 minutes.
kIOPSLowBatteryWarningFinal |
The battery can provide no more than 10 minutes of runtime.
See Also:kIOPSLowBatteryWarningNone = 1, kIOPSLowBatteryWarningEarly = 2, kIOPSLowBatteryWarningFinal = 3 } IOPSLowBatteryWarningLevel;
OS X makes no guarantees that the system shall remain in Final Warning for 10 minutes. Batteries are frequently calibrated differently and may provide runtime for more or less than the estimated 10 minutes.
Notify(3) key. The system delivers notifications on this key when the battery time remaining drops into a warnable level.
kIOPSNotifyLowBattery |
Notify(3) key. The system delivers notifications on this key when the battery time remaining drops into a warnable level.
#define kIOPSNotifyLowBattery "com.apple.system.powersources.lowbattery"
Last Updated: 2009-10-15