Libudev 和 AT 命令
我正在搜索如何发送和接收 SMS,并且从如何在 Linux 上执行此操作开始进行了很多搜索。我所找到的只是libudev。我对 C/C++ 很熟悉,所以我希望它适合我。但是我不确定 libudev 是否可以让我连接到电话/调制解调器并允许我发送命令,所以我想在这里问: libudev+AT 命令是一个好的选择吗?如果是的话,我将不胜感激有关如何向 USB 调制解调器/电话发送命令的教程。当然是C/C++ 谢谢
I was searching how to send and receive SMS and I have searched a lot starting with how to do it on Linux. All I have found is libudev. I'm confortable with C/C++ so I hope it will fit me. However I'm not sure if libudev can enable me connect to a phone/modem and allow me send commands, So I though I would ask here:
Is libudev+AT commands a good option? If yes I would appreciate tutorials on how to send command to a USB Modem/Phone. It is C/C++ of course
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
几年前,我写了一个简单的程序,在linux下使用串口发送和接收短信。
我必须格式化 PDU 消息,然后使用标准 AT 命令通过串行端口发送它。
我使用了一个名为 PDUSPY 的有用软件: http://www.nobbi.com/pduspy.html
你可以在google中搜索“PDU SMS format”找到很多信息。
我不认为您需要像 libudev 这样的额外库来访问您的端口。
你为什么不尝试用 minicom 来测试你的 AT 命令和串口呢?
您可以在命令行中输入“dmesg | grep -i tty”列出可用的串行端口。
祝你好运。
Some years ago, I wrote a simple program that send and receive sms using a serial port under linux.
I had to format a PDU message, and then send it throught the serial port using standar AT commands.
I used an useful software called PDUSPY: http://www.nobbi.com/pduspy.html
You can find lot of info searching "PDU SMS format" in google.
I don't believe you need extra libraries like libudev to access your ports.
Why don't you try to play with minicom to test your AT commands an serial ports?.
You can list your available serial ports making a "dmesg | grep -i tty" in the command line.
Good luck.
首先让我澄清一些事情:
/dev
中的所有设备文件节点。所以,回到你的问题。您可以使用 libudev 以编程方式在其他设备中查找调制解调器。在这种情况下,udev 可能会为该设备创建类似
/dev/ttyUSB0
的内容。您还可以使用 udevadm 命令行工具来查询设备。当您拥有正确的设备时,通过串行接口向调制解调器发送命令只需写入该设备文件即可。网络上充满了这样的例子:
Let me first clarify few things:
/dev
.So, back to your question. You can use libudev to find the modem among your other devices programmatically. In this case, udev might have created something like
/dev/ttyUSB0
for that device. You can also useudevadm
command line tool for querying devices.When you've got the right device, sending commands to your modem via serial interface is just a matter of writing to that device file. Web is full of examples of that: