我试图通过AT命令用huawei调制解调器发送ussd消息。 这是我的函数,它将At命令写入串口。
对于短信,我尝试以下和它的工作,我可以短信。
string recievedData = ExecCommand(port,"AT", 300, "No phone connected");
recievedData = ExecCommand(port,"AT+CMGF=1", 300, "Failed to set message format.");
String command = "AT+CMGS=\"" + PhoneNo + "\"";
recievedData = ExecCommand(port,command, 300, "Failed to accept phoneNo");
command = Message + char.ConvertFromUtf32(26) + "\r";
recievedData = ExecCommand(port,command, 3000, "Failed to send message"); //3 seconds
if (recievedData.EndsWith("\r\nOK\r\n"))
{
isSend = true;
}
else if (recievedData.Contains("ERROR"))
{
isSend = false;
}
但对于ussd消息,我在尝试以下内容时,
string recievedData = ExecCommand(port,"AT", 300, "No phone connected");
recievedData = ExecCommand(port,"AT+CMGF=1", 300, "Failed to set message format.");
String command = "AT+CUSD=1,*566#";
recievedData = ExecCommand(port,command, 3000, "Failed to send ussd");
Console.WriteLine("received data : " +recievedData);
// command = Message + char.ConvertFromUtf32(26) + "\r";
// recievedData = ExecCommand(port,command, 3000, "Failed to send message"); //3 seconds
if (recievedData.EndsWith("\r\nOK\r\n"))
{
isSend = true;
}
else if (recievedData.Contains("ERROR"))
{
isSend = false;
}
前两个exec命令返回ok,但第三个exec命令返回错误。
USSD代码正在提供商移动合作伙伴应用程序
我需要发送哪些AT命令来正确处理ussd应用程序?