如何调制解调​​器code聊到Android code [英] How does Modem code talk to Android code

查看:111
本文介绍了如何调制解调​​器code聊到Android code的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道Android的调制解调器code会怎么称呼/传递消息到Android应用层高层的想法。假设我们以短信为例。如果网络发送短信和调制解调器(说高通C $ C $Ç解析它)它是如何传播到Android应用层?

I would like to know high level idea of how Android Modem code will call/pass message to Android application layer. Say we take SMS for example. If network sends SMS and Modem (say Qualcomm C code parses it) how is it transmitted to Android Application layer?

时总是有一个JNI调用发生?作为调制解调器和Android之间的接口?能否请您与我们分享的信息。谢谢

Is there always a JNI call happening? as interface between modem and Android? Can you please share the information with us. Thanks

推荐答案

在几乎在AOSP / CAF / CM源中找到所有的Andr​​oid源代码库(Android开源项目,codeAurora论坛,分别的CyanogenMod),将有C $ C $称为C在 RILD ,(无线接口层守护进程)。这通常是在 /硬件/源代码树的RIL 中找到。

In almost all android source base as found in the AOSP/CAF/CM source (Android Open Source Project, CodeAurora Forum, Cyanogenmod respectively), will have C code called the rild, (Radio Interface Layer Daemon). This is commonly found within the /hardware/ril of the source tree.

该守护的那一刻起Android的启动时运行,并创建了一个名为插座的/ dev /插座/ RILD 的/ dev /插座/ RILD -debug 。将有一个专有的库来自高通,宏达电,这被动态地在运行时在启动时加载的到来。它是专有的库,它反过来,连通到无线电固件。而在 RILD 的挂钩的回调到专有库设在那里,然后。

This daemon runs from the moment Android boots up, and creates a socket called /dev/socket/rild and /dev/socket/rild-debug. There will be a proprietary library coming from Qualcomm, HTC, that gets dynamically loaded at run time upon boot. It is that proprietary library that in turn, communicates to the radio firmware. And the rild's hooks for the call-backs into the proprietary library is established there and then.

RILD 层,通过上述的插槽中,是如何在Android层(源树中找到框架/基/电话/ COM /安卓/内部/电话/ RIL.java )进行通信。

At the rild layer, via the aforementioned socket, is how the Android layer (found in the source tree, frameworks/base/telephony/com/android/internal/telephony/RIL.java) communicates.

在Java方面,它打开插座进行读/写,以及建立的目的和建立代表广播/通过该接口接收事件。

On the Java side, it opens the socket for reading/writing, along with establishing intents and setting up delegates for broadcasting/receiving events via this socket.

例如,来电,私有软件库,调用回调挂钩的设立 RILD 。在 RILD 写入标准的通用海耶斯调制解调器命令到插座,在Java端,它读取和跨$ P $点调制解调器命令,并从那里, PhoneManager 的广播 CALL_STATE_RINGING ,其中的电话的应用程序(在源代码中找到包/应用程序/电话 )注册了一个接收器和的kickstart的用户界面,这就是你如何去接听电话。

For example, an incoming call, the proprietary library, invokes a callback hook as set up by rild. The rild writes standard generic AT Hayes modem commands to the socket, on the Java side, it reads and interprets the modem commands, and from there, the PhoneManager broadcasts CALL_STATE_RINGING, in which Phone application (found in the source packages/apps/Phone) has registered a receiver and kickstarts the User interface, and that is how you get to answer the call.

另外一个例子,拨出电话,你拨一个号码在Android上,意图被创建并反过来的 PhoneManager 的(的这是这一切的根源 ,在这里,不记得我的头顶,认为它在框架/基/核心/ Java的某处的源代码树中)接收的意图,将它转换成AT贺氏调制解调器命令的任一个序列,写出来的插座,在 RILD ,然后调用回调的专有库,继而委托给无线固件的专利库。

Another example, making an outgoing call, you dial a number on Android, the intent gets created and which in turn the PhoneManager (This is the root of it all, here, cannot remember top of my head, think its in frameworks/base/core/java somewhere in the source tree) receives the intent, convert it into either a sequence of AT Hayes modem commands, write it out to the socket, the rild then invokes a callback to the proprietary library, the proprietary library in turn delegates to the radio firmware.

最后一个例子,发送短信,信息的(在包/应用程序发现/彩信源代码树)的应用程序,您键入的文本,被推搡到一个意向,在 PhoneManager 的接收意向,利用7位GSM字母文字到GSM-CN codeD转换(IIRC),被写入到插座,< STRONG> RILD 依次调用回调私有软件库,私有软件库又委托给无线固件和文字现在已经离开了手机的领域,并在电波的地方... :)沿在与Android的自身发送广播消息,但 READ_PHONE_STATE 许可使用,并指定在的Andr​​oidManifest.xml

Final example, sending text messages, from the Messaging (found in packages/apps/Mms source tree) application, the text you type, gets shoved into an intent, the PhoneManager receives the intent, converts the text into GSM-encoded using 7-bit GSM letters (IIRC), gets written out to the socket, the rild in turn invokes a callback to the proprietary library, the proprietary library in turn delegates to the radio firmware and the text has now left the domain of the handset and is in the airwaves somewhere... :) Along with sending a broadcast message within Android itself, provided that READ_PHONE_STATE permission is used and specified in the AndroidManifest.xml.

同样相反地,当接收文本消息时,它是在反向,无线电固件接收一些字节,专有库调用回调到 RILD 下,并且因此写出字节到插座。在Java方面,它读取,和去codeS字节序列,将其转换为文本,因为我们知道,火灾有消息广播收到通知。在信息的依次应用中,注册了接收器该广播,并发送一个意图通知栏说类似从+ XXXXXX 的收到的新邮件

Likewise conversely, when receiving a text message, it is in the reverse, radio firmware receives some bytes, the proprietary library invokes the callback to the rild, and thus writes out the bytes to the socket. On the Java side, it reads from it, and decodes the sequence of bytes, converts it to text as we know of, fires a broadcast with a message received notification. The Messaging application in turn, has registered receivers for the said broadcast, and sends an intent to the notification bar to say something like "New message received from +xxxxxx"

的意图被发现在框架/基/电话/的Java / COM /安卓/内部/电话/ TelephonyIntents.java

这是的电话系统是如何工作的要点,真正的美,它使用普通的AT贺氏调制解调器命令正是如此简化和隐藏真正的私有的机制。

That is the gist of how the telephony system works, the real beauty is, that it uses generic AT Hayes modem commands thusly simplifying and hiding the real proprietary mechanisms.

至于高通的喜欢,HTC,忘掉它,以为他们会永远开源,因为无线电话层嵌入在SoC(片上系统)电路中的库有问题!

As for the likes of Qualcomm, HTC, forget about it in thinking they'd ever open source the library in question because the radio telephony layer is embedded within the S-o-C (System on a Chip) circuitry!

这也是作为一个侧面说明,为什么它的危险的闪无线固件,一些手机提供了这样做的能力,闪了错误的固件(如不兼容的或不适合的手机),亲吻手机睦邻再见,并用它作为一个门顶或纸张的重量! :)

Which is also, as a side note, why its risky to flash radio firmware, some handsets provide the capability to do it, flash the wrong firmware (such as an incompatible or not suitable for handset), kiss the handset good-bye and use that as a door stopper or paper-weight! :)

应当指出,有涉及零JNI机制。

It should be noted, that there is zero JNI mechanisms involved.

这是从我的它是如何工作的,从我可以告诉的就是这个,无线电固件加载到内存地址的地方在那里Linux内核预留的地址空间,不动它,有点像回到了理解旧的PC日子DOS启动了,出现了使用的BIOS保留地址,我想,它同样在这里,标记为保留通过固件被占用的地址,而专有的无线库会谈,以它 - 因为库在内核拥有的地址空间运行,由根与根权限拥有一拉,就可以说话吧,如果你想使用偷看旧BASIC方言戳,我猜你会不会离谱那里,写字节一定的顺序到该地址,就可以了无线电固件的行为,几乎就像有一个中断向量表......这猜这里它是如何工作的。 :)

This is from my understanding of how it works, from what I can tell is this, the radio firmware is loaded into a memory address somewhere where the linux kernel has reserved the address space and does not touch it, something like back in the old PC days when DOS booted up, there was reserved addresses used by the BIOS, I think, its similar here, the addresses marked as reserved are occupied by the firmware, in which the proprietary radio library talks to it - and since the library is running in the address space owned by the kernel, a lá owned by root with root privileges, it can "talk" to it, if you think of using the old BASIC dialect of peek and poke, I'd guess you would not be far off the mark there, by writing a certain sequence of bytes to that address, the radio firmware acts on it, almost like having a interrupt vector table... this am guessing here how it works exactly. :)

这篇关于如何调制解调​​器code聊到Android code的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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