Cancelling sleep
Cancelling sleep
- Subject: Cancelling sleep
- From: Renaud Boisjoly <email@hidden>
- Date: Thu, 28 Aug 2003 15:52:05 -0400
Hi there!
I'm looking for a way to cancel sleep or at least delay it somehow. I'm
detecting sleep by using the IOKit and I can react on sleep or wake
this way:
void sleepNotification(
void * refcon,
io_service_t service,
natural_t messageType,
void * messageArgument )
{
switch(messageType)
{
case kIOMessageSystemWillSleep:
// tell all the service controllers to disconnect due to
sleep
// go to sleep
NSLog(@"Sleep");
IOAllowPowerChange(powerConnection, (long)
messageArgument);
break;
case kIOMessageCanSystemSleep:
//IOAllowPowerChange(powerConnection, (long)
messageArgument);
NSLog(@"Can system sleep?");
break;
case kIOMessageSystemHasPoweredOn:
// awake
NSLog(@"Waking");
break;
}
}
I get notified when the Mac WILL sleep or is waking, but the
kIOMessageCanSystemSleep never gets called.
So I do not get a chance to stop the system from sleeping or adding
some form of delay. I doubt I should start writing to a file to delay
sleep, not quite elegant... there must be some other notification I can
react too?
I also want to delay log out whenever I need to do something on logout,
there must be a similar way to do this too, right?
Thanks for any info...
- Renaud
_______________________________________________
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.