[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:25 UTC 2009
The following commit has been merged in the master branch:
commit f7a6730579ac6c2ac14cd2b1eeec8a29778339d5
Author: Michael 'Mickey' Lauer <mickey at vanille-media.de>
Date: Thu Nov 27 00:21:53 2008 +0100
ogsmd: bring SINGLELINE and MUXED4LINE up to speed again
diff --git a/framework/subsystems/ogsmd/modems/abstract/channel.py b/framework/subsystems/ogsmd/modems/abstract/channel.py
index b8efe68..bc134b5 100644
--- a/framework/subsystems/ogsmd/modems/abstract/channel.py
+++ b/framework/subsystems/ogsmd/modems/abstract/channel.py
@@ -122,7 +122,7 @@ class AbstractModemChannel( AtCommandChannel ):
self._commands["init"] = c
c = []
- c.append( '+CSMS=1' ) # GSM Phase 2+ commands: enable (this seems to fail in PDU mode?)
+ c.append( '+CSMS=1' ) # GSM Phase 2+ commands: enable
def sms_and_cb( self=self ):
if self._modem.data( "sim-buffers-sms" ):
@@ -140,4 +140,3 @@ class AbstractModemChannel( AtCommandChannel ):
c = []
self._commands["resume"] = c
-
diff --git a/framework/subsystems/ogsmd/modems/muxed4line/channel.py b/framework/subsystems/ogsmd/modems/muxed4line/channel.py
index 3efd23a..aefc22c 100644
--- a/framework/subsystems/ogsmd/modems/muxed4line/channel.py
+++ b/framework/subsystems/ogsmd/modems/muxed4line/channel.py
@@ -13,38 +13,16 @@ This module contains communication channel abstractions that
transport their data over a (virtual) serial line.
"""
-from ogsmd.gsm.decor import logged
-from ogsmd.gsm.channel import AtCommandChannel
+from ogsmd.modems.abstract.channel import AbstractModemChannel
from ogsmd.gsm.callback import SimpleCallback
#=========================================================================#
-class GenericModemChannel( AtCommandChannel ):
-#=========================================================================#
- def __init__( self, *args, **kwargs ):
- AtCommandChannel.__init__( self, *args, **kwargs )
-
- # reset
- self.enqueue('Z') # soft reset
- self.enqueue('E0V1') # echo off, verbose result on
-
- # result and error reporting
- self.enqueue('+CMEE=1') # report mobile equipment errors: in numerical format
- self.enqueue('+CRC=1') # cellular result codes: enable extended format
- self.enqueue('+CSCS="8859-1"') # character set conversion: use 8859-1 (latin 1)
- self.enqueue('+CSDH=1') # show text mode parameters: show values
-
- # sms
- self.enqueue('+CMGF=1') # message format: disable pdu mode, enable text mode
- self.enqueue('+CSMS=1') # sms gsm phase 2+ extensions: enable
-
-
-#=========================================================================#
-class CallChannel( GenericModemChannel ):
+class CallChannel( AbstractModemChannel ):
#=========================================================================#
def __init__( self, *args, **kwargs ):
if not "timeout" in kwargs:
kwargs["timeout"] = 60*60
- GenericModemChannel.__init__( self, *args, **kwargs )
+ AbstractModemChannel.__init__( self, *args, **kwargs )
self.callback = None
def setIntermediateResponseCallback( self, callback ):
@@ -58,38 +36,29 @@ class CallChannel( GenericModemChannel ):
print "CALLCHANNEL: UNHANDLED INTERMEDIATE: ", response
#=========================================================================#
-class MiscChannel( GenericModemChannel ):
+class MiscChannel( AbstractModemChannel ):
#=========================================================================#
pass
#=========================================================================#
-class UnsolicitedResponseChannel( GenericModemChannel ):
+class UnsolicitedResponseChannel( AbstractModemChannel ):
#=========================================================================#
def __init__( self, *args, **kwargs ):
- GenericModemChannel.__init__( self, *args, **kwargs )
-
- self.enqueue( "+CLIP=1" ) # calling line identification presentation enable
- self.enqueue( "+COLP=1" ) # connected line identification presentation enable
- self.enqueue( "+CCWA=1" ) # call waiting: send unsol. code
- self.enqueue( "+CSSN=1,1") # supplementary service notifications: send unsol. code
- self.enqueue( "+CRC=1" ) # cellular result codes: extended
- self.enqueue( "+CSNS=0" ) # single numbering scheme: voice
- self.enqueue( "+CTZU=1" ) # timezone update
- self.enqueue( "+CTZR=1" ) # timezone reporting
- self.enqueue( "+CREG=2" ) # registration information (TODO not all modems support that)
-
- # NOTE: This fails until CFUN=4 or CFUN=1 and SIM Auth is given
- self.enqueue( "+CNMI=2,1,2,1,1" ) # buffer SMS on SIM, report new SMS after storing, report CB directly
-
- @logged
- def suspend( self, ok_callback, error_callback ):
- self.enqueue( "+CTZU=0;+CTZR=0;+CREG=0;+CNMI=2,1,0,0,0",
- SimpleCallback( ok_callback, self ),
- SimpleCallback( error_callback, self ) )
-
- @logged
- def resume( self, ok_callback, error_callback ):
- self.enqueue( "+CTZU=1;+CTZR=1;+CREG=2;+CNMI=2,1,2,1,1",
- SimpleCallback( ok_callback, self ),
- SimpleCallback( error_callback, self ) )
+ AbstractModemChannel.__init__( self, *args, **kwargs )
+
+ def _populateCommands( self ):
+ AbstractModemChannel._populateCommands( self )
+
+ c = self._commands["init"]
+ # enable unsolicited codes
+
+ c.append( "+CLIP=1" ) # calling line identification presentation enable
+ c.append( "+COLP=1" ) # connected line identification presentation enable
+ c.append( "+CCWA=1" ) # call waiting: send unsol. code
+ c.append( "+CSSN=1,1") # supplementary service notifications: send unsol. code
+ c.append( "+CRC=1" ) # cellular result codes: extended
+ c.append( "+CSNS=0" ) # single numbering scheme: voice
+ c.append( "+CTZU=1" ) # timezone update
+ c.append( "+CTZR=1" ) # timezone reporting
+ c.append( "+CREG=2" ) # registration information (TODO not all modems support that)
diff --git a/framework/subsystems/ogsmd/modems/muxed4line/modem.py b/framework/subsystems/ogsmd/modems/muxed4line/modem.py
index e703f6d..f4688d8 100644
--- a/framework/subsystems/ogsmd/modems/muxed4line/modem.py
+++ b/framework/subsystems/ogsmd/modems/muxed4line/modem.py
@@ -29,11 +29,11 @@ class Muxed4Line( AbstractModem ):
AbstractModem.__init__( self, *args, **kwargs )
# VC 1
- self._channels["CALL"] = CallChannel( self.pathfactory, "ogsmd.call" )
+ self._channels["CALL"] = CallChannel( self.pathfactory, "ogsmd.call", modem=self )
# VC 2
- self._channels["UNSOL"] = UnsolicitedResponseChannel( self.pathfactory, "ogsmd.unsolicited" )
+ self._channels["UNSOL"] = UnsolicitedResponseChannel( self.pathfactory, "ogsmd.unsolicited", modem=self )
# VC 3
- self._channels["MISC"] = MiscChannel( self.pathfactory, "ogsmd.misc" )
+ self._channels["MISC"] = MiscChannel( self.pathfactory, "ogsmd.misc", modem=self )
# VC 4
# GPRS
diff --git a/framework/subsystems/ogsmd/modems/singleline/channel.py b/framework/subsystems/ogsmd/modems/singleline/channel.py
index c94afe4..d780b43 100644
--- a/framework/subsystems/ogsmd/modems/singleline/channel.py
+++ b/framework/subsystems/ogsmd/modems/singleline/channel.py
@@ -11,14 +11,13 @@ Package: ogsmd.modems.singeline
Module: channel
"""
-from ogsmd.gsm.decor import logged
-from ogsmd.gsm.channel import AtCommandChannel
+from ogsmd.modems.abstract.channel import AbstractModemChannel
#=========================================================================#
-class SingleLineChannel( AtCommandChannel ):
+class SingleLineChannel( AbstractModemChannel ):
#=========================================================================#
def __init__( self, *args, **kwargs ):
- AtCommandChannel.__init__( self, *args, **kwargs )
+ AbstractModemChannel.__init__( self, *args, **kwargs )
if not "timeout" in kwargs:
kwargs["timeout"] = 60*60
@@ -28,33 +27,19 @@ class SingleLineChannel( AtCommandChannel ):
Populate the command queues to be sent on modem state changes.
"""
- c = []
- # reset
- c.append( 'Z' ) # soft reset
- c.append( 'E0V1' ) # echo off, verbose result on
- # error and result reporting reporting
- c.append( '+CMEE=1' ) # report mobile equipment errors: in numerical format
- c.append( '+CRC=1' ) # cellular result codes: enable extended format
- c.append( '+CSCS="8859-1"' ) # character set conversion: use 8859-1 (latin 1)
- c.append( '+CSDH=1' ) # show text mode parameters: show values
- # sms
- c.append( '+CMGF=1' ) # message format: disable pdu mode, enable text mode
- c.append( '+CSMS=1' ) # GSM Phase 2+ commands: enable
- # unsolicited
+ AbstractModemChannel._populateCommands( self ) # prepopulated
+
+ c = self._commands["init"]
+ # reenable unsolicited responses, we don't have a seperate channel
+ # so we need to process them here as well
c.append( '+CLIP=1' ) # calling line identification presentation enable
c.append( '+COLP=1' ) # connected line identification presentation enable
c.append( '+CCWA=1' ) # call waiting
c.append( "+CSSN=1,1" ) # supplementary service notifications: send unsol. code
c.append( '+CTZU=1' ) # timezone update
c.append( '+CTZR=1' ) # timezone reporting
- c.append( '+CREG=2' ) # registration information (TODO not all modems support that)
+ c.append( '+CREG=2' ) # registration information (NOTE not all modems support =2)
c.append( "+CAOC=2" ) # advice of charge: send unsol. code
- self._commands["init"] = c
-
- c = []
- c.append( "+CNMI=2,1,2,1,1" ) # buffer sms on SIM, report CB directly
-
- self._commands["sim"] = c
-
- c = []
- self._commands["antenna"] = c
+ # GPRS unsolicited
+ c.append( "+CGEREP=2,1" )
+ c.append( "+CGREG=2" )
diff --git a/framework/subsystems/ogsmd/modems/singleline/modem.py b/framework/subsystems/ogsmd/modems/singleline/modem.py
index 5db5f3c..ac108b0 100644
--- a/framework/subsystems/ogsmd/modems/singleline/modem.py
+++ b/framework/subsystems/ogsmd/modems/singleline/modem.py
@@ -17,19 +17,15 @@ from ..abstract.modem import AbstractModem
from .channel import SingleLineChannel
from .unsolicited import UnsolicitedResponseDelegate
-from ogsmd.gsm.decor import logged
-from ogsmd.gsm.channel import AtCommandChannel
-
#=========================================================================#
class SingleLine( AbstractModem ):
#=========================================================================#
- @logged
def __init__( self, *args, **kwargs ):
AbstractModem.__init__( self, *args, **kwargs )
# The one and only serial line
- self._channels["SINGLE"] = SingleLineChannel( self.portfactory, "ogsmd" )
+ self._channels["SINGLE"] = SingleLineChannel( self.portfactory, "ogsmd", modem=self )
# configure channels
self._channels["SINGLE"].setDelegate( UnsolicitedResponseDelegate( self._object, mediator ) )
--
FSO frameworkd Debian packaging
More information about the pkg-fso-commits
mailing list