[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:23 UTC 2009


The following commit has been merged in the master branch:
commit 283d8bbad8647548e8bc14452701f5e46015a9ac
Merge: fa7d656bd195456f221a44032197df1a2431b95d f7fa0d515da9a66b9ba2c56f653ebf51386b5c47
Author: Michael 'Mickey' Lauer <mickey at vanille-media.de>
Date:   Tue Nov 25 16:42:35 2008 +0100

    Merge commit 'origin/stabilization/milestone4'

diff --combined framework/subsystems/ogsmd/modems/abstract/mediator.py
index bd3894f,df58b47..0eb920e
--- a/framework/subsystems/ogsmd/modems/abstract/mediator.py
+++ b/framework/subsystems/ogsmd/modems/abstract/mediator.py
@@@ -104,7 -104,7 +104,7 @@@ class AbstractMediator( object )
              elif code == 16:
                  e = error.SimAuthFailed( "SIM Authorization code not accepted" )
              elif code in ( 21, 22 ): # invalid phonebook index, phonebook entry not found
-                 e = error.SimNotFound()
+                 e = error.SimInvalidIndex()
              elif code == 30:
                  e = error.NetworkNotPresent()
              elif code in ( 32, 262 ): # 32 if SIM card is not activated
@@@ -581,6 -581,11 +581,11 @@@ class SimListPhonebooks( SimMediator )
          else:
              SimMediator.responseFromChannel( self, request, response )
  
+             #
+             # FIXME: we should try harder here -- if a modem does not support
+             # +CBPS=?, then we could iterate through our list of known phonebooks
+             # and try to select it +CPBS="..." and build the list up from these results
+ 
  #=========================================================================#
  class SimGetPhonebookInfo( SimMediator ):
  #=========================================================================#
@@@ -765,15 -770,15 +770,15 @@@ class SimRetrieveMessagebook( SimMediat
                      index = int(header.groupdict()["index"])
                      status = const.SMS_PDU_STATUS_OUT[int(header.groupdict()["status"])]
                      if "read" in status:
 -                      dir = "MT"
 +                      direction = "MT"
                      else:
 -                      dir = "MO"
 +                      direction = "MO"
                      length = int(header.groupdict()["pdulen"])
                  else:
                      # Now we decode the actual PDU
  
 -                    sms = ogsmd.gsm.sms.decodeSMS( line, dir)
 -                    result.append( ( index, status, str(sms.oa), sms.ud, sms.featureMap ) )
 +                    sms = ogsmd.gsm.sms.SMS.decode( line, direction )
 +                    result.append( ( index, status, str(sms.oa), sms.ud, sms.properties ) )
              self._ok( result )
          else:
              SimMediator.responseFromChannel( self, request, response )
@@@ -796,14 -801,14 +801,14 @@@ class SimRetrieveMessage( SimMediator )
                      header = const.PAT_SMS_PDU_HEADER_SINGLE.match( self._rightHandSide(line) )
                      status = const.SMS_PDU_STATUS_OUT[int(header.groupdict()["status"])]
                      if "read" in status:
 -                      dir = "MT"
 +                      direction = "MT"
                      else:
 -                      dir = "MO"
 +                      direction = "MO"
                      length = int(header.groupdict()["pdulen"])
                  else:
                      # Now we decode the actual PDU
 -                    sms = ogsmd.gsm.sms.decodeSMS( line, dir )
 -                    result = ( status, str(sms.oa), sms.ud, sms.featureMap )
 +                    sms = ogsmd.gsm.sms.SMS.decode( line, direction )
 +                    result = ( status, str(sms.oa), sms.ud, sms.properties )
  
              self._ok( *result )
  
@@@ -819,14 -824,14 +824,14 @@@ class SimSetServiceCenterNumber( SimMed
  class SimStoreMessage( SimMediator ):
  #=========================================================================#
      def trigger( self ):
 -        sms = ogsmd.gsm.sms.AbstractSMS("MO")
 +        sms = ogsmd.gsm.sms.SMS("MO")
          sms.pdu_mti = 1
          sms.pid = 0
          sms.dcs = 0
          # Use PDUAddress
          sms.oa = ogsmd.gsm.sms.PDUAddress.guess( self.number )
          sms.ud = self.contents
 -        sms.featureMap = self.featuremap
 +        sms.properties = self.properties
          pdu = sms.pdu()
          self._commchannel.enqueue( '+CMGW=%i\r%s' % ( len(pdu)/2-1, pdu), self.responseFromChannel, self.errorFromChannel, timeout=const.TIMEOUT["SIMACCESS"])
  
@@@ -867,14 -872,14 +872,14 @@@ class SimDeleteMessage( SimMediator )
  class SmsSendMessage( SmsMediator ):
  #=========================================================================#
      def trigger( self ):
 -        sms = ogsmd.gsm.sms.AbstractSMS("MO")
 +        sms = ogsmd.gsm.sms.SMS("MO")
          sms.pdu_mti = 1
          sms.pid = 0
          sms.dcs = 0
          # Use PDUAddress
          sms.oa = ogsmd.gsm.sms.PDUAddress.guess( self.number )
          sms.ud = self.contents
 -        sms.featureMap = self.featuremap
 +        sms.properties = self.properties
          pdu = sms.pdu()
          self._commchannel.enqueue( '+CMGS=%i\r%s' % ( len(pdu)/2-1, pdu), self.responseFromChannel, self.errorFromChannel, timeout=const.TIMEOUT["NETWORK"])
  
@@@ -994,18 -999,8 +999,18 @@@ class NetworkRegisterWithProvider( Netw
  #=========================================================================#
  class NetworkGetCountryCode( NetworkMediator ):
  #=========================================================================#
 -    def __init__( self, dbus_object, dbus_ok, dbus_error, **kwargs ):
 -        dbus_error( error.UnsupportedCommand( self.__class__.__name__ ) )
 +    def trigger( self ):
 +        self._commchannel.enqueue( "+COPS=3,2;+COPS?;+COPS=3,0", self.responseFromChannel, self.errorFromChannel )
 +
 +    def responseFromChannel( self, request, response ):
 +        if response[-1] == "OK" and len( response ) > 1:
 +            values = self._rightHandSide( response[0] ).split( ',' )
 +            if len( values ) != 3:
 +                self._error( error.NetworkNotFound( "Not registered to an operator" ) )
 +            else:
 +                mcc = int( values[2].strip( '"' )[:3] )
 +                code, name = const.mccToCountryCode( mcc )
 +                self._ok( code, name )
  
  #=========================================================================#
  class NetworkGetCallForwarding( NetworkMediator ): # a{sv}
diff --combined tests/test.py
index 011f882,a80f46f..2d5109e
--- a/tests/test.py
+++ b/tests/test.py
@@@ -14,12 -14,15 +14,15 @@@ GPLv2 or late
  # cases. It is not easily done using unittest.
  # We can use the framewok tasklet module to simplify things a little.
  
+ import framework
+ from framework.patterns.tasklet import Tasklet, Sleep
+ 
+ import types
  import unittest
  import gobject
  import ConfigParser
  
- import framework
- from framework.patterns.tasklet import Tasklet, Sleep
+ import dbus
  
  config = ConfigParser.ConfigParser()
  config.readfp(open('tests.conf'))
@@@ -128,6 -131,29 +131,29 @@@ class TestTest(unittest.TestCase)
          yield True
  
  #=========================================================================#
+ def testDbusValueIsInteger( value ):
+ #=========================================================================#
+         assert type( value ) == dbus.Int16 or \
+                type( value ) == dbus.Int32 or \
+                type( value ) == dbus.Int64, "value type not an integer"
+ 
+ #=========================================================================#
+ def testDbusDictionaryWithStringValues( result ):
+ #=========================================================================#
+     assert type( result ) is dbus.Dictionary, "wrong type returned"
+     for key, value in result.items():
+         assert type( key ) == dbus.String, "key type in dictionary not a string"
+         assert type( value ) == dbus.String, "value type in dictionary not a string"
+ 
+ #=========================================================================#
+ def testDbusDictionaryWithIntegerValues( result ):
+ #=========================================================================#
+     assert type( result ) is dbus.Dictionary, "wrong type returned"
+     for key, value in result.items():
+         assert type( key ) == dbus.String, "key type in dictionary not a string"
+         testDBusValueIsInteger( value )
+ 
+ #=========================================================================#
  def check_debug_mode():
  #=========================================================================#
      """Exit the program if we are not in debug mode"""
@@@ -166,7 -192,7 +192,7 @@@ if __name__ == '__main__'
  #=========================================================================#
      # This list all the modules containing the tests we want to run
      # TODO: provide command line arguments like in Mikey ogsmd test script
 -    modules = ['test', 'opreferencesd', 'sim', 'opimd', 'ogsmd2']
 +    modules = ['test', 'opreferencesd', 'sim', 'opimd', 'ogsmd2', 'oevents']
  
      for module in modules:
          module = __import__(module)

-- 
FSO frameworkd Debian packaging



More information about the pkg-fso-commits mailing list