Function

IOPMSchedulePowerEvent

Schedule the machine to wake from sleep, power on, go to sleep, or shutdown.

Declaration

IOReturn IOPMSchedulePowerEvent(CFDateRef time_to_wake, CFStringRef my_id, CFStringRef type);

Parameters

time_to_wake

Date and time that the system will power on/off.

my_id

A CFStringRef identifying the calling app by CFBundleIdentifier. May be NULL.

type

The type of power on you desire, either wake from sleep or power on. Choose from: CFSTR(kIOPMAutoWake) == wake machine, CFSTR(kIOPMAutoPowerOn) == power on machine, CFSTR(kIOPMAutoWakeOrPowerOn) == wake or power on, CFSTR(kIOPMAutoSleep) == sleep machine, CFSTR(kIOPMAutoShutdown) == power off machine, CFSTR(kIOPMAutoRestart) == restart the machine.

Return Value

kIOReturnSuccess on success, otherwise on failure

Discussion

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.

See Also

ScheduledEvents

IOPMCancelScheduledPowerEvent

Cancel a previously scheduled power event.

IOPMCopyScheduledPowerEvents

List all scheduled system power events

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software