]> git.neil.brown.name Git - plato.git/commitdiff
gsmd: record 'sim' and 'sid'.
authorNeilBrown <neilb@suse.de>
Mon, 31 Dec 2012 08:10:19 +0000 (19:10 +1100)
committerNeilBrown <neilb@suse.de>
Mon, 31 Dec 2012 08:10:19 +0000 (19:10 +1100)
SIM number and service provider ID are records as
'sim' and 'sid'.

If 'sid' is a prefix of 'sim', then we aren't roaming.

Different SMS histories and APN values can be keyed off
different 'sim' values, for people who swap sims.

gsm/gsmd.py

index f71e8c6683895fd3da4269ff95a5c510e5192662..66d99c0335ba982d4f978a7cf97e6af6321a6c31 100644 (file)
@@ -506,6 +506,10 @@ control['init'] = [
     AtAction(at='+CNMI=1,1,2,0,0', critical=False),
     # Enable async reporting of signal strength
     AtAction(at='_OSQI=1', critical=False),
+    AtAction(check='+CIMI', ok='(\d\d\d+)', record=('sim','\\1')),
+    #_OSIMOP: "YES OPTUS","YES OPTUS","50502"
+    AtAction(check='_OSIMOP', ok='_OSIMOP: ".*",".*","(.*)"',
+             record=('sid','\\1'), critical=False),
 
     # Enable reporting of Caller number id.
     AtAction(check='+CLIP?', ok='\+CLIP: 1,[012]', at='+CLIP=1', timeout=10000,
@@ -645,6 +649,8 @@ class GsmD(AtChannel):
         record('incoming','')
         record('signal_strength','')
         record('status', '')
+        record('sim','')
+        record('sid','')
 
         # set the initial state
         self.set_state('flight')
@@ -839,7 +845,7 @@ class GsmD(AtChannel):
             elif type(repeat) != int:
                 repeat = repeat(self)
 
-            if repeat and self.lastrun[i] + repeat <= now):
+            if repeat and self.lastrun[i] + repeat <= now:
                 return (i, 0)
             if repeat:
                 delay = (self.lastrun[i] + repeat) - now;