From: NeilBrown Date: Mon, 31 Dec 2012 08:10:19 +0000 (+1100) Subject: gsmd: record 'sim' and 'sid'. X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=15d50ddcb3f66a3873c3c549f4e096ca22d692e7;p=plato.git gsmd: record 'sim' and 'sid'. 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. --- diff --git a/gsm/gsmd.py b/gsm/gsmd.py index f71e8c6..66d99c0 100644 --- a/gsm/gsmd.py +++ b/gsm/gsmd.py @@ -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;