Wakeup/Sleep?
Wakeup/Sleep?
- Subject: Wakeup/Sleep?
- From: Jerry LeVan <email@hidden>
- Date: Wed, 17 Mar 2004 13:45:01 -0500
Hi,
I am trying to figure out how to sleep/wake the machine...
Here is some code that does not work.
#import <Foundation/Foundation.h>
#import <IOKit/pwr_mgt/IOPMLib.h>
int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int res;
NSCalendarDate *now = [NSCalendarDate calendarDate];
NSCalendarDate *plus30Sec = [now dateByAddingYears:0 months:0
days:0 hours:0 minutes:0 seconds:30];
NSLog(@"\nnow: %@ \nlater: %@", now, plus30Sec);
res = IOPMSchedulePowerEvent ((CFDateRef)plus30Sec,NULL,
CFSTR(kIOPMAutoSleep));
NSLog(@"res=%x",res);
[pool release];
return 0;
}
The program runs and returns something that looks like some kind of
error code.
Am I doing something obviously wrong? ( I run the program with root
privileges).
--Jerry
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.