Function

IOPMCopyBatteryInfo

Request raw battery data from the system.

Declaration

IOReturn IOPMCopyBatteryInfo(mach_port_t masterPort, CFArrayRef *info);

Parameters

masterPort

The master port obtained from IOMasterPort(). Just pass MACH_PORT_NULL.

info

A CFArray of CFDictionaries containing raw battery data.

Return Value

Returns kIOReturnSuccess or an error condition if request failed.

Discussion

WARNING! IOPMCoyBatteryInfo is unsupported on ALL Intel CPU based systems. For PPC CPU based systems, it remains not recommended. For almost all purposes, developers should use the richer IOPowerSources API (with change notifications) instead of using IOPMCopyBatteryInfo. Keys to decipher IOPMCopyBatteryInfo's return CFArray exist in IOPM.h.

See Also

Miscellaneous

IOPMAssertionTypes

Use as AssertionType argument to IOPMAssertionCreate. The idle display will not sleep when enabled, and consequently the system will not idle sleep.

IOPMFindPowerManagement

Finds the Root Power Domain IOService.

IOPMGetAggressiveness

Retrieves the current value of one of the aggressiveness factors in IOKit Power Management.

IOPMSetAggressiveness

Sets one of the aggressiveness factors in IOKit Power Management.

IOPMSleepEnabled

Tells whether the system supports full sleep, or just doze

IOPMSleepSystem

Request that the system initiate sleep.