• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Cancelling sleep
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Prev by Date: Tcp/ip
  • Next by Date: Property List Representation
  • Previous by thread: Re: Tcp/ip
  • Next by thread: Property List Representation
  • Index(es):
    • Date
    • Thread