summaryrefslogtreecommitdiffstats
path: root/package/query3g/files/usr/share/3gmodem/model.gcom
diff options
context:
space:
mode:
Diffstat (limited to 'package/query3g/files/usr/share/3gmodem/model.gcom')
-rw-r--r--package/query3g/files/usr/share/3gmodem/model.gcom70
1 files changed, 70 insertions, 0 deletions
diff --git a/package/query3g/files/usr/share/3gmodem/model.gcom b/package/query3g/files/usr/share/3gmodem/model.gcom
new file mode 100644
index 000000000..40dcc4096
--- /dev/null
+++ b/package/query3g/files/usr/share/3gmodem/model.gcom
@@ -0,0 +1,70 @@
+opengt
+ set com 115200n81
+ set comecho off
+ set senddelay 0.02
+ waitquiet 0.2 0.2
+
+ send "AT^m"
+ waitfor 1 "OK","ERROR"
+
+ let $c="AT+CGMI^m"
+ gosub readatcmdnr
+ let $v=$s
+
+ let $c="AT+CGSN^m"
+ gosub readatcmdnr
+ let $n=$s
+
+ let $c="AT+CGMM^m"
+ gosub readatcmdnr
+ print $v,",",$s,",",$n,"\n"
+
+ exit 0
+
+
+:readatcmd
+ let i=5
+ send $c
+:loop
+ get 1 "^m" $s
+ let l=len($r)
+ if len($s) < l goto loop1
+ if $mid($s,1,l) <> $r goto loop1
+ print $s
+ return
+
+:loop1
+ if len($s) < 2 goto loop2
+ if $mid($s,1,2) = "ER" return
+ if $mid($s,1,2) = "CO" return
+:loop2
+ if i = 0 return
+ let i=i-1
+ sleep 0.25
+ goto loop
+
+:readatcmdnr
+ let i=10
+ send $c
+:loop3
+ get 1 "^m" $s
+ if len($s) < 2 goto loop5
+ if $mid($s,1,2) = "ER" goto loop4
+ if $mid($s,1,2) = "OK" goto loop5
+ if $mid($s,1,2) = "AT" goto loop5
+ if $mid($s,1,2) = "TE" goto loop5
+ if $mid($s,1,1) = "+" goto loop5
+ if $mid($s,1,1) = "\^" goto loop5
+ let l=len($s)
+ let $s=$mid($s,1,l)
+ return
+
+:loop4
+ let $s=""
+ return
+
+:loop5
+ if i = 0 return
+ let i=i-1
+ sleep 0.25
+ goto loop3