[pkg-fso-commits] [SCM] FSO frameworkd Debian packaging branch, debian, updated. upstream/0.9.5.5-717-g0f98819
Michael 'Mickey' Lauer
mickey at vanille-media.de
Sat Aug 6 08:17:14 UTC 2011
The following commit has been merged in the debian branch:
commit 8cabc0bac1ae69615d1e846defe6b0f00b6e965c
Author: Michael 'Mickey' Lauer <mickey at vanille-media.de>
Date: Tue May 12 18:26:48 2009 +0200
ogsmd: CSD handling with external call handler part 1/2 done (incoming)
diff --git a/framework/subsystems/ogsmd/gsm/channel.py b/framework/subsystems/ogsmd/gsm/channel.py
index ec64565..7f47b20 100644
--- a/framework/subsystems/ogsmd/gsm/channel.py
+++ b/framework/subsystems/ogsmd/gsm/channel.py
@@ -197,6 +197,12 @@ class VirtualChannel( object ):
self.connected = self.serial.isOpen()
return not self.connected
+ def port( self ):
+ """
+ Return name of transport.
+ """
+ return self.serial.port
+
#
# hooks
#
diff --git a/framework/subsystems/ogsmd/modems/abstract/calling.py b/framework/subsystems/ogsmd/modems/abstract/calling.py
index 7417703..d31b74e 100644
--- a/framework/subsystems/ogsmd/modems/abstract/calling.py
+++ b/framework/subsystems/ogsmd/modems/abstract/calling.py
@@ -12,12 +12,14 @@ Module: calling
New style abstract call handling
"""
-__version__ = "0.9.1.2"
+__version__ = "0.9.1.3"
MODULE_NAME = "ogsmd.callhandler"
from ogsmd import error
from ogsmd.gsm import const
+from framework.patterns.processguard import ProcessGuard
+
import logging
logger = logging.getLogger( MODULE_NAME )
@@ -54,6 +56,42 @@ class CallHandler( object ):
return self._calls[1]["status"], self._calls[2]["status"]
#
+ # additional support for data call handling
+ #
+ def onActivateResult( self, request, response ):
+ """
+ Called after ATA
+ """
+ # if this is a data call, add the port where communication can happen
+ if response[0].startswith( "CONNECT" ): # data call succeeded
+ self.csdid = callId = 1 if self._calls[1]["status"] == "active" else 2
+ self.csdchan = channel = self._object.modem.channel( "CallMediator" )
+ self.statusChangeFromNetwork( callId, { "status": "connect", "port": channel.port() } )
+
+ # check whether we have a data call handler registered
+ dataCallHandler = self._object.modem.data( "data-call-handler" )
+ if dataCallHandler is not None:
+ self.csdchan.freeze()
+ csd_commandline = dataCallHandler.split()
+ if not dataCallHandler.startswith( "/bin/sleep" ): # for debugging
+ csd_commandline += [ channel.port(), self._calls[callId]["direction"] ]
+ self.csdproc = ProcessGuard( csd_commandline )
+ logger.info( "launching csd handler as commandline %s" % csd_commandline )
+ self.csdproc.execute( onExit=self._spawnedProcessDone )
+ else:
+ logger.info( "no csd handler registered" )
+
+ def _spawnedProcessDone( self, pid, exitcode, exitsignal ):
+ """
+ Called after CSD Handler exit.
+ """
+ logger.info( "csd handler exited with code %d, signal %d" % ( exitcode, exitsignal ) )
+ # unfreeze
+ self.csdchan.thaw()
+ # release call and resume normal operation
+ self.release( self.csdid, self._object.modem.channel( "MiscMediator" ) )
+
+ #
# called from mediators
#
@@ -198,7 +236,7 @@ class CallHandler( object ):
return True
elif action == "activate" and kwargs["index"] == 1:
# FIXME handle data calls here
- kwargs["channel"].enqueue( 'A' )
+ kwargs["channel"].enqueue( 'A', self.onActivateResult )
return True
def state_outgoing_release( self, action, *args, **kwargs ):
diff --git a/framework/subsystems/ogsmd/modems/abstract/modem.py b/framework/subsystems/ogsmd/modems/abstract/modem.py
index 242d50a..97ceae8 100644
--- a/framework/subsystems/ogsmd/modems/abstract/modem.py
+++ b/framework/subsystems/ogsmd/modems/abstract/modem.py
@@ -13,9 +13,11 @@ Module: modem
# FIXME: The modem should really be a sigleton
-__version__ = "0.9.9.4"
+__version__ = "0.9.9.5"
MODULE_NAME = "ogsmd.modem.abstract"
+from framework.config import config
+
import gobject
import sys, types
@@ -88,6 +90,8 @@ class AbstractModem( object ):
self._data["cancel-outgoing-call"] = "H" # default will kill all connections
+ self._data["data-call-handler"] = config.getValue( "ogsmd", "data_call_handler", None )
+
def open( self, on_ok, on_error ):
"""
Triggers opening the channels on this modem.
--
FSO frameworkd Debian packaging
More information about the pkg-fso-commits
mailing list