如何在C#中使用AT命令

发布于 2024-10-03 19:51:49 字数 181 浏览 0 评论 0原文

我尝试使用此代码通过 C# 向 GSM 调制解调器或手机发送命令,但它不起作用!谁能告诉我我应该做什么?

SerialPort sp = new SerialPort();
sp.PortName = "COM42";
sp.Open();
sp.Write("ATD09364191752");

I tried to send commands to a GSM modem or phone with C# using this code but it`s not working! Can anybody tell me what should I do ?

SerialPort sp = new SerialPort();
sp.PortName = "COM42";
sp.Open();
sp.Write("ATD09364191752");

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

过期情话 2024-10-10 19:51:49
  1. 您没有在 ATD 命令后写入换行符。 (我认为您必须这样做。)
  2. 您没有调用 sp.Flush(),因此该命令可能会卡在缓冲区中。尝试在 Write() 调用之后添加此调用。
  1. You are not writing a newline after the ATD command. (I think you have to.)
  2. You don't call sp.Flush(), so the command may be getting stuck in a buffer. Try adding this call after the Write() call.
巡山小妖精 2024-10-10 19:51:49

您依赖于波特率、握手协议等的所有默认设置。您可能需要检查有关这些的调制解调器文档。

You are relying on all default settings for baud-rate, handshake protocols etc. You may want to check the modem docs about those.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文