<div dir="ltr"><div class="gmail_default"><span style="font-family:tahoma,sans-serif">Hi,<br><br></span></div><div class="gmail_default"><span style="font-family:tahoma,sans-serif">I don't know but perhaps you can use qtsensors</span><span style="font-family:tahoma,sans-serif"><span style="font-family:tahoma,sans-serif">(e.g. tapsensor)</span>  in order to track/register some special event indicating <br>
that the phone is live again.<br></span></div><div class="gmail_extra"><span style="font-family:tahoma,sans-serif"><br></span><div class="gmail_default"><span style="font-family:tahoma,sans-serif">​-Mikko​</span></div><br>
<br><div class="gmail_quote">2014/1/15 Luca Donaggio <span dir="ltr"><<a href="mailto:donaggio@gmail.com" target="_blank">donaggio@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr"><div><div><div><div>I'm in a  similar situation: I've written a small app for my personal use that periodically download some stats from one of my company's web servers.<br></div>I'm perfectly fine with it not doing anything while in deep-sleep, but I would like to do a forced update as soon as the device wakes up.<br>

</div>How can I detect such event from C++ side (my app is run as a daemon actually, so no qml involved)? Is there some DBus signal I can listen to?<br><br></div>Thanks,<br><br></div>Luca Donaggio<br></div><div class="gmail_extra">
<div><div class="h5">
<br><br><div class="gmail_quote">On Wed, Jan 15, 2014 at 9:26 AM, Jonni Rainisto <span dir="ltr"><<a href="mailto:jonni.rainisto@jolla.com" target="_blank">jonni.rainisto@jolla.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">

Hi,<br>
<br>
For the love of ***, dont use libiphb every 5 seconds, that will kill batterylife for suspend (store QA will reject apps that eat battery). Its more meant to be triggered every 10, 15, 30 etc. minutes. So if you want to make 25 minute timer that works even while suspended, then you should do libiphb to wake up after 25 minutes.<br>


<br>
Or if you want to make libiphb to wake up device every 10 minutes, you can make your application to check how much time has really passed since last wakeup by checking hw clock (as that is the only clock which is updated even while beeing suspended) timestamps like this:<br>


<br>
static void tv_get_monotime(struct timeval *tv)<br>
{<br>
#if defined(CLOCK_BOOTTIME)<br>
  struct timespec ts;<br>
  if (clock_gettime(CLOCK_BOOTTIME, &ts) < 0)<br>
      if (clock_gettime(CLOCK_MONOTONIC, &ts) < 0)<br>
          qFatal("Can't clock_gettime!");<br>
  TIMESPEC_TO_TIMEVAL(tv, &ts);<br>
#endif<br>
}<br>
<br>
<br>
________________________________________<br>
From: <a href="mailto:devel-bounces@lists.sailfishos.org" target="_blank">devel-bounces@lists.sailfishos.org</a> [<a href="mailto:devel-bounces@lists.sailfishos.org" target="_blank">devel-bounces@lists.sailfishos.org</a>] on behalf of Thomas Tanghus [<a href="mailto:thomas@tanghus.net" target="_blank">thomas@tanghus.net</a>]<br>


Sent: Tuesday, January 14, 2014 4:11 PM<br>
To: Sailfish OS Developers<br>
Subject: Re: [SailfishDevel] QML Timer stops running<br>
<div><div><br>
On Tuesday 14 January 2014 13:05 Graham Cobb wrote:<br>
> On 14/01/14 01:14, Thomas Tanghus wrote:<br>
> > On Tuesday 14 January 2014 01:53 Ove Kåven wrote:<br>
> >> No matter what OS or platform you're on, counting the number of times<br>
> >> your timer callback is called is *never* a good idea, even on desktop<br>
> >> PCs. Timer callbacks can be skipped for any number of reasons (heavy<br>
> >> system load, laptop suspend, etc).<br>
><br>
> > Good point. That will also at least work around the issue when in<br>
> > "pre-deep- sleep".<br>
><br>
> I agree with Ove (that is how every timer function I have ever worked on<br>
> works, from interrupt handlers in embedded system kernels through to the<br>
> GPE Calendar app) -- repeating timers are a convenience, but are never<br>
> treated as accurate.<br>
><br>
> But I would also suggest that for any apps that do timing, when the app<br>
> is not being displayed (and so the screen doesn't need to be updated),<br>
> the code should switch to using a single-shot timer set to the time when<br>
> the next event happens, instead of using repeating timers.  If the<br>
> kitchen timer is set for 25 minutes and the screen is blank you don't<br>
> want your app waking up every second.  Of course, it is a little bit<br>
> tedious to write the code to cancel the long timer and restart short<br>
> timers when the screen is turned back on but the user will thank you for it.<br>
<br>
It sounds like a good idea, and should be fairly easy to implement. I just<br>
don't know how to detect when the screen is off (this is my first baby-steps<br>
in mobile coding). We have the applicationActive property, but the cover can<br>
still be active and visible while it is false.<br>
<br>
> Unfortunately, I have no idea how you actually set up a single shot<br>
> timer that will fire correctly in deep sleep from the Qt environment<br>
> (the last time I implemented that logic was on Maemo).<br>
<br>
Rainisto pointed to libiphb[1] which I have now implemented with a crude<br>
wakeup every 5-10 seconds. Not optimal, but I'm OK with it for v 0.1.1 ;)<br>
<br>
[1] <a href="http://talk.maemo.org/showpost.php?p=1401318&postcount=2" target="_blank">http://talk.maemo.org/showpost.php?p=1401318&postcount=2</a><br>
<br>
--<br>
Med venlig hilsen / Best Regards<br>
<br>
Thomas Tanghus<br>
_______________________________________________<br>
SailfishOS.org Devel mailing list<br>
_______________________________________________<br>
SailfishOS.org Devel mailing list<br>
</div></div></blockquote></div><br><br clear="all"><br></div></div><span class=""><font color="#888888">-- <br>Luca Donaggio
</font></span></div>
<br>_______________________________________________<br>
SailfishOS.org Devel mailing list<br></blockquote></div><br><br clear="all">

</div></div>