[pkg-fso-commits] [SCM] FSO frameworkd Debian packaging branch, master, updated. milestone4-368-g700ab82
Jan Luebbe
jluebbe at debian.org
Mon Feb 2 18:52:08 UTC 2009
The following commit has been merged in the master branch:
commit ed743b76a658c6e15c45f6b8732851f4e1a41212
Author: Jan Luebbe <jluebbe at debian.org>
Date: Fri Jan 30 13:02:24 2009 +0100
otimed: Add config options for time and zone sources.
diff --git a/ChangeLog b/ChangeLog
index 7329399..a8e1326 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2009-01-30 Jan Luebbe <jluebbe at debian.org>
+
+ * [otimed] Add config options for time and zone sources. Set to "NONE" to disable this feature.
+
2009-01-28 Michael Lauer <mlauer at vanille-media.de>
* [opimd]: Fixed dbus objects not appearing since they were registered on the initial dbus connection,
diff --git a/conf/example/frameworkd.conf b/conf/example/frameworkd.conf
index 6541c75..c6aaa49 100644
--- a/conf/example/frameworkd.conf
+++ b/conf/example/frameworkd.conf
@@ -104,3 +104,9 @@ messages_default_folder = Unfiled
messages_trash_folder = Trash
sim_messages_default_folder = SMS
rootdir = ../etc/freesmartphone/opim:/etc/freesmartphone/opim:/usr/etc/freesmartphone/opim
+
+[otimed]
+# a list of time/zone sources to use or NONE
+timesources = GPS,NTP
+zonesources = GSM
+
diff --git a/framework/subsystems/otimed/otimed.py b/framework/subsystems/otimed/otimed.py
index 91a367d..287c8bb 100644
--- a/framework/subsystems/otimed/otimed.py
+++ b/framework/subsystems/otimed/otimed.py
@@ -17,6 +17,8 @@ MODULE_NAME = "otimed"
import clock
+from framework.config import config
+
from datetime import datetime, timedelta
from math import sqrt
import shutil
@@ -87,6 +89,9 @@ class GPSTimeSource( TimeSource ):
logger.debug( "GPS: timeout" )
return False
+ def __repr__( self ):
+ return "<%s>" % ( self.__class__.__name__, )
+
#============================================================================#
class NTPTimeSource( TimeSource ):
#============================================================================#
@@ -123,8 +128,11 @@ class NTPTimeSource( TimeSource ):
self.offset = None
logger.warning( "NTP: no timestamp received" )
+ def __repr__( self ):
+ return "<%s checking %s every %s seconds>" % ( self.__class__.__name__, self.server, self.interval )
+
#============================================================================#
-class ZoneSource( object ):
+class GSMZoneSource( object ):
#============================================================================#
def __init__( self, bus ):
self.zone = None
@@ -182,6 +190,9 @@ class ZoneSource( object ):
self.zone = None
logger.debug( "GSM: no ISO-Code for this network" )
+ def __repr__( self ):
+ return "<%s>" % ( self.__class__.__name__, )
+
#============================================================================#
class Time( dbus.service.Object ):
#============================================================================#
@@ -191,11 +202,22 @@ class Time( dbus.service.Object ):
self.interface = "org.freesmartphone.Time"
self.bus = bus
+ timesources = [x.strip().upper() for x in config.getValue( "otimed", "timesources", "GPS,NTP").split( ',' )]
+ zonesources = [x.strip().upper() for x in config.getValue( "otimed", "zonesources", "GSM").split( ',' )]
+
self.timesources = []
- self.timesources.append( GPSTimeSource( self.bus ) )
- self.timesources.append( NTPTimeSource( self.bus ) )
+ if 'GPS' in timesources:
+ self.timesources.append( GPSTimeSource( self.bus ) )
+ if 'NTP' in timesources:
+ self.timesources.append( NTPTimeSource( self.bus ) )
+
+ logger.info( "loaded timesources %s", self.timesources )
+
+ self.zonesources = []
+ if 'GSM' in zonesources:
+ self.zonesources.append( GSMZoneSource( self.bus ) )
- self.zonesource = ZoneSource( self.bus )
+ logger.info( "loaded zonesources %s", self.zonesources )
self.interval = 90
self.updateTimeout = gobject.timeout_add_seconds( self.interval, self._handleUpdateTimeout )
--
FSO frameworkd Debian packaging
More information about the pkg-fso-commits
mailing list