上一篇有提到rild,这里作我我的的理解来分析rild:
参考达人B的文章,连接:http://blog.csdn.net/qitaosong/article/details/5069823 html
1.rild.c结构: java
2.各个函数分析: android
2.1>RIL_register
extern void RIL_register (const RIL_RadioFunctions *callbacks);
该函数在ril.cpp里有实现,RIL_RadioFunctions 在ril.h里定义为: socket
typedef struct { int version; /* set to RIL_VERSION */ RIL_RequestFunc onRequest; RIL_RadioStateRequest onStateRequest; RIL_Supports supports; RIL_Cancel onCancel; RIL_GetVersion getVersion; } RIL_RadioFunctions;其中onRequest,指令请求会在reference-ril.c里实现:
2.2>RIL_onRequestComplete
extern void RIL_onRequestComplete(RIL_Token t, RIL_Errno e,void *response, size_t responselen)、RIL_onUnsolicitedResponse、
RIL_requestTimedCallback和RIL_startEventLoop函数同上,都在ril.cpp里有实现。 函数
2.3>main(守护进程) oop
编译以后是个rild可执行文件,在/init.rc里面打开rild服务,会随系统一块儿运行。
1>首先和phone.apk服务创建socket链接,句柄为fd: spa
fd = socket_local_client( QEMUD_SOCKET_NAME, ANDROID_SOCKET_NAMESPACE_RESERVED, SOCK_STREAM );
2>加载/system/lib/libreference-ril.so动态库
dlHandle = dlopen(rilLibPath, RTLD_NOW); .net
3>启动eventLoop线程,开始执行RIL消息队列 线程
http://blog.csdn.net/hare_lee/article/details/6903460 调试
http://blog.csdn.net/fengkehuan/article/details/6203076
(ril_commands.h)
http://blog.csdn.net/ace1985/article/details/7051522
http://blog.csdn.net/hare_lee/article/details/6903962
http://blog.csdn.net/qitaosong/article/details/5069823
http://www.eoeandroid.com/thread-109142-1-1.html