Reply
Thread Tools
Posts: 197 | Thanked: 101 times | Joined on Dec 2009 @ Netherlands
#131
Hi caco3

sleepanalyser takes a noticable ammount of cpu/battery. To improve on this I changed the duration value during recording to only show hour:minute. E.g. remove the seconds. This apperantly save lots of screenupdates.
In my case it gets me 2 to 3% less battery drain during the night.
 
Posts: 125 | Thanked: 77 times | Joined on Oct 2009 @ Sao Paulo, Brazil
#132
Originally Posted by mirakels View Post
sleepanalyser takes a noticable ammount of cpu/battery. To improve on this I changed the duration value during recording to only show hour:minute. E.g. remove the seconds. This apperantly save lots of screenupdates.
In my case it gets me 2 to 3% less battery drain during the night.
Why update the screen while you are sleeping?
It would be better only update the screen if the display is on?
 

The Following User Says Thank You to jaguilar For This Useful Post:
caco3's Avatar
Posts: 560 | Thanked: 423 times | Joined on May 2010 @ Switzerland
#133
Hi Mirakels and Jaguilar

My original idea was only to update the screen (incl. graph) when the display is on.
How ever i have not yet figured out how to detect if the display is on.
I expect I can get that information with dbus, but how?
__________________
On N9 check out this:
CacheMe 4 the N9, a geocaching client / MiniBible, a bible viewer / TheWord brings daily bible verses onto your phone / BatteryGraph to monitor the battery drainage / doublepress2unlock to unlock your phone with a double press onto the power button / GPRS Data Usage to monitor your GPRS data usage /
and more...

On N900 check out this: SleepAnalyser to analyse your sleep movements / PasswordMaker a for a password generator
 
Posts: 125 | Thanked: 77 times | Joined on Oct 2009 @ Sao Paulo, Brazil
#134
Caco3,

Using "dbus-monitor --system" in the terminal, received these signals:

1- signal sender=:1.9 -> dest=(null destination) serial=1553 path=/com/nokia/mce/signal; interface=com.nokia.mce.signal; member=display_status_ind
string "off"

2- signal sender=:1.9 -> dest=(null destination) serial=1556 path=/com/nokia/mce/signal; interface=com.nokia.mce.signal; member=display_status_ind
string "on"

Signal 1 when display off, and signal 2 when on!
Register in dbus listening these signals and be happy!
 

The Following 3 Users Say Thank You to jaguilar For This Useful Post:
caco3's Avatar
Posts: 560 | Thanked: 423 times | Joined on May 2010 @ Switzerland
#135
Thank you a lot!

What do you mean with "register at the bus?"
Do I then have to listen all the time? Isn't that also power sucking?
Or can I get a trigger when a certain event occures?

I guess I could somehow use dbus-scripts, but as it is only in Extras-Devel, most people could not use it.
__________________
On N9 check out this:
CacheMe 4 the N9, a geocaching client / MiniBible, a bible viewer / TheWord brings daily bible verses onto your phone / BatteryGraph to monitor the battery drainage / doublepress2unlock to unlock your phone with a double press onto the power button / GPRS Data Usage to monitor your GPRS data usage /
and more...

On N900 check out this: SleepAnalyser to analyse your sleep movements / PasswordMaker a for a password generator

Last edited by caco3; 2010-08-25 at 21:22.
 
Posts: 125 | Thanked: 77 times | Joined on Oct 2009 @ Sao Paulo, Brazil
#136
When you register in dbus listening for a signal you provide a callback function. When the signal is emited the function is called. There is no power sucking!

This code works for you:
Code:
#!/usr/bin/env python2.5
# -*- coding: utf-8 -*-
import sys
import dbus
from dbus.mainloop.qt import DBusQtMainLoop

from PyQt4.QtGui import *
from PyQt4.QtCore import *


