{"id":498,"date":"2012-02-06T10:00:29","date_gmt":"2012-02-06T04:30:29","guid":{"rendered":"http:\/\/www.e-consystems.com\/blog\/android\/?p=498"},"modified":"2023-08-15T12:34:27","modified_gmt":"2023-08-15T07:04:27","slug":"ril","status":"publish","type":"post","link":"https:\/\/www.e-consystems.com\/blog\/system-on-module-som\/ril\/","title":{"rendered":"Android RIL Architecture"},"content":{"rendered":"<p><strong>Introduction<\/strong><\/p>\n<p>The document explains about the building blocks of Android telephony and how it works<\/p>\n<p><strong>Android telephony  architecture<\/strong><\/p>\n<figure style=\"width: 536px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.e-consystems.com\/images\/blog\/RIL-blog-Img1.jpg\"><img decoding=\"async\" loading=\"lazy\" title=\"Android RIL Architecture\" src=\"https:\/\/www.e-consystems.com\/images\/blog\/RIL-blog-Img1.jpg\" alt=\"Android RIL Architecture\" width=\"536\" height=\"722\" \/><\/a><figcaption class=\"wp-caption-text\">Android RIL Architecture<\/figcaption><\/figure>\n<p>&nbsp;<\/p>\n<p>Application:\u00a0 All the  telephony related applications like Dialer, Call tracker, SMS, MMS, GPRS,  Antenna signal indicator and etc, will come into this section. All these  applications will be started during the android boot up. These applications  will be tied up with the Android telephony framework services. The telephony  framework provides APIs to access the Phone.<\/p>\n<p>Framework services: Telephony framework will be initialized and  started during the system start up. All the queries from the application  through API will directed to the Radio interface Layer of Android by these  services. The service will keep tracking of all the unsolicited commands from  the modem. Unsolicited commands are the commands initiated from the modem.<\/p>\n<p>Radio Interface Layer: It is the bridge between Android  phone framework services and the hardware. In other words, it is the protocol  stack for Telephone.\u00a0 The RIL consist of  two primary components.<\/p>\n<ol>\n<li>RIL Daemon<\/li>\n<li>Vendor RIL<\/li>\n<\/ol>\n<p><strong>RIL Daemon <\/strong><\/p>\n<p>RILD will be initialized during the Android system start up.  It will read the system property to find which library has to be used for  Vendor RIL, provide the appropriate input for vendor RIL and finally calls  RIL_Init function of Vendor RIL to map all the Vendor RIL functions to the  upper layer. Each vendor RIL has RIL_Init function.<\/p>\n<p><strong>Vendor RIL<\/strong><\/p>\n<p>It is a library specific to each modem. In other words, we  can call it as a driver to function the modem. The RIL daemon will call the  RIL_Init function with the device location (eg: \/dev\/ttyS0). It will initiate  the modem and returns theRIL_RadioFunctions structure contains the handles of  radio functions<\/p>\n<p>&nbsp;<\/p>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"6\" width=\"420\">\n<tbody>\n<tr>\n<td valign=\"middle\">\n&nbsp;<br \/>\n&nbsp;&nbsp;type structure {<\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;intRIL_version;<\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RIL_RequestFunconRequest;<\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RIL_RadioStateRequestonStateRequest;<\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RIL_Supports  supports;<\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RIL_CancelonCancel;<\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RIL_GetVersiongetVersion;<\/p>\n<p>&nbsp;&nbsp;} RIL_RadioFunctions;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p><em>RIL_version<\/em> : Version of Android RIL<\/p>\n<p><em>onRequest<\/em> : Call to Vendor RIL to make a  RIL_REQUEST. It must be completed with a call to RIL_onRequestComplete().It will  always be called from the same thread, so returning here implies that the radio  is ready to process another command (whether or not the previous command has  completed)<\/p>\n<p>supports\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 :  Return current radio state.RADIO_STATE_UNAVAILABLE should be the initial state<\/p>\n<p>getVersion\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 :  Version of Vendor RIL<\/p>\n<p>There are two forms of communications in Android RIL<\/p>\n<p><strong><em>Solicited Commands :<\/em><\/strong>These are commands initiated from the upper  layer. Like, <em>Dialing\/Send SMS<\/em> are the  solicited commands from the upper layer to the RIL. <em>OnRequest<\/em>is the function for sending the solicited commands from  the upper layer<\/p>\n<p>The following diagram describes the solicited call in Android<\/p>\n<figure style=\"width: 353px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.e-consystems.com\/images\/blog\/RIL-blog-Img2.jpg\"><img decoding=\"async\" loading=\"lazy\" title=\"Solicited call in Android\" src=\"https:\/\/www.e-consystems.com\/images\/blog\/RIL-blog-Img2.jpg\" alt=\"Solicited call in Android\" width=\"353\" height=\"462\" \/><\/a><figcaption class=\"wp-caption-text\">Solicited call in Android<\/figcaption><\/figure>\n<p>&nbsp;<\/p>\n<p>Each onRequest call should end with RIL_onRequestComplete.  It is to send the response for the previous onRequest and to intimate we are  ready for the next command. Refer <em>ril.h<\/em> for all the solicited commands<\/p>\n<p><strong>Unsolicited commands<\/strong><\/p>\n<p>These are the commands initiated from the modem to the upper  layer. Like, Receive Call \/Receive SMS are the commands. The Vendor RIL has to  continuously monitor the device for unsolicited command from the modem.<\/p>\n<p>The following diagram describes the unsolicited call in Android<\/p>\n<figure style=\"width: 338px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.e-consystems.com\/images\/blog\/RIL-blog-Img3.jpg\"><img decoding=\"async\" loading=\"lazy\" title=\"Unsolicited call in Android\" src=\"https:\/\/www.e-consystems.com\/images\/blog\/RIL-blog-Img3.jpg\" alt=\"Unsolicited call in Android\" width=\"338\" height=\"443\" \/><\/a><figcaption class=\"wp-caption-text\">Unsolicited call in Android<\/figcaption><\/figure>\n<p>&nbsp;<\/p>\n<p><strong>Implementation of Vendor RIL<\/strong><\/p>\n<p>Android is providing the basic vendor RIL with minimum  feature set (reference-ril). It is good to start with that reference code. Compile  the Vendor RIL as a shared library with the following style<\/p>\n<p>libril-&lt;companyname&gt;-&lt;RIL version&gt;.so<\/p>\n<p>libril \u2013 all the Vendor ril library should start with this<\/p>\n<p><strong>Vendor RIL  Configuration <\/strong>: Replace the following line in the init.rc file<\/p>\n<p>serviceril-daemon \/system\/bin\/rild<\/p>\n<p>with<\/p>\n<p>serviceril-daemon \/system\/bin\/rild -l  \/system\/lib\/libreference-ril.so &#8212; -d\/dev\/ttySx<\/p>\n<p>Commands after \u201c&#8211;&#8221; will be input for Vendor ril.<\/p>\n<p><strong>Here is sample log of  Sending a SMS<\/strong><\/p>\n<p>D\/SMS\u00a0\u00a0\u00a0\u00a0 ( 1962): SMS  send size=0time=1319439322559<\/p>\n<p>D\/RILJ\u00a0\u00a0\u00a0 ( 1962):  [0312]&gt; SEND_SMS<\/p>\n<p>D\/RIL\u00a0\u00a0\u00a0\u00a0 ( 1814):  onRequest: SEND_SMS<\/p>\n<p>D\/AT\u00a0\u00a0\u00a0\u00a0\u00a0 ( 1814):  MUX[primary]: AT&gt; AT+CMGS=14<\/p>\n<p>D\/AT\u00a0\u00a0\u00a0\u00a0\u00a0 ( 1814):  MUX[primary]: AT&lt;&gt;<\/p>\n<p>D\/AT\u00a0\u00a0\u00a0\u00a0\u00a0 ( 1814):  AT&gt; 0001000a814978045948000002c834^Z<\/p>\n<p>D\/AT\u00a0\u00a0\u00a0\u00a0\u00a0 ( 1814):  MUX[primary]: AT&lt; Q: 31,0<\/p>\n<p>D\/AT\u00a0\u00a0\u00a0\u00a0\u00a0 ( 1814):  MUX[primary]: AT&lt; +CUSD: 0,&#8221;Your Last Call charge IS Rs\u00a0 0.5000\u00a0  AND CURRENT Balance IS\u00a0 47.8770  AND EXP IS\u00a0 25\/09\/21. Love Spl 6 Caller  tunes for Jd<\/p>\n<p>D\/RILC\u00a0\u00a0\u00a0 ( 1814):  Unsolicited Response!!!<\/p>\n<p>D\/RILJ\u00a0\u00a0\u00a0 ( 1962):  [UNSL]&lt; UNSOL_ON_USSD 0<\/p>\n<p>D\/AT\u00a0\u00a0\u00a0\u00a0\u00a0 ( 1814):  MUX[primary]: AT&lt; &#8220;,15<\/p>\n<p>D\/AT\u00a0\u00a0\u00a0\u00a0\u00a0 ( 1814):  MUX[primary]: AT&lt; +CMGS: 219<\/p>\n<p>D\/AT\u00a0\u00a0\u00a0\u00a0\u00a0 ( 1814):  MUX[primary]: AT&lt; OK<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<br \/>\n&#8211;<\/p>\n<p>We offer <a href=\"https:\/\/www.e-consystems.com\/SOM-system-on-modules.asp\">System-on-Modules<\/a> based on NXP <a href=\"https:\/\/www.e-consystems.com\/iMX6-som-system-on-module.asp\">iMX6<\/a>, NVIDIA <a href=\"https:\/\/www.e-consystems.com\/tk1-som-tegra-k1-systemonmodule.asp\">Tegra K1<\/a>, TI <a href=\"https:\/\/www.e-consystems.com\/DM3730-som-computer-on-module.asp\">DM3730\/AM3037<\/a>, Marvell <a href=\"https:\/\/www.e-consystems.com\/esom270.asp\">PXA270<\/a> processors. Our ARM Cortex system on modules supports Linux, Android &#038; WinCE. Our system on modules can be used in many applications likes Automation, Medical Imaging, Industrial Control, Remote Date Acquisition, etc. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction The document explains about the building blocks of Android telephony and how it works&#8230;<\/p>\n","protected":false},"author":15,"featured_media":546,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[5,95,102],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.e-consystems.com\/blog\/system-on-module-som\/wp-json\/wp\/v2\/posts\/498"}],"collection":[{"href":"https:\/\/www.e-consystems.com\/blog\/system-on-module-som\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.e-consystems.com\/blog\/system-on-module-som\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.e-consystems.com\/blog\/system-on-module-som\/wp-json\/wp\/v2\/users\/15"}],"replies":[{"embeddable":true,"href":"https:\/\/www.e-consystems.com\/blog\/system-on-module-som\/wp-json\/wp\/v2\/comments?post=498"}],"version-history":[{"count":16,"href":"https:\/\/www.e-consystems.com\/blog\/system-on-module-som\/wp-json\/wp\/v2\/posts\/498\/revisions"}],"predecessor-version":[{"id":1864,"href":"https:\/\/www.e-consystems.com\/blog\/system-on-module-som\/wp-json\/wp\/v2\/posts\/498\/revisions\/1864"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.e-consystems.com\/blog\/system-on-module-som\/wp-json\/wp\/v2\/media\/546"}],"wp:attachment":[{"href":"https:\/\/www.e-consystems.com\/blog\/system-on-module-som\/wp-json\/wp\/v2\/media?parent=498"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.e-consystems.com\/blog\/system-on-module-som\/wp-json\/wp\/v2\/categories?post=498"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.e-consystems.com\/blog\/system-on-module-som\/wp-json\/wp\/v2\/tags?post=498"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}