- Radio Layer Interface
- In this document
- RIL Initialization
- RIL Interaction
- Solicited
- Unsolicited
- Implementing the RIL
- RIL_Init
- RIL Functions
- RIL Solicited Command Requests
- RIL Unsolicited Commands
- Программно-определяемая радиосвязь (SDR) с Android-смартфонами
- Требования к настройке
- Настройка оборудования
- Настройка программного обеспечения
- Загрузить и установить:
- Заметки.
Radio Layer Interface
In this document
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 blocks.
The RIL consists of two primary components:
- RIL Daemon: The RIL daemon initializes the Vendor RIL, processes all communication from Android telephony services, and dispatches calls to the Vendor RIL as solicited commands.
- Vendor RIL: The radio-specific Vendor RIL of ril.h that processes all communication with radio hardware and dispatches calls to the RIL Daemon ( rild ) through unsolicited commands.
RIL Initialization
Android initializes the telephony stack and the Vendor RIL at startup as described in the sequence below:
- RIL daemon reads 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 RIL
- RIL daemon loads the Vendor RIL library and calls RIL_Init to initialize the RIL and obtain a reference to RIL functions
- RIL daemon calls RIL_register on the Android telephony stack, providing a reference to the Vendor RIL functions
See the RIL Daemon source code at //device/commands/rild/rild.c for details.
The following RIL-related system properties are set by the RIL library:
- ro.ril.ecclist : list of valid Emergency Call Codes, for example, 911. Values are read from EF_ECC on the SIM and possibly supplmented by tables based on operator, network, or manufacturing code.
The following RIL_related system properties are available to the RIL library:
- ro.ril.hsxpa : inidcates hsxpa support of target network.
- ro.ril.gprsclass : inidcates GPRS class of target network.
- ro.ril.enable.3g.prefix=1 : adds the 3G prefix to the operator name.
RIL Interaction
There are two forms of communication that the RIL handles:
- Solicited commands: Solicited commands originated by RIL lib, such as DIAL and HANGUP .
- Unsolicited responses: Unsolicited responses that originate from the baseband, such as CALL_STATE_CHANGED and NEW_SMS .
Solicited
The following snippet illustrates the interface for solicited commands:
There are over sixty solicited commands grouped by the following families:
- SIM PIN, IO, and IMSI/IMEI (11)
- Call status and handling (dial, answer, mute…) (16)
- Network status query (4)
- Network setting (barring, forwarding, selection…) (12)
- SMS (3)
- PDP connection (4)
- Power and reset (2)
- Supplementary Services (5)
- Vendor defined and support (4)
The following diagram illustrates a solicited call in Android.
Unsolicited
The following snippet illustrates the interface for unsolicited commands:
There are over ten unsolicited commands grouped by the following families:
- Network status changed (4)
- New SMS notify (3)
- New USSD notify (2)
- Signal strength or time changed (2)
The following diagram illustrates an unsolicited call in Android.
Implementing the RIL
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- — .so , for example, libril-acme-124.so, where:
- libril: all vendor RIL implementations start with ‘libril’
- : a company-specific abbreviation
- : RIL version number
- so: file extension
RIL_Init
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_Init should return a RIL_RadioFunctions structure containing the handles to the radio functions:
RIL Functions
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.
RIL Solicited Command Requests
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 |
---|---|
void (*RIL_RequestFunc) (int request, void *data, size_t datalen, RIL_Token t); | |
RIL_RadioState (*RIL_RadioStateRequest)(); | This function should return the current radio state synchronously. |
int (*RIL_Supports)(int requestCode); | This function returns «1» if the specified RIL_REQUEST code is supported and 0 if it is not. |
void (*RIL_Cancel)(RIL_Token t); | |
const char * (*RIL_GetVersion) (void); | 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 |
---|---|
void RIL_onRequestComplete(RIL_Token t, RIL_Errno e, void *response, size_t responselen); |
|
void RIL_requestTimedCallback (RIL_TimedCallback callback, void *param, const struct timeval *relativeTime); | Call user-specified callback function on the same thread that RIL_RequestFunc is called. If relativeTime is specified, then it specifies a relative time value at which the callback is invoked. If relativeTime is NULL or points to a 0-filled structure, the callback will be invoked as soon as possible. |
RIL Unsolicited Commands
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.
Источник
Программно-определяемая радиосвязь (SDR) с Android-смартфонами
Программно-определяемое радио с Android-смартфонами.
Программно-определяемая радиосвязь (SDR) является одной из важнейших технологий беспроводной связи. Это уникальный тип радиосистемы, которая может настраиваться на любой частотный диапазон. Платформа SDR является общей, то есть одна платформа поддерживает различные сигналы разных частот.
Ранее оборудование SDR предназначалось только для поддержки высококлассных компьютерных систем и настольных компьютеров. Однако с учетом последних достижений в технологии смартфонов и доступности недорогих смартфонов разработчики начали работать над поддержкой SDR для мобильных телефонов.
Ключи RTL-SDR могут легко выполнять функцию приемника SDR с помощью смартфона Android с поддержкой OTG. На рис. 1 показан ключ RTL-SDR, подключенный к смартфону Android.
Рис. 1: настройка RTL-SDR и Android
Ключи RTL-SDR обеспечивают функциональность для приема сигнала в диапазоне частот 25–1,75 ГГц. Система / радиоприемник, разработанная с использованием ключа RTL-SDR, также может быть использована для изучения цифровых коммуникаций студентами, изучающими электронику и коммуникацию.
Ключ RTL-SDR — это в основном ключ приемника сигнала DVB-T / DVB-T2 для просмотра наземных телеканалов. Но разработчики поняли, что чип RTL2832U, присутствующий в этих ключах, также может использоваться в качестве аппаратного обеспечения SDR. Ключ устанавливается в тестовом режиме и действует как приемник SDR. Ключи DVB-T и DVB-T2 показаны на рис. 2.
Антенна, снабженная ключом (см. Рис. 3), подходит для приема сигнала. Он поставляется с магнитным основанием, поэтому его можно установить на металлическую поверхность.
Рис. 3: Антенна, снабженная ключом
Для приложений SDR вы можете использовать любой из двух USB-ключей (показан на рис. 2). Настройка для системы SDR на базе смартфона Android с возможностью приема только сигнала описана в следующих разделах.
Систему SDR и смартфон Android можно использовать для выполнения следующих функций:
1. Ключ SDR может сделать планшет / телефон Android совместимым для приема FM-сигнала и прослушивания FM-трансляций, что полезно для устройств без опции FM.
2. SDR, реализованный с использованием смартфона Android и RTL-SDR, может принимать каналы FM-вещания.
3. Сигнал амплитудной модуляции (АМ) может быть демодулирован с использованием установки между поддерживаемыми частотными диапазонами.
4. Систему SDR можно использовать для получения значений системы радиоданных (RDS) сигналов FM-вещания.
5. Спектр FM-сигнала можно просмотреть с помощью приложения Android.
6. В приложении SDRTouch содержится руководство по устранению неполадок для использования системы Android SDR.
Требования к настройке
1. Android-смартфон (желательно с Android 5 или более поздней версией)
2. USB OTG адаптер
3. RTL-SDR ключ (DVB-T / DVB-T2)
4. Интернет-соединение для загрузки приложений
5. Драйвер RTL-SDR (доступен в PlayStore, разработанном Мартином Мариновым)
6. Приложение SDRTouch (доступно в PlayStore, разработано Мартином Мариновым)
Настройка оборудования
1. Сначала аккуратно подключите адаптер OTG к смартфону Android.
2. Правильно подключите антенну к ключу RTL-SDR.
3. Подключите USB-ключ к OTG-адаптеру.
4. После завершения подключения поместите устройство в подходящее место.
Настройка программного обеспечения
Загрузить и установить:
1. RTL-SDR драйвер от PlayStore
2. Приложение SDRTouch из PlayStore. Это приложение доступно в двух версиях; Тестирование проводилось с использованием бесплатного приложения с ограниченными функциональными возможностями.
3. Приложение SDRoid (бесплатная версия) из PlayStore. Обеспечивает функцию спектра
Экран смартфона с установленным выше программным обеспечением показан на рис. 4.
Рис. 4: Необходимые приложения
Интерфейс приложения SDRTouch показан на рис. 5.
Рис. 5: Интерфейс приложения SDRTouch
На рисунках с 6 по 13 показан интерфейс приложения и основные параметры, доступные в приложениях SDR для смартфонов Android.
Рис. 6: Спектр в приложении SDRTouch
Рис. 7: Типы сигналов, поддерживаемые приложением SDRTouch
Рис. 8: Интерфейс приложения SDRoid
Рис. 9: Сигналы, поддерживаемые приложением SDRoid
Рис. 10: Настройка на частоту в SDRoid
Рис. 11: Спектр в SDRoid
Рис. 12: Значения данных RDS в SDRTouch
Рис. 13: Интерфейс со значениями RDS в SDRTouch
Заметки.
1. Приложение SDRTouch (бесплатная версия) поддерживает просмотр спектра только в течение ограниченного времени (несколько секунд).
2. Используйте качественный OTG-адаптер / кабель для проекта.
3. SDRTouch поддерживает запись звука.
4. Некоторые мобильные телефоны могут не поддерживать оборудование и драйверы.
Источник