Re: Preventing system sleep

2010-02-17 Thread James Bucanek

On 2/16/10 4:10 PM, Neil Allain wrote:


On Feb 16, 2010, at 2:57 PM, Laurent Daudelin wrote:


I'm working on a an app that at some point might start transferring a large 
file to a USB device. Apparently, if the system is set to go to sleep, the 
transfer will fail.

I was thinking of using the NSWorkspace extendPowerOffBy: but then the doc says 
Currently unimplemented.

So, if my app get a notification that the system is going to sleep, how can I 
delay it?



You can call UpdateSystemActivity() periodically (such as on a timer) to 
prevent it from going to sleep.

Neil


You should probably be using IOPMAssertionCreateWithName() 
instead if you can require 10.5+. This gives the system a lot 
more information about the intent of your code and the potential 
ability to show some nice UI to the user.


-- Joe Ranieri
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/subscriber%40gloaming.com

This email sent to subscri...@gloaming.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Preventing system sleep

2010-02-16 Thread Neil Allain

On Feb 16, 2010, at 2:57 PM, Laurent Daudelin wrote:

 I'm working on a an app that at some point might start transferring a large 
 file to a USB device. Apparently, if the system is set to go to sleep, the 
 transfer will fail.
 
 I was thinking of using the NSWorkspace extendPowerOffBy: but then the doc 
 says Currently unimplemented.
 
 So, if my app get a notification that the system is going to sleep, how can I 
 delay it?
 

You can call UpdateSystemActivity() periodically (such as on a timer) to 
prevent it from going to sleep.

Neil

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Preventing system sleep

2010-02-16 Thread Sean McBride
On 2/16/10 12:57 PM, Laurent Daudelin said:

I'm working on a an app that at some point might start transferring a
large file to a USB device. Apparently, if the system is set to go to
sleep, the transfer will fail.

You can temporarily disable sleep using IOPMAssertionCreateWithName() on
10.6 or IOPMAssertionCreate on 10.5.

I was thinking of using the NSWorkspace extendPowerOffBy: but then the
doc says Currently unimplemented.

Don't you just love those?! :)

--

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Preventing system sleep

2010-02-16 Thread Joe Ranieri

On 2/16/10 4:10 PM, Neil Allain wrote:


On Feb 16, 2010, at 2:57 PM, Laurent Daudelin wrote:


I'm working on a an app that at some point might start transferring a large 
file to a USB device. Apparently, if the system is set to go to sleep, the 
transfer will fail.

I was thinking of using the NSWorkspace extendPowerOffBy: but then the doc says 
Currently unimplemented.

So, if my app get a notification that the system is going to sleep, how can I 
delay it?



You can call UpdateSystemActivity() periodically (such as on a timer) to 
prevent it from going to sleep.

Neil


You should probably be using IOPMAssertionCreateWithName() instead if 
you can require 10.5+. This gives the system a lot more information 
about the intent of your code and the potential ability to show some 
nice UI to the user.


-- Joe Ranieri
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Preventing system sleep

2010-02-16 Thread Laurent Daudelin
Thanks, Joe, I'll have a look!




-Laurent.
-- 
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin 
http://nemesys.dyndns.org
Logiciels Nemesys Software  
laurent.daude...@gmail.com
Photo Gallery Store: http://laurentdaudelin.shutterbugstorefront.com/g/galleries

On Feb 16, 2010, at 13:13, Joe Ranieri wrote:

 On 2/16/10 4:10 PM, Neil Allain wrote:
 
 On Feb 16, 2010, at 2:57 PM, Laurent Daudelin wrote:
 
 I'm working on a an app that at some point might start transferring a large 
 file to a USB device. Apparently, if the system is set to go to sleep, the 
 transfer will fail.
 
 I was thinking of using the NSWorkspace extendPowerOffBy: but then the doc 
 says Currently unimplemented.
 
 So, if my app get a notification that the system is going to sleep, how can 
 I delay it?
 
 
 You can call UpdateSystemActivity() periodically (such as on a timer) to 
 prevent it from going to sleep.
 
 Neil
 
 You should probably be using IOPMAssertionCreateWithName() instead if you can 
 require 10.5+. This gives the system a lot more information about the intent 
 of your code and the potential ability to show some nice UI to the user.
 
 -- Joe Ranieri

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Preventing system sleep

2010-02-16 Thread Laurent Daudelin
On Feb 16, 2010, at 13:13, Joe Ranieri wrote:

 On 2/16/10 4:10 PM, Neil Allain wrote:
 
 On Feb 16, 2010, at 2:57 PM, Laurent Daudelin wrote:
 
 I'm working on a an app that at some point might start transferring a large 
 file to a USB device. Apparently, if the system is set to go to sleep, the 
 transfer will fail.
 
 I was thinking of using the NSWorkspace extendPowerOffBy: but then the doc 
 says Currently unimplemented.
 
 So, if my app get a notification that the system is going to sleep, how can 
 I delay it?
 
 
 You can call UpdateSystemActivity() periodically (such as on a timer) to 
 prevent it from going to sleep.
 
 Neil
 
 You should probably be using IOPMAssertionCreateWithName() instead if you can 
 require 10.5+. This gives the system a lot more information about the intent 
 of your code and the potential ability to show some nice UI to the user.

Oops! The doc says it was introduced in 10.6 and I need to support 10.5. I 
guess I'll have to check IOPMAssertionCreate...

Thanks!

-Laurent.
-- 
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin 
http://nemesys.dyndns.org
Logiciels Nemesys Software  
laurent.daude...@gmail.com
Photo Gallery Store: http://laurentdaudelin.shutterbugstorefront.com/g/galleries

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Preventing system sleep

2010-02-16 Thread Joe Ranieri

On 2/16/10 4:18 PM, Laurent Daudelin wrote:

On Feb 16, 2010, at 13:13, Joe Ranieri wrote:


On 2/16/10 4:10 PM, Neil Allain wrote:


On Feb 16, 2010, at 2:57 PM, Laurent Daudelin wrote:


I'm working on a an app that at some point might start transferring a large 
file to a USB device. Apparently, if the system is set to go to sleep, the 
transfer will fail.

I was thinking of using the NSWorkspace extendPowerOffBy: but then the doc says 
Currently unimplemented.

So, if my app get a notification that the system is going to sleep, how can I 
delay it?



You can call UpdateSystemActivity() periodically (such as on a timer) to 
prevent it from going to sleep.

Neil


You should probably be using IOPMAssertionCreateWithName() instead if you can 
require 10.5+. This gives the system a lot more information about the intent of 
your code and the potential ability to show some nice UI to the user.


Oops! The doc says it was introduced in 10.6 and I need to support 10.5. I guess I'll 
have to check IOPMAssertionCreate...

Thanks!


Curious. The header file says:
IOReturn IOPMAssertionCreateWithName(
CFStringRef  AssertionType,
IOPMAssertionLevel   AssertionLevel,
CFStringRef  AssertionName,
IOPMAssertionID  *AssertionID) 
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;


Is the header wrong?

-- Joe Ranieri
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Preventing system sleep

