Android phone Functions

Source: Internet
Author: User

Part 1Phone numberFunctionOverview
AndroidThe radio interface layer (RIL) provides an abstraction layer between the telephone service and the radio hardware.
Radio interface layer RIL (radio interface layer)DataReliable transmission, at command transmission, and responseAnalysis.ApplicationThe processor communicates with the wireless communication module with the GPRS function through the AT command set.
Invented by Hayes, at Command is a modem command language used by a modem manufacturer. Each command starts with the letter ".

Java framework
CodePath:
Frameworks/base/telephony/Java/Android/Telephony
Android. telephony and Android. telephony. GSM

Core native:
In the hardware/RIL directory, provides local code for RIL support, including fourFileClip:
Hardware/RIL/include
Hardware/RIL/libril
Hardware/RIL/reference-RIL
Hardware/RIL/rild

Kernel Driver
InLinuxThe kernel driver provides related drivers.ProgramCan be built on UART, sdio, USB, and other high-speed serial bus.

Part 2 telephone Functions
Hardware/RIL/include/telephony/ The RIL. h file in the directory is the basic header file of the RIL part.
Where Definition The structure ril_radiofunctions of is as follows:
Typedef struct {
Int version;
Ril_requestfunc onrequest;
Ril_radiostaterequest onstaterequest;
Ril_supports supports;
Ril_cancel oncancel;
Ril_getversion getversion;
} Ril_radiofunctions;
Ril_radiofunctions contains several Function Pointer struct, which is actually a port layer interface. After the implementation of the lower-layer library, the rild daemon obtains these function pointers and executes the corresponding functions.
The prototype of several function pointers is:
Typedef void (* ril_requestfunc) (INT request, void * data,
Size_t datalen, ril_token t );
Typedef ril_radiostate (* ril_radiostaterequest )();
Typedef int (* ril_supports) (INT requestcode );
Typedef void (* ril_cancel) (ril_token t );
Typedef const char * (* ril_getversion) (void );
The most important function is onrequest (), which is a function executed by the request.

2.1 rild daemon
The rild daemon file containsHardware/RIL/rildDirectory, which contains two files: rild. C and radiooptions. C.CompileGenerate an executable program inSystemThe installation path of is:
/System/bin/rild
Rild. c is the entrance of this daemon. It has the main function entry. The Execution Process converts the request to the at command.CharacterString to the underlying hardware. InRunDuring the process, use dlopen to open the path to/system/lib/named libreference-ril.soDynamicLibrary, and then extract the ril_init symbol to run.
The ril_init symbol is a function pointer. After executing this function, a ril_radiofunctions type pointer is returned. After obtaining the pointer, call the ril_register () function, register the pointer to the libril library, and enter the loop.
In fact, this daemon provides a framework for application processing, and the specific features are all done in libril. So and libreference-ril.so.

2.2 libreference-ril.so dynamic library

Libreference-ril.so dynamic library path is:
Hardware/RIL/reference-RIL 
The main files are reference-ril.c and atchannel. C. This library must implement a function named ril_init. The result of this function is to return a pointer to the ril_radiofunctions struct, pointing to the function pointer.
This library needs to createThreadTo execute the actual function. During execution, the Library opens a/dev/ttysxxx terminal (the terminal name is passed in from the upper layer), and then uses the terminal to control hardware execution.

2.3 libril. So dynamic library
The Directory of the libril. So library is:
Hardware/RIL/libril
The main file is RIL. cpp. The following interfaces must be implemented in this library:
Ril_starteventloop (void );
Void ril_setcallbacks (const ril_radiofunctions * callbacks );
Ril_register (const ril_radiofunctions * callbacks );
Ril_onrequestcomplete (ril_token T, ril_errno E, void * response, size_t responselen );
Void ril_onunsolicitedresponse (INT unsolresponse, void * data,
Size_t datalen );
Ril_requesttimedcallback (ril_timedcallback callback, void * Param,
Const struct timeval * relativetime );
These functions are also called by the rild daemon. Different vendors can implement these interfaces in their own ways to ensure that RIL can be transplanted to different systems. Here, the ril_register () function registers the external ril_radiofunctions struct into this library and calls the corresponding function at the appropriate time. During execution, this database processes some functions that convert requests to strings.

Android content:

    • How does Android implement vertical alignment for multiple lines of edittext (text area )?
    • How does Android align all views on the screen to the right?
    • How to display buttons in one row in Android
    • How does Android Add a Custom button status?
    • SMS sending and receiving in Android

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.