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

Daniel Willmann daniel at totalueberwachung.de
Mon Feb 2 18:51:17 UTC 2009


The following commit has been merged in the master branch:
commit adda6cc7c3610178df14fa65a82be766dde3dc9a
Author: Daniel Willmann <daniel at totalueberwachung.de>
Date:   Sat Nov 15 04:20:42 2008 +0100

    ogsmd: Rename featuremap to properties, add type

diff --git a/framework/subsystems/ogsmd/gsm/sms.py b/framework/subsystems/ogsmd/gsm/sms.py
index 622120a..e33f388 100644
--- a/framework/subsystems/ogsmd/gsm/sms.py
+++ b/framework/subsystems/ogsmd/gsm/sms.py
@@ -294,10 +294,27 @@ class SMS(object):
 
     dcs = property( _getDCS, _setDCS )
 
-    def _getFeatureMap( self ):
-        map = {}
-        map["direction"] = self.direction
+    def _getType( self ):
         if self.direction == "MT":
+            map = TP_MTI_INCOMING
+        elif self.direction == "MO":
+            map = TP_MTI_OUTGOING
+        return map[self.pdu_mti]
+
+    def _setType( self, smstype ):
+        if TP_MTI_INCOMING.has_key(smstype):
+            self.direction = "MT"
+            self.pdu_mti = TP_MTI_INCOMING[smstype]
+        elif TP_MTI_OUTGOING.has_key(smstype):
+            self.direction = "MO"
+            self.pdu_mti = TP_MTI_OUTGOING[smstype]
+
+    type = property( _getType, _setType )
+
+    def _getProperties( self ):
+        map = {}
+        map["type"] = self.type
+        if self.type == "sms-deliver":
             # FIXME Return correct time with timezoneinfo
             map["timestamp"] = self.scts[0].ctime() + " %+05i" % (self.scts[1]*100)
         if 0 in self.udh:
@@ -311,15 +328,15 @@ class SMS(object):
 
         return map
 
-    def _setFeatureMap( self, featureMap ):
-        for k,v in featureMap.items():
+    def _setProperties( self, properties ):
+        for k,v in properties.items():
             if k == "csm_id":
-                if "csm_num" in featureMap and "csm_seq" in featureMap:
-                    self.udh[0] = [ v, featureMap["csm_num"], featureMap["csm_seq"] ]
+                if "csm_num" in properties and "csm_seq" in properties:
+                    self.udh[0] = [ v, properties["csm_num"], properties["csm_seq"] ]
             if k == "port":
                 self.udh[4] = [v]
 
-    featureMap = property( _getFeatureMap, _setFeatureMap )
+    properties = property( _getProperties, _setProperties )
 
     def _getUdhi( self ):
         return self.udh
diff --git a/framework/subsystems/ogsmd/modems/abstract/mediator.py b/framework/subsystems/ogsmd/modems/abstract/mediator.py
index 8a9cf24..11073c4 100644
--- a/framework/subsystems/ogsmd/modems/abstract/mediator.py
+++ b/framework/subsystems/ogsmd/modems/abstract/mediator.py
@@ -770,7 +770,7 @@ class SimRetrieveMessagebook( SimMediator ):
                     # Now we decode the actual PDU
 
                     sms = ogsmd.gsm.sms.SMS.decode( line, direction )
-                    result.append( ( index, status, str(sms.oa), sms.ud, sms.featureMap ) )
+                    result.append( ( index, status, str(sms.oa), sms.ud, sms.properties ) )
             self._ok( result )
         else:
             SimMediator.responseFromChannel( self, request, response )
@@ -800,7 +800,7 @@ class SimRetrieveMessage( SimMediator ):
                 else:
                     # Now we decode the actual PDU
                     sms = ogsmd.gsm.sms.SMS.decode( line, direction )
-                    result = ( status, str(sms.oa), sms.ud, sms.featureMap )
+                    result = ( status, str(sms.oa), sms.ud, sms.properties )
 
             self._ok( *result )
 
@@ -823,7 +823,7 @@ class SimStoreMessage( SimMediator ):
         # 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"])
 
@@ -871,7 +871,7 @@ class SmsSendMessage( SmsMediator ):
         # 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"])
 
diff --git a/framework/subsystems/ogsmd/objects.py b/framework/subsystems/ogsmd/objects.py
index 71a9d64..a6cf4b5 100644
--- a/framework/subsystems/ogsmd/objects.py
+++ b/framework/subsystems/ogsmd/objects.py
@@ -434,8 +434,8 @@ class Device( resource.Resource ):
     @dbus.service.method( DBUS_INTERFACE_SIM, "ssa{sv}", "i",
                           async_callbacks=( "dbus_ok", "dbus_error" ) )
     @resource.checkedmethod
-    def StoreMessage( self, number, contents, featuremap, dbus_ok, dbus_error ):
-        mediator.SimStoreMessage( self, dbus_ok, dbus_error, number=number, contents=contents, featuremap=featuremap )
+    def StoreMessage( self, number, contents, properties, dbus_ok, dbus_error ):
+        mediator.SimStoreMessage( self, dbus_ok, dbus_error, number=number, contents=contents, properties=properties )
 
     @dbus.service.method( DBUS_INTERFACE_SIM, "i", "i",
                           async_callbacks=( "dbus_ok", "dbus_error" ) )
@@ -463,8 +463,8 @@ class Device( resource.Resource ):
     @dbus.service.method( DBUS_INTERFACE_SMS, "ssa{sv}", "i",
                           async_callbacks=( "dbus_ok", "dbus_error" ) )
     @resource.checkedmethod
-    def SendMessage( self, number, contents, featuremap, dbus_ok, dbus_error ):
-        mediator.SmsSendMessage( self, dbus_ok, dbus_error, number=number, contents=contents, featuremap=featuremap )
+    def SendMessage( self, number, contents, properties, dbus_ok, dbus_error ):
+        mediator.SmsSendMessage( self, dbus_ok, dbus_error, number=number, contents=contents, properties=properties )
 
     @dbus.service.signal( DBUS_INTERFACE_SMS, "ssa{sv}" )
     def IncomingMessage( self, address, text, features ):

-- 
FSO frameworkd Debian packaging



More information about the pkg-fso-commits mailing list