在 Android 手机上使用 AT 命令 [英] Using AT commands with an Android phone

查看:94
本文介绍了在 Android 手机上使用 AT 命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个程序,该程序能够使用 AT 命令从我的 Android 手机中的 GSM 调制解调器发送和接收数据.

I'm writing a program that is able to send and receive data from the GSM modem in my Android phone with AT commands.

我执行以下 shell 脚本:

I execute the following shell script:

su
echo -e "AT+CSQ?
" > /dev/smd0
cat /dev/smd0 > /dev/asd.txt

asd.txt 文件已创建,但其中没有任何内容(它应该写出信号强度).看起来它挂在 cat 命令上,我想是因为它没有得到任何输出.我尝试了一些其他命令,但到目前为止我没有运气.你能推荐什么吗?

The asd.txt file is created, however there is nothing in it (it should write out the signal strength). It looks like it hangs at the cat command, I think because it doesn't get any output. I've tried some other commands, but I had no luck so far. Can you recommend anything?

推荐答案

您可以尝试使用 atinout程序,它应该像下面这样:

You can try to use the atinout program, it should behave like the following:

$ echo AT+CSQ | atinout - /dev/smd0 -
AT+CSQ
+CSQ: <rssi>,<ber>

OK
$

Run as ... -/dev/smd0/dev/asd.txt 如果你想像你的代码一样捕获结果.请注意,您应该运行 AT+CSQ,而不是 AT+CSQ?.

Run as ... - /dev/smd0 /dev/asd.txt if you want to capture the results like in your code. Notice that you should run AT+CSQ, not AT+CSQ?.

(atinout-0.9.tar.gz中的Makefile需要稍微改动编译,git源码就可以了)

(the Makefile in atinout-0.9.tar.gz needs a small change to compile, the git source is fine).

这篇关于在 Android 手机上使用 AT 命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