2010-02-16 Thread Laurent Daudelin
On Feb 16, 2010, at 13:19, Joe Ranieri wrote:

 On 2/16/10 4:18 PM, Laurent Daudelin wrote:
 On Feb 16, 2010, at 13:13, Joe Ranieri wrote:
 
 On 2/16/10 4:10 PM, Neil Allain wrote:
 
 On Feb 16, 2010, at 2:57 PM, Laurent Daudelin wrote:
 
 I'm working on a an app that at some point might start transferring a 
 large file to a USB device. Apparently, if the system is set to go to 
 sleep, the transfer will fail.
 
 I was thinking of using the NSWorkspace extendPowerOffBy: but then the 
 doc says Currently unimplemented.
 
 So, if my app get a notification that the system is going to sleep, how 
 can I delay it?
 
 
 You can call UpdateSystemActivity() periodically (such as on a timer) to 
 prevent it from going to sleep.
 
 Neil
 
 You should probably be using IOPMAssertionCreateWithName() instead if you 
 can require 10.5+. This gives the system a lot more information about the 
 intent of your code and the potential ability to show some nice UI to the 
 user.
 
 Oops! The doc says it was introduced in 10.6 and I need to support 10.5. I 
 guess I'll have to check IOPMAssertionCreate...
 
 Thanks!
 
 Curious. The header file says:
 IOReturn IOPMAssertionCreateWithName(
CFStringRef  AssertionType,
IOPMAssertionLevel   AssertionLevel,
CFStringRef  AssertionName,
IOPMAssertionID  *AssertionID) 
 AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
 
 Is the header wrong?
 
 -- Joe Ranieri

I'll give it a shot and see. Should find out pretty quickly...

-Laurent.
-- 
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin 
http://nemesys.dyndns.org
Logiciels Nemesys Software  
laurent.daude...@gmail.com
Photo Gallery Store: http://laurentdaudelin.shutterbugstorefront.com/g/galleries

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Preventing system sleep

2010-02-16 Thread Sean McBride
On 2/16/10 4:19 PM, Joe Ranieri said:

Curious. The header file says:
IOReturn IOPMAssertionCreateWithName(
 CFStringRef  AssertionType,
 IOPMAssertionLevel   AssertionLevel,
 CFStringRef  AssertionName,
 IOPMAssertionID  *AssertionID)
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;

It actually is available on 10.5 (at runtime).  But it's not in the 10.5
SDK.  So depends on what kind of 10.5 support you need.  If you need to
compile on 10.5, then you can't use it; if you only need to deploy on
10.5, then you can use it.

--

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Preventing system sleep

2010-02-16 Thread Jens Alfke



On Feb 16, 2010, at 13:19, Joe Ranieri wrote:

Oops! The doc says it was introduced in 10.6 and I need to support  
10.5. I guess I'll have to check IOPMAssertionCreate...


Curious. The header file says:
IOReturn IOPMAssertionCreateWithName(
  CFStringRef  AssertionType,
  IOPMAssertionLevel   AssertionLevel,
  CFStringRef  AssertionName,
  IOPMAssertionID  *AssertionID)  
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;


Is the header wrong?


It could be a function that existed as private API in 10.5, was made  
public in 10.6, and retroactively made public for 10.5. This means you  
can call the function on 10.5 but it only exists in the headers in the  
10.6+ SDK (even if you're building for 10.5)


If you still need to build with the 10.5 SDK, you can copy the  
declaration from the newer SDK and paste it into your own code.


—Jens___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Preventing system sleep

2010-02-16 Thread Laurent Daudelin
On Feb 16, 2010, at 13:27, Sean McBride wrote:

 On 2/16/10 4:19 PM, Joe Ranieri said:
 
 Curious. The header file says:
 IOReturn IOPMAssertionCreateWithName(
CFStringRef  AssertionType,
IOPMAssertionLevel   AssertionLevel,
CFStringRef  AssertionName,
IOPMAssertionID  *AssertionID)
 AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
 
 It actually is available on 10.5 (at runtime).  But it's not in the 10.5
 SDK.  So depends on what kind of 10.5 support you need.  If you need to
 compile on 10.5, then you can't use it; if you only need to deploy on
 10.5, then you can use it.

I should be fine, then. I'm developing on 10.6 but need to support 10.5. Thanks 
for the clarification.

-Laurent.
-- 
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin 
http://nemesys.dyndns.org
Logiciels Nemesys Software  
laurent.daude...@gmail.com
Photo Gallery Store: http://laurentdaudelin.shutterbugstorefront.com/g/galleries

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com