class Daemon:
    def __init__(self):
        print "Daemon"
        loop = DBusQtMainLoop(set_as_default=True)
        system_bus = dbus.SystemBus()
        system_bus.add_signal_receiver(self.test_signal,
                                       path='/com/nokia/mce/signal',
                                    signal_name='display_status_ind',
                                    dbus_interface='com.nokia.mce.signal')
        print "Daemon ok"


    def test_signal(self, *params):
        print "1", len(params)
        print params


class test:
    def __init__(self):
        app = QApplication(sys.argv)
        Daemon()
        app.exec_()


if __name__ == "__main__":
    test()
 

The Following 4 Users Say Thank You to jaguilar For This Useful Post:
caco3's Avatar
Posts: 560 | Thanked: 423 times | Joined on May 2010 @ Switzerland
#137
Hi jaguilar

Thank you sooo much for your help!
Now I can make SleepAnalyser even more power saving.

Now I just have to figure out how to make big buttons without repeating theme (http://talk.maemo.org/showthread.php?p=798347)
__________________
On N9 check out this:
CacheMe 4 the N9, a geocaching client / MiniBible, a bible viewer / TheWord brings daily bible verses onto your phone / BatteryGraph to monitor the battery drainage / doublepress2unlock to unlock your phone with a double press onto the power button / GPRS Data Usage to monitor your GPRS data usage /
and more...

On N900 check out this: SleepAnalyser to analyse your sleep movements / PasswordMaker a for a password generator

Last edited by caco3; 2010-08-25 at 23:06.
 
Posts: 1,341 | Thanked: 708 times | Joined on Feb 2010
#138
Nice program!
I used to use Sleepy before, but this is nicer looking. (more candy)

What I am missing from Sleepy, is to able to see several sleeping times (nights) top of eachothers to visually compare.
Also Sleepy will tell how much "deep" sleep was there.
Similarly SleeyAnalyzer could tell total cumulative time of those Green, Dark Green, Red, Light Red zones....and maybe also max length of those.
In example: Your "max deep sleep" (light green) was 20 minutes long, total 2h 10m.

Horizontal scrolling of diagram with finger and not just with arrow-buttons would be nice.

BTW, not really about sleep, but this same program could have an option to alarm when just some treshold of movement in some selectable time period have occured. Maybe alarm could be a slient phone call and/or SMS message also. Could be usefull as a burglary alarm inside of luggage or attached to a hotel door.

Could be a separate program, but the internal logic would be so much similar to SleepAnalyser this could be included also IMO.
Besides, the name "SleepAnalyzer" would then also mean it analyzes if N900 is not disturbed by shaking, moving or tilting. Let N900 "sleep" or it acts. Some optional delay, so SMS is not send if owner STOPs the delayed alarm.

Last edited by zimon; 2010-08-26 at 14:25.
 
Posts: 125 | Thanked: 77 times | Joined on Oct 2009 @ Sao Paulo, Brazil
#139
Originally Posted by caco3 View Post
Now I just have to figure out how to make big buttons without repeating theme (http://talk.maemo.org/showthread.php?p=798347)
Well....with that unfortunally I can't help! My expertise in Python is not so good, and with Qt even less!

But keep going with the excelent job in SleepAnalyser!
 
caco3's Avatar
Posts: 560 | Thanked: 423 times | Joined on May 2010 @ Switzerland
#140
Hi Guys
In the newest devel version I changed a lot in the ui. It now more gets into how it should be for daily usage.
I still have to figure out how to make big buttons (with QT Designer or in python).
I was told to do it with stylesheets, but how?
If you know how to do it, please let me know.

Also please still test and vote for the version 1.6-28 in testing.
It is quite stable ond has only very minor bugs. I want to get it into extras, so others also can profit from the alarm function.
__________________
On N9 check out this:
CacheMe 4 the N9, a geocaching client / MiniBible, a bible viewer / TheWord brings daily bible verses onto your phone / BatteryGraph to monitor the battery drainage / doublepress2unlock to unlock your phone with a double press onto the power button / GPRS Data Usage to monitor your GPRS data usage /
and more...

On N900 check out this: SleepAnalyser to analyse your sleep movements / PasswordMaker a for a password generator
 
Reply


 
Forum Jump


All times are GMT. The time now is 14:42.