Re: [SailfishDevel] Preventing deep sleep for a few seconds?

2014-02-05 Thread Valerio Valerio

On 05/02/14 10:04, Ove Kåven wrote:

Den 05. feb. 2014 07:16, skrev Valerio Valerio:

Hi,

On 05/02/14 02:58, Thomas Tanghus wrote:

On Monday 03 February 2014 22:58:42 Ove Kåven wrote:
But for scheduled wakeups (say I want the next synchronization to 
occur

after 6 hours), I suppose the best option is to use timed?

I made a QML plugin including libiphb for that, and it did pass the
harbour
master ;)

https://github.com/tanghus/kitchen-timer-qml/tree/master/src/insomniac


Didn't checked your code carefully but this is probably not sufficient,
if the device enters late suspend the timers will stop unless you use
the keepalive apis (unfortunately not suited for harbour yet):
https://github.com/nemomobile/nemo-keepalive


But he does. From that README, it sounds like nemo-keepalive's 
PeriodicBackgroundProcessing is using libiphb, just like he is...


Not only, if you check the code it also pings MCE preventing the device 
to go into late suspend, at least for me libiphb alone was not sufficient.





Perhaps I could just use the nemo-keepalive API anyway since I'm not 
currently targeting harbour anyway because of its other restrictions.


There's also QML interface there in case you haven't noticed.

Best regards,

Valério


___
SailfishOS.org Devel mailing list


___
SailfishOS.org Devel mailing list


Re: [SailfishDevel] Preventing deep sleep for a few seconds?

2014-02-05 Thread Thomas Tanghus
On Wednesday 05 February 2014 08:16:32 Valerio Valerio wrote:
 Hi,
 
 On 05/02/14 02:58, Thomas Tanghus wrote:
  On Monday 03 February 2014 22:58:42 Ove Kåven wrote:
  But for scheduled wakeups (say I want the next synchronization to occur
  after 6 hours), I suppose the best option is to use timed?
  
  I made a QML plugin including libiphb for that, and it did pass the
  harbour
  master ;)
  
  https://github.com/tanghus/kitchen-timer-qml/tree/master/src/insomniac
 
 Didn't checked your code carefully but this is probably not sufficient,
 if the device enters late suspend the timers will stop unless you use
 the keepalive apis (unfortunately not suited for harbour yet):
 https://github.com/nemomobile/nemo-keepalive

As I use it in the kitchen-timer app any normal QML timers are stopped when 
the app is no longer visible, and the Insomniac timer (using the libiphb 
included) is set to wake up a few seconds before the timeout, restart timers 
and adjust the UI.

Works flawlessly (in my tests) for waking up from deep sleep.

-- 
Best regards / Med venlig hilsen

Thomas Tanghus
___
SailfishOS.org Devel mailing list


Re: [SailfishDevel] Preventing deep sleep for a few seconds?

2014-02-04 Thread Valerio Valerio

Hi,

On 05/02/14 02:58, Thomas Tanghus wrote:

On Monday 03 February 2014 22:58:42 Ove Kåven wrote:

But for scheduled wakeups (say I want the next synchronization to occur
after 6 hours), I suppose the best option is to use timed?

I made a QML plugin including libiphb for that, and it did pass the harbour
master ;)

https://github.com/tanghus/kitchen-timer-qml/tree/master/src/insomniac


Didn't checked your code carefully but this is probably not sufficient, 
if the device enters late suspend the timers will stop unless you use 
the keepalive apis (unfortunately not suited for harbour yet): 
https://github.com/nemomobile/nemo-keepalive


Best regards,

Valério




___
SailfishOS.org Devel mailing list


Re: [SailfishDevel] Preventing deep sleep for a few seconds?

2014-02-03 Thread Thomas Perl
On 01 Feb 2014, at 21:32, Ove Kåven o...@arcticnet.no wrote:
 If a synchronization starts with the screen off, there's a chance that the 
 phone enters deep suspend during the synchronization. If so, the other side 
 might time out and the sync will fail.
 
 So I want prevent the CPU from suspending before the synchronization is 
 complete, which might take a few seconds (and there might not be network 
 activity all the time while it's running). I've read that to get periodic 
 wakeups, you could use libiphb or maybe timed, but what's the recommended way 
 to temporarily prevent suspending completely for a few seconds?

You can talk to MCE via the system D-Bus, this is quite low-level, but works 
already:

https://github.com/nemomobile/mce-dev/blob/master/include/mce/dbus-names.h#L329

To quote the documentation:

 * The idea is: if some process needs to do non-interactive
 * background processing, it can prevent the system from
 * entering late suspend by
 *
 * 1) get timer period via #MCE_CPU_KEEPALIVE_PERIOD_REQ call
 *
 * 2) call #MCE_CPU_KEEPALIVE_START_REQ
 *
 * 3) repeat #MCE_CPU_KEEPALIVE_START_REQ calls in interval
 *that is shorter than the maximum obtained at (1)
 *
 * 4) call #MCE_CPU_KEEPALIVE_STOP_REQ when finished
 *
 * MCE keeps track of active clients and blocks late suspend
 * until all clients have called #MCE_CPU_KEEPALIVE_STOP_REQ,
 * lost D-Bus connection (exit, crash, ...) or all timeouts
 * have been missed.

There might be a higher-level API for this in the future (Qt-flavored C++ and 
QML), for a preview, see:
https://github.com/nemomobile/nemo-keepalive

HTH :)
Thomas
___
SailfishOS.org Devel mailing list


[SailfishDevel] Preventing deep sleep for a few seconds?

2014-02-01 Thread Ove Kåven
If a synchronization starts with the screen off, there's a chance that 
the phone enters deep suspend during the synchronization. If so, the 
other side might time out and the sync will fail.


So I want prevent the CPU from suspending before the synchronization is 
complete, which might take a few seconds (and there might not be network 
activity all the time while it's running). I've read that to get 
periodic wakeups, you could use libiphb or maybe timed, but what's the 
recommended way to temporarily prevent suspending completely for a few 
seconds?

___
SailfishOS.org Devel mailing list