[pkg-fso-commits] [SCM] FSO frameworkd Debian packaging branch, master, updated. milestone4-368-g700ab82

Michael 'Mickey' Lauer mickey at vanille-media.de
Mon Feb 2 18:51:35 UTC 2009


The following commit has been merged in the master branch:
commit 52f6fa4c1d4333418b55582cd7fa51768857f994
Author: Michael 'Mickey' Lauer <mickey at vanille-media.de>
Date:   Thu Dec 11 21:13:14 2008 +0100

    ogsmd: implement org.freesmartphone.GSM.Network.TimeZoneReport()
    Thanks Dieter S., Jörg R. and all who contributed to the puzzle :)

diff --git a/ChangeLog b/ChangeLog
index 6f4d29f..d5faf05 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,7 @@
 
 	* [ogsmd] Implemented org.freesmartphone.GSM.PDP.NetworkStatus()
 	* [ogsmd] Implemented org.freesmartphone.GSM.PDP.GetNetworkStatus()
+	* [ogsmd] Implemented org.freesmartphone.GSM.Network.TimeZoneReport()
 
 2008-12-06	Michael Lauer	<mickey at openmoko.org>
 
diff --git a/framework/subsystems/ogsmd/device.py b/framework/subsystems/ogsmd/device.py
index 772e9f1..d13dd89 100644
--- a/framework/subsystems/ogsmd/device.py
+++ b/framework/subsystems/ogsmd/device.py
@@ -11,7 +11,7 @@ Module: device
 """
 
 MODULE_NAME = "ogsmd.device"
-__version__ = "0.9.8.0"
+__version__ = "0.9.10.0"
 
 from framework import resource
 from modems import modemFactory, allModems, setCurrentModem
@@ -463,6 +463,10 @@ class Device( resource.Resource ):
     @dbus.service.signal( DBUS_INTERFACE_NETWORK, "ss" )
     def CipherStatus( self, gsm, gprs ):
         logger.info( "org.freesmartphone.GSM.Network.CypherStatus: %s: %s", gsm, gprs )
+
+    @dbus.service.signal( DBUS_INTERFACE_NETWORK, "i" )
+    def TimeZoneReport( self, timezone ):
+        logger.info( "org.freesmartphone.GSM.Network.TimeZoneReport: %d" )
     #
     # dbus org.freesmartphone.GSM.Call
     #
diff --git a/framework/subsystems/ogsmd/gsm/const.py b/framework/subsystems/ogsmd/gsm/const.py
index 698c7fa..e94314a 100644
--- a/framework/subsystems/ogsmd/gsm/const.py
+++ b/framework/subsystems/ogsmd/gsm/const.py
@@ -1126,6 +1126,25 @@ def codeToOperator( mccmni ):
     return operator
 
 #=========================================================================#
+def ctzvToTimeZone( ctzv ):
+#=========================================================================#
+    """
+    Computes the timezone offset out of a value from +CTZV
+
+    <DieterS> Lets try again: 0x19 -> swap the BCD digits: 0x91, high bit is minus -> -11 this is -2:45
+    <wpwrak> dieter: i think if you try enough variations, you can produce any number ;-)
+    <DieterS> Now the same for a real world example: 105  = 0x69 swap 0x96, high bit set, minus 16, this minus 4 hours
+    <DieterS> Werner: Sure, but one can also read the GSM spec ;-)
+    <wpwrak> dieter: that's cheating :)
+    <DieterS> Start with 04.08, check 03.40  and look at 02.42
+    <DieterS> So it's is really simple ;-)
+    """
+    bcd = hex( int( ctzv ) & 0xf7 )[2:][::-1]
+    sign = int( ctzv ) & 0x08 == 8
+    value = int(bcd[0]) * 10 + int(bcd[1])
+    return -value if sign else value
+
+#=========================================================================#
 if __name__ == "__main__":
 #=========================================================================#
     # FIXME use Python unit testing framework
@@ -1154,3 +1173,6 @@ if __name__ == "__main__":
     assert codeToOperatorCache( "26203" ) == "E-Plus"
     assert codeToOperatorCache( "111222" ) == "E-Plus"
     print "OK"
+    assert ctzvToTimeZone( "25" ) == -11 # UTC-2:45
+    assert ctvzToTimeZone( "35" ) == 32  # UTC+8
+    assert ctvzToTimeZone( "105" ) == -15 # UTC-4
diff --git a/framework/subsystems/ogsmd/modems/abstract/unsolicited.py b/framework/subsystems/ogsmd/modems/abstract/unsolicited.py
index 4f9fd73..4b0f7fe 100644
--- a/framework/subsystems/ogsmd/modems/abstract/unsolicited.py
+++ b/framework/subsystems/ogsmd/modems/abstract/unsolicited.py
@@ -166,6 +166,14 @@ class AbstractUnsolicitedResponseDelegate( object ):
         if errornumber == 322:
             self._object.MemoryFull()
 
+    # +CTZV: 35 (observed in Taipei, UTC+7)
+    # +CTZV: 105 (observed in UTC-4)
+    def plusCTZV( self, righthandside ):
+        """
+        Incoming Timezone Report
+        """
+        self._object.TimeZoneReport( const.ctzvToTimeZone( righthandside ) )
+
     # +CUSD: 0," Aktuelles Guthaben: 10.00 EUR.",0'
     def plusCUSD( self, righthandside ):
         """

-- 
FSO frameworkd Debian packaging



More information about the pkg-fso-commits mailing list