使用C#和GSM调制解调器的SMS应用程序正在给出错误
我正在尝试使用GSM调制解调器从此C#应用程序中将消息发送到电话号码。但这给了这个怪异。
+cme错误:PACM(AP),未重新待办事项
OK
ok ok ok
+CME错误:PACM(AP),not_allowed_slo
OK
+CME错误:PACM(ap),not_allowed_slo
ok ok
+cme ok +cme错误:pacm(ap),not_allowed_slo
ok ok ok ok ok ok 嗨,
错误,
这是我的代码
private void btnsend_Click(object sender, EventArgs e)
{
try
{
SerialPort sp = new SerialPort();
sp.PortName = txtport.Text;
sp.Open();
sp.WriteLine("AT" + Environment.NewLine);
Thread.Sleep(100);
sp.WriteLine("AT+CMGF=1" + Environment.NewLine);
Thread.Sleep(100);
sp.WriteLine("AT+CSCS=\"GSM\"" + Environment.NewLine);
Thread.Sleep(100);
sp.WriteLine("AT+CMGS=\"" + txtphone.Text + "\"" + Environment.NewLine);
Thread.Sleep(100);
sp.WriteLine(txtmessage.Text + Environment.NewLine);
Thread.Sleep(100);
sp.Write(new byte[] { 26 }, 0, 1);
Thread.Sleep(100);
var response = sp.ReadExisting();
if (response.Contains("ERROR"))
{
MessageBox.Show("Sending fialed", "Message", MessageBoxButtons.OK, MessageBoxIcon.Stop);
MessageBox.Show(response);
}
else
{
MessageBox.Show("Message sent", "Message", MessageBoxButtons.OK, MessageBoxIcon.None);
}
sp.Close();
}
catch (Exception ex)
{
}
}
}
}
I am trying to make a SMS application to send message to phone number from this C# application by using GSM modem. but it gives this eorror.
+CME Error:PACM(AP),UNREGISTED
OK
OK
+CME Error:PACM(AP),NOT_ALLOWED_SLO
OK
+CME Error:PACM(AP),NOT_ALLOWED_SLO
OK
+CME Error:PACM(AP),NOT_ALLOWED_SLO
OK
HI
ERROR
here is my code
private void btnsend_Click(object sender, EventArgs e)
{
try
{
SerialPort sp = new SerialPort();
sp.PortName = txtport.Text;
sp.Open();
sp.WriteLine("AT" + Environment.NewLine);
Thread.Sleep(100);
sp.WriteLine("AT+CMGF=1" + Environment.NewLine);
Thread.Sleep(100);
sp.WriteLine("AT+CSCS=\"GSM\"" + Environment.NewLine);
Thread.Sleep(100);
sp.WriteLine("AT+CMGS=\"" + txtphone.Text + "\"" + Environment.NewLine);
Thread.Sleep(100);
sp.WriteLine(txtmessage.Text + Environment.NewLine);
Thread.Sleep(100);
sp.Write(new byte[] { 26 }, 0, 1);
Thread.Sleep(100);
var response = sp.ReadExisting();
if (response.Contains("ERROR"))
{
MessageBox.Show("Sending fialed", "Message", MessageBoxButtons.OK, MessageBoxIcon.Stop);
MessageBox.Show(response);
}
else
{
MessageBox.Show("Message sent", "Message", MessageBoxButtons.OK, MessageBoxIcon.None);
}
sp.Close();
}
catch (Exception ex)
{
}
}
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论