Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add tapi debug log #2

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ if(CONFIG_TELEPHONY)
APPEND
PROPERTY NUTTX_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_LIST_DIR}/include)
set(CSRCS)
file(GLOB APPEND_FILES ${CMAKE_CURRENT_LIST_DIR}/src/*.c)
file(GLOB APPEND_FILES ${CMAKE_CURRENT_LIST_DIR}/*.c)
list(APPEND CSRCS ${APPEND_FILES})
list(REMOVE_ITEM CSRCS ${CMAKE_CURRENT_LIST_DIR}/tools/telephony_tool.c)
list(REMOVE_ITEM CSRCS ${CMAKE_CURRENT_LIST_DIR}/telephony_tool.c)
set(INCDIR
${NUTTX_APPS_DIR}/external/dbus/dbus
${NUTTX_APPS_DIR}/external/ofono/include
Expand All @@ -42,7 +42,7 @@ if(CONFIG_TELEPHONY)
PRIORITY
${CONFIG_TELEPHONY_TOOL_PRIORITY}
SRCS
tools/telephony_tool.c
telephony_tool.c
INCLUDE_DIRECTORIES
${INCDIR}
DEPENDS
Expand Down
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ CFLAGS += ${INCDIR_PREFIX}$(APPDIR)/external/ofono/include
CFLAGS += ${INCDIR_PREFIX}$(APPDIR)/frameworks/system/utils/gdbus
CFLAGS += ${INCDIR_PREFIX}$(APPDIR)/frameworks/connectivity/telephony

CSRCS += $(wildcard src/*.c)
CSRCS += tapi_manager.c tapi_utils.c tapi_call.c tapi_data.c tapi_sim.c tapi_stk.c
CSRCS += tapi_cbs.c tapi_sms.c tapi_network.c tapi_ss.c tapi_ims.c tapi_phonebook.c

ifneq ($(CONFIG_TELEPHONY_TOOL),)
MAINSRC += tools/telephony_tool.c
MAINSRC += telephony_tool.c
PROGNAME += telephonytool
PRIORITY += $(CONFIG_TELEPHONY_TOOL_PRIORITY)
STACKSIZE += $(CONFIG_TELEPHONY_TOOL_STACKSIZE)
Expand Down
88 changes: 29 additions & 59 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

## **Overview**

Telephony is a framework and API set for handling phone and communication functions in the `openvela` operating system. `Framework/telephony` is the interface layer provided by `openvela` communication to the application layer, also known as `TAPI (Telephony API)`.
Telephony is a framework and API set for handling call and communication functions in the Vela system. Framework/telephony is the interface layer that Vela provides to upper-layer applications, also known as TAPI (Telephony API).

`TAPI` provides a set of feature-rich tools and interfaces, covering network services, call services, SMS services, data services, SIM card services and other related functions. These interface designs allow application developers to easily obtain information related to Telephony and complete application development by calling `API` without having to deeply understand the internal business logic of Telephony (Telephony internal business is implemented by `Ofono`). In addition, Telephony also supports flexible expansion and customization to meet changing communication needs.
TAPI provides a set of feature-rich tools and interfaces, covering network services, call services, SMS services, data services, SIM card services and other related functions. These interface allow application developers to easily obtain Telephony-related information and complete application development by calling APIs without having to deeply understand the internal implementation of Telephony (Telephony is implemented by Ofono). In addition, Telephony also supports flexible expansion and customization to realize ever-changing communication requirements.

![TelephonyFramework](./TelephonyFramework.jpg)

## **Code Directory**
## **Project Directory**
```tree
├── include
│   ├── tapi_call.h
Expand All @@ -25,40 +25,18 @@ Telephony is a framework and API set for handling phone and communication functi
│   ├── tapi_sms.h
│   ├── tapi_ss.h
│   └── tapi_stk.h
├── src
│   ├── tapi_call.c
│   ├── tapi_cbs.c
│   ├── tapi_data.c
│   ├── tapi_ims.c
│   ├── tapi_manager.c
│   ├── tapi_network.c
│   ├── tapi_phonebook.c
│   ├── tapi_sim.c
│   ├── tapi_sms.c
│   ├── tapi_ss.c
│   ├── tapi_stk.c
│   └── tapi_utils.c
├── tools
│   └── telephony_tool.c
├── test
│   ├── cmocka_telephony_test.c
│   ├── telephony_call_test.c
│   ├── telephony_call_test.h
│   ├── telephony_common_test.c
│   ├── telephony_common_test.h
│   ├── telephony_data_test.c
│   ├── telephony_data_test.h
│   ├── telephony_ims_test.c
│   ├── telephony_ims_test.h
│   ├── telephony_network_test.c
│   ├── telephony_network_test.h
│   ├── telephony_sim_test.c
│   ├── telephony_sim_test.h
│   ├── telephony_sms_test.c
│   ├── telephony_sms_test.h
│   ├── telephony_ss_test.c
│   ├── telephony_ss_test.h
│   └── telephony_test.h
├── tapi_call.c
├── tapi_cbs.c
├── tapi_data.c
├── tapi_ims.c
├── tapi_manager.c
├── tapi_network.c
├── tapi_phonebook.c
├── tapi_sim.c
├── tapi_sms.c
├── tapi_ss.c
├── tapi_stk.c
├── tapi_utils.c
├── README.md
└── README_zh-cn.md
```
Expand All @@ -77,15 +55,13 @@ Telephony is a framework and API set for handling phone and communication functi
| SMS | tapi_sms.c/h | SMS service interface |
| IMS | tapi_ims.c/h | IMS service interface |
| Phonebook | tapi_phonebook.c/h | Phonebook interface |
| <div style="width: 120pt">Telephony Utils| tapi_utils.c |Telephony util interface |
| Telephony Tools| telephony_tool.c | Telephony internal interface test |
| Telephony Test Case| test/* | Telephony internal test case |
| <div style="width: 120pt">Utils| tapi_utils.c/h |Telephony util interface |

### **Function Introduction**

#### Common Api
- Telephony service interface: provides an interface for obtaining and releasing Telephony services.
- Obtain communications equipment related information: such as `IMEI`, `MODEL`, `MSISDN`, `PhoneNumber`, `Modem` parameters, etc.
- Obtain communications equipment related information: such as IMEI, MODEL, MSISDN, PhoneNumber, Modem parameters, etc.
- Communication capability management: turn on/off flight mode, turn on/off cellular communication capability, etc.

#### Call Api
Expand Down Expand Up @@ -124,38 +100,32 @@ Telephony is a framework and API set for handling phone and communication functi
#### Phonebook Api
- SIM card contact management: perform operations related to adding, deleting, modifying and checking contacts on the SIM card.

#### Telephony Utils Api
#### Utils Api
- Bidirectional data type conversion: Bidirectional conversion between Telephony internal structure parameters and basic types to meet different data processing requirements.

#### Telephony Tools
- Internal interface test: Used for testing all internal TAPI interfaces.

#### Telephony Test Case
- Internal test case: Used for testing all internal Telephony scenarios.

## **TAPI Workflow**

![TelephonyApi](./TapiEn.jpg)

## **TAPI code demonstration**
### **Usage steps**
1. Call the `tapi_open` function to get the `tapi_context`.
```c
## **TAPI Code Demonstration**
### **How to use**
1. Call tapi_open function to get tapi_context
```c
tapi_context context;
char* dbus_name = "vela.telephony.tool";
context = tapi_open(dbus_name, on_tapi_client_ready, NULL);
```
```

2. Pass the `tapi_context` parameter to the `TAPI` interface function to operate the `Telephony` service.
```c
2. Transfer parameters to TAPI interface functions through tapi_context to operate Telephony services
```c
tapi_radio_state current = RADIO_STATE_UNAVAILABLE;
tapi_get_radio_state(t_context, get_used_slot_id(), &current);
```
```

3. Call the `tapi_close` function to release the `tapi_context`.
```c
3. Call tapi_close function to release tapi_context
```c
tapi_close(context);
```
```

### **Complete sample code**
```c
Expand Down
85 changes: 27 additions & 58 deletions README_zh-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@

## **概述**

Telephony 是 `openvela` 操作系统中用于处理电话和通信功能的框架和 `API` 集合。`Framework/telephony``openvela` 通信对应用层提供的接口层,又称为 `TAPI(Telephony API)`
Telephony 是 Vela 操作系统中用于处理电话和通信功能的框架和 API 集合。Framework/telephony 是 Vela 通信对应用层提供的接口层,又称为 TAPI(Telephony API)。

`TAPI` 提供了一组功能丰富的工具和接口,涵盖网络服务、通话服务、短信服务、数据服务、SIM 卡服务及其他相关功能。这些接口设计使得应用开发者无需深入了解 Telephony 的内部业务逻辑(Telephony 内部业务由 `Ofono` 实现),只需调用 API 即可轻松获取与 Telephony 相关的信息,完成应用开发。另外,Telephony 还支持灵活的扩展和定制,可满足不断变化的通信需求。
TAPI 提供了一组功能丰富的工具和接口,涵盖网络服务、通话服务、短信服务、数据服务、SIM 卡服务及其他相关功能。这些接口设计使得应用开发者无需深入了解 Telephony 的内部业务逻辑(Telephony 内部业务由 Ofono 实现),只需调用 API 即可轻松获取与 Telephony 相关的信息,完成应用开发。另外,Telephony 还支持灵活的扩展和定制,可满足不断变化的通信需求。

![Telephony架构图](./TelephonyFramework.jpg)

## **代码目录**
## **项目目录**
```tree
├── include
│   ├── tapi_call.h
Expand All @@ -26,40 +26,18 @@ Telephony 是 `openvela` 操作系统中用于处理电话和通信功能的框
│   ├── tapi_sms.h
│   ├── tapi_ss.h
│   └── tapi_stk.h
├── src
│   ├── tapi_call.c
│   ├── tapi_cbs.c
│   ├── tapi_data.c
│   ├── tapi_ims.c
│   ├── tapi_manager.c
│   ├── tapi_network.c
│   ├── tapi_phonebook.c
│   ├── tapi_sim.c
│   ├── tapi_sms.c
│   ├── tapi_ss.c
│   ├── tapi_stk.c
│   └── tapi_utils.c
├── tools
│   └── telephony_tool.c
├── test
│   ├── cmocka_telephony_test.c
│   ├── telephony_call_test.c
│   ├── telephony_call_test.h
│   ├── telephony_common_test.c
│   ├── telephony_common_test.h
│   ├── telephony_data_test.c
│   ├── telephony_data_test.h
│   ├── telephony_ims_test.c
│   ├── telephony_ims_test.h
│   ├── telephony_network_test.c
│   ├── telephony_network_test.h
│   ├── telephony_sim_test.c
│   ├── telephony_sim_test.h
│   ├── telephony_sms_test.c
│   ├── telephony_sms_test.h
│   ├── telephony_ss_test.c
│   ├── telephony_ss_test.h
│   └── telephony_test.h
├── tapi_call.c
├── tapi_cbs.c
├── tapi_data.c
├── tapi_ims.c
├── tapi_manager.c
├── tapi_network.c
├── tapi_phonebook.c
├── tapi_sim.c
├── tapi_sms.c
├── tapi_ss.c
├── tapi_stk.c
├── tapi_utils.c
├── README.md
└── README_zh-cn.md
```
Expand All @@ -78,15 +56,13 @@ Telephony 是 `openvela` 操作系统中用于处理电话和通信功能的框
| SMS | tapi_sms.c/h | 短信服务接口 |
| IMS | tapi_ims.c/h | IMS 服务接口 |
| Phonebook | tapi_phonebook.c/h | 电话簿接口 |
| <div style="width: 120pt">Telephony Utils| tapi_utils.c | Telephony 工具类接口 |
| Telephony Tools| telephony_tool.c | Telephony 内部接口测试 |
| Telephony Test Case| test/* | Telephony 内部测试用例 |
| <div style="width: 120pt">Telephony 工具类| tapi_utils.c/h | Telephony 工具类接口 |

### **功能介绍**

#### Common Api
- Telephony 服务接口:提供 Telephony 服务获取以及释放的接口。
- 获取通讯设备相关信息:如 `IMEI`、`MODEL`、`MSISDN`、`PhoneNumber`、`Modem` 参数等信息。
- 获取通讯设备相关信息:如 IMEIMODELMSISDNPhoneNumberModem 参数等信息。
- 设备通讯能力管理:开启/关闭飞行模式、蜂窝通信能力等功能。

#### Call Api
Expand Down Expand Up @@ -125,39 +101,32 @@ Telephony 是 `openvela` 操作系统中用于处理电话和通信功能的框
#### Phonebook Api
- SIM 卡联系人管理:SIM 卡上的联系人进行增删改查的相关操作。

#### Telephony Utils Api
#### Utils Api
- 双向数据类型转换:Telephony 内部结构体参数与基本类型之间的双向转换,以满足不同数据处理需求。

#### Telephony Tools
- 内部接口测试:用于内部所有 TAPI 接口测试。

#### Telephony Test Case
- 内部测试用例: 用于内部所有 Telephony 场景的测试用例。


## **TAPI 工作模型**

![TelephonyApi](./TapiZh.jpg)

## **TAPI 代码演示**
### **使用步骤**
1. 调用 `tapi_open` 函数获取 `tapi_context`。
```c
1. 调用 tapi_open 函数获取 tapi_context
```c
tapi_context context;
char* dbus_name = "vela.telephony.tool";
context = tapi_open(dbus_name, on_tapi_client_ready, NULL);
```
```

2. 通过 `tapi_context` 传参到 `TAPI` 接口函数进行 `Telephony` 服务的操作
```c
2. 通过 tapi_context 传参到TAPI接口函数进行 Telephony 服务的操作
```c
tapi_radio_state current = RADIO_STATE_UNAVAILABLE;
tapi_get_radio_state(t_context, get_used_slot_id(), &current);
```
```

3. 调用 `tapi_close` 函数释放 `tapi_context`。
```c
3. 调用 tapi_close 函数释放 tapi_context
```c
tapi_close(context);
```
```

### **完整示例代码**
```c
Expand Down
2 changes: 1 addition & 1 deletion include/tapi.h
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ typedef void* tapi_context;
const char* tapi_utils_network_mode_to_string(tapi_pref_net_mode mode);
tapi_pref_net_mode tapi_utils_network_mode_from_string(const char* mode);
tapi_network_type tapi_utils_network_type_from_ril_tech(int type);
const char* tapi_utils_get_registration_status_string(int status);
const char* tapi_utils_registration_status_to_string(int status);
tapi_registration_state tapi_utils_registration_status_from_string(const char* status);
tapi_selection_mode tapi_utils_registration_mode_from_string(const char* mode);
tapi_operator_status tapi_utils_operator_status_from_string(const char* mode);
Expand Down
12 changes: 6 additions & 6 deletions include/tapi_stk.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ typedef struct {
} tapi_stk_menu_item;

typedef struct {
char* info;
char* text;
unsigned char icon_id;
int urgent;
} tapi_stk_display_info_params;
} tapi_stk_display_text_params;

typedef struct {
char* alpha;
Expand All @@ -60,14 +60,14 @@ typedef struct {
char* alpha;
char* def_input;
char icon_id;
char min_len;
char max_len;
char min_chars;
char max_chars;
int hide_typing;
} tapi_stk_request_input_params;

typedef struct {
char* tone;
char* info;
char* text;
unsigned char icon_id;
} tapi_stk_play_tone_params;

Expand All @@ -79,7 +79,7 @@ typedef struct {
} tapi_stk_request_selection_params;

typedef struct {
char* info;
char* information;
unsigned char icon_id;
char* url;
} tapi_stk_confirm_launch_browser_params;
Expand Down
Loading
Loading