]> git.neil.brown.name Git - plato.git/commitdiff
gsmd2: improve CREG support to handle roaming.
authorNeilBrown <neil@brown.name>
Sun, 11 Oct 2015 08:12:53 +0000 (19:12 +1100)
committerNeilBrown <neil@brown.name>
Sun, 11 Oct 2015 08:12:53 +0000 (19:12 +1100)
Signed-off-by: NeilBrown <neil@brown.name>
gsm/gsmd2.py

index 8181d4c879c70d3c1526bbf59a2e25f74316a7f5..317b33f6400a5fbd74ac590d0ba1fd52c3082aee 100644 (file)
@@ -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':