Before reading the next article, read these three articles:
Android GSM Driver Module (rild) detailed analysis (I) basic architecture and initialization http://www.bkjia.com/kf/201201/116966.html
Android GSM Driver Module (rild) Detailed Analysis (2) request process http://www.bkjia.com/kf/201201/116967.html
Android GSM Driver Module (rild) detailed analysis (3) response Process http://www.bkjia.com/kf/201201/116968.html
These articles analyze the android GSM, which is the RIL driver. This article is based on this.
In the previous article, http://www.bkjia.com/kf/201/116969.htmlat the very beginning, the framework finally sends information to the underlying layer through socket. A daemon receives information, which is rild. The specific code is under/hardware/ril. The code structure and process are described in the previous three articles. Here, we only use the caller ID settings in call setting to track the complete process of the Code.
Request:
After the framework sends information, the rild process first selects the information and then enters ril. in cpp, listenCallback enters the processCommandsCallback callback function and calls processCommandBuffer. Here, pRI-> pCI-> dispatchFunction is called to process data.
PRI is a CommandInfo structure. The initialization content is in/hardware/ril/libril/ril_commands.h. In the previous article, we talked about how to deal with RIL_REQUEST_SET_CLIR. From {RIL_REQUEST_SET_CLIR, dispatchInts, responseVoid}, we can see that the dispatchFunction to be called is dispatchInts. The dispatchInts function in ril. cpp finally calls s_callbacks.onRequest to process the request. S_callbacks is a RIL_RadioFunctions whose Initialization is in/hardware/ril/reference-ril/reference-ril.c:
Static const RIL_RadioFunctions s_callbacks = {
RIL_VERSION,
OnRequest,
CurrentState,
OnSupports,
OnCancel,
GetVersion
};
The onRequest in the same file processes the information sent from the upper layer. The simple command directly calls at_send_command to send the command to simcard, and the complex points are distributed.
The requestXXX function is used for processing, but the at_send_command is called to write the AT command.
All functions related to at_send_command are in/hardware/ril/reference-ril/atchannel. c. At_send_command->
At_send_command_full-> at_send_command_full_nolock-> writeline. This writeline eventually calls write to write the information to the device.
By the way, how does one deal with RIL_REQUEST_SET_CLIR in onRequest?
Case RIL_REQUEST_SET_CLIR:
// TO DO
Break;
... Why DO? It looks like we have TO write it on our own (I say there are so few android phones ).
After the command is written, the result will be passed out. This is the response process. The article mentioned at the beginning is well written, and I will not go into details here (the code I want is
Not written ...).
Author: liujian885