使用 AT 命令的数据调用失败

Data Call with AT commands failed

我正在使用 at 命令将 3g 调制解调器连接到互联网。所有消息均显示一切正常,但 windows 中没有互联网访问和调制解调器状态 7 已断开连接。调制解调器的指示灯亮起,就像它已连接到互联网一样。 我正在使用的命令是(按此顺序):

COM5 115200 4000

CODE INTRODUCED: AT+CGREG? +CGREG: 0,1 OK

CODE INTRODUCED: AT+CGREG=? +CGREG: (0-2) OK

CODE INTRODUCED: AT+CGREG? +CGREG: 0,1 OK

CODE INTRODUCED: AT+COPS? +COPS: 0,2,"22603",0 OK

CODE INTRODUCED: AT+CSQ +CSQ: 21,99 OK

CODE INTRODUCED: AT+CGATT=1 OK

CODE INTRODUCED: AT+CGDCONT=1,"IP","broadband" OK

CODE INTRODUCED: AT+CGACT=1,1 OK

CODE INTRODUCED: AT+CEER +CEER: No cause information available OK

CODE INTRODUCED: AT+CGACT? +CGACT: 1,1 OK

CODE INTRODUCED: AT+CGATT? +CGATT: 1 OK

CODE INTRODUCED: AT+CGREG? +CGREG: 0,1 OK

CODE INTRODUCED: AT+CGDCONT? +CGDCONT: 1,"IP","broadband","0.0.0.0",0,0 OK

CODE INTRODUCED: AT+CGACT=0,1 OK

CODE INTRODUCED: AT+CEER +CEER: No cause information available OK

CODE INTRODUCED: AT+COPS? +COPS: 0,2,"22603",0 OK

CODE INTRODUCED: AT+CSQ +CSQ: 21,99 OK

CODE INTRODUCED: AT+CGATT=1 OK

CODE INTRODUCED: AT+CGDCONT=1,"IP","broadband" OK

CODE INTRODUCED: AT+CGACT=1,1 OK

CODE INTRODUCED: AT+CEER +CEER: No cause information available OK

CODE INTRODUCED: AT+CGACT? +CGACT: 1,1 OK

CODE INTRODUCED: AT+CGATT? +CGATT: 1 OK

CODE INTRODUCED: AT+CGREG? +CGREG: 0,1 OK

CODE INTRODUCED: AT+CGDCONT? +CGDCONT: 1,"IP","broadband","0.0.0.0",0,0 OK

CODE INTRODUCED: AT+CGACT=0,1 OK

CODE INTRODUCED: AT+CEER +CEER: No cause information available OK

我错过了什么?

可能在设备上建立连接是不够的,因为 windows 不会收到连接通知。您应该在 Windows 中设置调制解调器并使用它来建立连接。

DotRas 是一个在 c# 中执行此操作的项目。但是对于其他语言也可能有其他解决方案。如果您正在编写脚本,您可以查看 WMI。调制解调器也有 类。

我找到了问题的答案。要通过 3g 调制解调器连接到互联网,您需要创建一个拨号会话或使用一个现有的。 Visual C# 中最简单的方法是使用 DotRas 库并创建拨号。 示例

private void connectbtn_Click(object sender, EventArgs e)

{
            string path = RasPhoneBook.GetPhoneBookPath(RasPhoneBookType.User);
            RasPhoneBook pbk = new RasPhoneBook();
            pbk.Open(path);
            RasDevice modem = RasDevice.GetDeviceByName("HUAWEI Mobile Connect - 3G Modem",RasDeviceType.Modem);
           //get the exact device name from windows
            RasEntry entry = RasEntry.CreateDialUpEntry("Broadband", "*99#", modem);
            entry.Options.RemoteDefaultGateway = true;
            if (RasEntry.Exists("Broadband", path) == false)
            { pbk.Entries.Add(entry); }
            RasDialer dialer = new RasDialer();
            dialer.EntryName = "Broadband";
            dialer.PhoneBookPath = path;
            dialer.Credentials = new NetworkCredential();

            dialer.Credentials.Domain = "broadband";
            dialer.PhoneNumber="*99#";
            dialer.Dial();

        }

注意您的连接设置和 ghet 互联网访问。