首页
登录 | 注册

获取网络运营商

方法1、AT+CIMI
判断该SIM卡属于哪个运营商,前3为表示国家,如460表示中国,接下来的2位是运营商代码,00表示中国移动,01表示中国联通
方法2:  AT+COPS?
此命令返回的数据格式有几种,对于MTK,有
:
0       long format alphanumeric
1       short format alphanumeric
2       numeric
可以通过at+cops=3,0 或at+cops=3,01或at+cops=3,2来设置
无卡时:
at+cops                                
ERROR
at+cops?
+COPS:0
                                                                               
OK                                                                             
at+cops=?                                                                      
+COPS:                                                                         
,(0, 1, 3),(0-2)                                                               
                                                                               
OK   
有卡:
at+cops                                
ERROR                                  
at+cops?                               
+COPS: 0,0,"China Telecom"(这里为移动的卡,如为联通的卡,则为+COPS: 0,0,"China Unicom" )

OK
at+cops=?                                                                      
+COPS: (2,"China Telecom","CT-GSM","46000"),(3,"China Unicom","CU-GSM","46001"),
,(0, 1, 3),(0-2)                                                               
                                                                               
OK  

at+cops=3,2                                                                    
OK 
at+cops?                                                                       
+COPS: 0,2,"46000"         

at+cops=3,0                                                                    
OK                                                                             
at+cops?                                                                       
+COPS: 0,0,"China Telecom"  
对此,gsmd已有处理,但有个问题,要把0改为gmh->id才能阻塞读取。

另外,
有卡时
at+cpin                                                                        
ERROR                                                                          
at+cpin?                                                                       
+CPIN: READY                                                                   
                                                                               
OK                                                                             
at+cpin=?                                                                      
OK   
  
无卡时:
at+cpin                                                                     
ERROR                                                                       
at+cpin?                                                                    
ERROR                                  
at+cpin=?                              
OK                                     
at+cpin                                
ERROR

GPRS模块在上电时就会将SIM卡的数据读出保存起来,一般要隔较长的时间或者有需要时再去读取,所以当你带电拔出SIM卡后,系统还是保存着原来的SIM卡信息。所以建议先解注册(at+cfun=0)一下,再注册上然后再检查是否有SIM卡(at+cpin?)。


相关文章

  •     本文会介绍使用xpath来获取数据,并附上相应的代码片段来做说明.     lxml是python语言里处理XML以及HTML工作的功能最丰富和最容易使用的库.当然scrapy框架里也是使用xpath来解析数据的.lxml的安装在这 ...
  • Oracle数据库 测试平台 - Database 11gR2/12cR2 --数据字典表级信息 SELECT USER,T.TABLE_NAME,TC.COMMENTS,DECODE(C.CONSTRAINT_NAME,NULL,'N', ...
  • 遍历获得一个实体类的所有属性名,以及该类的所有属性的值 //先定义一个类: public class User { public string name { get; set; } public string gender { get; s ...
  • SQL Server安装程序无法获取ASPNET账户的系统账户信息
    SQL Server安装程序无法获取ASPNET账户的系统账户信息   安装SQL Server2005 问题信息: "SQL Server 安装程序无法获取 ASPNET 帐户的系统帐户信息" 解决办法: 用aspne ...
  • .NET连接SAP系统专题:C#获取RFC中自定义的异常(四)
        有的时候我们需要在RFC中抛出一些自定义的异常,比如输入一个不存在的品号,我们需要抛出一个异常,告知用户品号不存在.有一个笨笨的做法就是通过返回值来判断,但是这样不灵活,同时也会因为品号不存在而继续之行RFC.如果我们能自己抛出异常 ...
  • 困扰许久的问题,解决了.   cacti通过ucd/net snmp,添加硬盘监控不能获取到硬盘分区问题,现象如下: + Running data query [2].+ Found type = '3' [snmp query].+ Fo ...

2020 unjeep.com webmaster#unjeep.com
12 q. 0.012 s.
京ICP备10005923号