|
|
Log In | Not a Member? |
Contact ADC |
|
ADC Home > Reference Library > Reference > Hardware & Drivers > I/O Kit Framework Reference
|
IOPMLib.h |
| Includes: | <CoreFoundation/CFArray.h> <IOKit/IOKitLib.h> <IOKit/pwr_mgt/IOPMLibDefs.h> <IOKit/pwr_mgt/IOPMKeys.h> |
IOPMLib provides access to common power management facilites, like initiating system sleep, getting current idle timer values, registering for sleep/wake notifications, and preventing system sleep.
- IOPMAssertionCreate
- Dynamically requests a system behavior from the power management system.
- IOPMAssertionRelease
- Releases the behavior requested in IOPMAssertionCreate
- IOPMCopyAssertionsByProcess
- Returns a dictionary mapping processes to the assertions they are holding active.
- IOPMCopyAssertionsStatus
- Returns a list of available assertions and their system-wide level.
- IOAllowPowerChange
- The caller acknowledges notification of a power state change on a device it has registered for notifications for via IORegisterForSystemPower or IORegisterApp.
- IOCancelPowerChange
- The caller negatively acknowledges notification of a power state change on a device it is interested in. This prevents the state change.
- IODeregisterForSystemPower
- Disconnects the caller from the Root Power Domain IOService after receiving system power state change notifications. (Caller must also release IORegisterForSystemPower's return io_connect_t and returned IONotificationPortRef for complete clean-up).
- IODeregisterForSystemPower.
- Disconnects the caller from the Root Power Domain IOService after receiving system power state change notifications. (Caller must also release IORegisterForSystemPower's return io_connect_t and returned IONotificationPortRef for complete clean-up).
- IORegisterApp
- Connects the caller to an IOService for the purpose of receiving power state change notifications for the device controlled by the IOService.
- IORegisterForSystemPower
- Connects the caller to the Root Power Domain IOService for the purpose of receiving Sleep, Wake, ShutDown, PowerUp notifications for the System.
Events
- IOPMCancelScheduledPowerEvent
- Cancel a previously scheduled power event.
- IOPMCopyScheduledPowerEvents
- List all scheduled system power events
- IOPMSchedulePowerEvent
- Schedule the machine to wake from sleep, power on, go to sleep, or shutdown.
IOAllowPowerChange |
The caller acknowledges notification of a power state change on a device it has registered for notifications for via IORegisterForSystemPower or IORegisterApp.
IOReturn IOAllowPowerChange ( io_connect_t kernelPort, long notificationID );
kernelPortnotificationIDReturns kIOReturnSuccess or an error condition if request failed.
Must be used when handling kIOMessageCanSystemSleep and kIOMessageSystemWillSleep messages from IOPMrootDomain system power.
IOCancelPowerChange |
The caller negatively acknowledges notification of a power state change on a device it is interested in. This prevents the state change.
IOReturn IOCancelPowerChange ( io_connect_t kernelPort, long notificationID );
kernelPortnotificationIDReturns kIOReturnSuccess or an error condition if request failed.
Should only used when handling kIOMessageCanSystemSleep messages from IOPMrootDomain. IOCancelPowerChange() has no meaning for responding to kIOMessageSystemWillSleep (which is non-abortable) or any other messages.
IODeregisterForSystemPower |
Disconnects the caller from the Root Power Domain IOService after receiving system power state change notifications. (Caller must also release IORegisterForSystemPower's return io_connect_t and returned IONotificationPortRef for complete clean-up).
IOReturn IODeregisterForSystemPower ( io_object_t *notifier );
notifierReturns kIOReturnSuccess or an error condition if request failed.
IODeregisterForSystemPower. |
Disconnects the caller from the Root Power Domain IOService after receiving system power state change notifications. (Caller must also release IORegisterForSystemPower's return io_connect_t and returned IONotificationPortRef for complete clean-up).
IOReturn IODeregisterForSystemPower ( io_object_t *notifier );
notifierReturns kIOReturnSuccess or an error condition if request failed.
IOPMAssertionCreate |
Dynamically requests a system behavior from the power management system.
IOReturn IOPMAssertionCreate( CFStringRef AssertionType, IOPMAssertionLevel AssertionLevel, IOPMAssertionID *AssertionID);
AssertionTypeAssertionLevelAssertionIDReturns kIOReturnSuccess on success, any other return indicates PM could not successfully activate the specified assertion.
No special privileges necessary to make this call - any process may activate a power assertion.
IOPMAssertionRelease |
Releases the behavior requested in IOPMAssertionCreate
IOReturn IOPMAssertionRelease( IOPMAssertionID AssertionID);
AssertionIDReturns kIOReturnSuccess on success
All calls to IOPMAssertionCreate must be paired with calls to IOPMAssertionRelease.
IOPMCancelScheduledPowerEvent |
Cancel a previously scheduled power event.
IOReturn IOPMCancelScheduledPowerEvent( CFDateRef time_to_wake, CFStringRef my_id, CFStringRef type);
time_to_wakemy_idtypekIOReturnSuccess on success, otherwise on failure
Arguments mirror those to IOPMSchedulePowerEvent. All arguments must match the original arguments from when the power on was scheduled. Must be called as root.
IOPMCopyAssertionsByProcess |
Returns a dictionary mapping processes to the assertions they are holding active.
IOReturn IOPMCopyAssertionsByProcess( CFDictionaryRef *AssertionsByPID);
AssertionsByPIDReturns kIOReturnSuccess on success.
Notes: One process may have multiple assertions. Several processes may have asserted the same assertion to different levels.
IOPMCopyAssertionsStatus |
Returns a list of available assertions and their system-wide level.
IOReturn IOPMCopyAssertionsStatus( CFDictionaryRef *AssertionsStatus);
AssertionsStatusReturns kIOReturnSuccess on success.
Notes: One process may have multiple assertions. Several processes may have asserted the same assertion to different levels. The system-wide level is the maximum of these assertions' levels.
IOPMCopyBatteryInfo |
Request raw battery data from the system.
IOReturn IOPMCopyBatteryInfo( mach_port_t masterPort, CFArrayRef *info );
masterPortinfoReturns kIOReturnSuccess or an error condition if request failed.
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.
IOPMCopyScheduledPowerEvents |
List all scheduled system power events
CFArrayRef IOPMCopyScheduledPowerEvents( void);
A CFArray of CFDictionaries of power events. The CFArray must be released by the caller. NULL if there are no scheduled events.
Returns a CFArray of CFDictionaries of power events. Each CFDictionary contains keys for CFSTR(kIOPMPowerEventTimeKey), CFSTR(kIOPMPowerEventAppNameKey), and CFSTR(kIOPMPowerEventTypeKey).
IOPMFindPowerManagement |
Finds the Root Power Domain IOService.
io_connect_t IOPMFindPowerManagement( mach_port_t master_device_port );
master_device_portReturns a io_connect_t handle on the root domain. Must be released with IOServiceClose() when done.
IOPMGetAggressiveness |
Retrieves the current value of one of the aggressiveness factors in IOKit Power Management.
IOReturn IOPMGetAggressiveness ( io_connect_t fb, unsigned long type, unsigned long *aggressiveness );
fbtypetypeReturns kIOReturnSuccess or an error condition if request failed.
IOPMSchedulePowerEvent |
Schedule the machine to wake from sleep, power on, go to sleep, or shutdown.
IOReturn IOPMSchedulePowerEvent( CFDateRef time_to_wake, CFStringRef my_id, CFStringRef type);
time_to_wakemy_idtypekIOReturnSuccess on success, otherwise on failure
This event will be added to the system's queue of power events and stored persistently on disk. The sleep and shutdown events present a graphical warning and allow a console user to cancel the event. Must be called as root.
IOPMSetAggressiveness |
Sets one of the aggressiveness factors in IOKit Power Management.
IOReturn IOPMSetAggressiveness ( io_connect_t fb, unsigned long type, unsigned long aggressiveness );
fbtypetypeReturns kIOReturnSuccess or an error condition if request failed.
IOPMSleepEnabled |
Tells whether the system supports full sleep, or just doze
boolean_t IOPMSleepEnabled ( void );
Returns true if the system supports sleep, false if some hardware prevents full sleep.
IOPMSleepSystem |
Request that the system initiate sleep.
IOReturn IOPMSleepSystem ( io_connect_t fb );
fbReturns kIOReturnSuccess or an error condition if request failed.
For security purposes, caller must be root or the console user.
IORegisterApp |
Connects the caller to an IOService for the purpose of receiving power state change notifications for the device controlled by the IOService.
io_connect_t IORegisterApp( void *refcon, io_service_t theDriver, IONotificationPortRef *thePortRef, IOServiceInterestCallback callback, io_object_t *notifier );
refcontheDriverthePortRefcallbacknotifierReturns a io_connect_t session for the IOService or MACH_PORT_NULL if request failed. Caller must close return value via IOServiceClose() after calling IODeregisterApp on the notifier argument.
IORegisterApp requires that the IOService of interest implement an IOUserClient. In addition, that IOUserClient must implement the allowPowerChange and cancelPowerChange methods defined in IOPMLibDefs.h. If you're interested in receiving power state notifications from a device without an IOUserClient, try using IOServiceAddInterestNotification with interest type gIOGeneralInterest instead.
IORegisterForSystemPower |
Connects the caller to the Root Power Domain IOService for the purpose of receiving Sleep, Wake, ShutDown, PowerUp notifications for the System.
io_connect_t IORegisterForSystemPower ( void *refcon, IONotificationPortRef *thePortRef, IOServiceInterestCallback callback, io_object_t *notifier );
refconthePortRefcallbacknotifierReturns a io_connect_t session for the IOPMrootDomain or MACH_PORT_NULL if request failed. Caller must close return value via IOServiceClose() after calling IODeregisterForSystemPower on the notifier argument.
|