使用AT指令VB.net启用SIM卡锁定 [英] Enable SIM Lock using AT Command VB.net

查看:192
本文介绍了使用AT指令VB.net启用SIM卡锁定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用代码锁定我的Simcard,单击按钮后,我重新启动调制解调器,然后nothig发生.我希望SIM卡处于锁定状态所需的引脚才能使用它.

I want lock my simcard using code, after click the button i restart modem and nothig happen . i want the sim locked status required pin to use it.

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    SerialPort1.PortName = "COM8"
    SerialPort1.BaudRate = 9600
    SerialPort1.Parity = Parity.None
    SerialPort1.StopBits = StopBits.One
    SerialPort1.DataBits = 8
    SerialPort1.Handshake = Handshake.RequestToSend
    SerialPort1.DtrEnable = True
    SerialPort1.RtsEnable = True
    SerialPort1.NewLine = vbCrLf
End Sub

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    SerialPort1.Open()
    If SerialPort1.IsOpen() Then
        SerialPort1.Write("AT" & vbCrLf)

        SerialPort1.Write("AT+CPIN=1234" & vbCrLf)
        SerialPort1.Write("AT+CLCK='SC',1,'1234'" & vbCrLf)
        MsgBox("LOcked")
    Else
        MsgBox("Port not available")
    End If
End Sub




No error Return, SIM CArd Still Unlocked.

Thanks 

推荐答案

这里有些事情做错了,您必须进行重大更改,然后才能开始期望它们能正常工作.

Here are several things done wrong, and you must make significant changes before you can start expecting things to work.

最严重的是完全缺乏对从调制解调器发回的响应代码的任何分析. 在您解决该问题之前,任何事情都将无法解决. 此答案中的所有内容均适用.请阅读V.250中第5章的全部内容.

The most severe is the complete lack of any parsing of the response codes sent back from the modem. Nothing will ever work until you fix that. Everything in this answer applies. Do read all of chapter 5 in V.250.

此外(但是,在实现对调制解调器响应的读取和解析之前,请不要打扰以下内容),命令行应以单个\r回车符终止,而不是vbCrLf.并且字符串参数应使用"双引号(例如AT+CPIN="1234"AT+CLCK="SC",1,"1234")进行封装.

In addition (but do not bother addressing the following before you have implemented reading and parsing of the responses from the modem), the command line should be terminated by a single \r carriage return character, and not vbCrLf. And the string arguments should be encapsulated with " double quotes (e.g. AT+CPIN="1234" and AT+CLCK="SC",1,"1234").

这篇关于使用AT指令VB.net启用SIM卡锁定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