Sdílet prostřednictvím


Using The Radio Interface Layer

 

I was recently talking with a colleague about the RIL Proxy and it occurred to me that this component isn't well known and is pretty confusing.  I've been digging into the RIL Proxy for a little while now so I've become pretty comfortable with it, so I thought I'd write a blog that introduces RIL Proxy, then build up to more in-depth blogs on how to debug radio problems using RIL Proxy logging.  This first article is just the high level introduction targeted at people who may have heard of RIL Proxy but haven't worked with it.

 

Overview of RIL

The Radio Interface Layer (RIL) is an abstraction layer that enables clients to interact with the cellular radio on Windows Mobile (WM) devices.  The RIL is split into two main components:  the RIL Proxy (Ril.dll), and the RIL Driver (he filename of the driver changes from BSP to BSP, but the default name is RilGsm.dll or RilCdma.dll).  The RIL Driver is device specific, so clients should avoid calling directly into the driver.  The RIL Proxy layer sits on top of the RIL Driver and provides standard APIs that a client can use to interact with the hardware.

 

The RIL Proxy is a pass through layer who's main jobs are to provide notifications of cellular radio changes and coordinate cellular radio related requests from multiple clients.  Since the it's just a pass through layer, the RIL Proxy doesn't store any state information about the radio or maintain any hardware configurations.  There are several components that sit on top of RIL Proxy and abstract radio functionality even further to simplify specific tasks.  For example, the SIM Manager provides APIs for reading and writing contact information from/to a SIM card.  However, these components are outside the scope of this document; for more information on the components built on top of the RIL Proxy, consult the "RIL Architecture" section of the Windows Mobile 6.0 documentation.

RIL Architecture

 RIL Proxy is a notification based component.  To enable RIL Proxy to communicate with an application, each application must register with the RIL Proxy by calling RIL_Initialize().  This API creates a unique instance of a RIL client which the app can interact with directly.  An application can create multiple RIL clients by calling RIL_Initialize() multiple times, but there's no real benefit to doing this so it's rarely done.   When a RIL client is initialized, the application passes the client two callback functions and subscribes to specific classes of notifications.

 

Notification Callback

The first callback function registered with RIL Proxy client is used to receive and process unsolicited notifications.  These notifications are generated by the RIL Proxy when the radio or cellular states change.  A notification for a particular state change is only sent to a client if the client has subscribed to receive that class of notifications.  For example, if the client has registered to receive the RIL_NCLASS_NETWORK class of notifications, then it will receive the notification RIL_NOTIFY_REGSTATUSCHANGED  when the cellular radio registers or deregisters on a cellular network.

 

Async Results Callback

The second callback function registered with the client is response callback.  This callback is used to asynchronously pass data to the application.  A majority of the functions exported by the RIL Proxy are asynchronous, so no actual data is returned by the API.  Instead, the API queues a command with the RIL Driver and returns a command ID.  After the command has been processed by the driver, the response callback function is called and given the HRESULT of the command, the command ID, and any requested data.  Apps can have multiple commands outstanding and they can differentiate between the responses by matching the command ID for each response, but, for simplicity, most apps issue RIL requests serially so the command ID isn't necessary in these cases.

Untitled picture.png

Comments

  • Anonymous
    August 01, 2007
    Thanks for this post, very educational!

  • Anonymous
    October 16, 2007
    Hi, My question is regarding the usage of RIL_Initialize: If i say RIL_Initialize(1, RilResponseCallback, RilNotificationCallback, RIL_NOTIFY_REGSTATUSCHANGED, NULL, &g_hRil); is the RilNotificationCallback only for RIL_NOTIFY_REGSTATUSCHANGED or all network-related notification under RIL_NCLASS_NETWORK ? So, in effect can I register for only one specific notification such that the callback is not called for any other under the same notification class ? Thanks.

  • Anonymous
    December 27, 2007
    Does Windows Mobile 6.0 supports Secondary PDP context handling in RIL proxy ? What RIL functions one should call to activate secondary PDP context if network supports it ?

  • Anonymous
    December 27, 2007
    Does Windows Mobile 6.0 supports Secondary PDP context handling in RIL proxy ? What RIL functions one should call to activate secondary PDP context if network supports it ?

  • Anonymous
    January 06, 2008
    hi all Can you tell how we can pass the Traffic Flow Templates(TFT) and Quality of Service (QoS) in RIL  via Connection Manager and How will RIL Handle Using Secondary PDP Context if it supports ? -Thanks

  • Anonymous
    June 18, 2008
    Hello. My device is a Ubiquio 401(Gsmart slider). This device have bugs with GSM signal(missing calls in sleep mode). But when i use Gsmart i64 rom, i dont have GSM bugs. I see that i64 ROM have a dll called rilgsm_MO190.dll . Gsmart original ROM dont have this file. But i cannot use i64 ROM, because I have bad screen orientation (-180º). How to replace sucefull gsmart GSM modules with i64 modules to solve this issue?? I try to overwrite and replace registry but are unsucefull.

  • Anonymous
    June 24, 2008
    Hello. I have a such problem. After RIL_Initialize(1, RilResponseCallback, RilNotificationCallback, RIL_NOTIFY_REGSTATUSCHANGED, NULL, &g_hRil); I catch event by RilNotificationCallback, but not so long as i need :). Its seems to me that Ril.dll is close my connection or hang. I havent idea about a reason`s, Did you face it when "have been digging into the RIL Proxy".

  • Anonymous
    July 27, 2009
    Did RIL responsible for the coding of send SMS( like enable or disable Unicode)?

  • Anonymous
    January 31, 2010
    I'd like to know if the ril functions can be applied on very low end phones such as the nokia 1200 serie. I'm working on a project for locating my callers using windows mobile. thanks