| Framework | CoreServices/CoreServices.h |
| Declared in | Power.h |
The Power Manager controls power to the internal hardware devices of battery-powered Macintosh computers (such PowerBook computers). The Power Manager automatically shuts off power to internal devices to conserve power whenever the computer has not been used for a predetermined amount of time. In addition, the Power Manager allows your application or other software to
install a procedure that is executed when power to internal devices is about to be shut off or when power has just been restored
set a timer to wake up the computer at some time in the future
set or disable the wakeup timer and read its current setting
enable, disable, or delay the CPU idle feature
read the current CPU clock speed
control power to the internal modem and serial ports
read the status of the internal modem
read the state of the battery charge and the status of the battery charger
Most applications do not need to know whether they are executing on a battery-powered Macintosh computer because the transition between power states is largely invisible. As a result, most applications do not need to use Power Manager routines. You need Power Manager only if you are writing a program--such as a device driver--that must control power to some subsystem of a battery-powered Macintosh computer or that might be affected by the idle or sleep state.
Carbon supports Power Manager functions prior to Power Manager 2.0. However, many of these functions do nothing on Mac OS X; these calls have been retained in Carbon as the only means for implementing power management on Mac OS 8 and 9. Before using any of the Power Manager API, you should call the PMFeatures function to check the availability of the feature you wish to use. On Mac OS X, use the functions provided in IOKit for power management. For more information on IOKit, see I/O Kit Fundamentals.
Function descriptions are grouped by the tasks for which you use the functions. For an alphabetical list of functions, go to the API index at the end of the document.
CurrentProcessorSpeed
DisableIdle Deprecated in Mac OS X v10.0
EnableIdle Deprecated in Mac OS X v10.0
IdleUpdate Deprecated in Mac OS X v10.0
DisableWUTime Deprecated in Mac OS X v10.0
GetWUTime Deprecated in Mac OS X v10.0
SetWUTime Deprecated in Mac OS X v10.0
AOff Deprecated in Mac OS X v10.0
AOn Deprecated in Mac OS X v10.0
AOnIgnoreModem Deprecated in Mac OS X v10.0
BOff Deprecated in Mac OS X v10.0
BOn Deprecated in Mac OS X v10.0
ModemStatus Deprecated in Mac OS X v10.0
BatteryStatus Deprecated in Mac OS X v10.0
BatteryCount
DisposeHDSpindownUPP
DisposePMgrStateChangeUPP
DisposeSleepQUPP
GetCPUSpeed
InvokeHDSpindownUPP
InvokePMgrStateChangeUPP
InvokeSleepQUPP
MaximumProcessorSpeed
MinimumProcessorSpeed
NewHDSpindownUPP
NewPMgrStateChangeUPP
NewSleepQUPP
UpdateSystemActivity
FullProcessorSpeed Deprecated in Mac OS X v10.5
PMFeatures Deprecated in Mac OS X v10.5
PMSelectorCount Deprecated in Mac OS X v10.5
SetProcessorSpeed Deprecated in Mac OS X v10.5
SetSpindownDisable Deprecated in Mac OS X v10.5
AutoSleepControl Deprecated in Mac OS X v10.0
DelaySystemIdle Deprecated in Mac OS X v10.0
DimmingControl Deprecated in Mac OS X v10.0
EnableProcessorCycling Deprecated in Mac OS X v10.0
GetBatteryTimes Deprecated in Mac OS X v10.0
GetBatteryVoltage Deprecated in Mac OS X v10.0
GetDimmingTimeout Deprecated in Mac OS X v10.0
GetDimSuspendState Deprecated in Mac OS X v10.0
GetHardDiskTimeout Deprecated in Mac OS X v10.0
GetIntModemInfo Deprecated in Mac OS X v10.0
GetLastActivity Deprecated in Mac OS X v10.0
GetScaledBatteryInfo Deprecated in Mac OS X v10.0
GetSCSIDiskModeAddress Deprecated in Mac OS X v10.0
GetSleepTimeout Deprecated in Mac OS X v10.0
GetSoundMixerState Deprecated in Mac OS X v10.0
GetStartupTimer Deprecated in Mac OS X v10.0
GetWakeupTimer Deprecated in Mac OS X v10.0
HardDiskPowered Deprecated in Mac OS X v10.0
HardDiskQInstall Deprecated in Mac OS X v10.0
HardDiskQRemove Deprecated in Mac OS X v10.0
IsAutoSlpControlDisabled Deprecated in Mac OS X v10.0
IsDimmingControlDisabled Deprecated in Mac OS X v10.0
IsProcessorCyclingEnabled Deprecated in Mac OS X v10.0
IsSpindownDisabled Deprecated in Mac OS X v10.0
PMgrStateQInstall Deprecated in Mac OS X v10.0
PMgrStateQRemove Deprecated in Mac OS X v10.0
SetDimmingTimeout Deprecated in Mac OS X v10.0
SetDimSuspendState Deprecated in Mac OS X v10.0
SetHardDiskTimeout Deprecated in Mac OS X v10.0
SetIntModemState Deprecated in Mac OS X v10.0
SetSCSIDiskModeAddress Deprecated in Mac OS X v10.0
SetSleepTimeout Deprecated in Mac OS X v10.0
SetSoundMixerState Deprecated in Mac OS X v10.0
SetStartupTimer Deprecated in Mac OS X v10.0
SetWakeupTimer Deprecated in Mac OS X v10.0
SpinDownHardDisk Deprecated in Mac OS X v10.0
short BatteryCount ( void );
Power.hReturns the current effective clock speed of the CPU in megahertz.
short CurrentProcessorSpeed ( void );
The clock speed of the CPU in megahertz (MHz). One MHz represents one million cycles per second.
Prior to Mac OS X 10.4, this function returns the maximum clock speed, not the current effective clock speed.
Power.hUnimplemented.
void DisposeHDSpindownUPP ( HDSpindownUPP userUPP );
Power.hUnimplemented
void DisposePMgrStateChangeUPP ( PMgrStateChangeUPP userUPP );
The I/O Kit Framework header file IOPMLib.h (in I/O Kit Framework Reference) provides access to common power management facilites, such as initiating system sleep, getting current idle timer values, registering for sleep/wake notifications, and preventing system sleep. For additional information about power management for device drivers, see I/O Kit Fundamentals and I/O Kit Device Driver Design Guidelines.
Power.hvoid DisposeSleepQUPP ( SleepQUPP userUPP );
Power.hReturns the current effective clock speed of the CPU in megahertz.
long GetCPUSpeed ( void );
The clock speed of the CPU in megahertz.
For more information, see CurrentProcessorSpeed.
Power.hUnimplemented.
void InvokeHDSpindownUPP ( HDQueueElement *theElement, HDSpindownUPP userUPP );
Power.hUnimplemented.
void InvokePMgrStateChangeUPP ( PMgrQueueElement *theElement, long stateBits, PMgrStateChangeUPP userUPP );
Power.hlong InvokeSleepQUPP ( long message, SleepQRecPtr qRecPtr, SleepQUPP userUPP );
Power.hshort MaximumProcessorSpeed ( void );
MaximumProcessorSpeed is unimplemented on versions of Mac OS X prior to Mac OS X 10.1.
Power.hshort MinimumProcessorSpeed ( void );
MinimumProcessorSpeed is unimplemented on versions of Mac OS X prior to Mac OS X v10.1.
Power.hUnimplemented.
HDSpindownUPP NewHDSpindownUPP ( HDSpindownProcPtr userRoutine );
See the description of the HDSpindownUPP data type.
See the callback HDSpindownProcPtr for more information.
The I/O Kit Framework header file IOPMLib.h (in I/O Kit Framework Reference) provides access to common power management facilites, such as initiating system sleep, getting current idle timer values, registering for sleep/wake notifications, and preventing system sleep. For additional information about power management for device drivers, see I/O Kit Fundamentals and I/O Kit Device Driver Design Guidelines.
Power.hUnimplemented.
PMgrStateChangeUPP NewPMgrStateChangeUPP ( PMgrStateChangeProcPtr userRoutine );
See the description of the PMgrStateChangeUPP data type.
Power.hSleepQUPP NewSleepQUPP ( SleepQProcPtr userRoutine );
See the description of the SleepQUPP data type.
See the callback SleepQProcPtr for more information.
Power.hAdds an entry to the sleep queue.
void SleepQInstall ( SleepQRecPtr qRecPtr );
A pointer to a sleep queue record that you must provide.
Power.hRemoves an entry from the sleep queue.
void SleepQRemove ( SleepQRecPtr qRecPtr );
A pointer to a sleep queue record that you provided when you added your routine to the sleep queue.
Power.hOSErr UpdateSystemActivity ( UInt8 activity );
A result code. See “Power Manager Result Codes.”
Power.htypedef void (*HDSpindownProcPtr) ( HDQueueElement * theElement );
If you name your function MyHDSpindownCallback, you would declare it like this:
void MyHDSpindownCallback ( HDQueueElement * theElement );
Power.htypedef void (*PMgrStateChangeProcPtr) ( PMgrQueueElement * theElement, long stateBits );
If you name your function MyPMgrStateChangeCallback, you would declare it like this:
void MyPMgrStateChangeCallback ( PMgrQueueElement * theElement, long stateBits );
Power.htypedef OSStatus (*PowerHandlerProcPtr) ( UInt32 message, void * param, UInt32 refCon, RegEntryID * regEntryID );
If you name your function MyPowerHandlerCallback, you would declare it like this:
OSStatus MyPowerHandlerCallback ( UInt32 message, void * param, UInt32 refCon, RegEntryID * regEntryID );
A result code. See “Power Manager Result Codes.”
Power.htypedef long (*SleepQProcPtr) ( long message, SleepQRecPtr qRecPtr );
If you name your function MySleepQProc, you would declare it like this:
long MySleepQProc ( long message, SleepQRecPtr qRecPtr );
Power.h
struct ActivityInfo {
short ActivityType;
unsigned long ActivityTime;
};
typedef struct ActivityInfo ActivityInfo;
ActivityTypeA short representing the type of activity to fetch.
ActivityTimeAn unsigned long representing the time of the last activity in ticks.
Power.htypedef SInt8 BatteryByte;
Power.h
struct BatteryInfo {
UInt8 flags;
UInt8 warningLevel;
UInt8 reserved;
UInt8 batteryLevel;
};
typedef struct BatteryInfo BatteryInfo;
flagsAn unsigned, 8-bit integer representing battery state information.
warningLevelAn unsigned, 8-bit integer representing a scaled warning level. The value of this field is in the range of 0-255.
reservedThis field is reserved for internal use.
batteryLevelAn unsigned, 8-bit integer representing a scaled battery level. The value for this field is in the range of 0-255.
Power.h
struct BatteryTimeRec {
unsigned long expectedBatteryTime;
unsigned long minimumBatteryTime;
unsigned long maximumBatteryTime;
unsigned long timeUntilCharged;
};
typedef struct BatteryTimeRec BatteryTimeRec;
expectedBatteryTimeAn unsigned long representing in seconds, the estimated battery time remaining.
minimumBatteryTimeAn unsigned long representing in seconds, the minimum battery time remaining.
maximumBatteryTimeAn unsigned long representing in seconds, the maximum battery time remaining.
timeUntilChargedAn unsigned long representing in seconds, the time remaining until the battery is fully charged.
Power.h
struct DevicePowerInfo {
UInt32 version;
RegEntryID regID;
OptionBits flags;
UInt32 minimumWakeTime;
UInt32 sleepPowerNeeded;
};
typedef struct DevicePowerInfo DevicePowerInfo;
versionThe version of this structure.
regIDThe Registry Entry ID for the device.
flagsA value of type OptionBits representing device power information.
minimumWakeTimeThe minimum number of seconds before the device sleeps again.
sleepPowerNeededThe milliwatts the device requires in the sleep state.
Power.h
struct HDQueueElement {
struct HDQueueElement * hdQLink;
short hdQType;
short hdFlags;
HDSpindownUPP hdProc;
long hdUser;
};
typedef struct HDQueueElement HDQueueElement;
hdQLinkA pointer to the next queue element.
hdQTypeA value of type short representing the queue element type.
hdFlagsA value of type short representing flags.
hdProcA pointer to the hard drive spindown routine to call.
hdUserA user-defined value.
Power.htypedef HDSpindownProcPtr HDSpindownUPP;
Power.htypedef SInt8 ModemByte;
Power.h
struct PMgrQueueElement {
struct PMgrQueueElement * pmQLink;
short pmQType;
short pmFlags;
long pmNotifyBits;
PMgrStateChangeUPP pmProc;
long pmUser;
};
typedef struct PMgrQueueElement PMgrQueueElement;
pmQLinkA pointer to the next queue element.
pmQTypeA value of type short representing the queue element type.
pmFlagsA value of type short representing flags.
pmNotifyBitsA bitmap representing the changes of which you wish to be notified.
pmProcA pointer to the routine to call.
pmUserA user-defined value.
Power.htypedef PMgrStateChangeProcPtr PMgrStateChangeUPP;
Power.htypedef long PMResultCode;
Power.htypedef UInt32 PowerLevel;
Power.htypedef SInt16 PowerSourceID;
Power.h
struct PowerSourceParamBlock {
PowerSourceID sourceID;
UInt16 sourceCapacityUsage;
UInt32 sourceVersion;
OptionBits sourceAttr;
OptionBits sourceState;
UInt32 currentCapacity;
UInt32 maxCapacity;
UInt32 timeRemaining;
UInt32 timeToFullCharge;
UInt32 voltage;
SInt32 current;
UInt32 lowWarnLevel;
UInt32 deadWarnLevel;
UInt32 reserved[16];
};
typedef struct PowerSourceParamBlock PowerSourceParamBlock;
typedef PowerSourceParamBlock * PowerSourceParamBlockPtr;
sourceIDA unique ID assigned by the Power Manager.
sourceCapacityUsageAn unsigned, 16-bit integer representing current capacity usage.
sourceVersionAn unsigned, 32-bit integer indicating the version of this record.
sourceAttrA value of type OptionBits representing power source attributes.
sourceStateA value of type OptionBits representing power source states.
currentCapacityThe current capacity represented in milliwatts or percentage.
maxCapacityThe full capacity represented in milliwatts.
timeRemainingThe time remaining represented in milliwatt-hours.
timeToFullChargeThe time required to charge represented in milliwatt-hours.
voltageThe voltage represented in millivolts.
currentThe current represented in milliamperes. This value may be negative if the power source is consuming.
lowWarnLevelThe low warning level represented in milliwatts, or percentage depending on the representation of sourceCapacityUsage.
deadWarnLevelThe dead warming level represented in milliwatts, or percentage depending on the representation of sourceCapacityUsage.
reservedThis field is reserved for future expansion.
Power.htypedef PowerSourceParamBlock* PowerSourceParamBlockPtr;
Power.h
struct PowerSummary {
UInt32 version;
OptionBits flags;
UInt32 sleepPowerAvailable;
UInt32 sleepPowerNeeded;
UInt32 minimumWakeTime;
ItemCount deviceCount;
DevicePowerInfo devices[1];
};
typedef struct PowerSummary PowerSummary;
versionAn unsigned, 32-bit integer indicating the version of this record.
flagsA value of type OptionBits representing power summary information.
sleepPowerAvailableAn unsigned, 32-bit integer indicating the milliwatts available during sleep.
sleepPowerNeededAn unsigned, 32-bit integer indicating the milliwatts needed during sleep.
minimumWakeTimeAn unsigned, 32-bit integer indicating the minimum number of seconds required before sleeping again.
deviceCountThe number of device power info records.
devicesAn array of device power info records.
Power.h
struct SleepQRec {
SleepQRecPtr sleepQLink;
short sleepQType;
SleepQUPP sleepQProc;
short sleepQFlags;
};
typedef struct SleepQRec SleepQRec;
typedef SleepQRec * SleepQRecPtr;
sleepQLinkA pointer to the next element in the queue. This pointer is maintained by the Power Manager; your application should not modify this field.
sleepQTypeA short indicating the type of the queue, which must be the constant sleepQType (16).
sleepQProcA pointer to the routine that you provide.
sleepQFlagsA short containing flags which is reserved for use by Apple Computer, Inc.
Power.htypedef SleepQRec *SleepQRecPtr;
Power.htypedef SleepQProcPtr SleepQUPP;
Power.htypedef SInt8 SoundMixerByte;
Power.h
struct StartupTime {
unsigned long startTime;
Boolean startEnabled;
SInt8 filler;
};
typedef struct StartupTime StartupTime;
Power.h
struct WakeupTime {
unsigned long wakeTime;
Boolean wakeEnabled;
SInt8 filler;
};
typedef struct WakeupTime WakeupTime;
Power.h
enum {
kAEMacPowerMgtEvt = 'pmgt',
kAEMacToWake = 'wake',
kAEMacLowPowerSaveData = 'pmsd',
kAEMacEmergencySleep = 'emsl',
kAEMacEmergencyShutdown = 'emsd'
};
enum {
chargerConnBit = 0,
hiChargeBit = 1,
chargeOverFlowBit = 2,
batteryDeadBit = 3,
batteryLowBit = 4,
connChangedBit = 5
};
chargerConnBitWhen this bit is set, it indicates the charger is connected.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
hiChargeBitWhen this bit is set, it indicates charging at fastest rate.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
chargeOverFlowBitWhen this bit is set, it indicates the hicharge counter has overflowed.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
batteryDeadBitAlways 0.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
batteryLowBitWhen this bit is set, it indicates the battery is low.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
connChangedBitWhen this bit is set, it indicates the charger connection has changed.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
enum {
chargerConnMask = 0x01,
hiChargeMask = 0x02,
chargeOverFlowMask = 0x04,
batteryDeadMask = 0x08,
batteryLowMask = 0x10,
connChangedMask = 0x20
};
chargerConnMaskThe charger is connected.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
hiChargeMaskCharging at fastest rate.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
chargeOverFlowMaskThe hicharge counter has overflowed.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
batteryDeadMaskThe battery is dead.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
batteryLowMaskThe battery is low.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
connChangedMaskThe connection has changed.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
enum {
batteryInstalled = 7,
batteryCharging = 6,
chargerConnected = 5,
upsConnected = 4,
upsIsPowerSource = 3
};
batteryInstalledWhen this bit is set, it indicates the battery is currently connected.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
batteryChargingWhen this bit is set, it indicates the battery is being charged.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
chargerConnectedWhen this bit is set, it indicates the charger is connected.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
upsConnectedWhen this bit is set, it indicates there is an uninterruptable power source (UPS) connected.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
upsIsPowerSourceWhen this bit is set, it indicates the UPS is the source of power.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
enum {
pmSleepTimeoutChanged = 0,
pmSleepEnableChanged = 1,
pmHardDiskTimeoutChanged = 2,
pmHardDiskSpindownChanged = 3,
pmDimmingTimeoutChanged = 4,
pmDimmingEnableChanged = 5,
pmDiskModeAddressChanged = 6,
pmProcessorCyclingChanged = 7,
pmProcessorSpeedChanged = 8,
pmWakeupTimerChanged = 9,
pmStartupTimerChanged = 10,
pmHardDiskPowerRemovedbyUser = 11,
pmChargeStatusChanged = 12,
pmPowerLevelChanged = 13,
pmWakeOnNetActivityChanged = 14
};
enum {
pmSleepTimeoutChangedMask = (1 << pmSleepTimeoutChanged),
pmSleepEnableChangedMask = (1 << pmSleepEnableChanged),
pmHardDiskTimeoutChangedMask = (1 << pmHardDiskTimeoutChanged),
pmHardDiskSpindownChangedMask = (1 << pmHardDiskSpindownChanged),
pmDimmingTimeoutChangedMask = (1 << pmDimmingTimeoutChanged),
pmDimmingEnableChangedMask = (1 << pmDimmingEnableChanged),
pmDiskModeAddressChangedMask = (1 << pmDiskModeAddressChanged),
pmProcessorCyclingChangedMask = (1 << pmProcessorCyclingChanged),
pmProcessorSpeedChangedMask = (1 << pmProcessorSpeedChanged),
pmWakeupTimerChangedMask = (1 << pmWakeupTimerChanged),
pmStartupTimerChangedMask = (1 << pmStartupTimerChanged),
pmHardDiskPowerRemovedbyUserMask = (1 << pmHardDiskPowerRemovedbyUser),
pmChargeStatusChangedMask = (1 << pmChargeStatusChanged),
pmPowerLevelChangedMask = (1 << pmPowerLevelChanged),
pmWakeOnNetActivityChangedMask = (1 << pmWakeOnNetActivityChanged)
};
enum {
kDevicePCIPowerOffAllowed = (1L << 0),
kDeviceSupportsPMIS = (1L << 1),
kDeviceCanAssertPMEDuringSleep = (1L << 2),
kDeviceUsesCommonLogicPower = (1L << 3),
kDeviceDriverPresent = (1L << 4),
kDeviceDriverSupportsPowerMgt = (1L << 5)
};
kDevicePCIPowerOffAllowedIf the bit specified by this mask is set, PCI power off is allowed for this device.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
kDeviceSupportsPMISIf the bit specified by this mask is set, the device supports Power Manager Interface Specifications.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
kDeviceCanAssertPMEDuringSleepIf the bit specified by this mask is set, the device can assert the PME# line during sleep.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
kDeviceUsesCommonLogicPowerIf the bit specified by this mask is set, the device uses common-logic power.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
kDeviceDriverPresentIf the bit specified by this mask is set, the device driver is present.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
kDeviceDriverSupportsPowerMgtIf the bit specified by this mask is set, the device driver installed a power handler.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
enum {
HDPwrQType = 0x4844,
PMgrStateQType = 0x504D
};
HDPwrQTypeThe hard disk spindown queue element type.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
PMgrStateQTypeThe Power Manager state queue element type.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
enum {
kHDQueuePostBit = 0,
kHDQueuePostMask = (1 << kHDQueuePostBit)
};
kHDQueuePostBitWhen this bit is set, it indicates the routine will be called on the second pass.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
kHDQueuePostMaskIf the bit specified by this mask is set, it indicates the routine will be called on the second pass.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
enum {
kMediaPowerCSCode = 70
};
enum {
kUseDefaultMinimumWakeTime = 0,
kPowerSummaryVersion = 1,
kDevicePowerInfoVersion = 1
};
kUseDefaultMinimumWakeTimeDefaults to 5 minutes.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
kPowerSummaryVersionVersion of PowerSummary structure.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
kDevicePowerInfoVersionVersion of DevicePowerInfo structure
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
enum {
hasInternalModem = 0,
intModemRingDetect = 1,
intModemOffHook = 2,
intModemRingWakeEnb = 3,
extModemSelected = 4,
modemSetBit = 15
};
hasInternalModemWhen this bit is set, it indicates an internal modem is installed.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
intModemRingDetectWhen this bit is set, it indicates the internal modem has detected a ring.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
intModemOffHookWhen this bit is set, it indicates the internal modem is off the hook.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
intModemRingWakeEnbWhen this bit is set, it indicates wakeup on ring is enabled.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
extModemSelectedWhen this bit is set, it indicates external modem is selected.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
modemSetBitWhen this bit is set, it indicates set bit. If 0, clear bit.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
These bits are in the bit field returned by the GetIntModemInfo function and set by the SetIntModemState function.
enum {
modemOnBit = 0,
ringWakeUpBit = 2,
modemInstalledBit = 3,
ringDetectBit = 4,
modemOnHookBit = 5
};
modemOnBitWhen this bit is set, it indicates the modem is on.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
ringWakeUpBitWhen this bit is set, it indicates ring wakeup is enabled.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
modemInstalledBitWhen this bit is set, it indicates an internal modem is installed.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
ringDetectBitWhen this bit is set, it indicates an incoming call is detected.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
modemOnHookBitWhen this bit is set, it indicates the modem is off the hook.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
enum {
modemOnMask = 0x01,
ringWakeUpMask = 0x04,
modemInstalledMask = 0x08,
ringDetectMask = 0x10,
modemOnHookMask = 0x20
};
modemOnMaskThe modem is on.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
ringWakeUpMaskRing wakeup is enabled.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
modemInstalledMaskAn internal modem is installed.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
ringDetectMaskAn incoming call is detected.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
modemOnHookMaskThe modem is off the hook.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
enum {
kConfigSupportsWakeOnNetBit = 0,
kWakeOnNetAdminAccessesBit = 1,
kWakeOnAllNetAccessesBit = 2,
kUnmountServersBeforeSleepingBit = 3,
kConfigSupportsWakeOnNetMask = (1 << kConfigSupportsWakeOnNetBit),
kWakeOnNetAdminAccessesMask = (1 << kWakeOnNetAdminAccessesBit),
kWakeOnAllNetAccessesMask = (1 << kWakeOnAllNetAccessesBit),
kUnmountServersBeforeSleepingMask = (1 << kUnmountServersBeforeSleepingBit)
};
enum {
kPMDevicePowerLevel_On = 0,
kPMDevicePowerLevel_D1 = 1,
kPMDevicePowerLevel_D2 = 2,
kPMDevicePowerLevel_Off = 3
};
kPMDevicePowerLevel_OnWhen this bit is set, it indicates the PCI bus is fully powered.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
kPMDevicePowerLevel_D1Reserved.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
kPMDevicePowerLevel_D2Reserved.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
kPMDevicePowerLevel_OffWhen this bit is set, it indicates the main PCI bus power is off, but PCI standby power is available.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
enum {
kCapacityIsActual = 0,
kCapacityIsPercentOfMax = 1
};
kCapacityIsActualThe capacity is expressed as actual capacity in the same units as maxCapacity.
Available in Mac OS X v10.0 through Mac OS X v10.4.
Declared in Power.h.
kCapacityIsPercentOfMaxThe capacity is expressed as a percentage of maxCapacity.
Available in Mac OS X v10.0 through Mac OS X v10.4.
Declared in Power.h.
enum {
kDeviceDidNotWakeMachine = 0,
kDeviceRequestsFullWake = 1,
kDeviceRequestsWakeToDoze = 2
};
kDeviceDidNotWakeMachineThe device did not wake the computer.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
kDeviceRequestsFullWakeThe device did wake the computer and requests full wakeup.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
kDeviceRequestsWakeToDozeThe device did wake the computer and requests partial wakeup.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
On query by the Power Manager, these are result values returned by a power handler if the device the power handler represents woke the computer.
enum {
hasWakeupTimer = 0,
hasSharedModemPort = 1,
hasProcessorCycling = 2,
mustProcessorCycle = 3,
hasReducedSpeed = 4,
dynamicSpeedChange = 5,
hasSCSIDiskMode = 6,
canGetBatteryTime = 7,
canWakeupOnRing = 8,
hasDimmingSupport = 9,
hasStartupTimer = 10,
hasChargeNotification = 11,
hasDimSuspendSupport = 12,
hasWakeOnNetActivity = 13,
hasWakeOnLid = 14,
canPowerOffPCIBus = 15,
hasDeepSleep = 16,
hasSleep = 17,
supportsServerModeAPIs = 18,
supportsUPSIntegration = 19,
hasAggressiveIdling = 20,
supportsIdleQueue = 21
};
hasWakeupTimerWhen this bit is set, it indicates the wakeup timer is supported.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
hasSharedModemPortWhen this bit is set, it indicates the modem port is shared by the serial communications chip (SCC) and the internal modem.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
hasProcessorCyclingWhen this bit is set, it indicates processor cycling is supported.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
mustProcessorCycleWhen this bit is set, it indicates processor cycling should not be turned off.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
hasReducedSpeedWhen this bit is set, it indicates the processor can be started up at a reduced speed.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
dynamicSpeedChangeWhen this bit is set, it indicates the processor speed can be switched dynamically.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
hasSCSIDiskModeWhen this bit is set, it indicates SCSI disk mode is supported.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
canGetBatteryTimeWhen this bit is set, it indicates battery time can be calculated.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
canWakeupOnRingWhen this bit is set, it indicates wakeup when the modem detects a ring.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
hasDimmingSupportWhen this bit is set, it indicates dimming support is built in—display power management system (DPMS) standby by default.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
hasStartupTimerWhen this bit is set, it indicates the startup timer is supported.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
hasChargeNotificationWhen this bit is set, it indicates the client can determine charge connect status change notification available.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
hasDimSuspendSupportWhen this bit is set, it indicates support of dimming LCD and CRT to DPMS suspend state.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
hasWakeOnNetActivityWhen this bit is set, it indicates hardware supports wake on network activity.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
hasWakeOnLidWhen this bit is set, it indicates hardware can wake when opened.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
canPowerOffPCIBusWhen this bit is set, it indicates hardware can power off PCI bus during sleep if cards allow.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
hasDeepSleepWhen this bit is set, it indicates hardware supports deep sleep (hibernation) mode.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
hasSleepWhen this bit is set, it indicates hardware supports normal sleep.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
supportsServerModeAPIsWhen this bit is set, it indicates hardware supports server mode API.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
supportsUPSIntegrationWhen this bit is set, it indicates hardware supports UPS integration and reporting.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
hasAggressiveIdlingWhen this bit is set, it indicates Power Manager only resets OverallAct on UsrActivity.
Available in Mac OS X v10.1 and later.
Not available to 64-bit applications.
Declared in Power.h.
supportsIdleQueueWhen this bit is set, it indicates Power Manager supports the idle queue.
Available in Mac OS X v10.1 and later.
Not available to 64-bit applications.
Declared in Power.h.
These bits are in the bit field returned by the PMFeatures function.
enum {
bSourceIsBattery = 0,
bSourceIsAC = 1,
bSourceCanBeCharged = 2,
bSourceIsUPS = 3,
bSourceProvidesWarnLevels = 4,
kSourceIsBatteryMask = (1 << bSourceIsBattery),
kSourceIsACMask = (1 << bSourceIsAC),
kSourceCanBeChargedMask = (1 << bSourceCanBeCharged),
kSourceIsUPSMask = (1 << bSourceIsUPS),
kSourceProvidesWarnLevelsMask = (1 << bSourceProvidesWarnLevels)
};
bSourceIsBatteryWhen this bit is set, it indicates the power source is a battery.
Available in Mac OS X v10.0 through Mac OS X v10.4.
Declared in Power.h.
bSourceIsACWhen this bit is set, it indicates the power source is AC.
Available in Mac OS X v10.0 through Mac OS X v10.4.
Declared in Power.h.
bSourceCanBeChargedWhen this bit is set, it indicates the power source can be charged.
Available in Mac OS X v10.0 through Mac OS X v10.4.
Declared in Power.h.
bSourceIsUPSWhen this bit is set, it indicates the power source is an uninterruptable power supply (UPS). bSourceIsBattery and bSourceIsAC should be set as well if appropriate.
Available in Mac OS X v10.0 through Mac OS X v10.4.
Declared in Power.h.
bSourceProvidesWarnLevelsWhen this bit is set, it indicates power source provides low power and dead battery warning levels.
Available in Mac OS X v10.0 through Mac OS X v10.4.
Declared in Power.h.
kSourceIsBatteryMaskIf the bit specified by this mask is set, the power source is a battery.
Available in Mac OS X v10.0 through Mac OS X v10.4.
Declared in Power.h.
kSourceIsACMaskIf the bit specified by this mask is set, the power source is AC.
Available in Mac OS X v10.0 through Mac OS X v10.4.
Declared in Power.h.
kSourceCanBeChargedMaskIf the bit specified by this mask is set, the power source can be charged.
Available in Mac OS X v10.0 through Mac OS X v10.4.
Declared in Power.h.
kSourceIsUPSMaskIf the bit specified by this mask is set, the power source is a UPS.
Available in Mac OS X v10.0 through Mac OS X v10.4.
Declared in Power.h.
kSourceProvidesWarnLevelsMaskIf the bit specified by this mask is set, the power source provides low power and dead battery warning levels.
Available in Mac OS X v10.0 through Mac OS X v10.4.
Declared in Power.h.
enum {
kCurrentCapacityIsActualValue = 0,
kCurrentCapacityIsPercentOfMax = 1
};
kCurrentCapacityIsActualValueThe current capacity is expressed as a real value in the same units as maxCapacity.
Available in Mac OS X v10.0 through Mac OS X v10.4.
Declared in Power.h.
kCurrentCapacityIsPercentOfMaxThe current capacity is expressed as a percentage of maxCapacity.
Available in Mac OS X v10.0 through Mac OS X v10.4.
Declared in Power.h.
enum {
bSourceIsAvailable = 0,
bSourceIsCharging = 1,
bChargerIsAttached = 2,
kSourceIsAvailableMask = (1 << bSourceIsAvailable),
kSourceIsChargingMask = (1 << bSourceIsCharging),
kChargerIsAttachedMask = (1 << bChargerIsAttached)
};
bSourceIsAvailableWhen this bit is set, it indicates a power source is installed.
Available in Mac OS X v10.0 through Mac OS X v10.4.
Declared in Power.h.
bSourceIsChargingWhen this bit is set, it indicates a power source is charging.
Available in Mac OS X v10.0 through Mac OS X v10.4.
Declared in Power.h.
bChargerIsAttachedWhen this bit is set, it indicates a charger is connected.
Available in Mac OS X v10.0 through Mac OS X v10.4.
Declared in Power.h.
kSourceIsAvailableMaskIf the bit specified by this mask is set, the power source is installed.
Available in Mac OS X v10.0 through Mac OS X v10.4.
Declared in Power.h.
kSourceIsChargingMaskIf the bit specified by this mask is set, the power source is charging.
Available in Mac OS X v10.0 through Mac OS X v10.4.
Declared in Power.h.
kChargerIsAttachedMaskIf the bit specified by this mask is set, a charger is connected.
Available in Mac OS X v10.0 through Mac OS X v10.4.
Declared in Power.h.
enum {
kVersionOnePowerSource = 1,
kVersionTwoPowerSource = 2,
kCurrentPowerSourceVersion = kVersionTwoPowerSource
};
enum {
kPCIPowerOffAllowed = (1L << 0)
};
kPCIPowerOffAllowedIf the bit specified by this mask is set, it indicates PCI power off is allowed.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
Not recommended
enum {
sleepRequest = kSleepRequest,
sleepDemand = kSleepDemand,
sleepWakeUp = kSleepWakeUp,
sleepRevoke = kSleepRevoke,
sleepUnlock = kSleepUnlock,
sleepDeny = kSleepDeny,
sleepNow = kSleepNow,
dozeDemand = kDozeDemand,
dozeWakeUp = kDozeWakeUp,
dozeRequest = kDozeRequest,
enterStandby = kEnterStandby,
enterRun = kEnterRun,
suspendRequestMsg = kSuspendRequest,
suspendDemandMsg = kSuspendDemand,
suspendRevokeMsg = kSuspendRevoke,
suspendWakeUpMsg = kSuspendWakeUp,
getPowerLevel = kGetPowerLevel,
setPowerLevel = kSetPowerLevel
};
sleepRequestA sleep request.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
sleepDemandA sleep demand.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
sleepWakeUpA wakeup demand.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
sleepRevokeA sleep request revocation.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
enum {
noCalls = 1,
noRequest = 2,
slpQType = 16,
sleepQType = 16
};
noCallsA noCalls queue type.
Available in Mac OS X v10.0 and later.
Declared in Power.h.
noRequestA noRequest queue type.
Available in Mac OS X v10.0 and later.
Declared in Power.h.
slpQTypeA sleepQType queue.
Available in Mac OS X v10.0 and later.
Declared in Power.h.
sleepQTypeA sleepQType queue.
Available in Mac OS X v10.0 and later.
Declared in Power.h.
enum {
kSleepRequest = 1,
kSleepDemand = 2,
kSleepWakeUp = 3,
kSleepRevoke = 4,
kSleepUnlock = 4,
kSleepDeny = 5,
kSleepNow = 6,
kDozeDemand = 7,
kDozeWakeUp = 8,
kDozeRequest = 9,
kEnterStandby = 10,
kEnterRun = 11,
kSuspendRequest = 12,
kSuspendDemand = 13,
kSuspendRevoke = 14,
kSuspendWakeUp = 15,
kGetPowerLevel = 16,
kSetPowerLevel = 17,
kDeviceInitiatedWake = 18,
kWakeToDoze = 19,
kDozeToFullWakeUp = 20,
kGetPowerInfo = 21,
kGetWakeOnNetInfo = 22,
kSuspendWakeToDoze = 23,
kEnterIdle = 24,
kStillIdle = 25,
kExitIdle = 26
};
kSleepDenyA non-zero value clients can use to deny requests.
Available in Mac OS X v10.0 and later.
Declared in Power.h.
kDozeRequestAdditional messages for Power Manager 2.0.
Available in Mac OS X v10.0 and later.
Declared in Power.h.
kEnterStandbyIdle queue only.
Available in Mac OS X v10.0 and later.
Declared in Power.h.
kEnterRunIdle queue only.
Available in Mac OS X v10.0 and later.
Declared in Power.h.
kEnterIdleIdle queue only.
Available in Mac OS X v10.1 and later.
Declared in Power.h.
kStillIdleIdle queue only.
Available in Mac OS X v10.1 and later.
Declared in Power.h.
kExitIdleIdle queue only.
Available in Mac OS X v10.1 and later.
Declared in Power.h.
enum {
MediaBaySndEnBit = 0,
PCISndEnBit = 1,
ZVSndEnBit = 2,
PCCardSndEnBit = 3
};
enum {
MediaBaySndEnMask = 0x01,
PCISndEnMask = 0x02,
ZVSndEnMask = 0x04,
PCCardSndEnMask = 0x08
};
enum {
kMediaModeOn = 0,
kMediaModeStandBy = 1,
kMediaModeSuspend = 2,
kMediaModeOff = 3
};
kMediaModeOnWhen this bit is set, it indicates the media is active—the drive is spinning at full power.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
kMediaModeStandByWhen this bit is set, it indicates the media is on standby. This is not implemented.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
kMediaModeSuspendWhen this bit is set, it indicates the media is idle. This is not implemented.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
kMediaModeOffWhen this bit is set, it indicates the media is asleep—the drive is not spinning and is at minimum power and maximum recovery time.
Available in Mac OS X v10.0 and later.
Not available to 64-bit applications.
Declared in Power.h.
enum {
OverallAct = 0,
UsrActivity = 1,
NetActivity = 2,
HDActivity = 3,
IdleActivity = 4
};
OverallActDelays idle sleep by a small amount. This will only delay power cycling if it's enabled, and will delay sleep by a small amount when hasAggressiveIdling is set.
Available in Mac OS X v10.0 and later.
Declared in Power.h.
UsrActivityDelays idle sleep and dimming by timeout time.
Available in Mac OS X v10.0 and later.
Declared in Power.h.
NetActivityDelays idle sleep and power cycling by small amount.
Available in Mac OS X v10.0 and later.
Declared in Power.h.
HDActivityDelays hard drive spindown and idle sleep by small amount.
Available in Mac OS X v10.0 and later.
Declared in Power.h.
IdleActivityDelays idle sleep by timeout time. The IdleActivity selector is not available unless the hasAggressiveIdling bit is set. Use IdleActivity where you used to use OverallAct if necessary. Don't use IdleActivity unless hasAggressiveIdling is set; when hasAggressiveIdling is not set, the use of IdleActivity is undefined, and will do different things depending on which Power Manager is currently running.
Available in Mac OS X v10.1 and later.
Declared in Power.h.
The most common result codes returned by Power Manager are listed below.
Last updated: 2006-07-13