简体   繁体   English

如何在Android中执行AT命令?

[英]How to execute AT commands in Android?

Is it possible to execute AT commands on my Android phone? 可以在我的Android手机上执行AT命令吗? I want to extract layer-3 signaling information about the serving GSM network (MTP-3, RRC, ARFCN, channel type, RxQual, RxLev, etc). 我想提取有关服务GSM网络(MTP-3,RRC,ARFCN,信道类型,RxQual,RxLev等)的第3层信令信息。 I did a lot of Google search but couldn't find anything useful. 我做了很多Google搜索,但找不到任何有用的东西。 Android telephony API seems very restrictive (only CGI, LAI, signal strength, etc) can be obtained. Android电话API似乎非常严格(只能获取CGI,LAI,信号强度等)。 It is unreliable too, for example, getBitErrorRate() always returns -1, even in dedicated mode. 这也不可靠,例如,即使在专用模式下, getBitErrorRate()始终返回-1。 I read somewhere that it is possible to snoop-out some low level system information from UART interface between application processor (hosting Android OS) and baseband processor (hosting basic telephony applications). 我在某处读到,可以从应用程序处理器(托管Android OS)和基带处理器(托管基本电话应用程序)之间的UART接口中侦听一些低级系统信息。 But I'm really not sure how to do that! 但是我真的不确定该怎么做! Sorry, if the question seems out of place, but I'm hoping to get a workaround. 抱歉,如果问题似乎不合时宜,但我希望能找到一种解决方法。 I'm willing to root my phone! 我愿意扎根我的手机!

First of all try to find information about invoking AT commands through adb interface. 首先,尝试查找有关通过adb接口调用AT命令的信息。

Then if you get satisfying results you can root your phone and try to get the same results using code like this: 然后,如果您获得满意的结果,则可以将您的手机扎根并尝试使用如下代码获得相同的结果:

Process process = Runtime.getRuntime().exec("su -c " + command);

Where command is exactly the same you invoked in adb interface. where 命令与您在adb接口中调用的命令完全相同。

Monitor both: 监视两个:

process.getInputStream();
process.getErrorStream();

for the result of the command. 命令的结果。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM