From: NeilBrown Date: Sun, 11 Oct 2015 08:12:53 +0000 (+1100) Subject: gsmd2: improve CREG support to handle roaming. X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=ee868f6378e79957dff4d16fd766799b5ac2e318;p=plato.git gsmd2: improve CREG support to handle roaming. Signed-off-by: NeilBrown --- diff --git a/gsm/gsmd2.py b/gsm/gsmd2.py index 8181d4c..317b33f 100644 --- a/gsm/gsmd2.py +++ b/gsm/gsmd2.py @@ -752,6 +752,16 @@ add_engine(suspender()) ### # location # when service, monitor cellid etc. + +# CREG? -> CREG:N,M +# Async is _CREG: M,lac,cellid +# N is 0=GSM, 1=GSM compact, 2=UTRAN, 3=GSM/EPGRS, 4=UTRAN/HSDPA +# 5=UTRAN/HSUPA 6=UTRAN/HSDUPA, 7=EUTRAN +# I seem to get '2'. +# M is 0=notreg, 1=home-net 2=searching, 3=denied, 4=unknown, +# 5=roaming 6=home/SMS-only 7=roam/SMS-only 8=emergency only +# 9=CSFB-not-preferred home net 10=CSFB-not-prefered roaming + class Cellid(Engine): def __init__(self): Engine.__init__(self) @@ -797,9 +807,9 @@ class Cellid(Engine): return False def async(self, line): - m = re.match('\+CREG: ([012])(,"([^"]*)","([^"]*)")?$', line) + m = re.match('\+CREG: ([0125])(,"([^"]*)","([^"]*)")?$', line) if m: - if m.group(1) == '1' and m.group(2): + if m.group(1) in ['1','5'] and m.group(2): self.record(m) self.retry() if m.group(1) == '0':