RIL. Java Class Analysis in Android froyo framework

Source: Internet
Author: User

This class is used to communicate with the RIL Layer

For example, if I want to answer a call and call the method in RIL. Java layer by layer, MCT. acceptcall (Message result)

929 public void
930 acceptcall (Message result ){
931 rilrequest rr
932 = rilrequest. Obtain (ril_request_answer, result );
933
934 if (rilj_logd) riljlog (RR. serialstring () + ">" + requesttostring (RR. mrequest ));
935
936 send (RR );
937}
First Form a ril request, pay attention to the ril_request_answer in it, this is a signal name, and then call send (RR );

2072 private void
2073 send (rilrequest RR ){
2074 message MSG;
2075
2076 MSG = msender. obtainmessage (event_send, RR );
2077
2078 acquirewakelock ();
2079
2080 msg. sendtotarget ();
2081}
This function sends the RIL request to msender. It is an rilsender class object used to send the RIL request. It also has an rilsender class to receive the following RIL response.

Rilsender extends handler implements runnable

Call handlemessage () after receiving event_send Information ()

Mrequestslist. Add (RR); Save the request to the request list, so that when the rilreceiver receives the response, find the request for notification.

Data = RR. MP. Marshall (); converts requests into word throttling

S. getoutputstream (). Write (data); write requests to the socket

 

In the rilpolicer class

520 (;;){
521 parcel P;
522
523 length = readrilmessage (is, buffer );
524
525 if (length <0 ){
526 // end-of-stream reached
527 break;
528}
529
530 P = parcel. Obtain ();
531 P. unmarshall (buffer, 0, length );
532 P. setdataposition (0 );
533
534 // log. V (log_tag, "Read packet:" + Length + "bytes ");
535
536 processresponse (P );
537 P. Recycle ();
538}
Continuously read data from the socket, structure the parcel object P, and call processresponse (p) to process the response. If the response is received, processsolicited (P) is called effectively );

Locate the original request, that is, the rilrequest object, and delete it from the request list according to serial = P. readint ();

Find the RR. mrequest is ril_queset_anser for processing, and then

2264 asyncresult. formessage (RR. mresult, null, TR );
2265 RR. mresult. sendtotarget ();
This completes the entire process.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.