赞
踩
Introduction
RIL Initialization
RIL Interaction
RIL Solicited Command Requests
RIL Unsolicited Commands
Android's Radio Interface Layer (RIL) provides an abstraction layer between Android telephony services (android.telephony ) and radio hardware. The RIL is radio agnostic, and includes support for Global System for Mobile communication (GSM)-based radios.
The diagram below illustrates the RIL in the context of Android's Telephony system architecture.
Solid elements represent Android blocks and dashed elements represent partner-specific proprietary blocks.
The RIL consists of two primary components:
ril.h
that processes all communication with radio hardware and dispatches calls to the RIL Daemon (rild
) through unsolicited commands.Android initializes the telephony stack and the Vendor RIL at startup as described in the sequence below:
rild.lib
path and rild.libargs
system properties to determine the Vendor RIL library to use and any initialization arguments to provide to the Vendor RILRIL_Init
to initialize the RIL and obtain a reference to RIL functionsRIL_register
on the Android telephony stack, providing a reference to the Vendor RIL functionsSee the RIL Daemon source code at //device/commands/rild/rild.c
for details.
There are two forms of communication that the RIL handles:
DIAL
and HANGUP
.CALL_STATE_CHANGED
and NEW_SMS
.The following snippet illustrates the interface for solicited commands:
void OnRequest (int request_id, void *data, size_t datalen, RIL_Token t);
void OnRequestComplete (RIL_Token t, RIL_Error e, void *response, size_t responselen);
There are over sixty solicited commands grouped by the following families:
The following diagram illustrates a solicited call in Android.
The following snippet illustrates the interface for unsolicited commands:
void OnUnsolicitedResponse (int unsolResponse, void *data, size_t datalen);
There are over ten unsolicited commands grouped by the following families:
The following diagram illustrates an unsolicited call in Android.
To implement a radio-specific RIL, create a shared library that implements a set of functions required by Android to process radio requests. The required functions are defined in the RIL header (/include/telephony/ril.h
).
The Android radio interface is radio-agnostic and the Vendor RIL can use any protocol to communicate with the radio. Android provides a reference Vendor RIL, using the Hayes AT command set, that you can use as a quick start for telephony testing and a guide for commercial vendor RILs. The source code for the reference RIL is found at /commands/reference-ril/
.
Compile your Vendor RIL as a shared library using the convention libril-<companyname>-<RIL version>.so
, for example, libril-acme-124.so, where:
Your Vendor RIL must define a RIL_Init function that provides a handle to the functions which will process all radio requests. RIL_Init will be called by the Android RIL Daemon at boot time to initialize the RIL.
RIL_RadioFunctions *RIL_Init (RIL_Env* env, int argc, char **argv);
RIL_Init should return a RIL_RadioFunctions structure containing the handles to the radio functions:
type structure {
int RIL_version;
RIL_RequestFunc onRequest;
RIL_RadioStateRequest onStateRequest;
RIL_Supports supports;
RIL_Cancel onCancel;
RIL_GetVersion getVersion;
}
RIL_RadioFunctions;
ril.h
defines RIL states and variables, such as RIL_UNSOL_STK_CALL_SETUP
, RIL_SIM_READY
, RIL_SIM_NOT_READY
, as well as the functions described in the tables below. Skim the header file (/device/include/telephony/ril.h
) for details.
The vendor RIL must provide the functions described in the table below to handle solicited commands. The RIL solicited command request types are defined in ril.h
with the RIL_REQUEST_
prefix. Check the header file for details.
Name | Description |
| This is the RIL entry point for solicited commands and must be able to handle the various RIL solicited request types defined in
Must be completed with a call to |
| This function should return the current radio state synchronously. |
| This function returns "1" if the specified |
| This function is used to indicate that a pending request should be canceled. This function is called from a separate thread--not the thread that calls On cancel, the callee should do its best to abandon the request and call Subsequent calls to
|
| Return a version string for your Vendor RIL |
The vendor RIL uses the following callback methods to communicate back to the Android RIL daemon.
Name | Description |
|
|
| Call user-specified callback function on the same thread that |
The functions listed in the table below are call-back functions used by the Vendor RIL to invoke unsolicited commands on the Android platform. See ril.h
for details.
Name | Description |
|
|
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。