Compare commits
7 Commits
dev-ai-con
...
dev
| Author | SHA1 | Date |
|---|---|---|
|
|
14c3520569 | |
|
|
20ca12fcda | |
|
|
e54a93a2ee | |
|
|
58e8a7b47c | |
|
|
706e0ecea2 | |
|
|
66a7389de5 | |
|
|
275b97deab |
|
|
@ -1,3 +1 @@
|
|||
# AI contest 2026 branch — reviews restricted to the contest team.
|
||||
# Do NOT copy this file to other branches.
|
||||
* @open-vela/dev-ai-contest-reviewer
|
||||
* @aiduxiaoxiong @smile0425 @tanghao-xiaomi @TangMeng12 @yanxingyu17
|
||||
|
|
|
|||
17
README.md
17
README.md
|
|
@ -46,7 +46,7 @@ The name "Vela" is originated from the Latin term for "sail," which is also the
|
|||
|
||||
- **Standard Compliant and High Portability**
|
||||
|
||||
openvela Kernel is built upon Apache NuttX, which is often referred to as "tiny Linux". With this foundation, openvela achieves a high degree of conformity with the POSIX standard. Our team has been continually enhancing its POSIX compatibility, which has now reached an impressive 88%. Because of this standards conformance, software developed under other standard OSs (such as Linux) can be easily ported to openvela with minimum effort.
|
||||
openvela Kernel is built upon Apache NuttX, which is often referred to as "tiny Linux". With this foundation, openvela achieves a high degree of conformity with the POSIX standard. Our team has been continually enhancing its POSIX compatibility, which has now reached an impressive 89%. Because of this standards conformance, software developed under other standard OSs (such as Linux) can be easily ported to openvela with minimum effort.
|
||||
|
||||
- **Comprehensive Connectivity Suite**
|
||||
|
||||
|
|
@ -155,6 +155,7 @@ If you want to experience openvela, we provide a fully functional emulator that
|
|||
## Developer Documentation
|
||||
|
||||
- [Documentation Center](https://doc.openvela.com/document)
|
||||
- [API Reference](./en/api/index.md) — Complete API specification for kernel, network, and application framework interfaces
|
||||
|
||||
## Application Example Center
|
||||
|
||||
|
|
@ -167,17 +168,17 @@ Here are some typical native application examples demonstrating the usage of dif
|
|||
- [Music Player](./en/demo/Music_Player_Example.md): Demonstrates audio playback, playlist management, and background services.
|
||||
- [Smart Band](./en/demo/Smart_Band_Example.md): Demonstrates sleep monitoring, heart rate monitoring, music playback, and a stopwatch.
|
||||
- [Cycling Computer](./en/demo/X_Track.md): Demonstrates GPS positioning, real-time data display, and route tracking.
|
||||
- [Calculator](../../../../open-vela/packages_demos/blob/dev-ai-contest-2026/calculator/Readme.md): A basic example of UI and logic interaction.
|
||||
- [Relation Calculator](../../../../open-vela/packages_demos/blob/dev-ai-contest-2026/relation_calculator/Readme.md): Demonstrates complex conditional logic and algorithm implementation.
|
||||
- [Whack-a-Mole](../../../../open-vela/packages_demos/blob/dev-ai-contest-2026/Whackmole/README.md): Demonstrates a game loop, random number generation, and animation effects.
|
||||
- [Calculator](../../../../open-vela/packages_demos/blob/dev/calculator/Readme.md): A basic example of UI and logic interaction.
|
||||
- [Relation Calculator](../../../../open-vela/packages_demos/blob/dev/relation_calculator/Readme.md): Demonstrates complex conditional logic and algorithm implementation.
|
||||
- [Whack-a-Mole](../../../../open-vela/packages_demos/blob/dev/Whackmole/README.md): Demonstrates a game loop, random number generation, and animation effects.
|
||||
|
||||
To see the full list of native apps, please visit the [Native App Examples Repository](../../../packages_demos/blob/dev-ai-contest-2026/README_zh-cn.md).
|
||||
To see the full list of native apps, please visit the [Native App Examples Repository](../../../packages_demos/blob/dev/README_zh-cn.md).
|
||||
|
||||
### Quick Apps
|
||||
|
||||
- [Mi Band Weather App](../../.././packages_fe_examples/blob/dev-ai-contest-2026/weather/README.md): Presents a clean and intuitive seven-day weather forecast.
|
||||
- [Music Player](../../.././packages_fe_examples/blob/dev-ai-contest-2026/player/README.md): Demonstrates a basic music player, including playback, volume control, and playlist viewing.
|
||||
- [Calendar](../../.././packages_fe_examples/blob/dev-ai-contest-2026/calendar/README.md): Demonstrates a basic calendar.
|
||||
- [Mi Band Weather App](../../.././packages_fe_examples/blob/dev/weather/README.md): Presents a clean and intuitive seven-day weather forecast.
|
||||
- [Music Player](../../.././packages_fe_examples/blob/dev/player/README.md): Demonstrates a basic music player, including playback, volume control, and playlist viewing.
|
||||
- [Calendar](../../.././packages_fe_examples/blob/dev/calendar/README.md): Demonstrates a basic calendar.
|
||||
|
||||
More Quick App examples are continuously being added. To see all examples, please visit the [Quick App Examples Repository](../../../packages_fe_examples).
|
||||
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ Vela 的命名源自拉丁语中船帆的含义,也是南方星空中船帆星
|
|||
|
||||
- **标准兼容和高可移植性**
|
||||
|
||||
openvela 内核基于 Apache NuttX ,这个被称为 "Tiny Linux" 的系统为 openvela 提供了高标准的 POSIX 兼容性。通过持续提升其 POSIX 兼容性,openvela 当前已达到 88% 的兼容水平。这种高标准的兼容性意味着在其他标准操作系统(例如 Linux)上开发的软件可以轻松迁移到 openvela,几乎不需要额外的工作。
|
||||
openvela 内核基于 Apache NuttX ,这个被称为 "Tiny Linux" 的系统为 openvela 提供了高标准的 POSIX 兼容性。通过持续提升其 POSIX 兼容性,openvela 当前已达到 89% 的兼容水平。这种高标准的兼容性意味着在其他标准操作系统(例如 Linux)上开发的软件可以轻松迁移到 openvela,几乎不需要额外的工作。
|
||||
|
||||
- **全面的连接套件**
|
||||
|
||||
|
|
@ -156,6 +156,7 @@ openvela 采用双分支模型来平衡系统的创新性与稳定性。请根
|
|||
## 开发者文档
|
||||
|
||||
- [文档中心](https://doc.openvela.com/document)
|
||||
- [API 参考文档](./zh-cn/api/index.md) — 内核接口、网络接口、应用框架 API 完整说明
|
||||
|
||||
## 应用示例中心
|
||||
|
||||
|
|
@ -168,17 +169,17 @@ openvela 采用双分支模型来平衡系统的创新性与稳定性。请根
|
|||
- [音乐播放器](./zh-cn/demo/Music_Player_Example_zh-cn.md):演示音频播放、列表管理和后台服务。
|
||||
- [智能手环](./zh-cn/demo/Smart_Band_Example_zh-cn.md):演示睡眠监测、心率监测、音乐播放、秒表计时。
|
||||
- [自行车码表](./zh-cn/demo/X_Track_zh-cn.md):演示 GPS 定位、实时数据显示和运动轨迹记录。
|
||||
- [计算器](../../../../open-vela/packages_demos/blob/dev-ai-contest-2026/calculator/Readme.md):一个基础的 UI 与逻辑交互示例。
|
||||
- [亲戚计算器](../../../../open-vela/packages_demos/blob/dev-ai-contest-2026/relation_calculator/Readme_zh-cn.md):演示复杂的条件逻辑与算法实现。
|
||||
- [打地鼠](../../../../open-vela/packages_demos/blob/dev-ai-contest-2026/Whackmole/README_zh-cn.md):演示游戏循环、随机数生成和动画效果。
|
||||
- [计算器](../../../../open-vela/packages_demos/blob/dev/calculator/Readme.md):一个基础的 UI 与逻辑交互示例。
|
||||
- [亲戚计算器](../../../../open-vela/packages_demos/blob/dev/relation_calculator/Readme_zh-cn.md):演示复杂的条件逻辑与算法实现。
|
||||
- [打地鼠](../../../../open-vela/packages_demos/blob/dev/Whackmole/README_zh-cn.md):演示游戏循环、随机数生成和动画效果。
|
||||
|
||||
查看完整的原生应用列表,请访问[原生应用示例仓库](../../../packages_demos/blob/dev-ai-contest-2026/README_zh-cn.md)。
|
||||
查看完整的原生应用列表,请访问[原生应用示例仓库](../../../packages_demos/blob/dev/README_zh-cn.md)。
|
||||
|
||||
### 快应用(Quick Apps)
|
||||
|
||||
- [小米手环天气预报应用](../../.././packages_fe_examples/blob/dev-ai-contest-2026/weather/README.md):提供简洁直观的未来七日天气信息展示。
|
||||
- [音乐播放器](../../.././packages_fe_examples/blob/dev-ai-contest-2026/player/README.md):演示一个基础的音乐播放器,包含音乐的播放,音量调节,歌单查看。
|
||||
- [日历](../../.././packages_fe_examples/blob/dev-ai-contest-2026/calendar/README.md):演示一个基础的日历。
|
||||
- [小米手环天气预报应用](../../.././packages_fe_examples/blob/dev/weather/README.md):提供简洁直观的未来七日天气信息展示。
|
||||
- [音乐播放器](../../.././packages_fe_examples/blob/dev/player/README.md):演示一个基础的音乐播放器,包含音乐的播放,音量调节,歌单查看。
|
||||
- [日历](../../.././packages_fe_examples/blob/dev/calendar/README.md):演示一个基础的日历。
|
||||
|
||||
快应用相关示例正在持续丰富中。查看所有示例,请访问[快应用示例仓库](../../../packages_fe_examples)。
|
||||
|
||||
|
|
|
|||
|
|
@ -1,188 +0,0 @@
|
|||
\[ English | [简体中文](../../../../zh-cn/api/framework/bluetooth/bt_avrcp.md) \]
|
||||
|
||||
# Bluetooth AVRCP API
|
||||
|
||||
The openvela Bluetooth AVRCP (Audio/Video Remote Control Profile) interface supports playback control, track information queries, and more.
|
||||
|
||||
Header files: #include "bt_avrcp.h", #include "bt_avrcp_control.h", #include "bt_avrcp_target.h"
|
||||
|
||||
|
||||
## openvela Implementation Notes
|
||||
|
||||
- **Dual-role support**: Controller (control side) and Target (target side)
|
||||
- **Features**: Play/pause/skip tracks, volume control, track information retrieval
|
||||
|
||||
|
||||
## Synchronous Interfaces
|
||||
|
||||
|
||||
### bt_avrcp_control_unregister_callbacks
|
||||
|
||||
```c
|
||||
bool bt_avrcp_control_unregister_callbacks(bt_instance_t* ins, void* cookie);
|
||||
```
|
||||
|
||||
Unregister callback functions and stop receiving state change notifications.
|
||||
|
||||
**Parameters**:
|
||||
|
||||
- `ins` Bluetooth client instance.
|
||||
- `cookie` User context.
|
||||
|
||||
**Returns**:
|
||||
|
||||
Returns the callback cookie on success, or NULL on failure.
|
||||
|
||||
|
||||
### bt_avrcp_control_get_element_attributes
|
||||
|
||||
```c
|
||||
bt_status_t bt_avrcp_control_get_element_attributes(bt_instance_t* ins, bt_address_t* addr);
|
||||
```
|
||||
|
||||
Get media element attributes from the remote device.
|
||||
|
||||
**Parameters**:
|
||||
|
||||
- `ins` Bluetooth client instance.
|
||||
- `addr` Bluetooth address of the remote device.
|
||||
|
||||
|
||||
**Returns**:
|
||||
|
||||
Returns BT_STATUS_SUCCESS on success, or an error code on failure.
|
||||
|
||||
|
||||
### bt_avrcp_control_send_passthrough_cmd
|
||||
|
||||
```c
|
||||
bt_status_t bt_avrcp_control_send_passthrough_cmd(bt_instance_t* ins, bt_address_t* addr, uint8_t cmd, uint8_t state);
|
||||
```
|
||||
|
||||
Send a passthrough command to the remote device.
|
||||
|
||||
**Parameters**:
|
||||
|
||||
- `ins` Bluetooth client instance.
|
||||
- `addr` Bluetooth address of the remote device.
|
||||
- `cmd` Command code.
|
||||
- `state` Key state.
|
||||
|
||||
|
||||
### bt_avrcp_control_get_unit_info
|
||||
|
||||
```c
|
||||
bt_status_t bt_avrcp_control_get_unit_info(bt_instance_t* ins, bt_address_t* addr);
|
||||
```
|
||||
|
||||
Get unit information from the remote AVRCP device.
|
||||
|
||||
|
||||
**Parameters**:
|
||||
|
||||
- `ins` Bluetooth client instance.
|
||||
- `addr` Bluetooth address of the remote device.
|
||||
|
||||
|
||||
### bt_avrcp_control_get_subunit_info
|
||||
|
||||
```c
|
||||
bt_status_t bt_avrcp_control_get_subunit_info(bt_instance_t* ins, bt_address_t* addr);
|
||||
```
|
||||
|
||||
Get subunit information from the remote device.
|
||||
|
||||
**Parameters**:
|
||||
|
||||
- `ins` Bluetooth client instance.
|
||||
- `addr` Bluetooth address of the remote device.
|
||||
|
||||
|
||||
### bt_avrcp_control_get_playback_state
|
||||
|
||||
```c
|
||||
bt_status_t bt_avrcp_control_get_playback_state(bt_instance_t* ins, bt_address_t* addr);
|
||||
```
|
||||
|
||||
Get the current playback state of the remote device.
|
||||
|
||||
|
||||
**Parameters**:
|
||||
|
||||
- `ins` Bluetooth client instance.
|
||||
- `addr` Bluetooth address of the remote device.
|
||||
|
||||
|
||||
### bt_avrcp_control_register_notification
|
||||
|
||||
```c
|
||||
bt_status_t bt_avrcp_control_register_notification(bt_instance_t* ins, bt_address_t* addr, uint8_t event, uint32_t interval);
|
||||
```
|
||||
|
||||
Register for event notifications from the remote device.
|
||||
|
||||
**Parameters**:
|
||||
|
||||
- `ins` Bluetooth client instance.
|
||||
- `addr` Bluetooth address of the remote device.
|
||||
- `event` Event type.
|
||||
- `interval` Notification interval.
|
||||
|
||||
|
||||
### bt_avrcp_target_unregister_callbacks
|
||||
|
||||
```c
|
||||
bool bt_avrcp_target_unregister_callbacks(bt_instance_t* ins, void* cookie);
|
||||
```
|
||||
|
||||
Unregister callback functions and stop receiving state change notifications.
|
||||
|
||||
**Parameters**:
|
||||
|
||||
- `ins` Bluetooth client instance.
|
||||
- `cookie` User context.
|
||||
|
||||
**Returns**:
|
||||
|
||||
Returns the callback cookie on success, or NULL on failure.
|
||||
|
||||
|
||||
### bt_avrcp_target_get_play_status_response
|
||||
|
||||
```c
|
||||
bt_status_t bt_avrcp_target_get_play_status_response(bt_instance_t* ins, bt_address_t* addr, avrcp_play_status_t status, uint32_t song_len, uint32_t song_pos);
|
||||
```
|
||||
|
||||
Respond to a play status query from the remote device.
|
||||
|
||||
**Parameters**:
|
||||
|
||||
- `ins` Bluetooth client instance.
|
||||
- `addr` Bluetooth address of the peer device.
|
||||
- `status` Play status code.
|
||||
- `song_len` Song length in milliseconds.
|
||||
- `song_pos` Current playback position in milliseconds.
|
||||
|
||||
**Returns**:
|
||||
|
||||
Returns BT_STATUS_SUCCESS on success, or an error code on failure.
|
||||
|
||||
|
||||
### bt_avrcp_target_play_status_notify
|
||||
|
||||
```c
|
||||
bt_status_t bt_avrcp_target_play_status_notify(bt_instance_t* ins, bt_address_t* addr, avrcp_play_status_t status);
|
||||
```
|
||||
|
||||
Notify the remote device of a playback status change.
|
||||
|
||||
**Parameters**:
|
||||
|
||||
- `ins` Bluetooth client instance.
|
||||
- `addr` Bluetooth address of the remote device.
|
||||
- `status` Play status code.
|
||||
|
||||
|
||||
**Returns**:
|
||||
|
||||
Returns BT_STATUS_SUCCESS on success, or an error code on failure.
|
||||
|
|
@ -0,0 +1,217 @@
|
|||
\[ English | [简体中文](../../../../zh-cn/api/framework/bluetooth/bt_cs.md) \]
|
||||
|
||||
# Bluetooth Channel Sounding API
|
||||
|
||||
The openvela Bluetooth Channel Sounding (CS) interface provides distance measurement and positioning capabilities between Bluetooth devices. Based on the channel sounding technology introduced in the Bluetooth 5.4 specification, it supports centimeter-level ranging accuracy.
|
||||
|
||||
Header file: `#include <bt_cs.h>`
|
||||
|
||||
## openvela Implementation Notes
|
||||
|
||||
- **Ranging methods**: Supports automatic selection (AUTO), RSSI, and CS ranging methods
|
||||
- **Role model**: Supports Initiator and Reflector roles
|
||||
- **RAS features**: Supports real-time ranging data, lost data segment retrieval, abort operation, and data filtering
|
||||
- **Callback notifications**: Ranging start, stop, and result events are delivered asynchronously via callbacks
|
||||
- **Configuration dependency**: Test interface requires `CONFIG_BT_CS_RAS_TEST`
|
||||
|
||||
## Callback Management
|
||||
|
||||
### bt_cs_register_callbacks
|
||||
|
||||
```c
|
||||
void* bt_cs_register_callbacks(bt_instance_t* ins, const cs_callbacks_t* callbacks);
|
||||
```
|
||||
|
||||
Register CS event callback functions. After successful registration, the system notifies the application via callbacks when distance measurement starts, stops, or produces results.
|
||||
|
||||
**Parameters**:
|
||||
|
||||
- `ins` Bluetooth client instance.
|
||||
- `callbacks` CS event callback function set, see `cs_callbacks_t`.
|
||||
|
||||
**Returns**:
|
||||
|
||||
On success, returns a callback cookie (non-NULL) for later unregistration; on failure, returns NULL.
|
||||
|
||||
### bt_cs_unregister_callbacks
|
||||
|
||||
```c
|
||||
bool bt_cs_unregister_callbacks(bt_instance_t* ins, void* cookie);
|
||||
```
|
||||
|
||||
Unregister previously registered CS event callback functions.
|
||||
|
||||
**Parameters**:
|
||||
|
||||
- `ins` Bluetooth client instance.
|
||||
- `cookie` Cookie returned during callback registration.
|
||||
|
||||
**Returns**:
|
||||
|
||||
Returns `true` on success, `false` on failure.
|
||||
|
||||
## Distance Measurement
|
||||
|
||||
### bt_cs_start_distance_measurement
|
||||
|
||||
```c
|
||||
bt_status_t bt_cs_start_distance_measurement(bt_instance_t* ins, const bt_distance_measurement_params_t* params);
|
||||
```
|
||||
|
||||
Start distance measurement. Callbacks must be registered via `bt_cs_register_callbacks` before calling this function. Measurement results are delivered through the `cs_distance_measure_result_cb` callback.
|
||||
|
||||
**Parameters**:
|
||||
|
||||
- `ins` Bluetooth client instance.
|
||||
- `params` Distance measurement parameters, see `bt_distance_measurement_params_t`.
|
||||
|
||||
**Returns**:
|
||||
|
||||
Returns `BT_STATUS_SUCCESS` on success, or an error code on failure.
|
||||
|
||||
### bt_cs_stop_distance_measurement
|
||||
|
||||
```c
|
||||
bt_status_t bt_cs_stop_distance_measurement(bt_instance_t* ins, bt_address_t* addr, uint8_t method, bool timeout);
|
||||
```
|
||||
|
||||
Stop distance measurement.
|
||||
|
||||
**Parameters**:
|
||||
|
||||
- `ins` Bluetooth client instance.
|
||||
- `addr` Remote device address.
|
||||
- `method` Ranging method (AUTO/RSSI/CS).
|
||||
- `timeout` Whether stopping due to timeout.
|
||||
|
||||
**Returns**:
|
||||
|
||||
Returns `BT_STATUS_SUCCESS` on success, or an error code on failure.
|
||||
|
||||
## Capability Query
|
||||
|
||||
### bt_get_cs_max_supported_security_level
|
||||
|
||||
```c
|
||||
bt_status_t bt_get_cs_max_supported_security_level(bt_instance_t* ins, bt_address_t* addr);
|
||||
```
|
||||
|
||||
Get the maximum CS security level supported by the remote device.
|
||||
|
||||
**Parameters**:
|
||||
|
||||
- `ins` Bluetooth client instance.
|
||||
- `addr` Remote device address.
|
||||
|
||||
**Returns**:
|
||||
|
||||
Returns `BT_STATUS_SUCCESS` on success, or an error code on failure.
|
||||
|
||||
## Configuration Management
|
||||
|
||||
### bt_cs_set_config
|
||||
|
||||
```c
|
||||
bt_status_t bt_cs_set_config(bt_instance_t* ins, bt_address_t* addr, const bt_cs_set_params_t* params);
|
||||
```
|
||||
|
||||
Set CS configuration parameters, including RAS features, role, antenna selection, and maximum transmit power.
|
||||
|
||||
**Parameters**:
|
||||
|
||||
- `ins` Bluetooth client instance.
|
||||
- `addr` Remote device address.
|
||||
- `params` CS configuration parameters, see `bt_cs_set_params_t`.
|
||||
|
||||
**Returns**:
|
||||
|
||||
Returns `BT_STATUS_SUCCESS` on success, or an error code on failure.
|
||||
|
||||
## Data Structures
|
||||
|
||||
### bt_distance_measurement_params_t
|
||||
|
||||
Distance measurement parameters structure.
|
||||
|
||||
| Field | Type | Description |
|
||||
| -------------------- | -------------- | ------------------------------------- |
|
||||
| `addr` | `bt_address_t` | Remote device address |
|
||||
| `method` | `uint8_t` | Ranging method (0=AUTO, 1=RSSI, 2=CS) |
|
||||
| `role` | `uint8_t` | Role (initiator/reflector) |
|
||||
| `interval_ms` | `uint16_t` | Measurement interval (milliseconds) |
|
||||
| `duration_ms` | `uint16_t` | Measurement duration (milliseconds) |
|
||||
| `submode` | `uint8_t` | CS submode |
|
||||
| `max_steps` | `uint8_t` | Maximum steps |
|
||||
| `mode0_steps` | `uint8_t` | Mode 0 steps |
|
||||
| `rtt_type` | `uint8_t` | RTT type |
|
||||
| `sync_phy` | `uint8_t` | Sync PHY |
|
||||
| `channel_map` | `uint8_t` | Channel map |
|
||||
| `antenna_paths_mask` | `uint8_t` | Antenna paths mask |
|
||||
| `vendor_specific` | `uint8_t` | Vendor-specific parameter |
|
||||
| `debug_flags` | `uint8_t` | Debug flags |
|
||||
|
||||
### bt_distance_measurement_result_t
|
||||
|
||||
Distance measurement result structure.
|
||||
|
||||
| Field | Type | Description |
|
||||
| --------------------------- | --------- | ------------------------------ |
|
||||
| `centimeter` | `uint8_t` | Distance (centimeters) |
|
||||
| `error_centimeter` | `uint8_t` | Distance error (centimeters) |
|
||||
| `azimuth_angle` | `uint8_t` | Azimuth angle |
|
||||
| `error_azimuthAngle` | `uint8_t` | Azimuth angle error |
|
||||
| `altitude_angle` | `uint8_t` | Altitude angle |
|
||||
| `error_altitudeAngle` | `uint8_t` | Altitude angle error |
|
||||
| `elapsed_realtime_nanos` | `long` | Elapsed realtime (nanoseconds) |
|
||||
| `confidence_level` | `uint8_t` | Confidence level |
|
||||
| `delay_spread_meters` | `double` | Delay spread (meters) |
|
||||
| `detected_attack_level` | `uint8_t` | Detected attack level |
|
||||
| `velocity_meters_persecond` | `double` | Velocity (meters/second) |
|
||||
| `method` | `uint8_t` | Ranging method used |
|
||||
|
||||
### bt_cs_set_params_t
|
||||
|
||||
CS configuration parameters structure.
|
||||
|
||||
| Field | Type | Description |
|
||||
| --------------------------- | ---------- | ------------------------------------------------- |
|
||||
| `ras_feature` | `uint32_t` | RAS feature bits (see macro definitions below) |
|
||||
| `role` | `uint8_t` | CS role bits (Bit 0: initiator, Bit 1: reflector) |
|
||||
| `cs_sync_antenna_selection` | `uint8_t` | CS_SYNC antenna selection |
|
||||
| `max_tx_power` | `int8_t` | Maximum TX power (dBm, range -127 to 20) |
|
||||
|
||||
### cs_callbacks_t
|
||||
|
||||
CS event callback function set.
|
||||
|
||||
| Field | Type | Description |
|
||||
| -------------------------------- | ---------------- | ------------------------------------- |
|
||||
| `size` | `size_t` | Structure size |
|
||||
| `cs_distance_measure_started_cb` | Function pointer | Distance measurement started callback |
|
||||
| `cs_distance_measure_stopped_cb` | Function pointer | Distance measurement stopped callback |
|
||||
| `cs_distance_measure_result_cb` | Function pointer | Distance measurement result callback |
|
||||
|
||||
## Macro Definitions
|
||||
|
||||
### RAS Feature Bits
|
||||
|
||||
| Macro | Value | Description |
|
||||
| --------------------------------------- | ----- | ----------------------------------- |
|
||||
| `BT_CS_RAS_REAL_TIME_RANGING_DATA` | 0x01 | Real-time ranging data |
|
||||
| `BT_CS_RAS_RETRIEVE_LOST_DATA_SEGMENTS` | 0x02 | Retrieve lost ranging data segments |
|
||||
| `BT_CS_RAS_ABORT_OPERATION` | 0x04 | Abort operation |
|
||||
| `BT_CS_RAS_FILTER_RANGING_DATA` | 0x08 | Filter ranging data |
|
||||
|
||||
### Antenna Selection
|
||||
|
||||
| Macro | Value | Description |
|
||||
| ---------------------------------- | ----- | ---------------------------------------------- |
|
||||
| `BT_CS_ANTENNA_SEL_1` | 0x01 | Use antenna identifier 1 |
|
||||
| `BT_CS_ANTENNA_SEL_2` | 0x02 | Use antenna identifier 2 |
|
||||
| `BT_CS_ANTENNA_SEL_3` | 0x03 | Use antenna identifier 3 |
|
||||
| `BT_CS_ANTENNA_SEL_4` | 0x04 | Use antenna identifier 4 |
|
||||
| `BT_CS_ANTENNA_SEL_SINGLE_REPEATE` | 0xFD | Antenna identifiers in single repetitive order |
|
||||
| `BT_CS_ANTENNA_SEL_DOUBLE_REPEATE` | 0xFE | Antenna identifiers in double repetitive order |
|
||||
| `BT_CS_ANTENNA_SEL_NO_RECOMMEND` | 0xFF | Host has no recommendation |
|
||||
|
||||
**openvela extension interface.**
|
||||
|
|
@ -1,139 +0,0 @@
|
|||
\[ English | [简体中文](../../../../zh-cn/api/framework/bluetooth/bt_le_advertiser.md) \]
|
||||
|
||||
# Bluetooth BLE Advertising API
|
||||
|
||||
The openvela Bluetooth BLE advertising interface is used to send BLE advertising data and manage advertising instances.
|
||||
|
||||
Header file: `#include "bt_le_advertiser.h"`
|
||||
|
||||
|
||||
## openvela Implementation Notes
|
||||
|
||||
- **Advertising types**: Supports connectable advertising, non-connectable advertising, scan response, etc.
|
||||
- **Advertising data**: Supports custom advertising data and scan response data
|
||||
- **Multiple instances**: Supports running multiple advertising instances simultaneously
|
||||
|
||||
|
||||
## Synchronous Interfaces
|
||||
|
||||
|
||||
### bt_le_stop_advertising
|
||||
|
||||
```c
|
||||
void bt_le_stop_advertising(bt_instance_t* ins, bt_advertiser_t* adver);
|
||||
```
|
||||
|
||||
Stop BLE advertising.
|
||||
|
||||
**Parameters**:
|
||||
|
||||
- `ins` Bluetooth client instance.
|
||||
- `adver` Advertiser instance.
|
||||
|
||||
**Returns**:
|
||||
|
||||
None.
|
||||
|
||||
|
||||
### bt_le_stop_advertising_id
|
||||
|
||||
```c
|
||||
void bt_le_stop_advertising_id(bt_instance_t* ins, uint8_t adv_id);
|
||||
```
|
||||
|
||||
Stop the BLE advertising instance with the specified ID.
|
||||
|
||||
**Parameters**:
|
||||
|
||||
- `ins` Bluetooth client instance.
|
||||
- `adv_id` Advertising instance ID.
|
||||
|
||||
|
||||
### bt_le_advertising_is_supported
|
||||
|
||||
```c
|
||||
bool bt_le_advertising_is_supported(bt_instance_t* ins);
|
||||
```
|
||||
|
||||
Query whether BLE advertising is supported.
|
||||
|
||||
**Parameters**:
|
||||
|
||||
- `ins` Bluetooth client instance.
|
||||
|
||||
|
||||
**Returns**:
|
||||
|
||||
Returns true if BLE advertising is supported, false otherwise.
|
||||
|
||||
|
||||
## Asynchronous Interfaces
|
||||
|
||||
|
||||
### bt_le_start_advertising_async
|
||||
|
||||
```c
|
||||
bt_status_t bt_le_start_advertising_async(bt_instance_t* ins, ble_adv_params_t* params, uint8_t* adv_data, uint16_t adv_len, uint8_t* scan_rsp_data, uint16_t scan_rsp_len, advertiser_callback_t* adv_cbs, bt_le_start_adv_callback_cb_t cb, void* userdata);
|
||||
```
|
||||
|
||||
Start BLE advertising (asynchronous version).
|
||||
|
||||
**Parameters**:
|
||||
|
||||
- `ins` Bluetooth client instance.
|
||||
- `params` Advertising parameters structure.
|
||||
- `adv_data` Advertising data.
|
||||
- `adv_len` Advertising data length.
|
||||
- `scan_rsp_data` Scan response data.
|
||||
- `scan_rsp_len` Scan response data length.
|
||||
- `adv_cbs` Advertiser callback function set.
|
||||
- `cb` Completion callback function.
|
||||
- `userdata` User data.
|
||||
|
||||
|
||||
### bt_le_stop_advertising_async
|
||||
|
||||
```c
|
||||
bt_status_t bt_le_stop_advertising_async(bt_instance_t* ins, bt_advertiser_t* adver, bt_status_cb_t cb, void* userdata);
|
||||
```
|
||||
|
||||
Stop BLE advertising (asynchronous version).
|
||||
|
||||
**Parameters**:
|
||||
|
||||
- `ins` Bluetooth client instance.
|
||||
- `adver` Advertiser instance.
|
||||
- `cb` Completion callback function.
|
||||
- `userdata` User data.
|
||||
|
||||
|
||||
|
||||
### bt_le_stop_advertising_id_async
|
||||
|
||||
```c
|
||||
bt_status_t bt_le_stop_advertising_id_async(bt_instance_t* ins, uint8_t adv_id, bt_status_cb_t cb, void* userdata);
|
||||
```
|
||||
|
||||
Stop BLE advertising by specified ID (asynchronous version).
|
||||
|
||||
**Parameters**:
|
||||
|
||||
- `ins` Bluetooth client instance.
|
||||
- `adv_id` Advertising instance ID.
|
||||
- `cb` Completion callback function.
|
||||
- `userdata` User data.
|
||||
|
||||
|
||||
### bt_le_advertising_is_supported_async
|
||||
|
||||
```c
|
||||
bt_status_t bt_le_advertising_is_supported_async(bt_instance_t* ins, bt_bool_cb_t cb, void* userdata);
|
||||
```
|
||||
|
||||
Query whether BLE advertising is supported (asynchronous version).
|
||||
|
||||
**Parameters**:
|
||||
|
||||
- `ins` Bluetooth client instance.
|
||||
- `cb` Completion callback function.
|
||||
- `userdata` User data.
|
||||
|
|
@ -1,141 +0,0 @@
|
|||
\[ English | [简体中文](../../../../zh-cn/api/framework/bluetooth/bt_le_scan.md) \]
|
||||
|
||||
# Bluetooth BLE Scanning API
|
||||
|
||||
The openvela Bluetooth BLE scanning interface is used to discover nearby BLE devices and receive broadcast data.
|
||||
|
||||
Header file: `#include "bt_le_scan.h"`
|
||||
|
||||
|
||||
## openvela Implementation Notes
|
||||
|
||||
- **Scan modes**: Supports passive scanning and active scanning
|
||||
- **Filters**: Supports filtering scan results by name, address, UUID, and other criteria
|
||||
- **Callback notifications**: Scan results are returned asynchronously via callback functions
|
||||
|
||||
|
||||
## Synchronous Interfaces
|
||||
|
||||
|
||||
### bt_le_stop_scan
|
||||
|
||||
```c
|
||||
void bt_le_stop_scan(bt_instance_t* ins, bt_scanner_t* scanner);
|
||||
```
|
||||
|
||||
Stop BLE scanning.
|
||||
|
||||
**Parameters**:
|
||||
|
||||
- `scanner` Scanner instance.
|
||||
- `ins` Bluetooth client instance.
|
||||
|
||||
**Returns**:
|
||||
|
||||
None.
|
||||
|
||||
|
||||
### bt_le_scan_is_supported
|
||||
|
||||
```c
|
||||
bool bt_le_scan_is_supported(bt_instance_t* ins);
|
||||
```
|
||||
|
||||
Query whether BLE scanning is supported.
|
||||
|
||||
**Parameters**:
|
||||
|
||||
- `ins` Bluetooth client instance.
|
||||
|
||||
|
||||
**Returns**:
|
||||
|
||||
Returns true if BLE scanning is supported, false otherwise.
|
||||
|
||||
|
||||
## Asynchronous Interfaces
|
||||
|
||||
|
||||
### bt_le_start_scan_async
|
||||
|
||||
```c
|
||||
bt_status_t bt_le_start_scan_async(bt_instance_t* ins, const scanner_callbacks_t* scan_cbs, bt_le_start_scan_cb_t cb, void* userdata);
|
||||
```
|
||||
|
||||
Start BLE scanning (asynchronous version).
|
||||
|
||||
**Parameters**:
|
||||
|
||||
- `ins` Bluetooth client instance.
|
||||
- `scan_cbs` Scanner callback function set.
|
||||
- `cb` Completion callback function.
|
||||
- `userdata` User data.
|
||||
|
||||
|
||||
### bt_le_start_scan_settings_async
|
||||
|
||||
```c
|
||||
bt_status_t bt_le_start_scan_settings_async(bt_instance_t* ins, ble_scan_settings_t* settings, const scanner_callbacks_t* scan_cbs, bt_le_start_scan_cb_t cb, void* userdata);
|
||||
```
|
||||
|
||||
Start BLE scanning with custom settings (asynchronous version).
|
||||
|
||||
**Parameters**:
|
||||
|
||||
- `ins` Bluetooth client instance.
|
||||
- `settings` Scan settings.
|
||||
- `scan_cbs` Scanner callback function set.
|
||||
- `cb` Completion callback function.
|
||||
- `userdata` User data.
|
||||
|
||||
|
||||
|
||||
### bt_le_start_scan_with_filters_async
|
||||
|
||||
```c
|
||||
bt_status_t bt_le_start_scan_with_filters_async(bt_instance_t* ins, ble_scan_settings_t* settings, ble_scan_filter_t* filter, const scanner_callbacks_t* scan_cbs, bt_le_start_scan_cb_t cb, void* userdata);
|
||||
```
|
||||
|
||||
Start BLE scanning with filters (asynchronous version).
|
||||
|
||||
**Parameters**:
|
||||
|
||||
- `ins` Bluetooth client instance.
|
||||
- `settings` Scan settings.
|
||||
- `filter` Filter criteria.
|
||||
- `scan_cbs` Scanner callback function set.
|
||||
- `cb` Completion callback function.
|
||||
- `userdata` User data.
|
||||
|
||||
|
||||
### bt_le_stop_scan_async
|
||||
|
||||
```c
|
||||
bt_status_t bt_le_stop_scan_async(bt_instance_t* ins, bt_scanner_t* scanner, bt_le_stop_scan_cb_t cb, void* userdata);
|
||||
```
|
||||
|
||||
Stop BLE scanning (asynchronous version).
|
||||
|
||||
**Parameters**:
|
||||
|
||||
- `ins` Bluetooth client instance.
|
||||
- `scanner` Scanner instance.
|
||||
- `cb` Completion callback function.
|
||||
- `userdata` User data.
|
||||
|
||||
|
||||
|
||||
|
||||
### bt_le_scan_is_supported_async
|
||||
|
||||
```c
|
||||
bt_status_t bt_le_scan_is_supported_async(bt_instance_t* ins, bt_bool_cb_t cb, void* userdata);
|
||||
```
|
||||
|
||||
Query whether BLE scanning is supported (asynchronous version).
|
||||
|
||||
**Parameters**:
|
||||
|
||||
- `ins` Bluetooth client instance.
|
||||
- `cb` Completion callback function.
|
||||
- `userdata` User data.
|
||||
|
|
@ -10,17 +10,15 @@ The openvela Bluetooth framework provides a complete Bluetooth stack interface,
|
|||
- **[GATT](bt_gatt.md)** (Generic Attribute Profile) — BLE data attribute read/write and notifications
|
||||
- **[Device Management](bt_device.md)** — Remote device pairing, connection, and property queries
|
||||
|
||||
## BLE Interfaces
|
||||
|
||||
- **[BLE Scanning](bt_le_scan.md)** — BLE device discovery and broadcast data reception
|
||||
- **[BLE Advertising](bt_le_advertiser.md)** — BLE advertising data transmission and management
|
||||
|
||||
## Audio and Media
|
||||
|
||||
- **[A2DP](bt_a2dp.md)** (Advanced Audio Distribution Profile) — High-quality stereo music streaming
|
||||
- **[AVRCP](bt_avrcp.md)** (Audio/Video Remote Control Profile) — Playback control, track change, volume adjustment
|
||||
- **[HFP](bt_hfp.md)** (Hands-Free Profile) — Bluetooth call functionality
|
||||
|
||||
## Positioning and Ranging
|
||||
|
||||
- **[CS](bt_cs.md)** (Channel Sounding) — Bluetooth channel sounding for distance measurement and positioning
|
||||
|
||||
## Data and Peripherals
|
||||
|
||||
- **[HID](bt_hid.md)** (Human Interface Device) — Keyboards, mice, game controllers
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ Header: `#include <media_utils.h>`
|
|||
## openvela Implementation Notes
|
||||
|
||||
- **DTMF**: Generates DTMF dual-tone multi-frequency signals for `0-9` / `*#ABCD` keys, with a fixed audio format of `format=s16le:sample_rate=8000:ch_layout=mono` (defined by the `MEDIA_TONE_DTMF_FORMAT` macro)
|
||||
- **Debug Interfaces**: `media_graph_dump` and `media_policy_dump` print internal state for troubleshooting
|
||||
- **Debug Interfaces**: `media_graph_dump`, `media_player_dump`, `media_recorder_dump` and `media_policy_dump` print internal state for troubleshooting
|
||||
- **Generic Command**: `media_process_command` sends custom commands to the media server for extended capabilities (e.g., triggering an operation on a specific filter within a graph)
|
||||
- **Event Name Lookup**: `media_event_get_name` converts `MEDIA_EVENT_*` numeric values to human-readable strings for log output
|
||||
|
||||
|
|
@ -103,6 +103,33 @@ Prints the current state of the media policy for debugging.
|
|||
|
||||
- `options` Dump options string.
|
||||
|
||||
|
||||
### media_player_dump
|
||||
|
||||
```c
|
||||
void media_player_dump(const char* options);
|
||||
```
|
||||
|
||||
Prints the internal state of the media player for debugging.
|
||||
|
||||
**Parameters**:
|
||||
|
||||
- `options` Dump options string.
|
||||
|
||||
|
||||
### media_recorder_dump
|
||||
|
||||
```c
|
||||
void media_recorder_dump(const char* options);
|
||||
```
|
||||
|
||||
Prints the internal state of the media recorder for debugging.
|
||||
|
||||
**Parameters**:
|
||||
|
||||
- `options` Dump options string.
|
||||
|
||||
|
||||
## Generic Command
|
||||
|
||||
### media_process_command
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ TAPI is independent of the openvela telephony core stack. Its internal logic use
|
|||
## openvela Implementation Notes
|
||||
|
||||
- **Architecture**: TAPI encapsulates the Telephony Core Stack (oFono) via D-Bus, exposing standard C interfaces externally
|
||||
- **Multi-SIM support**: Different SIM slots are distinguished via the `slot_id` parameter
|
||||
- **SIM identification**: Different SIM slots are distinguished via the `slot_id` parameter
|
||||
- **Asynchronous model**: Most operations return results asynchronously through callback functions
|
||||
|
||||
## Module Overview
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ Header: `#include <tapi_call.h>`
|
|||
|
||||
## openvela Implementation Notes
|
||||
|
||||
- **Multi-SIM support**: Some interfaces do not take a `slot_id` and use the default slot; use `tapi_call_set_default_slot` to switch when a specific slot is needed
|
||||
- **SIM identification**: Some interfaces do not take a `slot_id` and use the default slot; use `tapi_call_set_default_slot` to switch when a specific slot is needed
|
||||
- **Synchronous/Asynchronous**: Time-consuming operations such as dialing and answering provide both synchronous versions and `_async` versions (callback-style)
|
||||
- **Operate by ID**: Long-lived calls are uniquely identified by the call ID (string) returned; `*_by_id` interfaces operate on the call accordingly
|
||||
- **DTMF**: Keypad tones are triggered via `tapi_call_send_tones` (batch) or `tapi_call_start_dtmf` / `tapi_call_stop_dtmf` (continuous key press)
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ Header: `#include <tapi_cbs.h>`
|
|||
- **Power control**: Enable/disable cell broadcast reception via `set_cell_broadcast_power_on`
|
||||
- **Topic subscription**: Configure broadcast topic ranges (by channel ID) via `set_cell_broadcast_topics`
|
||||
- **Event callback**: Register event callbacks via `tapi_cbs_register` to receive broadcast messages
|
||||
- **Multi-SIM support**: All interfaces include a `slot_id` parameter for multi-SIM devices
|
||||
- **SIM identification**: All interfaces include a `slot_id` parameter for multi-SIM devices
|
||||
- **Related protocol**: Corresponds to the Cell Broadcast procedure defined in 3GPP TS 23.041
|
||||
|
||||
## Power Control
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ Header file: `#include <tapi_data.h>`
|
|||
- **APN context**: Manage APN configurations (add/remove/edit/query) via the `tapi_data_*_apn_context` series of interfaces
|
||||
- **On-demand connection**: `tapi_data_request_network` / `tapi_data_release_network` controls data network establishment and release
|
||||
- **Roaming control**: Explicitly toggle data roaming via `tapi_data_enable_roaming`
|
||||
- **Multi-SIM support**: Operations involving a specific SIM use the `slot_id` parameter; the default data SIM is set via `tapi_data_set_default_slot`
|
||||
- **SIM identification**: Operations involving a specific SIM use the `slot_id` parameter; the default data SIM is set via `tapi_data_set_default_slot`
|
||||
- **State subscription**: `tapi_data_register` / `tapi_data_unregister` for registering/unregistering state change events
|
||||
|
||||
## APN Configuration Management
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ Header: `#include <tapi_ims.h>`
|
|||
- **Registration Status**: Queries whether IMS is registered to the network, subscribes to registration state change events
|
||||
- **Service Switch**: `set_service_status` controls enabling of specific services (e.g. voice, video)
|
||||
- **VoLTE Support**: Queries whether the current network supports VoLTE via `is_volte_available`
|
||||
- **Multi-SIM Support**: All interfaces include a `slot_id` parameter
|
||||
- **SIM identification**: All interfaces include a `slot_id` parameter
|
||||
|
||||
## IMS Switch
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ Header: `#include <tapi_manager.h>`
|
|||
## openvela Implementation Notes
|
||||
|
||||
- **D-Bus Based**: TAPI Manager communicates with the Telephony Core Stack (oFono) via D-Bus, exposing standard C interfaces externally
|
||||
- **Multi-SIM Support**: The manager layer does not directly handle SIM slot selection; slot-specific operations use the `slot_id` parameter in submodules such as `tapi_sim`
|
||||
- **SIM identification**: The manager layer does not directly handle SIM slot selection; slot-specific operations use the `slot_id` parameter in submodules such as `tapi_sim`
|
||||
- **Client Handle**: Obtain a `tapi_context` via `tapi_open`; all subsequent calls take this context as the first parameter
|
||||
- **Event Subscription**: Register event callbacks via `tapi_register`, unsubscribe via `tapi_unregister`
|
||||
- **Synchronous vs Asynchronous**: Most interfaces are asynchronous (with callbacks); some provide `*_sync` variants for simple scenarios
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ Header: `#include <tapi_network.h>`
|
|||
- **Network selection mode**: Supports automatic selection (`select_auto`) and manual selection (`select_manual`)
|
||||
- **Scanning**: `tapi_network_scan` scans for available network operators
|
||||
- **Cell information**: `get_serving_cellinfos` retrieves the current serving cell, `get_neighbouring_cellinfos` retrieves neighboring cells
|
||||
- **Multi-SIM support**: Most interfaces include a `slot_id` parameter to distinguish network state across different SIM slots
|
||||
- **SIM identification**: Most interfaces include a `slot_id` parameter to distinguish network state across different SIM slots
|
||||
- **Event subscription**: `tapi_network_register` / `tapi_network_unregister` monitor registration state and signal strength changes
|
||||
|
||||
## Network Selection and Scanning
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ Header: `#include <tapi_phonebook.h>`
|
|||
- **ADN**: Abbreviated Dialling Numbers, regular numbers stored on the SIM card
|
||||
- **FDN**: Fixed Dialling Numbers; when enabled, the phone can only dial numbers in the FDN list, protected by PIN2
|
||||
- **FDN operations require PIN2**: `insert_fdn_entry` / `delete_fdn_entry` / `update_fdn_entry` calls require PIN2
|
||||
- **Multi-SIM support**: All interfaces include a `slot_id` parameter
|
||||
- **SIM identification**: All interfaces include a `slot_id` parameter
|
||||
- **Asynchronous callbacks**: All operations return results asynchronously via `tapi_async_function`
|
||||
|
||||
## ADN Phonebook
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ Header file: `#include <tapi_sim.h>`
|
|||
|
||||
## openvela Implementation Notes
|
||||
|
||||
- **Multi-SIM support**: All interfaces include `slot_id` to support multi-SIM devices
|
||||
- **SIM management**: All interfaces include `slot_id` parameter for SIM card identification
|
||||
- **PIN management**: Provides `enter_pin` / `change_pin` / `reset_pin` / `lock_pin` / `unlock_pin` for complete PIN/PUK workflows
|
||||
- **APDU channel**: Use `open_logical_channel` / `close_logical_channel` / `transmit_apdu_*` to send APDU commands directly to the SIM card
|
||||
- **UICC switch**: Control SIM card enablement state via `get_uicc_enablement` / `set_uicc_enablement`
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ Header file: `#include <tapi_ss.h>`
|
|||
- **CLIR/CLIP**: Calling line identification display and restriction via `calling_line_restriction` and `calling_line_presentation_info` interfaces
|
||||
- **USSD**: `tapi_ss_send_ussd` sends `*#xxxx#` commands, `tapi_ss_cancel_ussd` cancels the session
|
||||
- **FDN**: Fixed Dialing Number switch via `tapi_ss_enable_fdn` / `tapi_ss_query_fdn`
|
||||
- **Multi-SIM support**: All interfaces include `slot_id`
|
||||
- **SIM identification**: All interfaces include `slot_id`
|
||||
- **Asynchronous callback**: All operations use `tapi_async_function`
|
||||
|
||||
## Call Barring
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ Header file: `#include <tapi_stk.h>`
|
|||
- **Registration levels**: Supports per-slot Agent (via `tapi_stk_agent_register`) and default Agent (system default UI).
|
||||
- **Main menu**: `tapi_stk_get_main_menu*` queries the main menu structure provided by the SIM card.
|
||||
- **Proactive Command responses**: The `tapi_stk_handle_agent_*` family of interfaces is used to send the Agent's responses to SIM card proactive commands back to the SIM.
|
||||
- **Multi-SIM support**: All interfaces include a `slot_id` parameter.
|
||||
- **SIM identification**: All interfaces include a `slot_id` parameter.
|
||||
|
||||
## Agent Registration
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ Header files: `#include <netutils/dhcpc.h>`, `#include <netutils/dhcp6c.h>`, `#i
|
|||
## openvela Implementation Notes
|
||||
|
||||
- **IPv4 client**: The `dhcpc_*` series encapsulates the complete DHCP client state machine (DISCOVER/OFFER/REQUEST/ACK)
|
||||
- **IPv6 client**: The `dhcp6c_*` series handles the IPv6 SLAAC / DHCPv6 process
|
||||
- **IPv6 client**: The `dhcp6c_*` series implements the DHCPv6 client protocol
|
||||
- **Server**: The `dhcpd_*` series provides simple DHCP server capabilities for IP allocation in hotspot/AP mode
|
||||
- **Asynchronous calls**: The `*_request_async` interfaces provide callback-based invocation to avoid blocking the current thread
|
||||
- **Configuration dependency**: Requires enabling `CONFIG_NETUTILS_DHCPC` / `CONFIG_NETUTILS_DHCP6C` / `CONFIG_NETUTILS_DHCPD`
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
## I. Prerequisites
|
||||
|
||||
1. Download the source code. Please refer to [Quick Start](./../../quickstart/openvela_ubuntu_quick_start.md).
|
||||
2. Before starting this tutorial, please obtain the example code from [music_player](../../../../../../packages_demos/tree/dev-ai-contest-2026/music_player).
|
||||
2. Before starting this tutorial, please obtain the example code from [music_player](../../../../../../packages_demos/tree/dev/music_player).
|
||||
|
||||
## II. Preliminary Concepts
|
||||
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ The following are the interrupt-related functions that vendors need to implement
|
|||
|
||||
### 2. Required Interrupt-Related Macros
|
||||
|
||||
Alongside the above function implementations, vendors need to define a series of interrupt-related macros, which describe the configuration of the NVIC (Nested Vectored Interrupt Controller). These macros should be defined in the `chips/chip_name/include/irq.h` file. Refer to the [RTL8720C example](../../../../../nuttx/blob/dev-ai-contest-2026/arch/arm/src/rtl8720c/include/irq.h) for guidance.
|
||||
Alongside the above function implementations, vendors need to define a series of interrupt-related macros, which describe the configuration of the NVIC (Nested Vectored Interrupt Controller). These macros should be defined in the `chips/chip_name/include/irq.h` file. Refer to the [RTL8720C example](../../../../../nuttx/blob/dev/arch/arm/src/rtl8720c/include/irq.h) for guidance.
|
||||
|
||||
The required macros and their descriptions are as follows:
|
||||
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ CONFIG_FRAME_POINTER=y
|
|||
CONFIG_SCHED_BACKTRACE=y
|
||||
```
|
||||
|
||||
For more information, refer to: [RISC-V Backtrace Implementation](../../../../../../nuttx/blob/dev-ai-contest-2026/arch/risc-v/src/common/riscv_backtrace.c).
|
||||
For more information, refer to: [RISC-V Backtrace Implementation](../../../../../../nuttx/blob/dev/arch/risc-v/src/common/riscv_backtrace.c).
|
||||
|
||||
### 4. Xtensa
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,6 @@
|
|||
| STMicroelectronics | STM32F411CEU6 | [STM32F411CE](https://www.st.com/en/microcontrollers-microprocessors/stm32f411ce.html) | [Blink an LED with openvela on STM32F411](../quickstart/development_board/STM32F411.md) | IoT, Industrial Automation | [ST MCU China Support](mailto:mcu.china@st.com) |
|
||||
| Espressif | [ESP32-S3-EYE](https://www.espressif.com/en/dev-board/esp32-s3-eye) | [ESP32-S3](https://www.espressif.com/en/products/socs/esp32-s3) | [Port openvela to the ESP32-S3-EYE Dev Board](../quickstart/development_board/ESP32-S3-EYE.md) | AIoT, HMI, Smart Home | [Espressif Developer Community](https://www.espressif.com/en/contact-us/technical-inquiries) |
|
||||
| Espressif | [ESP32-S3-BOX](https://www.espressif.com/en/news/ESP32-S3-BOX_video) | [ESP32-S3](https://www.espressif.com/en/products/socs/esp32-s3) | [See: Port openvela to the ESP32-S3-EYE Dev Board](../quickstart/development_board/ESP32-S3-EYE.md) | AIoT, HMI, Smart Home | [Espressif Developer Community](https://www.espressif.com/en/contact-us/technical-inquiries) |
|
||||
| Bestechnic | [BES2600WM MAIN BOARD V1.1](https://www.fortune-co.com/index.php?s=/Cn/Public/singlePage/catid/176.html) | BES2600WM-AX4F | [Readme](../../../../../vendor_bes/blob/dev-ai-contest-2026/boards/best2003_ep/aos_evb/Readme) | Smart Wearables, AI Toys | [Contact Distributor](https://www.fortune-co.com/Tech/projectDetail/id/64.html) |
|
||||
| Bestechnic | [BES2600WM MAIN BOARD V1.1](https://www.fortune-co.com/index.php?s=/Cn/Public/singlePage/catid/176.html) | BES2600WM-AX4F | [Readme](../../../../../vendor_bes/blob/dev/boards/best2003_ep/aos_evb/Readme) | Smart Wearables, AI Toys | [Contact Distributor](https://www.fortune-co.com/Tech/projectDetail/id/64.html) |
|
||||
| Flagchip | [FC7300F8M-EVB](https://www.flagchip.com.cn/Pro/3/3.html) | [FC7300F8MDT](https://www.flagchip.com.cn/Pro/3/3.html) | [openvela Running Guide for FC7300F8M-EVB](../quickstart/development_board/fc7300f8m_evb_guide.md) | Domain/Zonal Controllers, ADAS, BMS, Motor Control, etc. | [Contact Distributor](https://www.flagchip.com.cn/Pro/3/3.html) | [Contact Distributor](https://www.flagchip.com.cn/Pro/3/3.html) |
|
||||
| Infineon | [TC4D9-EVB](https://itools.infineon.com/aurix_tc4xx_code_examples/documents/Board_Users_Manual_TriBoard-TC4X9-COM-V2_0_0.pdf) | [AURIX ™ TC4x](https://www.infineon.cn/products/microcontroller/32-bit-tricore/aurix-tc4x/tc4dx#products) | [openvela Running Guide for TC4D9-EVB](../quickstart/development_board/tc4d9_evb_guide.md) | Vehicle Motion Controllers, Zonal Controllers, Automotive Gateways, etc. | [Contact Distributor](https://www.infineon.cn/contact-us/where-to-buy) | [Contact Distributor](https://www.infineon.cn/contact-us/where-to-buy) |
|
||||
|
|
@ -19,20 +19,20 @@ The implementation of these member functions depends on the actual operation of
|
|||
|
||||
#### Note
|
||||
|
||||
- To quickly validate custom callbacks and driver registration in a QEMU environment, this example implements the `struct bt_driver_s` member functions directly within the [drivers_initialize](../../../../../../../nuttx/blob/dev-ai-contest-2026/drivers/drivers_initialize.c) function and completes driver registration.
|
||||
- In a real integration or production scenario, it is recommended to create a separate source file under the [vendor](../../../../../../../vendor_template/blob/dev-ai-contest-2026/boards/chip_name/board_name/src) directory for maintainability and version control.
|
||||
- To quickly validate custom callbacks and driver registration in a QEMU environment, this example implements the `struct bt_driver_s` member functions directly within the [drivers_initialize](../../../../../../../nuttx/blob/dev/drivers/drivers_initialize.c) function and completes driver registration.
|
||||
- In a real integration or production scenario, it is recommended to create a separate source file under the [vendor](../../../../../../../vendor_template/blob/dev/boards/chip_name/board_name/src) directory for maintainability and version control.
|
||||
|
||||
#### Steps
|
||||
|
||||
1. In [drivers_initialize.c](../../../../../../../nuttx/blob/dev-ai-contest-2026/drivers/drivers_initialize.c), add the [bt_driver.h](../../../../../../../nuttx/blob/dev-ai-contest-2026/include/nuttx/wireless/bluetooth/bt_driver.h) header include:
|
||||
1. In [drivers_initialize.c](../../../../../../../nuttx/blob/dev/drivers/drivers_initialize.c), add the [bt_driver.h](../../../../../../../nuttx/blob/dev/include/nuttx/wireless/bluetooth/bt_driver.h) header include:
|
||||
|
||||
```C
|
||||
#include <nuttx/wireless/bluetooth/bt_driver.h> /* Add bt_driver.h header include */
|
||||
```
|
||||
|
||||
2. In [drivers_initialize.c](../../../../../../../nuttx/blob/dev-ai-contest-2026/drivers/drivers_initialize.c), implement the member functions.
|
||||
2. In [drivers_initialize.c](../../../../../../../nuttx/blob/dev/drivers/drivers_initialize.c), implement the member functions.
|
||||
|
||||
In openvela, the `receive` member function of `struct bt_driver_s` already has a default implementation in [uart_bth4.c](../../../../../../../nuttx/blob/dev-ai-contest-2026/drivers/serial/uart_bth4.c). Therefore, developers or vendors do not need to redefine or implement this method.
|
||||
In openvela, the `receive` member function of `struct bt_driver_s` already has a default implementation in [uart_bth4.c](../../../../../../../nuttx/blob/dev/drivers/serial/uart_bth4.c). Therefore, developers or vendors do not need to redefine or implement this method.
|
||||
|
||||
```C
|
||||
/* The following are sample implementations for demonstration only.
|
||||
|
|
@ -68,7 +68,7 @@ The implementation of these member functions depends on the actual operation of
|
|||
/* 4. The receive member function is assigned by openvela at registration time */
|
||||
```
|
||||
|
||||
3. In [drivers_initialize.c](../../../../../../../nuttx/blob/dev-ai-contest-2026/drivers/drivers_initialize.c), define the `struct bt_driver_s` structure.
|
||||
3. In [drivers_initialize.c](../../../../../../../nuttx/blob/dev/drivers/drivers_initialize.c), define the `struct bt_driver_s` structure.
|
||||
|
||||
The following code shows a complete example of initializing a `struct bt_driver_s` instance, where the function pointers are assigned to the sample functions defined above:
|
||||
|
||||
|
|
@ -94,7 +94,7 @@ After implementing the above structure, register the driver instance using one o
|
|||
|
||||
- `bt_driver_register_with_id(FAR struct bt_driver_s *driver, int id)`: Registers with the specified id
|
||||
|
||||
The type definition `int bt_driver_register(FAR struct bt_driver_s *drv)` can be found in the header [bt_driver.h](../../../../../../../nuttx/blob/dev-ai-contest-2026/include/nuttx/wireless/bluetooth/bt_driver.h). Vendors or developers do not need to define the `receive()` member function; the BTH4 driver will initialize it.
|
||||
The type definition `int bt_driver_register(FAR struct bt_driver_s *drv)` can be found in the header [bt_driver.h](../../../../../../../nuttx/blob/dev/include/nuttx/wireless/bluetooth/bt_driver.h). Vendors or developers do not need to define the `receive()` member function; the BTH4 driver will initialize it.
|
||||
|
||||
The call flow is shown below:
|
||||
|
||||
|
|
@ -102,7 +102,7 @@ The call flow is shown below:
|
|||
|
||||
### Example
|
||||
|
||||
After completing the driver implementation example above, call the driver registration API at the end of the `drivers_initialize()` function in [drivers_initialize.c](../../../../../../../nuttx/blob/dev-ai-contest-2026/drivers/drivers_initialize.c) to complete the driver registration:
|
||||
After completing the driver implementation example above, call the driver registration API at the end of the `drivers_initialize()` function in [drivers_initialize.c](../../../../../../../nuttx/blob/dev/drivers/drivers_initialize.c) to complete the driver registration:
|
||||
|
||||
```C
|
||||
void drivers_initialize(void)
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ In openvela, the application layer accesses drivers through system calls, with t
|
|||
|
||||
**System call -> VFS (Virtual File System) -> Driver**.
|
||||
|
||||
To understand how drivers are registered with the file system, it is necessary to first understand the relevant data structures. The definitions of these data structures are located in the [include/nuttx/fs/fs.h](../../../../../../nuttx/blob/dev-ai-contest-2026/include/nuttx/fs/fs.h) file.
|
||||
To understand how drivers are registered with the file system, it is necessary to first understand the relevant data structures. The definitions of these data structures are located in the [include/nuttx/fs/fs.h](../../../../../../nuttx/blob/dev/include/nuttx/fs/fs.h) file.
|
||||
|
||||
#### Driver Registration and `inode`
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ Openvela provides a generic **oneshot** driver, which is a one-time (non-periodi
|
|||
- **Upper Half**: Application-facing, provided by openvela, and does not require modification by chip vendors.
|
||||
- **Lower Half**: Platform-specific hardware control driver, which chip vendors need to adapt and provide.
|
||||
|
||||
The **oneshot** driver-related interface information is in the [oneshot.h](../../../../../../../../nuttx/blob/dev-ai-contest-2026/include/nuttx/timers/oneshot.h) file, and is also divided into **Upper Half** and **Lower Half** interface layers.
|
||||
The **oneshot** driver-related interface information is in the [oneshot.h](../../../../../../../../nuttx/blob/dev/include/nuttx/timers/oneshot.h) file, and is also divided into **Upper Half** and **Lower Half** interface layers.
|
||||
|
||||
### 2. Arch_alarm Timer Introduction
|
||||
|
||||
|
|
@ -47,7 +47,7 @@ The **`up_timer_initialize`** function in the Upper Half of openvela must be imp
|
|||
|
||||
## III. Arch_alarm API
|
||||
|
||||
`arch_alarm` provides a series of interfaces to meet the timer requirements of the sched module. Interface information can be found in the [arch.h](../../../../../../../../nuttx/blob/dev-ai-contest-2026/include/nuttx/arch.h) header file.
|
||||
`arch_alarm` provides a series of interfaces to meet the timer requirements of the sched module. Interface information can be found in the [arch.h](../../../../../../../../nuttx/blob/dev/include/nuttx/arch.h) header file.
|
||||
|
||||
### 1. Interface Classification
|
||||
|
||||
|
|
@ -193,7 +193,7 @@ In the openvela board adaptation, the initialization of the Oneshot timer requir
|
|||
|
||||
##### Instance Creation: Call `oneshot_initialize`
|
||||
|
||||
During the board initialization phase, it is necessary to invoke the **vendor-customized initialization function** to complete the allocation and initialization of the [struct oneshot_lowerhalf_s](../../../../../../../../nuttx/blob/dev-ai-contest-2026/include/nuttx/timers/oneshot.h#L226) structure. This function is provided by the openvela framework, with the prototype as follows:
|
||||
During the board initialization phase, it is necessary to invoke the **vendor-customized initialization function** to complete the allocation and initialization of the [struct oneshot_lowerhalf_s](../../../../../../../../nuttx/blob/dev/include/nuttx/timers/oneshot.h#L226) structure. This function is provided by the openvela framework, with the prototype as follows:
|
||||
|
||||
```C
|
||||
/****************************************************************************
|
||||
|
|
@ -224,7 +224,7 @@ Operation Instructions:
|
|||
|
||||
##### Device Registration: Call `oneshot_register`
|
||||
|
||||
Bind the instance returned by `oneshot_initialize` to the system device model, register the character device node (e.g., `/dev/oneshot`), and associate it with the file operation interface `struct file_operations g_oneshot_ops`. The prototype of the function [oneshot_register](../../../../../../../../nuttx/blob/dev-ai-contest-2026/drivers/timers/oneshot.c#L291) is as follows:
|
||||
Bind the instance returned by `oneshot_initialize` to the system device model, register the character device node (e.g., `/dev/oneshot`), and associate it with the file operation interface `struct file_operations g_oneshot_ops`. The prototype of the function [oneshot_register](../../../../../../../../nuttx/blob/dev/drivers/timers/oneshot.c#L291) is as follows:
|
||||
|
||||
```C
|
||||
/****************************************************************************
|
||||
|
|
@ -272,7 +272,7 @@ Key Role:
|
|||
|
||||
#### 2.2 Reference Implementation and Debugging
|
||||
|
||||
- Structure Definition: For details on the members of `struct oneshot_lowerhalf_s`, refer to [oneshot.h](../../../../../../../../nuttx/blob/dev-ai-contest-2026/include/nuttx/timers/oneshot.h#L226). Fill in function pointers such as interrupt triggering and timer startup according to hardware characteristics.
|
||||
- Structure Definition: For details on the members of `struct oneshot_lowerhalf_s`, refer to [oneshot.h](../../../../../../../../nuttx/blob/dev/include/nuttx/timers/oneshot.h#L226). Fill in function pointers such as interrupt triggering and timer startup according to hardware characteristics.
|
||||
- Example Code: For specific driver adaptation examples, refer to the [Driver Adaptation Example - Initialization Section](#1-initialization-process), and adjust the hardware register operation logic according to the target platform (e.g., ARM Cortex-M/RISC-V).
|
||||
- Debugging Suggestions: If initialization fails, check whether `CONFIG_ONESHOT`/`CONFIG_ALARM_ARCH` are correctly enabled, and use serial port logs to print the return value of `oneshot_initialize`.
|
||||
|
||||
|
|
@ -296,7 +296,7 @@ Design Principles:
|
|||
|
||||
#### 3.2 Core Interface Description
|
||||
|
||||
Upper-Half interfaces are defined in [arch.h](../../../../../../../../nuttx/blob/dev-ai-contest-2026/include/nuttx/arch.h#L1460), primarily for use by the scheduler (Sched).
|
||||
Upper-Half interfaces are defined in [arch.h](../../../../../../../../nuttx/blob/dev/include/nuttx/arch.h#L1460), primarily for use by the scheduler (Sched).
|
||||
|
||||
### 4. Lower-Half Interfaces
|
||||
|
||||
|
|
@ -323,7 +323,7 @@ This interface supports two time units (`struct timespec` and `tick`). Developer
|
|||
- Vendor Selection
|
||||
|
||||
- Choose to implement the `timespec` or `tick` interface group based on hardware capabilities.
|
||||
- Unimplemented interface groups can be automatically mapped via openvela's built-in [conversion functions](../../../../../../../../nuttx/blob/dev-ai-contest-2026/include/nuttx/timers/oneshot.h).
|
||||
- Unimplemented interface groups can be automatically mapped via openvela's built-in [conversion functions](../../../../../../../../nuttx/blob/dev/include/nuttx/timers/oneshot.h).
|
||||
|
||||
- Performance Optimization
|
||||
|
||||
|
|
@ -331,7 +331,7 @@ This interface supports two time units (`struct timespec` and `tick`). Developer
|
|||
|
||||
#### 4.2 Core Interface Description
|
||||
|
||||
`struct oneshot_operations_s` is defined in [oneshot.h](../../../../../../../../nuttx/blob/dev-ai-contest-2026/include/nuttx/timers/oneshot.h), with the following member functions.
|
||||
`struct oneshot_operations_s` is defined in [oneshot.h](../../../../../../../../nuttx/blob/dev/include/nuttx/timers/oneshot.h), with the following member functions.
|
||||
|
||||
##### Timer Control Interfaces
|
||||
|
||||
|
|
@ -432,7 +432,7 @@ board_late_initialize (or board_app_initialize)
|
|||
|
||||
#### 1.2 Key Code Implementation
|
||||
|
||||
- Hardware (Arch Layer) Timer Initialization, refer to code [arch/risc-v/src/bl602/bl602_timerisr.c](../../../../../../../../nuttx/blob/dev-ai-contest-2026/arch/risc-v/src/bl602/bl602_timerisr.c#L57).
|
||||
- Hardware (Arch Layer) Timer Initialization, refer to code [arch/risc-v/src/bl602/bl602_timerisr.c](../../../../../../../../nuttx/blob/dev/arch/risc-v/src/bl602/bl602_timerisr.c#L57).
|
||||
|
||||
```C
|
||||
/****************************************************************************
|
||||
|
|
@ -456,7 +456,7 @@ board_late_initialize (or board_app_initialize)
|
|||
}
|
||||
```
|
||||
|
||||
- Oneshot Driver Instantiation, refer to code [arch/risc-v/src/bl602/bl602_oneshot_lowerhalf.c](../../../../../../../../nuttx/blob/dev-ai-contest-2026/arch/risc-v/src/bl602/bl602_oneshot_lowerhalf.c#L361).
|
||||
- Oneshot Driver Instantiation, refer to code [arch/risc-v/src/bl602/bl602_oneshot_lowerhalf.c](../../../../../../../../nuttx/blob/dev/arch/risc-v/src/bl602/bl602_oneshot_lowerhalf.c#L361).
|
||||
|
||||
```C
|
||||
struct oneshot_lowerhalf_s *oneshot_initialize(int chan,
|
||||
|
|
@ -520,7 +520,7 @@ board_late_initialize (or board_app_initialize)
|
|||
|
||||
### 2. Lower-Half Interface Implementation
|
||||
|
||||
The operation interface binding is as follows, and the detailed code can be referred to in [arch/risc-v/src/bl602/bl602_oneshot_lowerhalf.c](../../../../../../../../nuttx/blob/dev-ai-contest-2026/arch/risc-v/src/bl602/bl602_oneshot_lowerhalf.c#L96).
|
||||
The operation interface binding is as follows, and the detailed code can be referred to in [arch/risc-v/src/bl602/bl602_oneshot_lowerhalf.c](../../../../../../../../nuttx/blob/dev/arch/risc-v/src/bl602/bl602_oneshot_lowerhalf.c#L96).
|
||||
|
||||
```C
|
||||
/* "Lower half" driver methods */
|
||||
|
|
@ -545,7 +545,7 @@ Below is a brief introduction to the timer API. For detailed information, refer
|
|||
man timer_create
|
||||
```
|
||||
|
||||
Detailed code can be found in [include/time.h](../../../../../../../../nuttx/blob/dev-ai-contest-2026/include/time.h#L233).
|
||||
Detailed code can be found in [include/time.h](../../../../../../../../nuttx/blob/dev/include/time.h#L233).
|
||||
|
||||
```C
|
||||
/*
|
||||
|
|
@ -600,7 +600,7 @@ int timer_getoverrun(timer_t timerid);
|
|||
|
||||
### 2. IOCTL API
|
||||
|
||||
Applications can directly operate the Oneshot timer through the `ioctl` function. Before using this feature, the `/dev/oneshot` device node must be registered during the system startup (bringup) process. Refer to the header file [include/nuttx/timers/oneshot.h](../../../../../../../../nuttx/blob/dev-ai-contest-2026/include/nuttx/timers/oneshot.h#L41) for the currently supported `ioctl` commands. Command descriptions are as follows:
|
||||
Applications can directly operate the Oneshot timer through the `ioctl` function. Before using this feature, the `/dev/oneshot` device node must be registered during the system startup (bringup) process. Refer to the header file [include/nuttx/timers/oneshot.h](../../../../../../../../nuttx/blob/dev/include/nuttx/timers/oneshot.h#L41) for the currently supported `ioctl` commands. Command descriptions are as follows:
|
||||
|
||||
- `OSIOC_START`
|
||||
|
||||
|
|
|
|||
|
|
@ -164,15 +164,15 @@ grep -rE "CONFIG_TIMER|CONFIG_TIMER_ARCH|CONFIG_ARCH_HAVE_TICKLESS|CONFIG_ARCH_H
|
|||
|
||||
During **board** initialization, the `***_timer_initialize` function implemented by the specific **Vendor** needs to be called to complete initialization. This function will perform the following operations:
|
||||
|
||||
1. Allocate and initialize an instance of [struct timer_lowerhalf_s](../../../../../../../../nuttx/blob/dev-ai-contest-2026/include/nuttx/timers/timer.h).
|
||||
2. Register the `timer_lowerhalf_s` instance as a Timer driver using the [timer_register](../../../../../../../../nuttx/blob/dev-ai-contest-2026/drivers/timers/timer.c) function.
|
||||
1. Allocate and initialize an instance of [struct timer_lowerhalf_s](../../../../../../../../nuttx/blob/dev/include/nuttx/timers/timer.h).
|
||||
2. Register the `timer_lowerhalf_s` instance as a Timer driver using the [timer_register](../../../../../../../../nuttx/blob/dev/drivers/timers/timer.c) function.
|
||||
|
||||
- The registration process generates the `/dev/timer` device node.
|
||||
- Simultaneously binds the `struct file_operations` and `g_timerops` instances to the `timer_lowerhalf_s` instance.
|
||||
|
||||
In the platform code, the `up_timer_initialize` function needs to be implemented to call the `up_timer_set_lowerhalf` function, binding the instance returned by `***_timer_initialize` to the system as the system timer.
|
||||
|
||||
Related interface definitions are in: [/include/nuttx/timers/timer.h](../../../../../../../../nuttx/blob/dev-ai-contest-2026/include/nuttx/timers/timer.h).
|
||||
Related interface definitions are in: [/include/nuttx/timers/timer.h](../../../../../../../../nuttx/blob/dev/include/nuttx/timers/timer.h).
|
||||
|
||||
#### `timer_register` Function Description
|
||||
|
||||
|
|
@ -244,7 +244,7 @@ The `lower-half` driver provides standardized `struct timer_ops_s` interfaces fo
|
|||
|
||||
#### Interface Definitions
|
||||
|
||||
The following is the detailed definition of [struct timer_ops_s](../../../../../../../../nuttx/blob/dev-ai-contest-2026/include/nuttx/timers/timer.h):
|
||||
The following is the detailed definition of [struct timer_ops_s](../../../../../../../../nuttx/blob/dev/include/nuttx/timers/timer.h):
|
||||
|
||||
```c
|
||||
struct timer_ops_s
|
||||
|
|
@ -486,7 +486,7 @@ The lower-half is the driver interface part that implements hardware functions,
|
|||
|
||||
In the ARMv7-M Arch Timer adaptation, the lower-half methods appear as follows:
|
||||
|
||||
File path: [arch/arm/src/armv7-m/arm_systick.c](../../../../../../../../nuttx/blob/dev-ai-contest-2026/arch/arm/src/armv7-m/arm_systick.c)
|
||||
File path: [arch/arm/src/armv7-m/arm_systick.c](../../../../../../../../nuttx/blob/dev/arch/arm/src/armv7-m/arm_systick.c)
|
||||
|
||||
```c
|
||||
/* "Lower half" driver methods */
|
||||
|
|
@ -509,7 +509,7 @@ This chapter briefly introduces POSIX API interfaces related to timers and clock
|
|||
|
||||
The following is a brief overview of timing-related POSIX APIs. For specific usage of these interfaces, please refer to the relevant `man` pages.
|
||||
|
||||
Header file location: [include/time.h](../../../../../../../../nuttx/blob/dev-ai-contest-2026/include/time.h)
|
||||
Header file location: [include/time.h](../../../../../../../../nuttx/blob/dev/include/time.h)
|
||||
|
||||
1. `timer_create`
|
||||
|
||||
|
|
@ -584,7 +584,7 @@ Application-level programs can directly operate the timer through the `ioctl` fu
|
|||
|
||||
#### Supported IOCTL Commands
|
||||
|
||||
The following are currently supported IOCTL commands, with related interface definitions in [include/nuttx/timers/timer.h](../../../../../../../../nuttx/blob/dev-ai-contest-2026/include/nuttx/timers/timer.h):
|
||||
The following are currently supported IOCTL commands, with related interface definitions in [include/nuttx/timers/timer.h](../../../../../../../../nuttx/blob/dev/include/nuttx/timers/timer.h):
|
||||
|
||||
- `TCIOC_START`: Start the timer.
|
||||
- `TCIOC_STOP`: Stop the timer.
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ openvela's Framebuffer user interface resembles Linux systems, offering standard
|
|||
|
||||
### 2. Lower-level Driver Interface
|
||||
|
||||
openvela's Framebuffer driver interface for managing LCD devices is designed with simplicity. Developers can refer to [video/fb.h](../../../../../../nuttx/blob/dev-ai-contest-2026/include/nuttx/video/fb.h) and [/drivers/video/fb.c](../../../../../../nuttx/blob/dev-ai-contest-2026/drivers/video/fb.c). Below is the `fb_register()` source code showing key parts of the Framebuffer device driver implementation:
|
||||
openvela's Framebuffer driver interface for managing LCD devices is designed with simplicity. Developers can refer to [video/fb.h](../../../../../../nuttx/blob/dev/include/nuttx/video/fb.h) and [/drivers/video/fb.c](../../../../../../nuttx/blob/dev/drivers/video/fb.c). Below is the `fb_register()` source code showing key parts of the Framebuffer device driver implementation:
|
||||
|
||||
```C
|
||||
int fb_register(int display, int plane)
|
||||
|
|
@ -341,5 +341,5 @@ To prevent screen tearing and improve rendering performance, it is recommended t
|
|||
Here are the links to the code repository related to Framebuffer driver:
|
||||
|
||||
|
||||
- [fb.c](../../../../../../nuttx/blob/dev-ai-contest-2026/drivers/video/fb.c):Framebuffer Implementation files of the driver.
|
||||
- [fb.h](../../../../../../nuttx/blob/dev-ai-contest-2026/include/nuttx/video/fb.h):Framebuffer Interface definitions of the driver.
|
||||
- [fb.c](../../../../../../nuttx/blob/dev/drivers/video/fb.c):Framebuffer Implementation files of the driver.
|
||||
- [fb.h](../../../../../../nuttx/blob/dev/include/nuttx/video/fb.h):Framebuffer Interface definitions of the driver.
|
||||
|
|
|
|||
|
|
@ -352,6 +352,6 @@ In LCD Framebuffer mode, you need to enable the following build options:
|
|||
|
||||
## V. Related Repositories
|
||||
|
||||
- [nuttx/include/nuttx/lcd/lcd.h](../../../../../../nuttx/blob/dev-ai-contest-2026/include/nuttx/lcd/lcd.h)
|
||||
- [nuttx/include/nuttx/lcd/lcd.h](../../../../../../nuttx/blob/dev/include/nuttx/lcd/lcd.h)
|
||||
|
||||
- [nuttx/drivers/lcd/lcd_framebuffer.c](../../../../../../nuttx/blob/dev-ai-contest-2026/drivers/lcd/lcd_framebuffer.c)
|
||||
- [nuttx/drivers/lcd/lcd_framebuffer.c](../../../../../../nuttx/blob/dev/drivers/lcd/lcd_framebuffer.c)
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ In most application scenarios, development is based on [libuv](https://libuv.org
|
|||
|
||||
The core of libuv is based on [poll](https://man7.org/linux/man-pages/man2/poll.2.html). Compared to traditional semaphores, the key advantage of `poll` is its ability to monitor multiple events simultaneously. `poll` exits its blocking state as soon as any one of the monitored events occurs. The principle of libuv is illustrated in the figure below:
|
||||
|
||||
The openvela framebuffer driver framework provides the necessary [interface](../../../../../../nuttx/blob/dev-ai-contest-2026/drivers/video/fb.c) for `poll` to monitor whether the framebuffer is in a writable state:
|
||||
The openvela framebuffer driver framework provides the necessary [interface](../../../../../../nuttx/blob/dev/drivers/video/fb.c) for `poll` to monitor whether the framebuffer is in a writable state:
|
||||
|
||||
```C
|
||||
/****************************************************************************
|
||||
|
|
@ -520,7 +520,7 @@ static void lcdc_te_irq(int irq, void *context, void *arg)
|
|||
|
||||
### 2. (Not Recommended) Blocking Mode
|
||||
|
||||
Using semaphores for synchronization is equivalent to locking the framebuffer. The renderer must acquire the lock before each rendering operation; otherwise, it will be blocked. For the code, see this [link](../../../../../../nuttx/blob/dev-ai-contest-2026/arch/arm/src/stm32/stm32_ltdc.c).
|
||||
Using semaphores for synchronization is equivalent to locking the framebuffer. The renderer must acquire the lock before each rendering operation; otherwise, it will be blocked. For the code, see this [link](../../../../../../nuttx/blob/dev/arch/arm/src/stm32/stm32_ltdc.c).
|
||||
|
||||
## V Related Repositories
|
||||
|
||||
|
|
|
|||
|
|
@ -292,7 +292,7 @@ When a thread attempts to acquire an unavailable semaphore:
|
|||
#### References
|
||||
|
||||
- For a detailed explanation of semaphores, see [Semaphore Mechanism](./resource_sync/semaphore_mechanism.md).
|
||||
- For the relevant implementation code, see [openvela Semaphore](../../../../../../../open-vela/nuttx/tree/dev-ai-contest-2026/sched/semaphore).
|
||||
- For the relevant implementation code, see [openvela Semaphore](../../../../../../../open-vela/nuttx/tree/dev/sched/semaphore).
|
||||
|
||||
### 2. Mutexes
|
||||
|
||||
|
|
@ -311,7 +311,7 @@ A mutex (mutual exclusion) is a sleeping lock that enforces mutual exclusion. In
|
|||
|
||||
#### References
|
||||
|
||||
- The implementation code can be found at [openvela Mutex](../../../../../../../open-vela/nuttx/tree/dev-ai-contest-2026/libs/libc/misc/lib_mutex.c).
|
||||
- The implementation code can be found at [openvela Mutex](../../../../../../../open-vela/nuttx/tree/dev/libs/libc/misc/lib_mutex.c).
|
||||
|
||||
### 3. Spinlocks
|
||||
|
||||
|
|
@ -331,7 +331,7 @@ A spinlock is a non-blocking lock. When a thread attempts to acquire a spinlock
|
|||
|
||||
#### References
|
||||
|
||||
The implementation code can be found at [openvela Spinlock](../../../../../../../open-vela/nuttx/tree/dev-ai-contest-2026/include/nuttx/spinlock.h).
|
||||
The implementation code can be found at [openvela Spinlock](../../../../../../../open-vela/nuttx/tree/dev/include/nuttx/spinlock.h).
|
||||
|
||||
### 4. Atomic Operations
|
||||
|
||||
|
|
@ -350,7 +350,7 @@ Atomic operations guarantee that instructions execute indivisibly, meaning their
|
|||
#### References
|
||||
|
||||
- For a detailed description of atomic operations, see the [Atomic Operations API](./resource_sync/atomic_operation.md).
|
||||
- For related interface code, see [openvela atomic](../../../../../../../open-vela/nuttx/tree/dev-ai-contest-2026/include/nuttx/atomic.h).
|
||||
- For related interface code, see [openvela atomic](../../../../../../../open-vela/nuttx/tree/dev/include/nuttx/atomic.h).
|
||||
|
||||
### 5. IRQ Control
|
||||
|
||||
|
|
@ -368,7 +368,7 @@ openvela implements interrupt masking for the local CPU via `up_irq_xxx()` funct
|
|||
#### References
|
||||
|
||||
- For details on interrupt system adaptation, refer to the [Interrupt System Adaptation Guide](./../../chip_porting/Interrupt_System_Adaptation_Guide.md).
|
||||
- For the interface code, see the [openvela irq interface](../../../../../../../open-vela/nuttx/tree/dev-ai-contest-2026/include/nuttx/irq.h).
|
||||
- For the interface code, see the [openvela irq interface](../../../../../../../open-vela/nuttx/tree/dev/include/nuttx/irq.h).
|
||||
|
||||
### 6. Scheduler Control
|
||||
|
||||
|
|
@ -448,7 +448,7 @@ int nsh_builtin(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd,
|
|||
|
||||
#### References
|
||||
|
||||
For the implementation code, see [openvela sched_lock.c](../../../../../../../open-vela/nuttx/tree/dev-ai-contest-2026/sched/sched/sched_lock.c) and [openvela sched_unlock.c](../../../../../../../open-vela/nuttx/tree/dev-ai-contest-2026/sched/sched/sched_unlock.c).
|
||||
For the implementation code, see [openvela sched_lock.c](../../../../../../../open-vela/nuttx/tree/dev/sched/sched/sched_lock.c) and [openvela sched_unlock.c](../../../../../../../open-vela/nuttx/tree/dev/sched/sched/sched_unlock.c).
|
||||
|
||||
### 7. Pthread Mutexes
|
||||
|
||||
|
|
@ -464,7 +464,7 @@ A mutex mechanism provided by the POSIX threads (Pthread) standard, intended exc
|
|||
|
||||
#### References
|
||||
|
||||
For the implementation code, see [openvela pthread](../../../../../../../open-vela/nuttx/tree/dev-ai-contest-2026/libs/libc/pthread).
|
||||
For the implementation code, see [openvela pthread](../../../../../../../open-vela/nuttx/tree/dev/libs/libc/pthread).
|
||||
|
||||
### 8. Choosing a Synchronization Mechanism
|
||||
|
||||
|
|
@ -526,7 +526,7 @@ Work queues are particularly well-suited for the following scenarios:
|
|||
#### References
|
||||
|
||||
- For a detailed description of work queues, refer to the [Work Queues](./IPC/work_queue.md).
|
||||
- For the implementation code, see the [openvela wqueue](../../../../../../../open-vela/nuttx/tree/dev-ai-contest-2026/sched/wqueue).
|
||||
- For the implementation code, see the [openvela wqueue](../../../../../../../open-vela/nuttx/tree/dev/sched/wqueue).
|
||||
|
||||
### 2. Message Queues
|
||||
|
||||
|
|
@ -552,7 +552,7 @@ Message queues are particularly well-suited for the following scenarios:
|
|||
#### References
|
||||
|
||||
- For a detailed description of message queues, refer to the [Message Queues](./IPC/message_queue.md).
|
||||
- For the implementation code, see the [openvela mqueue](../../../../../../../open-vela/nuttx/tree/dev-ai-contest-2026/sched/mqueue) source.
|
||||
- For the implementation code, see the [openvela mqueue](../../../../../../../open-vela/nuttx/tree/dev/sched/mqueue) source.
|
||||
|
||||
### 3. Choosing a Communication Scheme
|
||||
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@ In cases where the compiler or target hardware lacks adequate support for atomic
|
|||
|
||||
Developers can control this behavior using the kernel configuration option `CONFIG_LIBC_ARCH_ATOMIC`. If this option is enabled, the system will link against the software emulation functions defined in `arch_atomic.c` instead of using the compiler's built-in functions.
|
||||
|
||||
- **Source Path**: [nuttx/libs/libc/machine/arch_atomic.c](../../../../../../../nuttx/blob/dev-ai-contest-2026/libs/libc/machine/arch_atomic.c)
|
||||
- **Related Build Configuration**: [nuttx/libs/libc/machine/Make.defs](../../../../../../../nuttx/blob/dev-ai-contest-2026/libs/libc/machine/Make.defs)
|
||||
- **Source Path**: [nuttx/libs/libc/machine/arch_atomic.c](../../../../../../../nuttx/blob/dev/libs/libc/machine/arch_atomic.c)
|
||||
- **Related Build Configuration**: [nuttx/libs/libc/machine/Make.defs](../../../../../../../nuttx/blob/dev/libs/libc/machine/Make.defs)
|
||||
|
||||
## II. Usage
|
||||
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ void up_trigger_irq(int irq, cpu_set_t cpuset)
|
|||
|
||||
### 2. Interrupt-Related Macros to be Defined
|
||||
|
||||
In addition to the above function implementations, the manufacturer also needs to define a series of interrupt-related macros to describe the configuration of the NVIC (Nested Vectored Interrupt Controller). These macros need to be defined in the `chips/chip_name/include/irq.h` file. For reference, see the [RTL8720C example](../../../../../../../nuttx/blob/dev-ai-contest-2026/arch/arm/src/rtl8720c/include/irq.h).
|
||||
In addition to the above function implementations, the manufacturer also needs to define a series of interrupt-related macros to describe the configuration of the NVIC (Nested Vectored Interrupt Controller). These macros need to be defined in the `chips/chip_name/include/irq.h` file. For reference, see the [RTL8720C example](../../../../../../../nuttx/blob/dev/arch/arm/src/rtl8720c/include/irq.h).
|
||||
|
||||
The following are the macros that must be implemented and their functional descriptions:
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ This document guides embedded developers on how to write device drivers for the
|
|||
|
||||
A driver interacts with the PM framework through callback structures and registration functions defined in `pm.h`.
|
||||
|
||||
**Related Header File**: [openvela include/nuttx/power/pm.h](../../../../../../nuttx/blob/dev-ai-contest-2026/include/nuttx/power/pm.h)
|
||||
**Related Header File**: [openvela include/nuttx/power/pm.h](../../../../../../nuttx/blob/dev/include/nuttx/power/pm.h)
|
||||
|
||||
### 1. `pm_state_e` Power State Enumeration
|
||||
|
||||
|
|
@ -113,7 +113,7 @@ This is a convenience macro that registers a callback to the default `PM_IDLE_DO
|
|||
|
||||
This section uses the stm32f7 serial driver as an example to demonstrate how to implement PM functionality step-by-step.
|
||||
|
||||
**Source Code Reference**: [arch/arm/src/stm32f7/stm32_serial.c](../../../../../../nuttx/blob/dev-ai-contest-2026/arch/arm/src/stm32f7/stm32_serial.c)
|
||||
**Source Code Reference**: [arch/arm/src/stm32f7/stm32_serial.c](../../../../../../nuttx/blob/dev/arch/arm/src/stm32f7/stm32_serial.c)
|
||||
|
||||
### Step 1: Define the Callback Structure and State Variables
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ This document details the core concepts, API usage, and available power manageme
|
|||
|
||||
**Target Audience**: Embedded systems developers who need to develop or adapt power management features for a specific hardware platform.
|
||||
|
||||
**Related Header Files**: [openvela include/nuttx/power/pm.h](../../../../../../nuttx/blob/dev-ai-contest-2026/include/nuttx/power/pm.h)
|
||||
**Related Header Files**: [openvela include/nuttx/power/pm.h](../../../../../../nuttx/blob/dev/include/nuttx/power/pm.h)
|
||||
|
||||
## I. Core Concepts
|
||||
|
||||
|
|
@ -238,7 +238,7 @@ Governors are the core of the PM framework, implementing different power managem
|
|||
- **How it Works**: The simplest policy. It selects the lowest available power level that is not locked.
|
||||
- **Use Cases**: Suitable for domains with simple requirements. It is recommended to start PM adaptation with this governor.
|
||||
- **Default Behavior**: If this option is enabled, `pm_initialize` will set this governor as the default for all domains.
|
||||
- **Source Code Reference**: [openvela drivers/power/pm/greedy_governor.c](../../../../../../nuttx/blob/dev-ai-contest-2026/drivers/power/pm/greedy_governor.c)
|
||||
- **Source Code Reference**: [openvela drivers/power/pm/greedy_governor.c](../../../../../../nuttx/blob/dev/drivers/power/pm/greedy_governor.c)
|
||||
|
||||
- **Configuration Options**:
|
||||
|
||||
|
|
@ -254,7 +254,7 @@ Governors are the core of the PM framework, implementing different power managem
|
|||
- **How it Works**: Dynamically determines the most appropriate power state by analyzing driver activity time, the expected time to enter the next power state, and the expected time to exit the current power state.
|
||||
- **Use Cases**: Suitable for complex scenarios that require dynamic power adjustment based on system load.
|
||||
- **Default Behavior**: If the `greedy` governor is not enabled but the `activity` governor is, the latter becomes the default for all domains.
|
||||
- **Source Code Reference**: [openvela drivers/power/pm/activity_governor.c](../../../../../../nuttx/blob/dev-ai-contest-2026/drivers/power/pm/activity_governor.c)
|
||||
- **Source Code Reference**: [openvela drivers/power/pm/activity_governor.c](../../../../../../nuttx/blob/dev/drivers/power/pm/activity_governor.c)
|
||||
|
||||
- **Note**: The timing for each state is configurable. The time data for entering/exiting a power state is passed in via configuration, and all domains will be configured with the same data.
|
||||
|
||||
|
|
@ -292,7 +292,7 @@ Governors are the core of the PM framework, implementing different power managem
|
|||
pm_set_governor(PM_IDLE_DOMAIN, pm_stability_governor_initialize());
|
||||
```
|
||||
|
||||
- **Source Code Reference**: [openvela drivers/power/pm/stability_governor.c](../../../../../../nuttx/blob/dev-ai-contest-2026/drivers/power/pm/stability_governor.c)
|
||||
- **Source Code Reference**: [openvela drivers/power/pm/stability_governor.c](../../../../../../nuttx/blob/dev/drivers/power/pm/stability_governor.c)
|
||||
|
||||
- **Key Implementation Detail**: When the system wakes from `SLEEP` and returns to `IDLE`, it cannot use `last_state` to check the `WFI` hold time. Instead, it selects the deepest power level with a non-zero threshold from the configuration list (e.g., if the `SLEEP` threshold is 0 and the `STANDBY` threshold is 10, it will select `STANDBY`) as the new baseline for checking.
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
The following error occurs when initializing the openvela repository:
|
||||
|
||||
```Bash
|
||||
repo init --partial-clone -u git@gitee.com:open-vela/manifests.git -b dev-ai-contest-2026 -m openvela.xml --git-lfs
|
||||
repo init --partial-clone -u git@gitee.com:open-vela/manifests.git -b dev -m openvela.xml --git-lfs
|
||||
```
|
||||
|
||||

|
||||
|
|
@ -87,7 +87,7 @@ Switch to **HTTPS** protocol for downloading.
|
|||
- Github:
|
||||
|
||||
```Bash
|
||||
repo init --partial-clone -u https://github.com/open-vela/manifests.git -b dev-ai-contest-2026 -m openvela.xml --git-lfs
|
||||
repo init --partial-clone -u https://github.com/open-vela/manifests.git -b dev -m openvela.xml --git-lfs
|
||||
|
||||
|
||||
# Install Git LFS (Large File Storage) for managing large files
|
||||
|
|
@ -101,7 +101,7 @@ Switch to **HTTPS** protocol for downloading.
|
|||
- Gitee:
|
||||
|
||||
```Bash
|
||||
repo init --partial-clone -u https://gitee.com/open-vela/manifests.git -b dev-ai-contest-2026 -m openvela.xml --git-lfs
|
||||
repo init --partial-clone -u https://gitee.com/open-vela/manifests.git -b dev -m openvela.xml --git-lfs
|
||||
|
||||
|
||||
# Install Git LFS (Large File Storage) for managing large files
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ Yes, the community has a contribution incentive mechanism. For detailed reward r
|
|||
|
||||
### 3. When will the IDE be released?
|
||||
|
||||
It is expected to be officially released in early 2026.
|
||||
It has been released. openvela now ships an official VS Code plugin that supports the full development lifecycle on Ubuntu — project creation, build, system debugging, and application development. See the [openvela VS Code Plugin User Guide](../quickstart/vscode_plugin_usage.md) for details.
|
||||
|
||||
### 4. Is there a difference between the Gitee and GitHub versions of the source code repository?
|
||||
|
||||
|
|
@ -147,7 +147,7 @@ Debugging communication business on real machines has a high threshold (requires
|
|||
|
||||
### 24. Can the RPK file generated by Quick App packaging run directly on openvela devices?
|
||||
|
||||
Currently, it cannot. The Quick App framework engine (Runtime) is planned to be open-sourced in library form and integrated into the system around **February 2026**. At this stage, it is recommended to use the simulator for learning and development.
|
||||
Currently, it cannot. The Quick App framework engine (Runtime) is planned to be open-sourced in library form and integrated into the system around **June 2026**. At this stage, it is recommended to use the simulator for learning and development.
|
||||
|
||||
## V. Hardware Adaptation and Porting
|
||||
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ This section guides you through creating a board-specific configuration file and
|
|||
|
||||
### 1. Understand the esp32s3-eye Board-Level Code Structure
|
||||
|
||||
Before proceeding with the configuration, familiarize yourself with the Board Support Package (BSP) [directory structure](../../../../../../nuttx/tree/dev-ai-contest-2026/boards/xtensa/esp32s3/esp32s3-eye) for the `esp32s3-eye`. This will help you understand the purpose of each file.
|
||||
Before proceeding with the configuration, familiarize yourself with the Board Support Package (BSP) [directory structure](../../../../../../nuttx/tree/dev/boards/xtensa/esp32s3/esp32s3-eye) for the `esp32s3-eye`. This will help you understand the purpose of each file.
|
||||
|
||||
```bash
|
||||
esp32s3-eye/
|
||||
|
|
@ -184,8 +184,8 @@ This guide demonstrated how to port `openvela` to the ESP32-S3-EYE development b
|
|||
|
||||
## VII. References
|
||||
|
||||
- [esp32s3-eye](../../../../../../nuttx/tree/dev-ai-contest-2026/boards/xtensa/esp32s3/esp32s3-eye)
|
||||
- [defconfig](../../../../../../vendor_espressif/blob/dev-ai-contest-2026/boards/esp32s3/esp32s3-eye/configs/openvela/defconfig)
|
||||
- [esp32s3-eye](../../../../../../nuttx/tree/dev/boards/xtensa/esp32s3/esp32s3-eye)
|
||||
- [defconfig](../../../../../../vendor_espressif/blob/dev/boards/esp32s3/esp32s3-eye/configs/openvela/defconfig)
|
||||
- [Managing esptool on virtual environment](https://nuttx.apache.org/docs/latest/platforms/xtensa/esp32s3/index.html#managing-esptool-on-virtual-environment)
|
||||
|
||||
## Appendix A: Wi-Fi Feature defconfig
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ This section will guide you through creating the necessary files and writing the
|
|||
|
||||
First, create a new directory named `stm32f407-robomaster` inside `nuttx/boards/arm/stm32/`, and set up the following subdirectory and file structure.
|
||||
|
||||
**Code Path**: [`nuttx/boards/arm/stm32/stm32f407-robomaster/`](./../../../../../../nuttx/tree/dev-ai-contest-2026/boards/arm/stm32/stm32f407-robomaster)
|
||||
**Code Path**: [`nuttx/boards/arm/stm32/stm32f407-robomaster/`](./../../../../../../nuttx/tree/dev/boards/arm/stm32/stm32f407-robomaster)
|
||||
|
||||
```Plain
|
||||
stm32f407-robomaster
|
||||
|
|
|
|||
|
|
@ -113,8 +113,8 @@ Please ensure you have the complete `openvela` source code ready locally, follow
|
|||
|
||||
The `openvela` code follows a layered design. Understanding the key directories will help with future custom development.
|
||||
|
||||
- **Application Layer (Examples)**: [nuttx-apps/examples/leds](../../../../../../../open-vela/nuttx-apps/tree/dev-ai-contest-2026/examples/leds)
|
||||
- **Board Support Package (BSP)**: [nuttx/boards/arm/stm32/stm32f411-minimum](../../../../../../../open-vela/nuttx/tree/dev-ai-contest-2026/boards/arm/stm32/stm32f411-minimum)
|
||||
- **Application Layer (Examples)**: [nuttx-apps/examples/leds](../../../../../../../open-vela/nuttx-apps/tree/dev/examples/leds)
|
||||
- **Board Support Package (BSP)**: [nuttx/boards/arm/stm32/stm32f411-minimum](../../../../../../../open-vela/nuttx/tree/dev/boards/arm/stm32/stm32f411-minimum)
|
||||
|
||||
The table below briefly describes the function of core directories:
|
||||
|
||||
|
|
@ -476,7 +476,7 @@ As described in the demo's Kconfig file, enable the **EXAMPLES_LEDS** and **USER
|
|||
|
||||
### 3. What is the difference between the `packages/demos` and `nuttx/apps/examples` directories?
|
||||
|
||||
- **https://github.com/open-vela/nuttx-apps/tree/dev-ai-contest-2026/examples**
|
||||
- **https://github.com/open-vela/nuttx-apps/tree/dev/examples**
|
||||
|
||||
- **Source**: Official NuttX community.
|
||||
- **Content**: Contains various examples maintained by the NuttX community to demonstrate its core features.
|
||||
|
|
|
|||
|
|
@ -96,13 +96,13 @@ After installation, you can run `repo --version` to verify it.
|
|||
This method requires you to add your SSH public key to your GitHub account first. Please refer to the [official GitHub documentation](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account).
|
||||
|
||||
```bash
|
||||
repo init -u ssh://git@github.com/open-vela/manifests.git -b dev-ai-contest-2026 -m openvela.xml --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/ --git-lfs
|
||||
repo init -u ssh://git@github.com/open-vela/manifests.git -b dev -m openvela.xml --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/ --git-lfs
|
||||
```
|
||||
|
||||
- Method 2: HTTPS
|
||||
|
||||
```bash
|
||||
repo init -u https://github.com/open-vela/manifests.git -b dev-ai-contest-2026 -m openvela.xml --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/ --git-lfs
|
||||
repo init -u https://github.com/open-vela/manifests.git -b dev -m openvela.xml --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/ --git-lfs
|
||||
```
|
||||
|
||||
#### Option B: Download from Gitee
|
||||
|
|
@ -112,13 +112,13 @@ After installation, you can run `repo --version` to verify it.
|
|||
This method requires you to add your SSH public key to your Gitee account first. Please refer to the [official Gitee documentation](https://gitee.com/help/articles/4191).
|
||||
|
||||
```bash
|
||||
repo init -u ssh://git@gitee.com/open-vela/manifests.git -b dev-ai-contest-2026 -m openvela.xml --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/ --git-lfs
|
||||
repo init -u ssh://git@gitee.com/open-vela/manifests.git -b dev -m openvela.xml --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/ --git-lfs
|
||||
```
|
||||
|
||||
- Method 2: HTTPS
|
||||
|
||||
```bash
|
||||
repo init -u https://gitee.com/open-vela/manifests.git -b dev-ai-contest-2026 -m openvela.xml --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/ --git-lfs
|
||||
repo init -u https://gitee.com/open-vela/manifests.git -b dev -m openvela.xml --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/ --git-lfs
|
||||
```
|
||||
|
||||
#### Option C: Download from GitCode
|
||||
|
|
@ -128,13 +128,13 @@ After installation, you can run `repo --version` to verify it.
|
|||
This method requires you to add your SSH public key to your GitCode account first. Please refer to the [official GitCode documentation](https://docs.gitcode.com/docs/help/home/user_center/security_management/ssh).
|
||||
|
||||
```bash
|
||||
repo init -u ssh://git@gitcode.com/open-vela/manifests.git -b dev-ai-contest-2026 -m openvela.xml --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/ --git-lfs
|
||||
repo init -u ssh://git@gitcode.com/open-vela/manifests.git -b dev -m openvela.xml --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/ --git-lfs
|
||||
```
|
||||
|
||||
- Method 2: HTTPS
|
||||
|
||||
```bash
|
||||
repo init -u https://gitcode.com/open-vela/manifests.git -b dev-ai-contest-2026 -m openvela.xml --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/ --git-lfs
|
||||
repo init -u https://gitcode.com/open-vela/manifests.git -b dev -m openvela.xml --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/ --git-lfs
|
||||
```
|
||||
|
||||
3. Execute the sync command. `repo` will download all related source code repositories according to the manifest file (`openvela.xml`).
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ bool bt_a2dp_sink_unregister_callbacks(bt_instance_t* ins, void* cookie);
|
|||
|
||||
**返回值**:
|
||||
|
||||
成功时返回回调 cookie,失败或已注册时返回 NULL。
|
||||
成功时返回 `true`,失败时返回 `false`。
|
||||
|
||||
|
||||
### bt_a2dp_sink_is_connected
|
||||
|
|
@ -57,16 +57,16 @@ bool bt_a2dp_sink_unregister_callbacks(bt_instance_t* ins, void* cookie);
|
|||
bool bt_a2dp_sink_is_connected(bt_instance_t* ins, bt_address_t* addr);
|
||||
```
|
||||
|
||||
发起与远程设备的连接。
|
||||
查询指定设备的 A2DP Sink 是否已连接。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `ins` 蓝牙客户端实例。
|
||||
- `addr` 蓝牙地址 of the peer device.
|
||||
- `addr` 对端设备蓝牙地址。
|
||||
|
||||
**返回值**:
|
||||
|
||||
检查是否已连接。
|
||||
已连接时返回 `true`,未连接时返回 `false`。
|
||||
|
||||
|
||||
### bt_a2dp_sink_is_playing
|
||||
|
|
@ -75,16 +75,16 @@ bool bt_a2dp_sink_is_connected(bt_instance_t* ins, bt_address_t* addr);
|
|||
bool bt_a2dp_sink_is_playing(bt_instance_t* ins, bt_address_t* addr);
|
||||
```
|
||||
|
||||
检查是否正在播放。
|
||||
查询指定设备的 A2DP Sink 是否正在播放音频流。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `ins` 蓝牙客户端实例。
|
||||
- `addr` 蓝牙地址 of the peer device.
|
||||
- `addr` 对端设备蓝牙地址。
|
||||
|
||||
**返回值**:
|
||||
|
||||
检查是否正在播放。
|
||||
正在播放时返回 `true`,未播放时返回 `false`。
|
||||
|
||||
|
||||
### bt_a2dp_sink_get_connection_state
|
||||
|
|
@ -93,7 +93,7 @@ bool bt_a2dp_sink_is_playing(bt_instance_t* ins, bt_address_t* addr);
|
|||
profile_connection_state_t bt_a2dp_sink_get_connection_state(bt_instance_t* ins, bt_address_t* addr);
|
||||
```
|
||||
|
||||
发起与远程设备的连接。
|
||||
获取指定设备的 A2DP Sink 连接状态。
|
||||
|
||||
**参数**:
|
||||
|
||||
|
|
@ -103,6 +103,8 @@ profile_connection_state_t bt_a2dp_sink_get_connection_state(bt_instance_t* ins,
|
|||
|
||||
**返回值**:
|
||||
|
||||
返回当前连接状态枚举值,参见 `profile_connection_state_t`。
|
||||
|
||||
|
||||
|
||||
### bt_a2dp_sink_connect
|
||||
|
|
@ -111,16 +113,16 @@ profile_connection_state_t bt_a2dp_sink_get_connection_state(bt_instance_t* ins,
|
|||
bt_status_t bt_a2dp_sink_connect(bt_instance_t* ins, bt_address_t* addr);
|
||||
```
|
||||
|
||||
发起与远程设备的连接。
|
||||
发起与远程设备的 A2DP Sink 连接。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `ins` 蓝牙客户端实例。
|
||||
- `addr` 蓝牙地址 of the peer device.
|
||||
- `addr` 对端设备蓝牙地址。
|
||||
|
||||
**返回值**:
|
||||
|
||||
建立连接。
|
||||
成功时返回 BT_STATUS_SUCCESS,失败时返回错误码。
|
||||
|
||||
|
||||
### bt_a2dp_sink_disconnect
|
||||
|
|
@ -129,16 +131,16 @@ bt_status_t bt_a2dp_sink_connect(bt_instance_t* ins, bt_address_t* addr);
|
|||
bt_status_t bt_a2dp_sink_disconnect(bt_instance_t* ins, bt_address_t* addr);
|
||||
```
|
||||
|
||||
断开与远程设备的连接。
|
||||
断开与远程设备的 A2DP Sink 连接。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `ins` 蓝牙客户端实例。
|
||||
- `addr` 蓝牙地址 of the peer device.
|
||||
- `addr` 对端设备蓝牙地址。
|
||||
|
||||
**返回值**:
|
||||
|
||||
断开连接。
|
||||
成功时返回 BT_STATUS_SUCCESS,失败时返回错误码。
|
||||
|
||||
|
||||
### bt_a2dp_source_unregister_callbacks
|
||||
|
|
@ -157,7 +159,7 @@ bool bt_a2dp_source_unregister_callbacks(bt_instance_t* ins, void* cookie);
|
|||
|
||||
**返回值**:
|
||||
|
||||
成功时返回回调 cookie,失败或已注册时返回 NULL。
|
||||
成功时返回 `true`,失败时返回 `false`。
|
||||
|
||||
|
||||
### bt_a2dp_source_is_connected
|
||||
|
|
@ -166,16 +168,16 @@ bool bt_a2dp_source_unregister_callbacks(bt_instance_t* ins, void* cookie);
|
|||
bool bt_a2dp_source_is_connected(bt_instance_t* ins, bt_address_t* addr);
|
||||
```
|
||||
|
||||
发起与远程设备的连接。
|
||||
查询指定设备的 A2DP Source 是否已连接。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `ins` 蓝牙客户端实例。
|
||||
- `addr` 蓝牙地址 of the peer device.
|
||||
- `addr` 对端设备蓝牙地址。
|
||||
|
||||
**返回值**:
|
||||
|
||||
检查是否已连接。
|
||||
已连接时返回 `true`,未连接时返回 `false`。
|
||||
|
||||
|
||||
### bt_a2dp_source_is_playing
|
||||
|
|
@ -184,16 +186,16 @@ bool bt_a2dp_source_is_connected(bt_instance_t* ins, bt_address_t* addr);
|
|||
bool bt_a2dp_source_is_playing(bt_instance_t* ins, bt_address_t* addr);
|
||||
```
|
||||
|
||||
检查是否正在播放。
|
||||
查询指定设备的 A2DP Source 是否正在播放音频流。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `ins` 蓝牙客户端实例。
|
||||
- `addr` 蓝牙地址 of the peer device.
|
||||
- `addr` 对端设备蓝牙地址。
|
||||
|
||||
**返回值**:
|
||||
|
||||
检查是否正在播放。
|
||||
正在播放时返回 `true`,未播放时返回 `false`。
|
||||
|
||||
|
||||
### bt_a2dp_source_get_connection_state
|
||||
|
|
@ -202,7 +204,7 @@ bool bt_a2dp_source_is_playing(bt_instance_t* ins, bt_address_t* addr);
|
|||
profile_connection_state_t bt_a2dp_source_get_connection_state(bt_instance_t* ins, bt_address_t* addr);
|
||||
```
|
||||
|
||||
发起与远程设备的连接。
|
||||
获取指定设备的 A2DP Source 连接状态。
|
||||
|
||||
**参数**:
|
||||
|
||||
|
|
@ -212,6 +214,8 @@ profile_connection_state_t bt_a2dp_source_get_connection_state(bt_instance_t* in
|
|||
|
||||
**返回值**:
|
||||
|
||||
返回当前连接状态枚举值,参见 `profile_connection_state_t`。
|
||||
|
||||
|
||||
|
||||
### bt_a2dp_source_connect
|
||||
|
|
@ -220,16 +224,16 @@ profile_connection_state_t bt_a2dp_source_get_connection_state(bt_instance_t* in
|
|||
bt_status_t bt_a2dp_source_connect(bt_instance_t* ins, bt_address_t* addr);
|
||||
```
|
||||
|
||||
发起与远程设备的连接。
|
||||
发起与远程设备的 A2DP Source 连接。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `ins` 蓝牙客户端实例。
|
||||
- `addr` 蓝牙地址 of the peer device.
|
||||
- `addr` 对端设备蓝牙地址。
|
||||
|
||||
**返回值**:
|
||||
|
||||
建立连接。
|
||||
成功时返回 BT_STATUS_SUCCESS,失败时返回错误码。
|
||||
|
||||
|
||||
### bt_a2dp_source_disconnect
|
||||
|
|
|
|||
|
|
@ -1,193 +0,0 @@
|
|||
\[ [English](../../../../en/api/framework/bluetooth/bt_avrcp.md) | 简体中文 \]
|
||||
|
||||
# 蓝牙 AVRCP API
|
||||
|
||||
openvela 蓝牙 AVRCP(音视频远程控制)接口,支持播放控制、曲目信息查询等。
|
||||
|
||||
头文件:#include "bt_avrcp.h"、#include "bt_avrcp_control.h"、#include "bt_avrcp_target.h"
|
||||
|
||||
|
||||
## openvela 实现说明
|
||||
|
||||
- **双角色支持**:Controller(控制端)和 Target(目标端)
|
||||
- **功能**:播放/暂停/切歌、音量控制、曲目信息获取
|
||||
|
||||
|
||||
## 同步接口
|
||||
|
||||
|
||||
### bt_avrcp_control_unregister_callbacks
|
||||
|
||||
```c
|
||||
bool bt_avrcp_control_unregister_callbacks(bt_instance_t* ins, void* cookie);
|
||||
```
|
||||
|
||||
取消注册回调函数,停止接收状态变更通知。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `ins` 蓝牙客户端实例。
|
||||
- `cookie` 用户上下文。
|
||||
|
||||
**返回值**:
|
||||
|
||||
取消注册回调函数。
|
||||
|
||||
|
||||
### bt_avrcp_control_get_element_attributes
|
||||
|
||||
```c
|
||||
bt_status_t bt_avrcp_control_get_element_attributes(bt_instance_t* ins, bt_address_t* addr);
|
||||
```
|
||||
|
||||
获取媒体元素属性。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `ins` 蓝牙客户端实例。
|
||||
- `addr` 远程设备蓝牙地址。
|
||||
|
||||
|
||||
**返回值**:
|
||||
|
||||
成功时返回 BT_STATUS_SUCCESS,失败时返回错误码。
|
||||
|
||||
|
||||
### bt_avrcp_control_send_passthrough_cmd
|
||||
|
||||
```c
|
||||
bt_status_t bt_avrcp_control_send_passthrough_cmd(bt_instance_t* ins, bt_address_t* addr, uint8_t cmd, uint8_t state);
|
||||
```
|
||||
|
||||
发送透传命令。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `ins` 蓝牙客户端实例。
|
||||
- `addr` 远程设备蓝牙地址。
|
||||
- `cmd` 命令。
|
||||
- `state` 状态。
|
||||
|
||||
|
||||
### bt_avrcp_control_get_unit_info
|
||||
|
||||
```c
|
||||
bt_status_t bt_avrcp_control_get_unit_info(bt_instance_t* ins, bt_address_t* addr);
|
||||
```
|
||||
|
||||
获取远程 AVRCP 设备的单元信息。
|
||||
|
||||
|
||||
**参数**:
|
||||
|
||||
- `ins` 蓝牙客户端实例。
|
||||
- `addr` 蓝牙地址。
|
||||
|
||||
|
||||
### bt_avrcp_control_get_subunit_info
|
||||
|
||||
```c
|
||||
bt_status_t bt_avrcp_control_get_subunit_info(bt_instance_t* ins, bt_address_t* addr);
|
||||
```
|
||||
|
||||
获取子单元信息。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `ins` 蓝牙客户端实例。
|
||||
- `addr` 远程设备蓝牙地址。
|
||||
|
||||
|
||||
### bt_avrcp_control_get_playback_state
|
||||
|
||||
```c
|
||||
bt_status_t bt_avrcp_control_get_playback_state(bt_instance_t* ins, bt_address_t* addr);
|
||||
```
|
||||
|
||||
获取远程设备的当前播放状态。
|
||||
|
||||
|
||||
**参数**:
|
||||
|
||||
- `ins` 蓝牙客户端实例。
|
||||
- `addr` 蓝牙地址。
|
||||
|
||||
|
||||
### bt_avrcp_control_register_notification
|
||||
|
||||
```c
|
||||
bt_status_t bt_avrcp_control_register_notification(bt_instance_t* ins, bt_address_t* addr, uint8_t event, uint32_t interval);
|
||||
```
|
||||
|
||||
注册事件通知。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `ins` 蓝牙客户端实例。
|
||||
- `addr` 远程设备蓝牙地址。
|
||||
- `event` 事件类型。
|
||||
- `interval` 间隔。
|
||||
|
||||
|
||||
### bt_avrcp_target_unregister_callbacks
|
||||
|
||||
```c
|
||||
bool bt_avrcp_target_unregister_callbacks(bt_instance_t* ins, void* cookie);
|
||||
```
|
||||
|
||||
取消注册回调函数,停止接收状态变更通知。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `ins` 蓝牙客户端实例。
|
||||
- `cookie` 用户上下文。
|
||||
|
||||
|
||||
|
||||
- `cookie` 用户上下文。
|
||||
- `ins` 蓝牙客户端实例。
|
||||
|
||||
**返回值**:
|
||||
|
||||
成功时返回回调 cookie,失败或已注册时返回 NULL。
|
||||
|
||||
|
||||
### bt_avrcp_target_get_play_status_response
|
||||
|
||||
```c
|
||||
bt_status_t bt_avrcp_target_get_play_status_response(bt_instance_t* ins, bt_address_t* addr, avrcp_play_status_t status, uint32_t song_len, uint32_t song_pos);
|
||||
```
|
||||
|
||||
回复播放状态查询。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `ins` 蓝牙客户端实例。
|
||||
- `addr` 蓝牙地址 of the peer device.
|
||||
- `status` 状态码。
|
||||
- `song_len` 歌曲长度(毫秒)。
|
||||
- `song_pos` 当前播放位置(毫秒)。
|
||||
|
||||
**返回值**:
|
||||
|
||||
成功时返回 BT_STATUS_SUCCESS,失败时返回错误码。
|
||||
|
||||
|
||||
### bt_avrcp_target_play_status_notify
|
||||
|
||||
```c
|
||||
bt_status_t bt_avrcp_target_play_status_notify(bt_instance_t* ins, bt_address_t* addr, avrcp_play_status_t status);
|
||||
```
|
||||
|
||||
通知播放状态变更。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `ins` 蓝牙客户端实例。
|
||||
- `addr` 远程设备蓝牙地址。
|
||||
- `status` 状态码。
|
||||
|
||||
|
||||
**返回值**:
|
||||
|
||||
成功时返回 BT_STATUS_SUCCESS,失败时返回错误码。
|
||||
|
|
@ -0,0 +1,217 @@
|
|||
\[ [English](../../../../en/api/framework/bluetooth/bt_cs.md) | 简体中文 \]
|
||||
|
||||
# 蓝牙 Channel Sounding API
|
||||
|
||||
openvela 蓝牙 Channel Sounding(CS)接口,用于蓝牙设备间的距离测量和定位功能。CS 基于蓝牙 5.4 规范引入的信道探测技术,支持厘米级精度的测距。
|
||||
|
||||
头文件:`#include <bt_cs.h>`
|
||||
|
||||
## openvela 实现说明
|
||||
|
||||
- **测距方法**:支持自动选择(AUTO)、RSSI 和 CS 三种测距方法
|
||||
- **角色模型**:支持发起方(Initiator)和反射方(Reflector)两种角色
|
||||
- **RAS 特性**:支持实时测距数据、丢失数据段恢复、中止操作和数据过滤
|
||||
- **回调通知**:通过回调函数异步返回测距启动、停止和结果事件
|
||||
- **配置依赖**:测试接口需启用 `CONFIG_BT_CS_RAS_TEST`
|
||||
|
||||
## 回调管理
|
||||
|
||||
### bt_cs_register_callbacks
|
||||
|
||||
```c
|
||||
void* bt_cs_register_callbacks(bt_instance_t* ins, const cs_callbacks_t* callbacks);
|
||||
```
|
||||
|
||||
注册 CS 事件回调函数。注册成功后,当距离测量启动、停止或产生结果时,系统会通过回调函数通知应用。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `ins` 蓝牙客户端实例。
|
||||
- `callbacks` CS 事件回调函数集合,参见 `cs_callbacks_t`。
|
||||
|
||||
**返回值**:
|
||||
|
||||
成功时返回回调 cookie(非 NULL),用于后续注销;失败时返回 NULL。
|
||||
|
||||
### bt_cs_unregister_callbacks
|
||||
|
||||
```c
|
||||
bool bt_cs_unregister_callbacks(bt_instance_t* ins, void* cookie);
|
||||
```
|
||||
|
||||
注销已注册的 CS 事件回调函数。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `ins` 蓝牙客户端实例。
|
||||
- `cookie` 注册回调时返回的 cookie。
|
||||
|
||||
**返回值**:
|
||||
|
||||
成功时返回 `true`,失败时返回 `false`。
|
||||
|
||||
## 距离测量
|
||||
|
||||
### bt_cs_start_distance_measurement
|
||||
|
||||
```c
|
||||
bt_status_t bt_cs_start_distance_measurement(bt_instance_t* ins, const bt_distance_measurement_params_t* params);
|
||||
```
|
||||
|
||||
启动距离测量。调用前需先通过 `bt_cs_register_callbacks` 注册回调函数,测量结果将通过 `cs_distance_measure_result_cb` 回调返回。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `ins` 蓝牙客户端实例。
|
||||
- `params` 距离测量参数,参见 `bt_distance_measurement_params_t`。
|
||||
|
||||
**返回值**:
|
||||
|
||||
成功时返回 `BT_STATUS_SUCCESS`,失败时返回错误码。
|
||||
|
||||
### bt_cs_stop_distance_measurement
|
||||
|
||||
```c
|
||||
bt_status_t bt_cs_stop_distance_measurement(bt_instance_t* ins, bt_address_t* addr, uint8_t method, bool timeout);
|
||||
```
|
||||
|
||||
停止距离测量。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `ins` 蓝牙客户端实例。
|
||||
- `addr` 远端设备地址。
|
||||
- `method` 测距方法(AUTO/RSSI/CS)。
|
||||
- `timeout` 是否因超时而停止。
|
||||
|
||||
**返回值**:
|
||||
|
||||
成功时返回 `BT_STATUS_SUCCESS`,失败时返回错误码。
|
||||
|
||||
## 能力查询
|
||||
|
||||
### bt_get_cs_max_supported_security_level
|
||||
|
||||
```c
|
||||
bt_status_t bt_get_cs_max_supported_security_level(bt_instance_t* ins, bt_address_t* addr);
|
||||
```
|
||||
|
||||
获取远端设备支持的最大 CS 安全等级。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `ins` 蓝牙客户端实例。
|
||||
- `addr` 远端设备地址。
|
||||
|
||||
**返回值**:
|
||||
|
||||
成功时返回 `BT_STATUS_SUCCESS`,失败时返回错误码。
|
||||
|
||||
## 配置管理
|
||||
|
||||
### bt_cs_set_config
|
||||
|
||||
```c
|
||||
bt_status_t bt_cs_set_config(bt_instance_t* ins, bt_address_t* addr, const bt_cs_set_params_t* params);
|
||||
```
|
||||
|
||||
设置 CS 配置参数,包括 RAS 特性、角色、天线选择和最大发射功率。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `ins` 蓝牙客户端实例。
|
||||
- `addr` 远端设备地址。
|
||||
- `params` CS 配置参数,参见 `bt_cs_set_params_t`。
|
||||
|
||||
**返回值**:
|
||||
|
||||
成功时返回 `BT_STATUS_SUCCESS`,失败时返回错误码。
|
||||
|
||||
## 数据结构
|
||||
|
||||
### bt_distance_measurement_params_t
|
||||
|
||||
距离测量参数结构体。
|
||||
|
||||
| 字段 | 类型 | 说明 |
|
||||
| -------------------- | -------------- | -------------------------------- |
|
||||
| `addr` | `bt_address_t` | 远端设备地址 |
|
||||
| `method` | `uint8_t` | 测距方法(0=AUTO, 1=RSSI, 2=CS) |
|
||||
| `role` | `uint8_t` | 角色(发起方/反射方) |
|
||||
| `interval_ms` | `uint16_t` | 测量间隔(毫秒) |
|
||||
| `duration_ms` | `uint16_t` | 测量持续时间(毫秒) |
|
||||
| `submode` | `uint8_t` | CS 子模式 |
|
||||
| `max_steps` | `uint8_t` | 最大步数 |
|
||||
| `mode0_steps` | `uint8_t` | Mode 0 步数 |
|
||||
| `rtt_type` | `uint8_t` | RTT 类型 |
|
||||
| `sync_phy` | `uint8_t` | 同步 PHY |
|
||||
| `channel_map` | `uint8_t` | 信道映射 |
|
||||
| `antenna_paths_mask` | `uint8_t` | 天线路径掩码 |
|
||||
| `vendor_specific` | `uint8_t` | 厂商自定义参数 |
|
||||
| `debug_flags` | `uint8_t` | 调试标志 |
|
||||
|
||||
### bt_distance_measurement_result_t
|
||||
|
||||
距离测量结果结构体。
|
||||
|
||||
| 字段 | 类型 | 说明 |
|
||||
| --------------------------- | --------- | ---------------------- |
|
||||
| `centimeter` | `uint8_t` | 距离(厘米) |
|
||||
| `error_centimeter` | `uint8_t` | 距离误差(厘米) |
|
||||
| `azimuth_angle` | `uint8_t` | 方位角 |
|
||||
| `error_azimuthAngle` | `uint8_t` | 方位角误差 |
|
||||
| `altitude_angle` | `uint8_t` | 仰角 |
|
||||
| `error_altitudeAngle` | `uint8_t` | 仰角误差 |
|
||||
| `elapsed_realtime_nanos` | `long` | 经过的实时时间(纳秒) |
|
||||
| `confidence_level` | `uint8_t` | 置信度 |
|
||||
| `delay_spread_meters` | `double` | 延迟扩展(米) |
|
||||
| `detected_attack_level` | `uint8_t` | 检测到的攻击等级 |
|
||||
| `velocity_meters_persecond` | `double` | 速度(米/秒) |
|
||||
| `method` | `uint8_t` | 使用的测距方法 |
|
||||
|
||||
### bt_cs_set_params_t
|
||||
|
||||
CS 配置参数结构体。
|
||||
|
||||
| 字段 | 类型 | 说明 |
|
||||
| --------------------------- | ---------- | ----------------------------------------- |
|
||||
| `ras_feature` | `uint32_t` | RAS 特性位(见下方宏定义) |
|
||||
| `role` | `uint8_t` | CS 角色位(Bit 0: 发起方, Bit 1: 反射方) |
|
||||
| `cs_sync_antenna_selection` | `uint8_t` | CS_SYNC 天线选择 |
|
||||
| `max_tx_power` | `int8_t` | 最大发射功率(dBm,范围 -127 到 20) |
|
||||
|
||||
### cs_callbacks_t
|
||||
|
||||
CS 事件回调函数集合。
|
||||
|
||||
| 字段 | 类型 | 说明 |
|
||||
| -------------------------------- | -------- | ---------------- |
|
||||
| `size` | `size_t` | 结构体大小 |
|
||||
| `cs_distance_measure_started_cb` | 函数指针 | 距离测量启动回调 |
|
||||
| `cs_distance_measure_stopped_cb` | 函数指针 | 距离测量停止回调 |
|
||||
| `cs_distance_measure_result_cb` | 函数指针 | 距离测量结果回调 |
|
||||
|
||||
## 宏定义
|
||||
|
||||
### RAS 特性位
|
||||
|
||||
| 宏 | 值 | 说明 |
|
||||
| --------------------------------------- | ---- | -------------------- |
|
||||
| `BT_CS_RAS_REAL_TIME_RANGING_DATA` | 0x01 | 实时测距数据 |
|
||||
| `BT_CS_RAS_RETRIEVE_LOST_DATA_SEGMENTS` | 0x02 | 恢复丢失的测距数据段 |
|
||||
| `BT_CS_RAS_ABORT_OPERATION` | 0x04 | 中止操作 |
|
||||
| `BT_CS_RAS_FILTER_RANGING_DATA` | 0x08 | 过滤测距数据 |
|
||||
|
||||
### 天线选择
|
||||
|
||||
| 宏 | 值 | 说明 |
|
||||
| ---------------------------------- | ---- | ---------------------- |
|
||||
| `BT_CS_ANTENNA_SEL_1` | 0x01 | 使用天线 1 |
|
||||
| `BT_CS_ANTENNA_SEL_2` | 0x02 | 使用天线 2 |
|
||||
| `BT_CS_ANTENNA_SEL_3` | 0x03 | 使用天线 3 |
|
||||
| `BT_CS_ANTENNA_SEL_4` | 0x04 | 使用天线 4 |
|
||||
| `BT_CS_ANTENNA_SEL_SINGLE_REPEATE` | 0xFD | 天线标识符单次重复顺序 |
|
||||
| `BT_CS_ANTENNA_SEL_DOUBLE_REPEATE` | 0xFE | 天线标识符双次重复顺序 |
|
||||
| `BT_CS_ANTENNA_SEL_NO_RECOMMEND` | 0xFF | 主机无推荐 |
|
||||
|
||||
**openvela 扩展接口。**
|
||||
|
|
@ -31,7 +31,7 @@ bt_adapter_state_t bt_adapter_get_state(bt_instance_t* ins);
|
|||
|
||||
**返回值**:
|
||||
|
||||
bt_adapter_get_state 操作。
|
||||
返回当前适配器状态枚举值,参见 `bt_adapter_state_t`。
|
||||
|
||||
|
||||
#### bt_adapter_is_support_le
|
||||
|
|
@ -49,7 +49,7 @@ bool bt_adapter_is_support_le(bt_instance_t* ins);
|
|||
|
||||
**返回值**:
|
||||
|
||||
bt_adapter_is_support_le 操作。
|
||||
支持时返回 `true`,不支持时返回 `false`。
|
||||
|
||||
|
||||
#### bt_adapter_is_support_leaudio
|
||||
|
|
@ -67,7 +67,7 @@ bool bt_adapter_is_support_leaudio(bt_instance_t* ins);
|
|||
|
||||
**返回值**:
|
||||
|
||||
bt_adapter_is_support_leaudio 操作。
|
||||
支持时返回 `true`,不支持时返回 `false`。
|
||||
|
||||
|
||||
## 设备发现
|
||||
|
|
@ -101,7 +101,7 @@ bt_status_t bt_adapter_start_discovery(bt_instance_t* ins, uint32_t timeout);
|
|||
|
||||
**返回值**:
|
||||
|
||||
bt_adapter_start_discovery 操作。
|
||||
成功时返回 BT_STATUS_SUCCESS,失败时返回错误码。
|
||||
|
||||
|
||||
#### bt_adapter_cancel_discovery
|
||||
|
|
@ -118,7 +118,7 @@ bt_status_t bt_adapter_cancel_discovery(bt_instance_t* ins);
|
|||
|
||||
**返回值**:
|
||||
|
||||
bt_adapter_cancel_discovery 操作。
|
||||
成功时返回 BT_STATUS_SUCCESS,失败时返回错误码。
|
||||
|
||||
|
||||
#### bt_adapter_is_discovering
|
||||
|
|
@ -136,7 +136,7 @@ bool bt_adapter_is_discovering(bt_instance_t* ins);
|
|||
|
||||
**返回值**:
|
||||
|
||||
bt_adapter_is_discovering 操作。
|
||||
正在发现时返回 `true`,否则返回 `false`。
|
||||
|
||||
|
||||
## 属性管理
|
||||
|
|
@ -171,7 +171,7 @@ bt_status_t bt_adapter_set_name(bt_instance_t* ins, const char* name);
|
|||
|
||||
**返回值**:
|
||||
|
||||
成功时返回 BT_STATUS_SUCCESS,失败时返回负的错误码。。
|
||||
成功时返回 BT_STATUS_SUCCESS,失败时返回错误码。
|
||||
|
||||
|
||||
#### bt_adapter_get_name
|
||||
|
|
@ -200,15 +200,13 @@ bt_status_t bt_adapter_set_scan_mode(bt_instance_t* ins, bt_scan_mode_t mode, bo
|
|||
**参数**:
|
||||
|
||||
- `ins` 蓝牙客户端实例。
|
||||
- `mode` 模式。
|
||||
- `mode` 扫描模式。
|
||||
- `bondable` 是否可配对。
|
||||
- `name` 输出参数,存储适配器名称。
|
||||
- `length` 缓冲区长度。
|
||||
|
||||
|
||||
**返回值**:
|
||||
|
||||
成功时返回 BT_STATUS_SUCCESS,失败时返回负的错误码。。
|
||||
成功时返回 BT_STATUS_SUCCESS,失败时返回错误码。
|
||||
|
||||
|
||||
#### bt_adapter_get_scan_mode
|
||||
|
|
@ -226,9 +224,7 @@ bt_scan_mode_t bt_adapter_get_scan_mode(bt_instance_t* ins);
|
|||
|
||||
**返回值**:
|
||||
|
||||
|
||||
|
||||
#### bt_adapter_set_device_class
|
||||
返回扫描模式枚举值,参见 `bt_scan_mode_t`。
|
||||
|
||||
```c
|
||||
bt_status_t bt_adapter_set_device_class(bt_instance_t* ins, uint32_t cod);
|
||||
|
|
@ -262,9 +258,7 @@ uint32_t bt_adapter_get_device_class(bt_instance_t* ins);
|
|||
|
||||
**返回值**:
|
||||
|
||||
|
||||
|
||||
#### bt_adapter_set_debug_mode
|
||||
返回 24 位 Class of Device 值。
|
||||
|
||||
```c
|
||||
bt_status_t bt_adapter_set_debug_mode(bt_instance_t* ins, bt_debug_mode_t mode, uint8_t operation);
|
||||
|
|
@ -290,7 +284,7 @@ bt_status_t bt_adapter_set_le_address(bt_instance_t* ins, bt_address_t* addr);
|
|||
**参数**:
|
||||
|
||||
- `ins` 蓝牙客户端实例, 参见 bt_instance_t.
|
||||
- `addr` 指向 the BLE identity address.
|
||||
- `addr` BLE 身份地址。
|
||||
|
||||
|
||||
#### bt_adapter_set_le_appearance
|
||||
|
|
@ -379,18 +373,11 @@ uint32_t bt_adapter_get_le_io_capability(bt_instance_t* ins);
|
|||
|
||||
**参数**:
|
||||
|
||||
- `ins` 蓝牙客户端实例, 参见 bt_instance_t.- `mode` 调试模式。
|
||||
- `operation` 调试操作。
|
||||
- `appearance` BLE 外观值。
|
||||
- `addr` 设备地址。
|
||||
- `type` 地址类型。
|
||||
- `cap` IO 能力值。
|
||||
- `num` 输出参数,存储设备数量。
|
||||
|
||||
- `ins` 蓝牙客户端实例。
|
||||
|
||||
**返回值**:
|
||||
|
||||
成功时返回 BT_STATUS_SUCCESS,失败时返回错误码。
|
||||
返回 BLE IO 能力值。
|
||||
|
||||
|
||||
## BLE 管理
|
||||
|
|
@ -411,7 +398,7 @@ bt_status_t bt_adapter_enable(bt_instance_t* ins);
|
|||
|
||||
**返回值**:
|
||||
|
||||
bt_adapter_enable 操作。
|
||||
成功时返回 BT_STATUS_SUCCESS,失败时返回错误码。
|
||||
|
||||
|
||||
#### bt_adapter_disable
|
||||
|
|
@ -428,7 +415,7 @@ bt_status_t bt_adapter_disable(bt_instance_t* ins);
|
|||
|
||||
**返回值**:
|
||||
|
||||
bt_adapter_disable 操作。
|
||||
成功时返回 BT_STATUS_SUCCESS,失败时返回错误码。
|
||||
|
||||
|
||||
#### bt_adapter_disable_safe
|
||||
|
|
@ -472,7 +459,7 @@ bool bt_adapter_is_le_enabled(bt_instance_t* ins);
|
|||
|
||||
**返回值**:
|
||||
|
||||
bt_adapter_is_le_enabled 操作。
|
||||
已启用时返回 `true`,未启用时返回 `false`。
|
||||
|
||||
|
||||
#### bt_adapter_le_enable_key_derivation
|
||||
|
|
@ -675,7 +662,7 @@ bt_status_t bt_adapter_get_type_async(bt_instance_t* ins, bt_device_type_cb_t ge
|
|||
bt_status_t bt_adapter_set_discovery_filter_async(bt_instance_t* ins, bt_status_cb_t cb, void* userdata);
|
||||
```
|
||||
|
||||
Set the discovery filter(异步版本)。
|
||||
设置发现过滤器(异步版本)。
|
||||
|
||||
**参数**:
|
||||
|
||||
|
|
@ -872,7 +859,7 @@ bt_status_t bt_adapter_get_device_class_async(bt_instance_t* ins, bt_u32_cb_t ge
|
|||
bt_status_t bt_adapter_set_io_capability_async(bt_instance_t* ins, bt_io_capability_t cap, bt_status_cb_t cb, void* userdata);
|
||||
```
|
||||
|
||||
Set the BR/EDR adapter IO capability(异步版本)。
|
||||
设置 BR/EDR 适配器 IO 能力(异步版本)。
|
||||
|
||||
**参数**:
|
||||
|
||||
|
|
@ -889,7 +876,7 @@ Set the BR/EDR adapter IO capability(异步版本)。
|
|||
bt_status_t bt_adapter_get_io_capability_async(bt_instance_t* ins, bt_adapter_get_io_capability_cb_t get_ioc_cb, void* userdata);
|
||||
```
|
||||
|
||||
Get the BR/EDR adapter IO capability(异步版本)。
|
||||
获取 BR/EDR 适配器 IO 能力(异步版本)。
|
||||
|
||||
**参数**:
|
||||
|
||||
|
|
@ -943,7 +930,7 @@ bt_status_t bt_adapter_set_page_scan_parameters_async(bt_instance_t* ins, bt_sca
|
|||
bt_status_t bt_adapter_set_le_io_capability_async(bt_instance_t* ins, uint32_t le_io_cap, bt_status_cb_t cb, void* userdata);
|
||||
```
|
||||
|
||||
Set the BLE adapter IO capability(异步版本)。
|
||||
设置 BLE 适配器 IO 能力(异步版本)。
|
||||
|
||||
**参数**:
|
||||
|
||||
|
|
@ -960,7 +947,7 @@ Set the BLE adapter IO capability(异步版本)。
|
|||
bt_status_t bt_adapter_get_le_io_capability_async(bt_instance_t* ins, bt_u32_cb_t get_le_ioc_cb, void* userdata);
|
||||
```
|
||||
|
||||
Get the BLE adapter IO capability(异步版本)。
|
||||
获取 BLE 适配器 IO 能力(异步版本)。
|
||||
|
||||
**参数**:
|
||||
|
||||
|
|
@ -976,7 +963,7 @@ Get the BLE adapter IO capability(异步版本)。
|
|||
bt_status_t bt_adapter_get_le_address_async(bt_instance_t* ins, bt_adapter_get_le_address_cb_t cb, void* userdata);
|
||||
```
|
||||
|
||||
Get the BLE adapter address(异步版本)。
|
||||
获取 BLE 适配器地址(异步版本)。
|
||||
|
||||
**参数**:
|
||||
|
||||
|
|
@ -992,7 +979,7 @@ Get the BLE adapter address(异步版本)。
|
|||
bt_status_t bt_adapter_set_le_address_async(bt_instance_t* ins, bt_address_t* addr, bt_status_cb_t cb, void* userdata);
|
||||
```
|
||||
|
||||
Set the BLE private address(异步版本)。
|
||||
设置 BLE 私有地址(异步版本)。
|
||||
|
||||
**参数**:
|
||||
|
||||
|
|
@ -1009,7 +996,7 @@ Set the BLE private address(异步版本)。
|
|||
bt_status_t bt_adapter_set_le_identity_address_async(bt_instance_t* ins, bt_address_t* addr, bool is_public, bt_status_cb_t cb, void* userdata);
|
||||
```
|
||||
|
||||
Set the BLE identity address(异步版本)。
|
||||
设置 BLE 身份地址(异步版本)。
|
||||
|
||||
**参数**:
|
||||
|
||||
|
|
@ -1027,7 +1014,7 @@ Set the BLE identity address(异步版本)。
|
|||
bt_status_t bt_adapter_set_le_appearance_async(bt_instance_t* ins, uint16_t appearance, bt_status_cb_t cb, void* userdata);
|
||||
```
|
||||
|
||||
Set the BLE adapter appearance(异步版本)。
|
||||
设置 BLE 适配器外观值(异步版本)。
|
||||
|
||||
**参数**:
|
||||
|
||||
|
|
@ -1044,7 +1031,7 @@ Set the BLE adapter appearance(异步版本)。
|
|||
bt_status_t bt_adapter_get_le_appearance_async(bt_instance_t* ins, bt_u16_cb_t cb, void* userdata);
|
||||
```
|
||||
|
||||
Get the BLE adapter appearance(异步版本)。
|
||||
获取 BLE 适配器外观值(异步版本)。
|
||||
|
||||
**参数**:
|
||||
|
||||
|
|
@ -1078,7 +1065,7 @@ bt_status_t bt_adapter_le_enable_key_derivation_async(bt_instance_t* ins, bool b
|
|||
bt_status_t bt_adapter_le_add_whitelist_async(bt_instance_t* ins, bt_address_t* addr, bt_status_cb_t cb, void* userdata);
|
||||
```
|
||||
|
||||
Add a device to the BLE whitelist(异步版本)。
|
||||
添加设备到 BLE 白名单(异步版本)。
|
||||
|
||||
**参数**:
|
||||
|
||||
|
|
|
|||
|
|
@ -26,12 +26,12 @@ bool bt_hfp_hf_unregister_callbacks(bt_instance_t* ins, void* cookie);
|
|||
|
||||
**参数**:
|
||||
|
||||
- `cookie` 用户上下文。
|
||||
- `ins` 蓝牙客户端实例。
|
||||
- `cookie` 用户上下文。
|
||||
|
||||
**返回值**:
|
||||
|
||||
取消注册回调函数。
|
||||
成功时返回 `true`,失败时返回 `false`。
|
||||
|
||||
|
||||
### bt_hfp_hf_is_connected
|
||||
|
|
@ -40,7 +40,7 @@ bool bt_hfp_hf_unregister_callbacks(bt_instance_t* ins, void* cookie);
|
|||
bool bt_hfp_hf_is_connected(bt_instance_t* ins, bt_address_t* addr);
|
||||
```
|
||||
|
||||
发起与远程设备的连接。
|
||||
查询与远程设备的 HFP HF 是否已连接。
|
||||
|
||||
**参数**:
|
||||
|
||||
|
|
@ -50,7 +50,7 @@ bool bt_hfp_hf_is_connected(bt_instance_t* ins, bt_address_t* addr);
|
|||
|
||||
**返回值**:
|
||||
|
||||
成功时返回 BT_STATUS_SUCCESS,失败时返回错误码。
|
||||
已连接时返回 `true`,未连接时返回 `false`。
|
||||
|
||||
|
||||
### bt_hfp_hf_is_audio_connected
|
||||
|
|
@ -59,7 +59,7 @@ bool bt_hfp_hf_is_connected(bt_instance_t* ins, bt_address_t* addr);
|
|||
bool bt_hfp_hf_is_audio_connected(bt_instance_t* ins, bt_address_t* addr);
|
||||
```
|
||||
|
||||
发起与远程设备的连接。
|
||||
查询与远程设备的 HFP 音频通道是否已连接。
|
||||
|
||||
**参数**:
|
||||
|
||||
|
|
@ -69,7 +69,7 @@ bool bt_hfp_hf_is_audio_connected(bt_instance_t* ins, bt_address_t* addr);
|
|||
|
||||
**返回值**:
|
||||
|
||||
成功时返回 BT_STATUS_SUCCESS,失败时返回错误码。
|
||||
音频已连接时返回 `true`,未连接时返回 `false`。
|
||||
|
||||
|
||||
### bt_hfp_hf_get_connection_state
|
||||
|
|
@ -78,7 +78,7 @@ bool bt_hfp_hf_is_audio_connected(bt_instance_t* ins, bt_address_t* addr);
|
|||
profile_connection_state_t bt_hfp_hf_get_connection_state(bt_instance_t* ins, bt_address_t* addr);
|
||||
```
|
||||
|
||||
发起与远程设备的连接。
|
||||
获取与远程设备的 HFP HF 连接状态。
|
||||
|
||||
**参数**:
|
||||
|
||||
|
|
@ -88,6 +88,7 @@ profile_connection_state_t bt_hfp_hf_get_connection_state(bt_instance_t* ins, bt
|
|||
|
||||
**返回值**:
|
||||
|
||||
返回当前连接状态枚举值,参见 `profile_connection_state_t`。
|
||||
|
||||
|
||||
### bt_hfp_hf_connect
|
||||
|
|
@ -96,16 +97,16 @@ profile_connection_state_t bt_hfp_hf_get_connection_state(bt_instance_t* ins, bt
|
|||
bt_status_t bt_hfp_hf_connect(bt_instance_t* ins, bt_address_t* addr);
|
||||
```
|
||||
|
||||
发起与远程设备的连接。
|
||||
发起与远程设备的 HFP HF 连接。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `ins` 蓝牙客户端实例。
|
||||
- `addr` 蓝牙地址 of the peer device.
|
||||
- `addr` 对端设备蓝牙地址。
|
||||
|
||||
**返回值**:
|
||||
|
||||
建立连接。
|
||||
成功时返回 BT_STATUS_SUCCESS,失败时返回错误码。
|
||||
|
||||
|
||||
### bt_hfp_hf_disconnect
|
||||
|
|
@ -391,7 +392,7 @@ bt_status_t bt_hfp_hf_query_current_calls(bt_instance_t* ins, bt_address_t* addr
|
|||
**参数**:
|
||||
|
||||
- `ins` 蓝牙客户端实例。
|
||||
- `addr` 蓝牙地址 of the peer device.
|
||||
- `addr` 对端设备蓝牙地址。
|
||||
- `allocator` 内存分配函数。- `calls` 输出参数,存储通话信息数组。
|
||||
- `num` 输出参数,存储通话数量。
|
||||
|
||||
|
|
@ -502,16 +503,16 @@ bt_status_t bt_hfp_hf_get_subscriber_number(bt_instance_t* ins, bt_address_t* ad
|
|||
bt_status_t bt_hfp_hf_query_current_calls_with_callback(bt_instance_t* ins, bt_address_t* addr);
|
||||
```
|
||||
|
||||
查询当前所有通话的状态信息(CLCC)。
|
||||
查询当前所有通话的状态信息(CLCC),结果通过回调异步返回。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `ins` 蓝牙客户端实例。
|
||||
- `addr` 远程设备蓝牙地址。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
||||
- `ins` 蓝牙客户端实例。
|
||||
成功时返回 BT_STATUS_SUCCESS,失败时返回错误码。
|
||||
|
||||
|
||||
### bt_hfp_ag_unregister_callbacks
|
||||
|
|
@ -524,12 +525,12 @@ bool bt_hfp_ag_unregister_callbacks(bt_instance_t* ins, void* cookie);
|
|||
|
||||
**参数**:
|
||||
|
||||
- `cookie` 用户上下文。
|
||||
- `ins` 蓝牙客户端实例。
|
||||
- `cookie` 用户上下文。
|
||||
|
||||
**返回值**:
|
||||
|
||||
取消注册回调函数。
|
||||
成功时返回 `true`,失败时返回 `false`。
|
||||
|
||||
|
||||
### bt_hfp_ag_is_connected
|
||||
|
|
@ -538,7 +539,7 @@ bool bt_hfp_ag_unregister_callbacks(bt_instance_t* ins, void* cookie);
|
|||
bool bt_hfp_ag_is_connected(bt_instance_t* ins, bt_address_t* addr);
|
||||
```
|
||||
|
||||
发起与远程设备的连接。
|
||||
查询与远程设备的 HFP AG 是否已连接。
|
||||
|
||||
**参数**:
|
||||
|
||||
|
|
@ -548,7 +549,7 @@ bool bt_hfp_ag_is_connected(bt_instance_t* ins, bt_address_t* addr);
|
|||
|
||||
**返回值**:
|
||||
|
||||
成功时返回 BT_STATUS_SUCCESS,失败时返回错误码。
|
||||
已连接时返回 `true`,未连接时返回 `false`。
|
||||
|
||||
|
||||
### bt_hfp_ag_is_audio_connected
|
||||
|
|
@ -557,7 +558,7 @@ bool bt_hfp_ag_is_connected(bt_instance_t* ins, bt_address_t* addr);
|
|||
bool bt_hfp_ag_is_audio_connected(bt_instance_t* ins, bt_address_t* addr);
|
||||
```
|
||||
|
||||
发起与远程设备的连接。
|
||||
查询与远程设备的 HFP AG 音频通道是否已连接。
|
||||
|
||||
**参数**:
|
||||
|
||||
|
|
@ -567,7 +568,7 @@ bool bt_hfp_ag_is_audio_connected(bt_instance_t* ins, bt_address_t* addr);
|
|||
|
||||
**返回值**:
|
||||
|
||||
成功时返回 BT_STATUS_SUCCESS,失败时返回错误码。
|
||||
音频已连接时返回 `true`,未连接时返回 `false`。
|
||||
|
||||
|
||||
### bt_hfp_ag_get_connection_state
|
||||
|
|
@ -576,7 +577,7 @@ bool bt_hfp_ag_is_audio_connected(bt_instance_t* ins, bt_address_t* addr);
|
|||
profile_connection_state_t bt_hfp_ag_get_connection_state(bt_instance_t* ins, bt_address_t* addr);
|
||||
```
|
||||
|
||||
发起与远程设备的连接。
|
||||
获取与远程设备的 HFP AG 连接状态。
|
||||
|
||||
**参数**:
|
||||
|
||||
|
|
@ -586,6 +587,7 @@ profile_connection_state_t bt_hfp_ag_get_connection_state(bt_instance_t* ins, bt
|
|||
|
||||
**返回值**:
|
||||
|
||||
返回当前连接状态枚举值,参见 `profile_connection_state_t`。
|
||||
|
||||
|
||||
### bt_hfp_ag_connect
|
||||
|
|
@ -594,16 +596,16 @@ profile_connection_state_t bt_hfp_ag_get_connection_state(bt_instance_t* ins, bt
|
|||
bt_status_t bt_hfp_ag_connect(bt_instance_t* ins, bt_address_t* addr);
|
||||
```
|
||||
|
||||
发起与远程设备的连接。
|
||||
发起与远程设备的 HFP AG 连接。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `ins` 蓝牙客户端实例。
|
||||
- `addr` 蓝牙地址 of the peer device.
|
||||
- `addr` 对端设备蓝牙地址。
|
||||
|
||||
**返回值**:
|
||||
|
||||
建立连接。
|
||||
成功时返回 BT_STATUS_SUCCESS,失败时返回错误码。
|
||||
|
||||
|
||||
### bt_hfp_ag_disconnect
|
||||
|
|
@ -865,9 +867,9 @@ bt_status_t bt_hfp_ag_send_clcc_response(bt_instance_t* ins, bt_address_t* addr,
|
|||
- `dir` 方向(呼入/呼出)。
|
||||
- `state` 状态。
|
||||
- `mode` 模式。
|
||||
- `mpty` 是否 the call is multi party.
|
||||
- `mpty` 是否为多方通话。
|
||||
- `type` 类型。
|
||||
- `number` phone 数量 the call.
|
||||
- `number` 通话号码。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
|
|||
|
|
@ -25,12 +25,12 @@ bool bt_hid_device_unregister_callbacks(bt_instance_t* ins, void* cookie);
|
|||
|
||||
**参数**:
|
||||
|
||||
- `cookie` 用户上下文。
|
||||
- `ins` 蓝牙客户端实例, 参见 bt_instance_t.
|
||||
- `cookie` 用户上下文。
|
||||
|
||||
**返回值**:
|
||||
|
||||
取消注册回调函数。
|
||||
成功时返回 `true`,失败时返回 `false`。
|
||||
|
||||
|
||||
### bt_hid_device_register_app
|
||||
|
|
@ -59,7 +59,7 @@ bt_status_t bt_hid_device_register_app(bt_instance_t* ins, hid_device_sdp_settin
|
|||
bt_status_t bt_hid_device_unregister_app(bt_instance_t* ins);
|
||||
```
|
||||
|
||||
取消注册操作。
|
||||
取消注册 HID 设备应用。
|
||||
|
||||
**参数**:
|
||||
|
||||
|
|
@ -68,7 +68,7 @@ bt_status_t bt_hid_device_unregister_app(bt_instance_t* ins);
|
|||
|
||||
**返回值**:
|
||||
|
||||
bt_hid_device_unregister_app 操作。
|
||||
成功时返回 BT_STATUS_SUCCESS,失败时返回错误码。
|
||||
|
||||
|
||||
### bt_hid_device_connect
|
||||
|
|
@ -147,6 +147,10 @@ bt_status_t bt_hid_device_response_report(bt_instance_t* ins, bt_address_t* addr
|
|||
- `rpt_data` HID 报告数据。
|
||||
- `rpt_size` 报告数据大小(字节)。
|
||||
|
||||
**返回值**:
|
||||
|
||||
成功时返回 BT_STATUS_SUCCESS,失败时返回错误码。
|
||||
|
||||
|
||||
### bt_hid_device_report_error
|
||||
|
||||
|
|
@ -160,13 +164,11 @@ bt_status_t bt_hid_device_report_error(bt_instance_t* ins, bt_address_t* addr, h
|
|||
|
||||
- `ins` 蓝牙客户端实例。
|
||||
- `addr` 远程设备蓝牙地址。
|
||||
- `error` 错误码。
|
||||
- `error` 错误码,参见 `hid_status_error_t`。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
||||
- `ins` 蓝牙客户端实例, 参见 bt_instance_t.
|
||||
- `addr` Address of the peer device, 参见 bt_address_t.
|
||||
- `error` Error code, 参见 hid_status_error_t.
|
||||
成功时返回 BT_STATUS_SUCCESS,失败时返回错误码。
|
||||
|
||||
|
||||
### bt_hid_device_virtual_unplug
|
||||
|
|
@ -181,3 +183,7 @@ bt_status_t bt_hid_device_virtual_unplug(bt_instance_t* ins, bt_address_t* addr)
|
|||
|
||||
- `ins` 蓝牙客户端实例。
|
||||
- `addr` 远程设备蓝牙地址。
|
||||
|
||||
**返回值**:
|
||||
|
||||
成功时返回 BT_STATUS_SUCCESS,失败时返回错误码。
|
||||
|
|
|
|||
|
|
@ -1,141 +0,0 @@
|
|||
\[ [English](../../../../en/api/framework/bluetooth/bt_le_advertiser.md) | 简体中文 \]
|
||||
|
||||
# 蓝牙 BLE 广播 API
|
||||
|
||||
openvela 蓝牙 BLE 广播接口,用于发送 BLE 广播数据和管理广播实例。
|
||||
|
||||
头文件:`#include "bt_le_advertiser.h"`
|
||||
|
||||
|
||||
## openvela 实现说明
|
||||
|
||||
- **广播类型**:支持可连接广播、不可连接广播、扫描响应等
|
||||
- **广播数据**:支持自定义广播数据和扫描响应数据
|
||||
- **多实例**:支持同时运行多个广播实例
|
||||
|
||||
|
||||
## 同步接口
|
||||
|
||||
|
||||
### bt_le_stop_advertising
|
||||
|
||||
```c
|
||||
void bt_le_stop_advertising(bt_instance_t* ins, bt_advertiser_t* adver);
|
||||
```
|
||||
|
||||
停止 BLE 广播。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `ins` 蓝牙客户端实例。
|
||||
- `adver` 广播器实例。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
||||
|
||||
### bt_le_stop_advertising_id
|
||||
|
||||
```c
|
||||
void bt_le_stop_advertising_id(bt_instance_t* ins, uint8_t adv_id);
|
||||
```
|
||||
|
||||
停止指定 ID 的 BLE 广播实例。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `ins` 蓝牙客户端实例。
|
||||
- `adv_id` 广播实例 ID。
|
||||
|
||||
|
||||
### bt_le_advertising_is_supported
|
||||
|
||||
```c
|
||||
bool bt_le_advertising_is_supported(bt_instance_t* ins);
|
||||
```
|
||||
|
||||
广播数据查询supported。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `ins` 蓝牙客户端实例。
|
||||
|
||||
|
||||
**返回值**:
|
||||
|
||||
bt_le_advertising_is_supported 操作。
|
||||
|
||||
|
||||
## 异步接口
|
||||
|
||||
|
||||
### bt_le_start_advertising_async
|
||||
|
||||
```c
|
||||
bt_status_t bt_le_start_advertising_async(bt_instance_t* ins, ble_adv_params_t* params, uint8_t* adv_data, uint16_t adv_len, uint8_t* scan_rsp_data, uint16_t scan_rsp_len, advertiser_callback_t* adv_cbs, bt_le_start_adv_callback_cb_t cb, void* userdata);
|
||||
```
|
||||
|
||||
开始 BLE 广播(异步版本)。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `ins` 蓝牙客户端实例。
|
||||
- `params` 参数结构体。
|
||||
- `adv_data` 广播数据。
|
||||
- `adv_len` 广播数据长度。
|
||||
- `scan_rsp_data` 扫描响应数据。
|
||||
- `scan_rsp_len` 扫描响应数据长度。
|
||||
- `adv_cbs` 广播回调函数集合。
|
||||
- `cb` 回调函数。
|
||||
- `userdata` 用户数据。
|
||||
|
||||
|
||||
### bt_le_stop_advertising_async
|
||||
|
||||
```c
|
||||
bt_status_t bt_le_stop_advertising_async(bt_instance_t* ins, bt_advertiser_t* adver, bt_status_cb_t cb, void* userdata);
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**参数**:
|
||||
|
||||
- `ins` 蓝牙客户端实例。
|
||||
- `adver` 广播器实例。
|
||||
- `cb` 回调函数。
|
||||
- `userdata` 用户数据。
|
||||
|
||||
|
||||
|
||||
### bt_le_stop_advertising_id_async
|
||||
|
||||
```c
|
||||
bt_status_t bt_le_stop_advertising_id_async(bt_instance_t* ins, uint8_t adv_id, bt_status_cb_t cb, void* userdata);
|
||||
```
|
||||
|
||||
停止BLE 广播(指定 ID)(异步版本)。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `ins` 蓝牙客户端实例。
|
||||
- `adv_id` 广播实例 ID。
|
||||
- `cb` 回调函数。
|
||||
- `userdata` 用户数据。
|
||||
|
||||
|
||||
### bt_le_advertising_is_supported_async
|
||||
|
||||
```c
|
||||
bt_status_t bt_le_advertising_is_supported_async(bt_instance_t* ins, bt_bool_cb_t cb, void* userdata);
|
||||
```
|
||||
|
||||
查询是否支持 BLE 广播(异步版本)。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `ins` 蓝牙客户端实例。
|
||||
- `cb` 回调函数。
|
||||
- `userdata` 用户数据。
|
||||
|
||||
|
|
@ -1,141 +0,0 @@
|
|||
\[ [English](../../../../en/api/framework/bluetooth/bt_le_scan.md) | 简体中文 \]
|
||||
|
||||
# 蓝牙 BLE 扫描 API
|
||||
|
||||
openvela 蓝牙 BLE 扫描接口,用于发现周围的 BLE 设备和广播数据。
|
||||
|
||||
头文件:`#include "bt_le_scan.h"`
|
||||
|
||||
|
||||
## openvela 实现说明
|
||||
|
||||
- **扫描模式**:支持被动扫描和主动扫描
|
||||
- **过滤器**:支持按名称、地址、UUID 等条件过滤扫描结果
|
||||
- **回调通知**:通过回调函数异步返回扫描结果
|
||||
|
||||
|
||||
## 同步接口
|
||||
|
||||
|
||||
### bt_le_stop_scan
|
||||
|
||||
```c
|
||||
void bt_le_stop_scan(bt_instance_t* ins, bt_scanner_t* scanner);
|
||||
```
|
||||
|
||||
停止 BLE 扫描。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `scanner` 扫描器实例。
|
||||
- `ins` 蓝牙客户端实例, 参见 bt_instance_t.
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
||||
|
||||
### bt_le_scan_is_supported
|
||||
|
||||
```c
|
||||
bool bt_le_scan_is_supported(bt_instance_t* ins);
|
||||
```
|
||||
|
||||
查询操作。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `ins` 蓝牙客户端实例。
|
||||
|
||||
|
||||
**返回值**:
|
||||
|
||||
bt_le_scan_is_supported 操作。
|
||||
|
||||
|
||||
## 异步接口
|
||||
|
||||
|
||||
### bt_le_start_scan_async
|
||||
|
||||
```c
|
||||
bt_status_t bt_le_start_scan_async(bt_instance_t* ins, const scanner_callbacks_t* scan_cbs, bt_le_start_scan_cb_t cb, void* userdata);
|
||||
```
|
||||
|
||||
开始BLE 扫描(异步版本)。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `ins` 蓝牙客户端实例。
|
||||
- `scan_cbs` 扫描回调函数集合。
|
||||
- `cb` 回调函数。
|
||||
- `userdata` 用户数据。
|
||||
|
||||
|
||||
### bt_le_start_scan_settings_async
|
||||
|
||||
```c
|
||||
bt_status_t bt_le_start_scan_settings_async(bt_instance_t* ins, ble_scan_settings_t* settings, const scanner_callbacks_t* scan_cbs, bt_le_start_scan_cb_t cb, void* userdata);
|
||||
```
|
||||
|
||||
异步版本。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `ins` 蓝牙客户端实例。
|
||||
- `settings` 设置。
|
||||
- `scan_cbs` 扫描回调函数集合。
|
||||
- `cb` 回调函数。
|
||||
- `userdata` 用户数据。
|
||||
|
||||
|
||||
|
||||
### bt_le_start_scan_with_filters_async
|
||||
|
||||
```c
|
||||
bt_status_t bt_le_start_scan_with_filters_async(bt_instance_t* ins, ble_scan_settings_t* settings, ble_scan_filter_t* filter, const scanner_callbacks_t* scan_cbs, bt_le_start_scan_cb_t cb, void* userdata);
|
||||
```
|
||||
|
||||
开始操作(异步版本)。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `ins` 蓝牙客户端实例。
|
||||
- `settings` 设置。
|
||||
- `filter` 过滤条件。
|
||||
- `scan_cbs` 扫描回调函数集合。
|
||||
- `cb` 回调函数。
|
||||
- `userdata` 用户数据。
|
||||
|
||||
|
||||
### bt_le_stop_scan_async
|
||||
|
||||
```c
|
||||
bt_status_t bt_le_stop_scan_async(bt_instance_t* ins, bt_scanner_t* scanner, bt_le_stop_scan_cb_t cb, void* userdata);
|
||||
```
|
||||
|
||||
停止扫描(异步版本)。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `ins` 蓝牙客户端实例。
|
||||
- `scanner` 扫描器实例。
|
||||
- `cb` 回调函数。
|
||||
- `userdata` 用户数据。
|
||||
|
||||
|
||||
|
||||
|
||||
### bt_le_scan_is_supported_async
|
||||
|
||||
```c
|
||||
bt_status_t bt_le_scan_is_supported_async(bt_instance_t* ins, bt_bool_cb_t cb, void* userdata);
|
||||
```
|
||||
|
||||
查询是否支持 BLE 扫描(异步版本)。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `ins` 蓝牙客户端实例。
|
||||
- `cb` 回调函数。
|
||||
- `userdata` 用户数据。
|
||||
|
||||
|
|
@ -21,16 +21,16 @@ openvela 蓝牙 SPP(串口仿真)接口,用于替代物理串口进行数
|
|||
bt_status_t bt_spp_unregister_app(bt_instance_t* ins, void* handle);
|
||||
```
|
||||
|
||||
取消注册操作。
|
||||
取消注册 SPP 应用。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 句柄。
|
||||
- `ins` 蓝牙客户端实例。
|
||||
- `handle` 句柄。
|
||||
|
||||
**返回值**:
|
||||
|
||||
bt_spp_unregister_app 操作。
|
||||
成功时返回 BT_STATUS_SUCCESS,失败时返回错误码。
|
||||
|
||||
|
||||
### bt_spp_server_start
|
||||
|
|
@ -102,7 +102,7 @@ bt_status_t bt_spp_connect(bt_instance_t* ins, void* handle, bt_address_t* addr,
|
|||
bt_status_t bt_spp_insecure_connect(bt_instance_t* ins, void* handle, bt_address_t* addr, int16_t scn, bt_uuid_t* uuid, uint16_t* port);
|
||||
```
|
||||
|
||||
发起与远程设备的连接。
|
||||
发起与远程设备的非安全连接(不要求加密)。
|
||||
|
||||
**参数**:
|
||||
|
||||
|
|
@ -113,6 +113,10 @@ bt_status_t bt_spp_insecure_connect(bt_instance_t* ins, void* handle, bt_address
|
|||
- `uuid` 服务 UUID。
|
||||
- `port` 端口号。
|
||||
|
||||
**返回值**:
|
||||
|
||||
成功时返回 BT_STATUS_SUCCESS,失败时返回错误码。
|
||||
|
||||
|
||||
### bt_spp_disconnect
|
||||
|
||||
|
|
@ -126,7 +130,7 @@ bt_status_t bt_spp_disconnect(bt_instance_t* ins, void* handle, bt_address_t* ad
|
|||
|
||||
- `ins` 蓝牙客户端实例。
|
||||
- `handle` 句柄。
|
||||
- `addr` 蓝牙地址 of the peer device.
|
||||
- `addr` 对端设备蓝牙地址。
|
||||
- `port` 端口号。
|
||||
|
||||
**返回值**:
|
||||
|
|
|
|||
|
|
@ -10,19 +10,14 @@ openvela 蓝牙框架提供完整的蓝牙协议栈接口,支持经典蓝牙
|
|||
- **[GATT](bt_gatt.md)**(通用属性规范)— BLE 数据属性读写与通知
|
||||
- **[设备管理](bt_device.md)** — 远程设备配对、连接、属性查询
|
||||
|
||||
## BLE 接口
|
||||
|
||||
- **[BLE 扫描](bt_le_scan.md)** — BLE 设备发现与广播数据接收
|
||||
- **[BLE 广播](bt_le_advertiser.md)** — BLE 广播数据发送与管理
|
||||
|
||||
## 音频与媒体
|
||||
## 经典蓝牙规范
|
||||
|
||||
- **[A2DP](bt_a2dp.md)**(高级音频分发)— 高质量立体声音乐传输
|
||||
- **[AVRCP](bt_avrcp.md)**(音视频远程控制)— 播放控制、切歌、音量调节
|
||||
- **[HFP](bt_hfp.md)**(免提规范)— 蓝牙通话功能
|
||||
|
||||
## 数据与外设
|
||||
|
||||
- **[HID](bt_hid.md)**(人机接口设备)— 键盘、鼠标、游戏手柄
|
||||
- **[SPP](bt_spp.md)**(串口仿真)— 数据透传
|
||||
- **[PAN](bt_pan.md)**(个人局域网)— 网络共享与蓝牙组网
|
||||
|
||||
## 低功耗蓝牙规范
|
||||
|
||||
- **[CS](bt_cs.md)**(Channel Sounding)— 蓝牙信道探测测距与定位
|
||||
|
|
|
|||
|
|
@ -30,11 +30,11 @@ void* media_player_open(const char* stream);
|
|||
|
||||
**参数**:
|
||||
|
||||
- `stream` 流类型常量。 不同流类型有不同的路由逻辑.
|
||||
- `stream` 流类型常量,不同流类型有不同的路由逻辑。
|
||||
|
||||
**返回值**:
|
||||
|
||||
void* 播放器句柄, NULL on failure。
|
||||
成功时返回播放器句柄,失败时返回 `NULL`。
|
||||
|
||||
|
||||
### media_player_close
|
||||
|
|
@ -47,7 +47,7 @@ int media_player_close(void* handle, int pending_stop);
|
|||
|
||||
**参数**:
|
||||
|
||||
- `handle` 播放器句柄.
|
||||
- `handle` 播放器句柄。
|
||||
- `pending_stop` 关闭前是否等待停止完成:0 表示立即停止并关闭,1 表示等待当前曲目播放完成再关闭。此参数仅对音频播放器有效;视频播放器设置为 1 时不产生等待效果。
|
||||
|
||||
**返回值**:
|
||||
|
|
@ -65,13 +65,13 @@ int media_player_set_event_callback(void* handle, void* event_cookie, media_even
|
|||
|
||||
**参数**:
|
||||
|
||||
- `handle` 播放器句柄.
|
||||
- `event_cookie` 回调参数.
|
||||
- `handle` 播放器句柄。
|
||||
- `event_cookie` 回调上下文参数。
|
||||
- `on_event` 事件回调函数,用于接收流状态变化通知。
|
||||
|
||||
**返回值**:
|
||||
|
||||
成功时返回 0,失败时返回负的错误码。
|
||||
成功时返回 `0`,失败时返回负的错误码。
|
||||
|
||||
|
||||
### media_player_prepare
|
||||
|
|
@ -84,13 +84,13 @@ int media_player_prepare(void* handle, const char* url, const char* options);
|
|||
|
||||
**参数**:
|
||||
|
||||
- `handle` 播放器句柄.
|
||||
- `handle` 播放器句柄。
|
||||
- `url` 资源路径,支持两种模式:1. URL 模式:`url` 为本地文件路径或网络地址,框架会读取并播放;2. BUFFER 模式:`url` 为 `NULL`,调用方需通过 `media_player_write_data()` 或 `media_player_get_socket()` + `write()` 持续推送数据。
|
||||
- `options` 资源的额外配置参数,通常为描述资源格式的键值对(例如 `"format=s16le,sample_rate=44100,channels=2"`)。
|
||||
|
||||
**返回值**:
|
||||
|
||||
成功时返回 0,失败时返回负的错误码。
|
||||
成功时返回 `0`,失败时返回负的错误码。
|
||||
|
||||
|
||||
### media_player_reset
|
||||
|
|
@ -99,16 +99,15 @@ int media_player_prepare(void* handle, const char* url, const char* options);
|
|||
int media_player_reset(void* handle);
|
||||
```
|
||||
|
||||
重置指定类型的播放器。
|
||||
重置播放器到初始状态。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 播放器句柄,由 `media_player_open` 返回。
|
||||
- `handle` 播放器句柄.
|
||||
|
||||
**返回值**:
|
||||
|
||||
成功时返回 0,失败时返回负的错误码。
|
||||
成功时返回 `0`,失败时返回负的错误码。
|
||||
|
||||
|
||||
## 同步接口 - 数据流
|
||||
|
|
@ -123,13 +122,13 @@ ssize_t media_player_write_data(void* handle, const void* data, size_t len);
|
|||
|
||||
**参数**:
|
||||
|
||||
- `handle` 播放器句柄.
|
||||
- `data` 缓冲区地址.
|
||||
- `len` 缓冲区长度 to write.
|
||||
- `handle` 播放器句柄。
|
||||
- `data` 数据缓冲区地址。
|
||||
- `len` 要写入的数据长度(字节)。
|
||||
|
||||
**返回值**:
|
||||
|
||||
成功时返回发送的字节数,失败时返回负的错误码。
|
||||
成功时返回实际写入的字节数,失败时返回负的错误码。
|
||||
|
||||
|
||||
### media_player_get_sockaddr
|
||||
|
|
@ -142,8 +141,8 @@ int media_player_get_sockaddr(void* handle, struct sockaddr_storage* addr);
|
|||
|
||||
**参数**:
|
||||
|
||||
- `handle` 播放器句柄
|
||||
- `addr` Socket 地址信息。
|
||||
- `handle` 播放器句柄。
|
||||
- `addr` 用于存储 Socket 地址信息的输出参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -160,7 +159,7 @@ int media_player_get_socket(void* handle);
|
|||
|
||||
**参数**:
|
||||
|
||||
- `handle` 播放器句柄.
|
||||
- `handle` 播放器句柄。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -177,7 +176,7 @@ void media_player_close_socket(void* handle);
|
|||
|
||||
**参数**:
|
||||
|
||||
- `handle` 播放器句柄.
|
||||
- `handle` 播放器句柄。
|
||||
|
||||
|
||||
## 同步接口 - 播放控制
|
||||
|
|
@ -188,15 +187,15 @@ void media_player_close_socket(void* handle);
|
|||
int media_player_start(void* handle);
|
||||
```
|
||||
|
||||
开始/resume playing the re音频源。
|
||||
开始或恢复播放音频源。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 播放器句柄.
|
||||
- `handle` 播放器句柄。
|
||||
|
||||
**返回值**:
|
||||
|
||||
成功时返回 0,失败时返回负的错误码。
|
||||
成功时返回 `0`,失败时返回负的错误码。
|
||||
|
||||
|
||||
### media_player_stop
|
||||
|
|
@ -205,15 +204,15 @@ int media_player_start(void* handle);
|
|||
int media_player_stop(void* handle);
|
||||
```
|
||||
|
||||
停止 and clear the re音频源。
|
||||
停止播放并清除已准备的音频源。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 播放器句柄.
|
||||
- `handle` 播放器句柄。
|
||||
|
||||
**返回值**:
|
||||
|
||||
成功时返回 0,失败时返回负的错误码。
|
||||
成功时返回 `0`,失败时返回负的错误码。
|
||||
|
||||
|
||||
### media_player_pause
|
||||
|
|
@ -222,15 +221,15 @@ int media_player_stop(void* handle);
|
|||
int media_player_pause(void* handle);
|
||||
```
|
||||
|
||||
暂停。
|
||||
暂停播放。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 播放器句柄.
|
||||
- `handle` 播放器句柄。
|
||||
|
||||
**返回值**:
|
||||
|
||||
成功时返回 0,失败时返回负的错误码。
|
||||
成功时返回 `0`,失败时返回负的错误码。
|
||||
|
||||
|
||||
### media_player_seek
|
||||
|
|
@ -239,16 +238,16 @@ int media_player_pause(void* handle);
|
|||
int media_player_seek(void* handle, unsigned int position);
|
||||
```
|
||||
|
||||
跳转 to msec 位置 from begining。
|
||||
跳转到指定的播放位置。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 播放器句柄.
|
||||
- `position` 位置,单位为毫秒。
|
||||
- `handle` 播放器句柄。
|
||||
- `position` 目标位置,单位为毫秒,从起始位置计算。
|
||||
|
||||
**返回值**:
|
||||
|
||||
成功时返回 0,失败时返回负的错误码。
|
||||
成功时返回 `0`,失败时返回负的错误码。
|
||||
|
||||
|
||||
### media_player_set_looping
|
||||
|
|
@ -257,36 +256,35 @@ int media_player_seek(void* handle, unsigned int position);
|
|||
int media_player_set_looping(void* handle, int loop);
|
||||
```
|
||||
|
||||
设置 loop times。
|
||||
设置循环播放次数。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 播放器句柄.
|
||||
- `handle` 播放器句柄。
|
||||
- `loop` 循环次数,`-1` 表示无限循环。
|
||||
|
||||
|
||||
## 同步接口 - 状态查询
|
||||
|
||||
**返回值**:
|
||||
|
||||
成功时返回 `0`,失败时返回负的 errno。
|
||||
|
||||
|
||||
## 同步接口 - 状态查询
|
||||
|
||||
### media_player_is_playing
|
||||
|
||||
```c
|
||||
int media_player_is_playing(void* handle);
|
||||
```
|
||||
|
||||
检查 playing status。
|
||||
查询当前是否正在播放。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 播放器句柄.
|
||||
- `handle` 播放器句柄。
|
||||
|
||||
**返回值**:
|
||||
|
||||
int Positive on playing, zero on in活跃状态, negative on error。
|
||||
正在播放时返回正值,未播放时返回 `0`,出错时返回负的错误码。
|
||||
|
||||
|
||||
### media_player_get_position
|
||||
|
|
@ -295,12 +293,12 @@ int Positive on playing, zero on in活跃状态, negative on error。
|
|||
int media_player_get_position(void* handle, unsigned int* position);
|
||||
```
|
||||
|
||||
Gert current msec 位置 of re音频源。
|
||||
获取当前播放位置。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 播放器句柄.
|
||||
- `position` 位置,单位为毫秒。
|
||||
- `handle` 播放器句柄。
|
||||
- `position` 输出参数,当前播放位置,单位为毫秒。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -313,12 +311,12 @@ Gert current msec 位置 of re音频源。
|
|||
int media_player_get_duration(void* handle, unsigned int* duration);
|
||||
```
|
||||
|
||||
Gert msec 时长 of current re音频源。
|
||||
获取当前音频源的总时长。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 播放器句柄.
|
||||
- `duration` 位置,单位为毫秒。
|
||||
- `handle` 播放器句柄。
|
||||
- `duration` 输出参数,音频源总时长,单位为毫秒。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -331,37 +329,36 @@ Gert msec 时长 of current re音频源。
|
|||
int media_player_get_latency(void* handle, unsigned int* latency);
|
||||
```
|
||||
|
||||
Gert latency of current re音频源。
|
||||
获取当前音频源的播放延迟。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 播放器句柄.
|
||||
- `latency` 延迟帧数。
|
||||
|
||||
|
||||
## 同步接口 - 音量与属性
|
||||
- `handle` 播放器句柄。
|
||||
- `latency` 输出参数,延迟帧数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
成功时返回 `0`,失败时返回负的 errno。
|
||||
|
||||
|
||||
## 同步接口 - 音量与属性
|
||||
|
||||
### media_player_set_volume
|
||||
|
||||
```c
|
||||
int media_player_set_volume(void* handle, float volume);
|
||||
```
|
||||
|
||||
设置音量。
|
||||
设置播放音量。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 播放器句柄.
|
||||
- `handle` 播放器句柄。
|
||||
- `volume` 音量值,取值范围 `[0.0, 1.0]`。
|
||||
|
||||
**返回值**:
|
||||
|
||||
成功时返回 0,失败时返回负的错误码。
|
||||
成功时返回 `0`,失败时返回负的错误码。
|
||||
|
||||
|
||||
### media_player_get_volume
|
||||
|
|
@ -370,12 +367,12 @@ int media_player_set_volume(void* handle, float volume);
|
|||
int media_player_get_volume(void* handle, float* volume);
|
||||
```
|
||||
|
||||
获取音量。
|
||||
获取当前播放音量。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 播放器句柄.
|
||||
- `volume` 音量值,取值范围 `[0.0, 1.0]`。
|
||||
- `handle` 播放器句柄。
|
||||
- `volume` 输出参数,当前音量值,取值范围 `[0.0, 1.0]`。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -388,14 +385,14 @@ int media_player_get_volume(void* handle, float* volume);
|
|||
int media_player_set_property(void* handle, const char* target, const char* key, const char* value);
|
||||
```
|
||||
|
||||
设置 properties。
|
||||
设置播放器属性。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 播放器句柄。
|
||||
- `target` 目标 filter 名称。
|
||||
- `key` Key
|
||||
- `value` Value
|
||||
- `key` 属性键名。
|
||||
- `value` 属性值。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -408,44 +405,43 @@ int media_player_set_property(void* handle, const char* target, const char* key,
|
|||
int media_player_get_property(void* handle, const char* target, const char* key, char* value, int value_len);
|
||||
```
|
||||
|
||||
获取 properties。
|
||||
获取播放器属性。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 播放器句柄。
|
||||
- `target` 目标 filter 名称。
|
||||
- `key` Key
|
||||
- `value` 输出缓冲区。
|
||||
- `value_len` 缓冲区长度 of value
|
||||
|
||||
|
||||
## 异步接口(基于 libuv)
|
||||
|
||||
以下接口仅在启用 `CONFIG_LIBUV` 时可用,回调在 `uv_loop` 上执行,避免阻塞调用线程。
|
||||
- `key` 属性键名。
|
||||
- `value` 输出缓冲区,用于存储属性值。
|
||||
- `value_len` 输出缓冲区长度。
|
||||
|
||||
**返回值**:
|
||||
|
||||
成功时返回 `0`,失败时返回负的 errno。
|
||||
|
||||
|
||||
## 异步接口(基于 libuv)
|
||||
|
||||
以下接口仅在启用 `CONFIG_LIBUV` 时可用,回调在 `uv_loop` 上执行,避免阻塞调用线程。
|
||||
|
||||
### media_uv_player_open
|
||||
|
||||
```c
|
||||
void* media_uv_player_open(void* loop, const char* stream, media_uv_callback on_open, void* cookie);
|
||||
```
|
||||
|
||||
打开 an async player with given 流 type。
|
||||
打开异步播放器。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `loop` 当前线程的 `uv_loop_t*` 事件循环句柄。
|
||||
- `stream` 流类型常量。 . 不同流类型有不同的路由逻辑.
|
||||
- `stream` 流类型常量,不同流类型有不同的路由逻辑。
|
||||
- `on_open` 打开完成后触发的回调函数。
|
||||
- `cookie` 回调上下文,供 `on_open`、`on_event`、`on_connection`、`on_close` 共用。
|
||||
|
||||
**返回值**:
|
||||
|
||||
void* Handle of player, 失败时返回 NULL。
|
||||
成功时返回播放器句柄,失败时返回 `NULL`。
|
||||
|
||||
|
||||
### media_uv_player_listen
|
||||
|
|
@ -454,7 +450,7 @@ void* Handle of player, 失败时返回 NULL。
|
|||
int media_uv_player_listen(void* handle, media_event_callback on_event);
|
||||
```
|
||||
|
||||
Listen to status change 事件 by setting 回调。
|
||||
注册事件监听回调,接收播放状态变化通知。
|
||||
|
||||
**参数**:
|
||||
|
||||
|
|
@ -472,17 +468,17 @@ Listen to status change 事件 by setting 回调。
|
|||
int media_uv_player_close(void* handle, int pending, media_uv_callback on_close);
|
||||
```
|
||||
|
||||
关闭 the async player。
|
||||
关闭异步播放器。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 异步播放器句柄。
|
||||
- `pending` 是否以 pending 方式关闭。
|
||||
- `pending` 是否以 pending 方式关闭(等待当前播放完成)。
|
||||
- `on_close` 资源释放完成后触发的回调函数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
成功时返回 0,无效句柄时返回负的错误码。
|
||||
成功时返回 `0`,无效句柄时返回负的错误码。
|
||||
|
||||
|
||||
### media_uv_player_prepare
|
||||
|
|
@ -491,7 +487,7 @@ int media_uv_player_close(void* handle, int pending, media_uv_callback on_close)
|
|||
int media_uv_player_prepare(void* handle, const char* url, const char* options, media_uv_object_callback on_connection, media_uv_callback on_prepare, void* cookie);
|
||||
```
|
||||
|
||||
准备 re音频源 for playing。
|
||||
准备音频源以供播放。
|
||||
|
||||
**参数**:
|
||||
|
||||
|
|
@ -499,12 +495,12 @@ int media_uv_player_prepare(void* handle, const char* url, const char* options,
|
|||
- `url` 资源路径,支持两种模式:1. URL 模式:`url` 为本地文件路径或网络地址,框架会读取并播放;2. BUFFER 模式:`url` 为 `NULL`,调用方需通过 `media_player_write_data()` 或 `media_player_get_socket()` + `write()` 持续推送数据。
|
||||
- `options` 资源的额外配置参数,通常为描述资源格式的键值对(例如 `"format=s16le,sample_rate=44100,channels=2"`)。
|
||||
- `on_connection` BUFFER 模式下接收 `uv_pipe_t` 的回调函数。
|
||||
- `on_prepare` 结果回调函数。
|
||||
- `cookie` 回调参数 for `on_prepare`.
|
||||
- `on_prepare` 准备完成后的结果回调函数。
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
成功时返回 0,失败时返回负的错误码。
|
||||
成功时返回 `0`,失败时返回负的错误码。
|
||||
|
||||
|
||||
### media_uv_player_reset
|
||||
|
|
@ -513,13 +509,13 @@ int media_uv_player_prepare(void* handle, const char* url, const char* options,
|
|||
int media_uv_player_reset(void* handle, media_uv_callback on_reset, void* cookie);
|
||||
```
|
||||
|
||||
重置 player。
|
||||
重置播放器到初始状态。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 异步播放器句柄。
|
||||
- `on_reset` 结果回调函数。
|
||||
- `cookie` 回调参数 for `on_reset`.
|
||||
- `on_reset` 重置完成后的结果回调函数。
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -532,14 +528,14 @@ int media_uv_player_reset(void* handle, media_uv_callback on_reset, void* cookie
|
|||
int media_uv_player_start_auto(void* handle, const char* scenario, media_uv_callback on_start, void* cookie);
|
||||
```
|
||||
|
||||
Play or resume the prepared 音频源 with auto 焦点 request。
|
||||
播放或恢复已准备的音频源,并自动请求音频焦点。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 异步播放器句柄。
|
||||
- `scenario` 场景常量,不同场景对应不同的焦点优先级。
|
||||
- `on_play` 结果确认回调(用于 request/start 操作)。
|
||||
- `cookie` 回调参数 for `on_play`.
|
||||
- `on_start` 播放开始后的结果回调函数。
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -557,8 +553,8 @@ int media_uv_player_start(void* handle, media_uv_callback on_start, void* cookie
|
|||
**参数**:
|
||||
|
||||
- `handle` 异步播放器句柄。
|
||||
- `on_start` 结果回调函数。
|
||||
- `cookie` 回调参数 for `on_start`.
|
||||
- `on_start` 播放开始后的结果回调函数。
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -571,13 +567,13 @@ int media_uv_player_start(void* handle, media_uv_callback on_start, void* cookie
|
|||
int media_uv_player_pause(void* handle, media_uv_callback on_pause, void* cookie);
|
||||
```
|
||||
|
||||
暂停 the playing。
|
||||
暂停播放。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 异步播放器句柄。
|
||||
- `on_pause` 结果回调函数。
|
||||
- `cookie` 回调参数 for `on_pause`.
|
||||
- `on_pause` 暂停完成后的结果回调函数。
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -590,13 +586,13 @@ int media_uv_player_pause(void* handle, media_uv_callback on_pause, void* cookie
|
|||
int media_uv_player_stop(void* handle, media_uv_callback on_stop, void* cookie);
|
||||
```
|
||||
|
||||
停止 the playing, clear the prepared re音频源 file。
|
||||
停止播放并清除已准备的音频源。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 异步播放器句柄。
|
||||
- `on_stop` 结果回调函数。
|
||||
- `cookie` 回调参数 for `on_stop`.
|
||||
- `on_stop` 停止完成后的结果回调函数。
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -609,18 +605,18 @@ int media_uv_player_stop(void* handle, media_uv_callback on_stop, void* cookie);
|
|||
int media_uv_player_set_volume(void* handle, float volume, media_uv_callback on_volume, void* cookie);
|
||||
```
|
||||
|
||||
设置 player 音量。
|
||||
设置播放音量。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 异步播放器句柄。
|
||||
- `volume` Volume in [0.0, 1.0].
|
||||
- `on_volume` 结果回调函数。
|
||||
- `cookie` 回调参数 for `on_volume`.
|
||||
- `volume` 音量值,取值范围 `[0.0, 1.0]`。
|
||||
- `on_volume` 设置完成后的结果回调函数。
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
成功时返回 0,失败时返回负的错误码。
|
||||
成功时返回 `0`,失败时返回负的错误码。
|
||||
|
||||
|
||||
### media_uv_player_get_volume
|
||||
|
|
@ -629,14 +625,13 @@ int media_uv_player_set_volume(void* handle, float volume, media_uv_callback on_
|
|||
int media_uv_player_get_volume(void* handle, media_uv_float_callback on_volume, void* cookie);
|
||||
```
|
||||
|
||||
获取 播放器 handle 音量。
|
||||
获取当前播放音量。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 异步播放器句柄。
|
||||
- `volume` 音量值,取值范围 `0.0 - 1.0`。
|
||||
- `on_volume` 结果回调函数。
|
||||
- `cookie` 回调参数 for `on_volume`.
|
||||
- `on_volume` 结果回调函数,回调参数为当前音量值(范围 `0.0 - 1.0`)。
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -649,13 +644,13 @@ int media_uv_player_get_volume(void* handle, media_uv_float_callback on_volume,
|
|||
int media_uv_player_get_playing(void* handle, media_uv_int_callback on_playing, void* cookie);
|
||||
```
|
||||
|
||||
获取 current playing status。
|
||||
获取当前播放状态。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 异步播放器句柄。
|
||||
- `on_playing` 结果回调函数。
|
||||
- `cookie` 回调参数 for `on_playing`.
|
||||
- `on_playing` 结果回调函数,回调参数为播放状态。
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -668,13 +663,13 @@ int media_uv_player_get_playing(void* handle, media_uv_int_callback on_playing,
|
|||
int media_uv_player_get_position(void* handle, media_uv_unsigned_callback on_position, void* cookie);
|
||||
```
|
||||
|
||||
获取 current playing 位置。
|
||||
获取当前播放位置。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 异步播放器句柄。
|
||||
- `on_position` 结果回调函数。
|
||||
- `cookie` 回调参数 for `on_position`.
|
||||
- `on_position` 结果回调函数,回调参数为当前位置(毫秒)。
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -687,13 +682,13 @@ int media_uv_player_get_position(void* handle, media_uv_unsigned_callback on_pos
|
|||
int media_uv_player_get_duration(void* handle, media_uv_unsigned_callback on_duration, void* cookie);
|
||||
```
|
||||
|
||||
获取 时长 of current playing re音频源。
|
||||
获取当前音频源的总时长。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 异步播放器句柄。
|
||||
- `on_duration` 结果回调函数。
|
||||
- `cookie` 回调参数 for `on_duration`.
|
||||
- `on_duration` 结果回调函数,回调参数为总时长(毫秒)。
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -706,13 +701,13 @@ int media_uv_player_get_duration(void* handle, media_uv_unsigned_callback on_dur
|
|||
int media_uv_player_get_latency(void* handle, media_uv_unsigned_callback cb, void* cookie);
|
||||
```
|
||||
|
||||
获取 latency of current playing re音频源。
|
||||
获取当前音频源的播放延迟。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 异步播放器句柄。
|
||||
- `cb` 结果回调函数。
|
||||
- `cookie` 回调参数 for `on_latency`.
|
||||
- `cb` 结果回调函数,回调参数为延迟帧数。
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -725,14 +720,14 @@ int media_uv_player_get_latency(void* handle, media_uv_unsigned_callback cb, voi
|
|||
int media_uv_player_set_looping(void* handle, int loop, media_uv_callback on_looping, void* cookie);
|
||||
```
|
||||
|
||||
设置 the loop times。
|
||||
设置循环播放次数。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 异步播放器句柄。
|
||||
- `loop` 循环次数,`-1` 表示无限循环。
|
||||
- `on_looping` 结果回调函数。
|
||||
- `cookie` 回调参数 for `on_looping`.
|
||||
- `on_looping` 设置完成后的结果回调函数。
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -745,14 +740,14 @@ int media_uv_player_set_looping(void* handle, int loop, media_uv_callback on_loo
|
|||
int media_uv_player_seek(void* handle, unsigned int position, media_uv_callback on_seek, void* cookie);
|
||||
```
|
||||
|
||||
跳转 to msec 位置 from begining。
|
||||
跳转到指定的播放位置。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 异步播放器句柄。
|
||||
- `position` 起始位置,单位为毫秒。
|
||||
- `on_seek` 结果回调函数。
|
||||
- `cookie` 回调参数 for `on_seek`.
|
||||
- `position` 目标位置,单位为毫秒,从起始位置计算。
|
||||
- `on_seek` 跳转完成后的结果回调函数。
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -765,16 +760,16 @@ int media_uv_player_seek(void* handle, unsigned int position, media_uv_callback
|
|||
int media_uv_player_set_property(void* handle, const char* target, const char* key, const char* value, media_uv_callback on_setprop, void* cookie);
|
||||
```
|
||||
|
||||
设置 properties of 播放器 handle。
|
||||
设置播放器属性。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 异步播放器句柄。
|
||||
- `target` 目标 filter 名称。
|
||||
- `key` Key
|
||||
- `value` Value
|
||||
- `on_setprop` 结果回调函数。
|
||||
- `cookie` 回调参数 for `on_setprop`.
|
||||
- `key` 属性键名。
|
||||
- `value` 属性值。
|
||||
- `on_setprop` 设置完成后的结果回调函数。
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -787,15 +782,15 @@ int media_uv_player_set_property(void* handle, const char* target, const char* k
|
|||
int media_uv_player_get_property(void* handle, const char* target, const char* key, media_uv_string_callback on_getprop, void* cookie);
|
||||
```
|
||||
|
||||
获取 properties of 播放器 handle。
|
||||
获取播放器属性。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 异步播放器句柄。
|
||||
- `target` 目标 filter 名称。
|
||||
- `key` Key
|
||||
- `on_getprop` 结果回调函数。
|
||||
- `cookie` 回调参数 for `on_getprop`.
|
||||
- `key` 属性键名。
|
||||
- `on_getprop` 结果回调函数,回调参数为属性值字符串。
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -808,17 +803,17 @@ int media_uv_player_get_property(void* handle, const char* target, const char* k
|
|||
int media_uv_player_query(void* handle, media_uv_object_callback on_query, void* cookie);
|
||||
```
|
||||
|
||||
Query 元数据 of 播放器 handle。
|
||||
查询播放器元数据。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 异步播放器句柄。
|
||||
- `on_query` 接收元数据指针的回调函数。
|
||||
- `cookie` 回调参数 for `on_query`.
|
||||
- `on_query` 结果回调函数,回调参数为元数据指针。
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
成功时返回 0,失败时返回负的错误码。
|
||||
成功时返回 `0`,失败时返回负的错误码。
|
||||
|
||||
|
||||
### media_uv_player_close_socket
|
||||
|
|
@ -831,8 +826,8 @@ int media_uv_player_close_socket(void* handle);
|
|||
|
||||
**参数**:
|
||||
|
||||
- `handle` 播放器句柄.
|
||||
- `handle` 播放器句柄。
|
||||
|
||||
**返回值**:
|
||||
|
||||
成功时返回 0,失败时返回负的错误码。
|
||||
成功时返回 `0`,失败时返回负的错误码。
|
||||
|
|
|
|||
|
|
@ -48,16 +48,12 @@ int media_policy_get_audio_mode(char* mode, int len);
|
|||
|
||||
**参数**:
|
||||
|
||||
- `mode` 缓冲区地址.
|
||||
- `len` 缓冲区长度.
|
||||
- `mode` 输出缓冲区。
|
||||
- `len` 缓冲区长度。
|
||||
|
||||
|
||||
## 同步接口 - 设备使用
|
||||
|
||||
**返回值**:
|
||||
|
||||
成功时返回 `0`,失败时返回负的 errno。
|
||||
|
||||
|
||||
### media_policy_set_devices_use
|
||||
|
||||
|
|
@ -69,7 +65,7 @@ int media_policy_set_devices_use(const char* devices);
|
|||
|
||||
**参数**:
|
||||
|
||||
- `devices` 设备常量, 支持多设备,用 "|" 分隔.
|
||||
- `devices` 设备常量,支持多设备,用 "|" 分隔。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -86,7 +82,7 @@ int media_policy_set_devices_unuse(const char* devices);
|
|||
|
||||
**参数**:
|
||||
|
||||
- `devices` 设备常量, 支持多设备,用 "|" 分隔.
|
||||
- `devices` 设备常量,支持多设备,用 "|" 分隔。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -104,7 +100,7 @@ int media_policy_get_devices_use(char* devices, int len);
|
|||
**参数**:
|
||||
|
||||
- `devices` 设备名称字符串,多个设备用 `|` 分隔(例如 `"sco"`、`"sco|mic"`、`"<none>"`)。
|
||||
- `len` 缓冲区长度.
|
||||
- `len` 缓冲区长度。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -121,16 +117,12 @@ int media_policy_is_devices_use(const char* devices, int* use);
|
|||
|
||||
**参数**:
|
||||
|
||||
- `devices` 设备常量, 支持多设备,用 "|" 分隔.
|
||||
- `devices` 设备常量,支持多设备,用 "|" 分隔。
|
||||
- `use` 设备使用状态:0 表示所有设备均未使用,1 表示至少有一个设备正在使用。
|
||||
|
||||
|
||||
## 同步接口 - HFP 采样率与设备可用性
|
||||
|
||||
**返回值**:
|
||||
|
||||
成功时返回 `0`,失败时返回负的 errno。
|
||||
|
||||
|
||||
### media_policy_set_hfp_samplerate
|
||||
|
||||
|
|
@ -138,7 +130,7 @@ int media_policy_is_devices_use(const char* devices, int* use);
|
|||
int media_policy_set_hfp_samplerate(int rate);
|
||||
```
|
||||
|
||||
设置 HFP 蓝牙通话采样率. * HFP (Hand Free Profile) is based on bt-sco, the samplerate is uncertain before negotiation is done。
|
||||
设置 HFP 蓝牙通话采样率。HFP(Hands-Free Profile)基于 BT-SCO 传输,采样率在协商完成前不确定。
|
||||
|
||||
**参数**:
|
||||
|
||||
|
|
@ -159,7 +151,7 @@ int media_policy_set_devices_available(const char* devices);
|
|||
|
||||
**参数**:
|
||||
|
||||
- `devices` 设备常量, 支持多设备,用 "|" 分隔.
|
||||
- `devices` 设备常量,支持多设备,用 "|" 分隔。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -176,7 +168,7 @@ int media_policy_set_devices_unavailable(const char* devices);
|
|||
|
||||
**参数**:
|
||||
|
||||
- `devices` 设备常量, 支持多设备,用 "|" 分隔.
|
||||
- `devices` 设备常量,支持多设备,用 "|" 分隔。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -189,7 +181,7 @@ int media_policy_set_devices_unavailable(const char* devices);
|
|||
int media_policy_get_devices_available(char* devices, int len);
|
||||
```
|
||||
|
||||
获取 current 可用 设备s。
|
||||
获取当前可用设备。
|
||||
|
||||
**参数**:
|
||||
|
||||
|
|
@ -207,21 +199,16 @@ int media_policy_get_devices_available(char* devices, int len);
|
|||
int media_policy_is_devices_available(const char* devices, int* available);
|
||||
```
|
||||
|
||||
检查 whether 设备s are 可用。
|
||||
检查指定设备是否可用。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `devices` 待检查的设备,取值为 `MEDIA_DEVICE_*` 常量。
|
||||
设备 names are separated by "|"。
|
||||
- `devices` 待检查的设备,取值为 `MEDIA_DEVICE_*` 常量,多个设备用 `|` 分隔。
|
||||
- `available` 设备可用性状态:0 表示所有设备均不可用,1 表示至少有一个设备可用。
|
||||
|
||||
|
||||
## 同步接口 - 静音控制
|
||||
|
||||
**返回值**:
|
||||
|
||||
成功时返回 `0`,失败时返回负的 errno。
|
||||
|
||||
|
||||
### media_policy_set_mute_mode
|
||||
|
||||
|
|
@ -229,7 +216,7 @@ int media_policy_is_devices_available(const char* devices, int* available);
|
|||
int media_policy_set_mute_mode(int mute);
|
||||
```
|
||||
|
||||
设置 静音 mode。
|
||||
设置静音模式。
|
||||
|
||||
**参数**:
|
||||
|
||||
|
|
@ -246,7 +233,7 @@ int media_policy_set_mute_mode(int mute);
|
|||
int media_policy_get_mute_mode(int* mute);
|
||||
```
|
||||
|
||||
获取 静音 mode。
|
||||
获取当前静音模式。
|
||||
|
||||
**参数**:
|
||||
|
||||
|
|
@ -255,10 +242,6 @@ int media_policy_get_mute_mode(int* mute);
|
|||
|
||||
## 同步接口 - 音量控制
|
||||
|
||||
**返回值**:
|
||||
|
||||
成功时返回 `0`,失败时返回负的 errno。
|
||||
|
||||
|
||||
### media_policy_set_stream_volume
|
||||
|
||||
|
|
@ -266,11 +249,11 @@ int media_policy_get_mute_mode(int* mute);
|
|||
int media_policy_set_stream_volume(const char* stream, int volume);
|
||||
```
|
||||
|
||||
设置 流 type 音量 index。
|
||||
设置指定流类型的音量档位。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `stream` MEDIA_STREAM_XXX.
|
||||
- `stream` 流类型常量(`MEDIA_STREAM_*`)。
|
||||
- `volume` 新的音量档位。
|
||||
|
||||
**返回值**:
|
||||
|
|
@ -284,11 +267,11 @@ int media_policy_set_stream_volume(const char* stream, int volume);
|
|||
int media_policy_get_stream_volume(const char* stream, int* volume);
|
||||
```
|
||||
|
||||
获取 流 type 音量 index。
|
||||
获取指定流类型的音量档位。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `stream` MEDIA_STREAM_XXX.
|
||||
- `stream` 流类型常量(`MEDIA_STREAM_*`)。
|
||||
- `volume` 当前音量档位。
|
||||
|
||||
**返回值**:
|
||||
|
|
@ -302,11 +285,11 @@ int media_policy_get_stream_volume(const char* stream, int* volume);
|
|||
int media_policy_increase_stream_volume(const char* stream);
|
||||
```
|
||||
|
||||
Increase 流 type 音量 index by 1。
|
||||
将指定流类型的音量档位加 1。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `stream` MEDIA_STREAM_XXX.
|
||||
- `stream` 流类型常量(`MEDIA_STREAM_*`)。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -319,19 +302,15 @@ Increase 流 type 音量 index by 1。
|
|||
int media_policy_decrease_stream_volume(const char* stream);
|
||||
```
|
||||
|
||||
Decrease 流 type 音量 index by 1。
|
||||
将指定流类型的音量档位减 1。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `stream` MEDIA_STREAM_XXX.
|
||||
- `stream` 流类型常量(`MEDIA_STREAM_*`)。
|
||||
|
||||
|
||||
## 同步接口 - 麦克风静音
|
||||
|
||||
**返回值**:
|
||||
|
||||
成功时返回 `0`,失败时返回负的 errno。
|
||||
|
||||
|
||||
### media_policy_set_mic_mute
|
||||
|
||||
|
|
@ -348,10 +327,6 @@ int media_policy_set_mic_mute(int mute);
|
|||
|
||||
## 同步接口 - 通用参数读写
|
||||
|
||||
**返回值**:
|
||||
|
||||
成功时返回 `0`,失败时返回负的 errno。
|
||||
|
||||
|
||||
### media_policy_set_int
|
||||
|
||||
|
|
@ -359,7 +334,7 @@ int media_policy_set_mic_mute(int mute);
|
|||
int media_policy_set_int(const char* name, int value, int apply);
|
||||
```
|
||||
|
||||
设置 numerical value to 策略条件。
|
||||
设置策略条件的数值。
|
||||
|
||||
**参数**:
|
||||
|
||||
|
|
@ -378,7 +353,7 @@ int media_policy_set_int(const char* name, int value, int apply);
|
|||
int media_policy_get_int(const char* name, int* value);
|
||||
```
|
||||
|
||||
获取 numerical value of 策略条件。
|
||||
获取策略条件的数值。
|
||||
|
||||
**参数**:
|
||||
|
||||
|
|
@ -396,7 +371,7 @@ int media_policy_get_int(const char* name, int* value);
|
|||
int media_policy_get_range(const char* name, int* min_value, int* max_value);
|
||||
```
|
||||
|
||||
获取 numerical value range of 策略条件。
|
||||
获取策略条件的数值范围。
|
||||
|
||||
**参数**:
|
||||
|
||||
|
|
@ -415,7 +390,7 @@ int media_policy_get_range(const char* name, int* min_value, int* max_value);
|
|||
int media_policy_set_string(const char* name, const char* value, int apply);
|
||||
```
|
||||
|
||||
设置 literal value to 策略条件。
|
||||
设置策略条件的字符串值。
|
||||
|
||||
**参数**:
|
||||
|
||||
|
|
@ -434,13 +409,13 @@ int media_policy_set_string(const char* name, const char* value, int apply);
|
|||
int media_policy_get_string(const char* name, char* value, int len);
|
||||
```
|
||||
|
||||
获取 literal value from 策略条件。
|
||||
获取策略条件的字符串值。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `name` 准则名称。
|
||||
- `value` 缓冲区地址.
|
||||
- `len` 缓冲区长度.
|
||||
- `value` 输出缓冲区。
|
||||
- `len` 缓冲区长度。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -491,7 +466,7 @@ int media_policy_exclude(const char* name, const char* values, int apply);
|
|||
int media_policy_contain(const char* name, const char* values, int* result);
|
||||
```
|
||||
|
||||
检查 whether literal values included in InclusiveCriterion。
|
||||
检查字面值是否包含在包含型条件中。
|
||||
|
||||
**参数**:
|
||||
|
||||
|
|
@ -548,7 +523,7 @@ int media_policy_decrease(const char* name, int apply);
|
|||
void* media_policy_subscribe(const char* name, media_policy_change_callback on_change, void* cookie);
|
||||
```
|
||||
|
||||
Subscribe 策略条件 on change。
|
||||
订阅策略条件变化事件。
|
||||
|
||||
**参数**:
|
||||
|
||||
|
|
@ -566,7 +541,7 @@ Subscribe 策略条件 on change。
|
|||
int media_policy_unsubscribe(void* handle);
|
||||
```
|
||||
|
||||
Unubscribe 策略条件 on change。
|
||||
取消订阅策略条件变化事件。
|
||||
|
||||
**参数**:
|
||||
|
||||
|
|
@ -578,10 +553,6 @@ Unubscribe 策略条件 on change。
|
|||
|
||||
以下接口仅在启用 `CONFIG_LIBUV` 时可用。
|
||||
|
||||
**返回值**:
|
||||
|
||||
成功时返回 `0`,失败时返回负的 errno。
|
||||
|
||||
|
||||
### media_uv_policy_set_int
|
||||
|
||||
|
|
@ -589,7 +560,7 @@ Unubscribe 策略条件 on change。
|
|||
int media_uv_policy_set_int(void* loop, const char* name, int value, int apply, media_uv_callback cb, void* cookie);
|
||||
```
|
||||
|
||||
设置 numerical value to a 策略条件。
|
||||
设置策略条件的数值。
|
||||
|
||||
**参数**:
|
||||
|
||||
|
|
@ -598,7 +569,7 @@ int media_uv_policy_set_int(void* loop, const char* name, int value, int apply,
|
|||
- `value` 要设置的数值。
|
||||
- `apply` 是否将新值应用到策略配置。
|
||||
- `cb` 结果回调函数。
|
||||
- `cookie` 回调参数.
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -611,14 +582,14 @@ int media_uv_policy_set_int(void* loop, const char* name, int value, int apply,
|
|||
int media_uv_policy_get_int(void* loop, const char* name, media_uv_int_callback cb, void* cookie);
|
||||
```
|
||||
|
||||
获取 numerical value of a 策略条件。
|
||||
获取策略条件的数值。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `loop` 当前线程的 `uv_loop_t*` 事件循环句柄。
|
||||
- `name` 准则名称。
|
||||
- `cb` 结果回调函数。
|
||||
- `cookie` 回调参数.
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -631,7 +602,7 @@ int media_uv_policy_get_int(void* loop, const char* name, media_uv_int_callback
|
|||
int media_uv_policy_increase(void* loop, const char* name, int apply, media_uv_callback cb, void* cookie);
|
||||
```
|
||||
|
||||
Increase numerical value of a 策略条件 by one。
|
||||
将策略条件的数值加 1。
|
||||
|
||||
**参数**:
|
||||
|
||||
|
|
@ -639,7 +610,7 @@ Increase numerical value of a 策略条件 by one。
|
|||
- `name` 准则名称。
|
||||
- `apply` 是否将新值应用到策略配置。
|
||||
- `cb` 结果回调函数。
|
||||
- `cookie` 回调参数.
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -652,7 +623,7 @@ Increase numerical value of a 策略条件 by one。
|
|||
int media_uv_policy_set_string(void* loop, const char* name, const char* value, int apply, media_uv_callback cb, void* cookie);
|
||||
```
|
||||
|
||||
设置 literal value to a 策略条件。
|
||||
设置策略条件的字符串值。
|
||||
|
||||
**参数**:
|
||||
|
||||
|
|
@ -661,7 +632,7 @@ int media_uv_policy_set_string(void* loop, const char* name, const char* value,
|
|||
- `value` 要设置的字符串值。
|
||||
- `apply` 是否将新值应用到策略配置。
|
||||
- `cb` 结果回调函数。
|
||||
- `cookie` 回调参数.
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -674,14 +645,14 @@ int media_uv_policy_set_string(void* loop, const char* name, const char* value,
|
|||
int media_uv_policy_get_string(void* loop, const char* name, media_uv_string_callback cb, void* cookie);
|
||||
```
|
||||
|
||||
获取 literal value of a 策略条件。
|
||||
获取策略条件的字符串值。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `loop` 当前线程的 `uv_loop_t*` 事件循环句柄。
|
||||
- `name` 准则名称。
|
||||
- `cb` 结果回调函数。
|
||||
- `cookie` 回调参数.
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -694,7 +665,7 @@ int media_uv_policy_get_string(void* loop, const char* name, media_uv_string_cal
|
|||
int media_uv_policy_decrease(void* loop, const char* name, int apply, media_uv_callback cb, void* cookie);
|
||||
```
|
||||
|
||||
Decrease numerical value of a 策略条件 by one。
|
||||
将策略条件的数值减 1。
|
||||
|
||||
**参数**:
|
||||
|
||||
|
|
@ -702,7 +673,7 @@ Decrease numerical value of a 策略条件 by one。
|
|||
- `name` 准则名称。
|
||||
- `apply` 是否将新值应用到策略配置。
|
||||
- `cb` 结果回调函数。
|
||||
- `cookie` 回调参数.
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -721,10 +692,10 @@ int media_uv_policy_include(void* loop, const char* name, const char* value, int
|
|||
|
||||
- `loop` 当前线程的 `uv_loop_t*` 事件循环句柄。
|
||||
- `name` 准则名称。
|
||||
- `value` 字符串值数组。.
|
||||
- `value` 字符串值数组。
|
||||
- `apply` 是否将新值应用到策略配置。
|
||||
- `cb` 结果回调函数。
|
||||
- `cookie` 回调参数.
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -743,10 +714,10 @@ int media_uv_policy_exclude(void* loop, const char* name, const char* value, int
|
|||
|
||||
- `loop` 当前线程的 `uv_loop_t*` 事件循环句柄。
|
||||
- `name` 准则名称。
|
||||
- `value` 字符串值数组。.
|
||||
- `value` 字符串值数组。
|
||||
- `apply` 是否将新值应用到策略配置。
|
||||
- `cb` 结果回调函数。
|
||||
- `cookie` 回调参数.
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -759,15 +730,15 @@ int media_uv_policy_exclude(void* loop, const char* name, const char* value, int
|
|||
int media_uv_policy_contain(void* loop, const char* name, const char* value, media_uv_int_callback cb, void* cookie);
|
||||
```
|
||||
|
||||
检查 whether literal values included in InclusiveCriterion。
|
||||
检查字面值是否包含在包含型条件中。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `loop` 当前线程的 `uv_loop_t*` 事件循环句柄。
|
||||
- `name` 准则名称。
|
||||
- `value` 字符串值数组。.
|
||||
- `value` 字符串值数组。
|
||||
- `cb` 结果回调函数。
|
||||
- `cookie` 回调参数.
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -780,7 +751,7 @@ int media_uv_policy_contain(void* loop, const char* name, const char* value, med
|
|||
int media_uv_policy_set_stream_volume(void* loop, const char* stream, int volume, media_uv_callback cb, void* cookie);
|
||||
```
|
||||
|
||||
设置 音量 of a 流 type。
|
||||
设置指定流类型的音量。
|
||||
|
||||
**参数**:
|
||||
|
||||
|
|
@ -788,7 +759,7 @@ int media_uv_policy_set_stream_volume(void* loop, const char* stream, int volume
|
|||
- `stream` 流类型,取值为流类型常量。
|
||||
- `volume` 要设置的音量档位。
|
||||
- `cb` 结果回调函数。
|
||||
- `cookie` 回调参数.
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -801,7 +772,7 @@ int media_uv_policy_set_stream_volume(void* loop, const char* stream, int volume
|
|||
int media_uv_policy_get_stream_volume(void* loop, const char* stream, media_uv_int_callback cb, void* cookie);
|
||||
```
|
||||
|
||||
获取 音量 of a 流 type。
|
||||
获取指定流类型的音量。
|
||||
|
||||
**参数**:
|
||||
|
||||
|
|
@ -809,7 +780,7 @@ int media_uv_policy_get_stream_volume(void* loop, const char* stream, media_uv_i
|
|||
- `stream` 流类型,取值为流类型常量。
|
||||
- `volume` 要设置的音量档位。
|
||||
- `cb` 结果回调函数。
|
||||
- `cookie` 回调参数.
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -822,14 +793,14 @@ int media_uv_policy_get_stream_volume(void* loop, const char* stream, media_uv_i
|
|||
int media_uv_policy_increase_stream_volume(void* loop, const char* stream, media_uv_callback cb, void* cookie);
|
||||
```
|
||||
|
||||
Increase 音量 of a 流 type。
|
||||
将指定流类型的音量加 1。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `loop` 当前线程的 `uv_loop_t*` 事件循环句柄。
|
||||
- `stream` 流类型,取值为流类型常量。
|
||||
- `cb` 结果回调函数。
|
||||
- `cookie` 回调参数.
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -842,14 +813,14 @@ Increase 音量 of a 流 type。
|
|||
int media_uv_policy_decrease_stream_volume(void* loop, const char* stream, media_uv_callback cb, void* cookie);
|
||||
```
|
||||
|
||||
Decrease 音量 of a 流 type。
|
||||
将指定流类型的音量减 1。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `loop` 当前线程的 `uv_loop_t*` 事件循环句柄。
|
||||
- `stream` 流类型,取值为流类型常量。
|
||||
- `cb` 结果回调函数。
|
||||
- `cookie` 回调参数.
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -869,7 +840,7 @@ int media_uv_policy_set_audio_mode(void* loop, const char* mode, media_uv_callba
|
|||
- `loop` 当前线程的 `uv_loop_t*` 事件循环句柄。
|
||||
- `mode` 新的音频模式。
|
||||
- `cb` 结果回调函数。
|
||||
- `cookie` 回调参数.
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -888,7 +859,7 @@ int media_uv_policy_get_audio_mode(void* loop, media_uv_string_callback cb, void
|
|||
|
||||
- `loop` 当前线程的 `uv_loop_t*` 事件循环句柄。
|
||||
- `cb` 结果回调函数。
|
||||
- `cookie` 回调参数.
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -901,7 +872,7 @@ int media_uv_policy_get_audio_mode(void* loop, media_uv_string_callback cb, void
|
|||
int media_uv_policy_set_devices_use(void* loop, const char* devices, bool use, media_uv_callback cb, void* cookie);
|
||||
```
|
||||
|
||||
Force use/unuse 设备s (or protocols)。
|
||||
强制使用或取消使用指定设备(或协议)。
|
||||
|
||||
**参数**:
|
||||
|
||||
|
|
@ -909,7 +880,7 @@ Force use/unuse 设备s (or protocols)。
|
|||
- `devices` 目标设备。
|
||||
- `use` 将设备设置为使用或未使用状态。
|
||||
- `cb` 结果回调函数。
|
||||
- `cookie` 回调参数.
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -922,13 +893,13 @@ Force use/unuse 设备s (or protocols)。
|
|||
int media_uv_policy_get_devices_use(void* loop, media_uv_string_callback cb, void* cookie);
|
||||
```
|
||||
|
||||
获取 current force-use 设备s。
|
||||
获取当前强制使用的设备。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `loop` 当前线程的 `uv_loop_t*` 事件循环句柄。
|
||||
- `cb` 结果回调函数。
|
||||
- `cookie` 回调参数.
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -941,14 +912,14 @@ int media_uv_policy_get_devices_use(void* loop, media_uv_string_callback cb, voi
|
|||
int media_uv_policy_is_devices_use(void* loop, const char* devices, media_uv_int_callback cb, void* cookie);
|
||||
```
|
||||
|
||||
检查 whether 设备s are being used。
|
||||
检查指定设备是否正在被使用。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `loop` 当前线程的 `uv_loop_t*` 事件循环句柄。
|
||||
- `devices` 待检查的设备。
|
||||
- `cb` 结果回调函数。
|
||||
- `cookie` 回调参数.
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -961,19 +932,23 @@ int media_uv_policy_is_devices_use(void* loop, const char* devices, media_uv_int
|
|||
int media_uv_policy_set_hfp_samplerate(void* loop, int rate, media_uv_callback cb, void* cookie);
|
||||
```
|
||||
|
||||
设置 hfp(hands free protocol) sampling rate。
|
||||
设置 HFP(Hands-Free Profile)采样率。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `loop` 当前线程的 `uv_loop_t*` 事件循环句柄。
|
||||
- `rate` 采样率,CVSD 编码取 8000,mSBC 编码取 16000。
|
||||
- `cb` 结果回调函数。
|
||||
- `cookie` 回调参数.
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
成功时返回 0,失败时返回负的错误码。
|
||||
|
||||
**注意**:
|
||||
|
||||
- 此接口已废弃,`rate` 参数将来会改为 `int` 类型。
|
||||
|
||||
|
||||
### media_uv_policy_set_devices_available
|
||||
|
||||
|
|
@ -981,7 +956,7 @@ int media_uv_policy_set_hfp_samplerate(void* loop, int rate, media_uv_callback c
|
|||
int media_uv_policy_set_devices_available(void* loop, const char* devices, bool available, media_uv_callback cb, void* cookie);
|
||||
```
|
||||
|
||||
设置 设备s 可用 or un可用。
|
||||
设置设备可用或不可用状态。
|
||||
|
||||
**参数**:
|
||||
|
||||
|
|
@ -989,7 +964,7 @@ int media_uv_policy_set_devices_available(void* loop, const char* devices, bool
|
|||
- `devices` 目标设备。
|
||||
- `available` 将设备设置为可用或不可用状态。
|
||||
- `cb` 结果回调函数。
|
||||
- `cookie` 回调参数.
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -1002,13 +977,13 @@ int media_uv_policy_set_devices_available(void* loop, const char* devices, bool
|
|||
int media_uv_policy_get_devices_available(void* loop, media_uv_string_callback cb, void* cookie);
|
||||
```
|
||||
|
||||
获取 current 可用 设备s。
|
||||
获取当前可用设备。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `loop` 当前线程的 `uv_loop_t*` 事件循环句柄。
|
||||
- `cb` 结果回调函数。
|
||||
- `cookie` 回调参数.
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -1021,14 +996,14 @@ int media_uv_policy_get_devices_available(void* loop, media_uv_string_callback c
|
|||
int media_uv_policy_is_devices_available(void* loop, const char* devices, media_uv_int_callback cb, void* cookie);
|
||||
```
|
||||
|
||||
检查 whether 设备s are 可用。
|
||||
检查指定设备是否可用。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `loop` 当前线程的 `uv_loop_t*` 事件循环句柄。
|
||||
- `devices` 待检查的设备。
|
||||
- `cb` 结果回调函数。
|
||||
- `cookie` 回调参数.
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -1041,14 +1016,14 @@ int media_uv_policy_is_devices_available(void* loop, const char* devices, media_
|
|||
int media_uv_policy_set_mute_mode(void* loop, int mute, media_uv_callback cb, void* cookie);
|
||||
```
|
||||
|
||||
设置 静音 mode。
|
||||
设置静音模式。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `loop` 当前线程的 `uv_loop_t*` 事件循环句柄。
|
||||
- `mute` 新的静音模式。
|
||||
- `cb` 结果回调函数。
|
||||
- `cookie` 回调参数.
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -1061,13 +1036,13 @@ int media_uv_policy_set_mute_mode(void* loop, int mute, media_uv_callback cb, vo
|
|||
int media_uv_policy_get_mute_mode(void* loop, media_uv_int_callback cb, void* cookie);
|
||||
```
|
||||
|
||||
获取 静音 mode。
|
||||
获取当前静音模式。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `loop` 当前线程的 `uv_loop_t*` 事件循环句柄。
|
||||
- `cb` 结果回调函数。
|
||||
- `cookie` 回调参数.
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -1087,7 +1062,7 @@ int media_uv_policy_set_mic_mute(void* loop, int mute, media_uv_callback cb, voi
|
|||
- `loop` 当前线程的 `uv_loop_t*` 事件循环句柄。
|
||||
- `mute` 静音模式。
|
||||
- `cb` 结果回调函数。
|
||||
- `cookie` 回调参数.
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
|
|||
|
|
@ -27,11 +27,11 @@ void* media_recorder_open(const char* params);
|
|||
|
||||
**参数**:
|
||||
|
||||
- `params` 源类型常量。 Usually MEDIA_SOURCE_MIC.
|
||||
- `params` 源类型常量,通常为 `MEDIA_SOURCE_MIC`。
|
||||
|
||||
**返回值**:
|
||||
|
||||
void* 录制器句柄 on success; NULL on failure。
|
||||
成功时返回录制器句柄,失败时返回 `NULL`。
|
||||
|
||||
|
||||
### media_recorder_close
|
||||
|
|
@ -44,7 +44,7 @@ int media_recorder_close(void* handle);
|
|||
|
||||
**参数**:
|
||||
|
||||
- `handle` 录制器句柄
|
||||
- `handle` 录制器句柄。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -57,13 +57,13 @@ int media_recorder_close(void* handle);
|
|||
int media_recorder_set_event_callback(void* handle, void* cookie, media_event_callback event_cb);
|
||||
```
|
||||
|
||||
设置录制器事件回调, the callback will be called when state changed or something user cares。
|
||||
设置录制器事件回调,当状态变化或发生用户关注的事件时触发回调。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 录制器句柄。
|
||||
- `cookie` 用户数据,在 `event_cb` 触发时回传给用户,通常会被修改。
|
||||
- `on_event` 事件回调函数。
|
||||
- `cookie` 用户数据,在 `event_cb` 触发时回传给用户。
|
||||
- `event_cb` 事件回调函数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -80,7 +80,7 @@ int media_recorder_prepare(void* handle, const char* url, const char* options);
|
|||
|
||||
**参数**:
|
||||
|
||||
- `handle` 录制器句柄
|
||||
- `handle` 录制器句柄。
|
||||
- `url` 资源路径,支持两种模式:1. URL 模式:`url` 为本地文件路径,框架会打开并录制到该路径;2. BUFFER 模式:`url` 为 `NULL`,调用方需通过 `media_recorder_read_data()` 或 `media_recorder_get_socket()` + `read()` 持续接收数据。
|
||||
- `options` 额外配置参数,字段包括:format(封装格式,如 opus/wav)、sample_rate(采样率)、ch_layout(声道布局)、b(比特率,如 `"23900"`)、vbr(0=固定码率,1=可变码率)、level(编码复杂度,0-10,默认 10)。示例:`"format=opusraw:sample_rate=16000:ch_layout=mono:b=32000:vbr=0:level=1"`。
|
||||
|
||||
|
|
@ -95,15 +95,15 @@ int media_recorder_prepare(void* handle, const char* url, const char* options);
|
|||
int media_recorder_reset(void* handle);
|
||||
```
|
||||
|
||||
重置录制器。
|
||||
重置录制器到初始状态。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 录制器句柄.
|
||||
- `handle` 录制器句柄。
|
||||
|
||||
**返回值**:
|
||||
|
||||
int 成功时返回 0,失败时返回负的错误码。
|
||||
成功时返回 `0`,失败时返回负的错误码。
|
||||
|
||||
|
||||
## 同步接口 - 数据流
|
||||
|
|
@ -118,9 +118,9 @@ ssize_t media_recorder_read_data(void* handle, void* data, size_t len);
|
|||
|
||||
**参数**:
|
||||
|
||||
- `handle` 录制器句柄.
|
||||
- `data` 缓冲区地址.
|
||||
- `len` 缓冲区长度 to read.
|
||||
- `handle` 录制器句柄。
|
||||
- `data` 数据缓冲区地址。
|
||||
- `len` 要读取的数据长度(字节)。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -137,12 +137,12 @@ int media_recorder_get_sockaddr(void* handle, struct sockaddr_storage* addr);
|
|||
|
||||
**参数**:
|
||||
|
||||
- `handle` 录制器句柄.
|
||||
- `addr` Socket 地址信息。
|
||||
- `handle` 录制器句柄。
|
||||
- `addr` 用于存储 Socket 地址信息的输出参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
int 成功时返回 0,失败时返回负的错误码。
|
||||
成功时返回 `0`,失败时返回负的错误码。
|
||||
|
||||
|
||||
### media_recorder_get_socket
|
||||
|
|
@ -155,11 +155,11 @@ int media_recorder_get_socket(void* handle);
|
|||
|
||||
**参数**:
|
||||
|
||||
- `handle` 录制器句柄.
|
||||
- `handle` 录制器句柄。
|
||||
|
||||
**返回值**:
|
||||
|
||||
成功时返回 `0`,失败时返回负的 errno。
|
||||
成功时返回 Socket 文件描述符,失败时返回负的错误码。
|
||||
|
||||
|
||||
### media_recorder_close_socket
|
||||
|
|
@ -168,11 +168,11 @@ int media_recorder_get_socket(void* handle);
|
|||
void media_recorder_close_socket(void* handle);
|
||||
```
|
||||
|
||||
关闭 Socket fd when recorder finish recving data。
|
||||
关闭录制器数据接收完成后的 Socket 文件描述符。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 录制器句柄.
|
||||
- `handle` 录制器句柄。
|
||||
|
||||
|
||||
## 同步接口 - 录制控制
|
||||
|
|
@ -183,15 +183,15 @@ void media_recorder_close_socket(void* handle);
|
|||
int media_recorder_start(void* handle);
|
||||
```
|
||||
|
||||
开始/resume the recording the re音频源。
|
||||
开始或恢复录制。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 录制器句柄.
|
||||
- `handle` 录制器句柄。
|
||||
|
||||
**返回值**:
|
||||
|
||||
int 成功时返回 0,失败时返回负的错误码。
|
||||
成功时返回 `0`,失败时返回负的错误码。
|
||||
|
||||
|
||||
### media_recorder_pause
|
||||
|
|
@ -200,15 +200,15 @@ int 成功时返回 0,失败时返回负的错误码。
|
|||
int media_recorder_pause(void* handle);
|
||||
```
|
||||
|
||||
暂停 录制器 after capturing start。
|
||||
暂停录制。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 录制器句柄.
|
||||
- `handle` 录制器句柄。
|
||||
|
||||
**返回值**:
|
||||
|
||||
int 成功时返回 0,失败时返回负的错误码。
|
||||
成功时返回 `0`,失败时返回负的错误码。
|
||||
|
||||
|
||||
### media_recorder_stop
|
||||
|
|
@ -221,11 +221,11 @@ int media_recorder_stop(void* handle);
|
|||
|
||||
**参数**:
|
||||
|
||||
- `handle` 录制器句柄.
|
||||
- `handle` 录制器句柄。
|
||||
|
||||
**返回值**:
|
||||
|
||||
int 成功时返回 0,失败时返回负的错误码。
|
||||
成功时返回 `0`,失败时返回负的错误码。
|
||||
|
||||
|
||||
## 同步接口 - 属性
|
||||
|
|
@ -236,14 +236,14 @@ int 成功时返回 0,失败时返回负的错误码。
|
|||
int media_recorder_set_property(void* handle, const char* target, const char* key, const char* value);
|
||||
```
|
||||
|
||||
设置 properties of 录制器 path。
|
||||
设置录制器属性。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 录制器句柄。
|
||||
- `target` 目标 filter 名称。.
|
||||
- `key` 要设置的键名。
|
||||
- `value` 要设置的值。
|
||||
- `target` 目标 filter 名称。
|
||||
- `key` 属性键名。
|
||||
- `value` 属性值。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -256,24 +256,23 @@ int media_recorder_set_property(void* handle, const char* target, const char* ke
|
|||
int media_recorder_get_property(void* handle, const char* target, const char* key, char* value, int value_len);
|
||||
```
|
||||
|
||||
获取 properties of 录制器 path。
|
||||
获取录制器属性。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 录制器句柄。
|
||||
- `target` 目标 filter 名称。.
|
||||
- `key` 要设置的键名。
|
||||
- `value` 输出缓冲区。.
|
||||
- `value_len` 缓冲区长度 of value.
|
||||
|
||||
|
||||
## 同步接口 - 图片捕获
|
||||
- `target` 目标 filter 名称。
|
||||
- `key` 属性键名。
|
||||
- `value` 输出缓冲区,用于存储属性值。
|
||||
- `value_len` 输出缓冲区长度。
|
||||
|
||||
**返回值**:
|
||||
|
||||
成功时返回 `0`,失败时返回负的 errno。
|
||||
|
||||
|
||||
## 同步接口 - 图片捕获
|
||||
|
||||
### media_recorder_take_picture
|
||||
|
||||
```c
|
||||
|
|
@ -299,7 +298,7 @@ int media_recorder_take_picture(char* params, char* filename, size_t number);
|
|||
void* media_recorder_start_picture(char* params, char* filename, size_t number, media_event_callback event_cb, void* cookie);
|
||||
```
|
||||
|
||||
开始 taking picture, including open, set_事件_回调, prepare, and start operations。
|
||||
开始拍照,内部依次执行打开、设置事件回调、准备和启动操作。
|
||||
|
||||
**参数**:
|
||||
|
||||
|
|
@ -320,7 +319,7 @@ void* media_recorder_start_picture(char* params, char* filename, size_t number,
|
|||
int media_recorder_finish_picture(void* handle);
|
||||
```
|
||||
|
||||
关闭 录制器 when taking picture finished。
|
||||
拍照完成后关闭录制器。
|
||||
|
||||
**参数**:
|
||||
|
||||
|
|
@ -328,7 +327,7 @@ int media_recorder_finish_picture(void* handle);
|
|||
|
||||
**返回值**:
|
||||
|
||||
int 成功时返回 0,失败时返回负的错误码。
|
||||
成功时返回 `0`,失败时返回负的错误码。
|
||||
|
||||
|
||||
## 异步接口(基于 libuv)
|
||||
|
|
@ -341,7 +340,7 @@ int 成功时返回 0,失败时返回负的错误码。
|
|||
void* media_uv_recorder_open(void* loop, const char* source, media_uv_callback on_open, void* cookie);
|
||||
```
|
||||
|
||||
打开 an async recorder。
|
||||
打开异步录制器。
|
||||
|
||||
**参数**:
|
||||
|
||||
|
|
@ -352,7 +351,7 @@ void* media_uv_recorder_open(void* loop, const char* source, media_uv_callback o
|
|||
|
||||
**返回值**:
|
||||
|
||||
成功时返回录制器句柄。
|
||||
成功时返回录制器句柄,失败时返回 `NULL`。
|
||||
|
||||
|
||||
### media_uv_recorder_listen
|
||||
|
|
@ -361,7 +360,7 @@ void* media_uv_recorder_open(void* loop, const char* source, media_uv_callback o
|
|||
int media_uv_recorder_listen(void* handle, media_event_callback on_event);
|
||||
```
|
||||
|
||||
Listen to status change 事件 by setting 回调。
|
||||
注册事件监听回调,接收录制状态变化通知。
|
||||
|
||||
**参数**:
|
||||
|
||||
|
|
@ -379,7 +378,7 @@ Listen to status change 事件 by setting 回调。
|
|||
int media_uv_recorder_close(void* handle, media_uv_callback on_close);
|
||||
```
|
||||
|
||||
关闭 the async recorder。
|
||||
关闭异步录制器。
|
||||
|
||||
**参数**:
|
||||
|
||||
|
|
@ -397,15 +396,16 @@ int media_uv_recorder_close(void* handle, media_uv_callback on_close);
|
|||
int media_uv_recorder_prepare(void* handle, const char* url, const char* options, media_uv_object_callback on_connection, media_uv_callback on_prepare, void* cookie);
|
||||
```
|
||||
|
||||
准备 destination file。
|
||||
准备录制目标文件。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 异步录制器句柄。
|
||||
- `url` 目标路径。
|
||||
- `options` 目标配置参数,详见 `media_recorder_prepare`。
|
||||
- `on_connection` * @param[in] on_prepare 结果回调,在 BUFFER 模式下会携带可写入数据的 `uv_pipe_t`。
|
||||
- `cookie` 一次性回调上下文。
|
||||
- `on_connection` BUFFER 模式下接收可写入数据的 `uv_pipe_t` 的回调函数。
|
||||
- `on_prepare` 准备完成后的结果回调函数。
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -418,14 +418,14 @@ int media_uv_recorder_prepare(void* handle, const char* url, const char* options
|
|||
int media_uv_recorder_start_auto(void* handle, const char* stream, media_uv_callback on_start, void* cookie);
|
||||
```
|
||||
|
||||
开始 or resume the capturing with auto 焦点 request。
|
||||
开始或恢复录制,并自动请求音频焦点。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 异步录制器句柄。
|
||||
- `scenario` 场景常量。 in media_defs.h.
|
||||
- `on_start` 结果回调函数。
|
||||
- `cookie` 一次性回调上下文。
|
||||
- `scenario` 场景常量(定义在 `media_defs.h` 中)。
|
||||
- `on_start` 录制开始后的结果回调函数。
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -438,13 +438,13 @@ int media_uv_recorder_start_auto(void* handle, const char* stream, media_uv_call
|
|||
int media_uv_recorder_start(void* handle, media_uv_callback on_start, void* cookie);
|
||||
```
|
||||
|
||||
开始 or resume the capturing。
|
||||
开始或恢复录制。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 异步录制器句柄。
|
||||
- `on_start` 结果回调函数。
|
||||
- `cookie` 一次性回调上下文。
|
||||
- `on_start` 录制开始后的结果回调函数。
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -457,13 +457,13 @@ int media_uv_recorder_start(void* handle, media_uv_callback on_start, void* cook
|
|||
int media_uv_recorder_pause(void* handle, media_uv_callback on_pause, void* cookie);
|
||||
```
|
||||
|
||||
暂停 the capturing。
|
||||
暂停录制。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 异步录制器句柄。
|
||||
- `on_pause` 结果回调函数。
|
||||
- `cookie` 一次性回调上下文。
|
||||
- `on_pause` 暂停完成后的结果回调函数。
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -476,13 +476,13 @@ int media_uv_recorder_pause(void* handle, media_uv_callback on_pause, void* cook
|
|||
int media_uv_recorder_stop(void* handle, media_uv_callback on_stop, void* cookie);
|
||||
```
|
||||
|
||||
停止 the capturing, finish the destination file。
|
||||
停止录制并完成目标文件写入。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 异步录制器句柄。
|
||||
- `on_stop` 结果回调函数。
|
||||
- `cookie` 一次性回调上下文。
|
||||
- `on_stop` 停止完成后的结果回调函数。
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -495,16 +495,16 @@ int media_uv_recorder_stop(void* handle, media_uv_callback on_stop, void* cookie
|
|||
int media_uv_recorder_set_property(void* handle, const char* target, const char* key, const char* value, media_uv_callback cb, void* cookie);
|
||||
```
|
||||
|
||||
设置 properties of 录制器。
|
||||
设置录制器属性。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 异步录制器句柄。
|
||||
- `target` 目标 filter 名称。.
|
||||
- `key` Key.
|
||||
- `value` Value.
|
||||
- `cb` 结果回调函数。
|
||||
- `cookie` 一次性回调上下文。
|
||||
- `target` 目标 filter 名称。
|
||||
- `key` 属性键名。
|
||||
- `value` 属性值。
|
||||
- `cb` 设置完成后的结果回调函数。
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -517,17 +517,15 @@ int media_uv_recorder_set_property(void* handle, const char* target, const char*
|
|||
int media_uv_recorder_get_property(void* handle, const char* target, const char* key, media_uv_string_callback cb, void* cookie);
|
||||
```
|
||||
|
||||
获取 properties of 录制器。
|
||||
获取录制器属性。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 异步录制器句柄。
|
||||
- `target` 目标 filter 名称。.
|
||||
- `key` Key.
|
||||
- `value` 输出缓冲区。.
|
||||
- `value_len` 缓冲区长度 of value.
|
||||
- `cb` 结果回调函数。
|
||||
- `cookie` 一次性回调上下文。
|
||||
- `target` 目标 filter 名称。
|
||||
- `key` 属性键名。
|
||||
- `cb` 结果回调函数,回调参数为属性值字符串。
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -540,13 +538,13 @@ int media_uv_recorder_get_property(void* handle, const char* target, const char*
|
|||
int media_uv_recorder_reset(void* handle, media_uv_callback on_reset, void* cookie);
|
||||
```
|
||||
|
||||
重置 录制器, clear the origin record and record new one。
|
||||
重置录制器,清除当前录制内容以准备新的录制。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 异步录制器句柄。
|
||||
- `cb` 结果回调函数。
|
||||
- `cookie` 一次性回调上下文。
|
||||
- `on_reset` 重置完成后的结果回调函数。
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -559,7 +557,7 @@ int media_uv_recorder_reset(void* handle, media_uv_callback on_reset, void* cook
|
|||
int media_uv_recorder_take_picture(void* loop, char* params, char* filename, size_t number, media_uv_callback on_complete, void* cookie);
|
||||
```
|
||||
|
||||
从摄像头拍照。
|
||||
从摄像头异步拍照。
|
||||
|
||||
**参数**:
|
||||
|
||||
|
|
@ -567,11 +565,9 @@ int media_uv_recorder_take_picture(void* loop, char* params, char* filename, siz
|
|||
- `params` 相机打开路径参数。
|
||||
- `filename` 新图片的存储路径。
|
||||
- `number` 拍摄图片的数量。
|
||||
- `on_complete` 处理结果的回调函数。
|
||||
- `cookie` 用户私有数据。
|
||||
- `on_complete` 拍照完成后的结果回调函数。
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
成功时返回 `0`,失败时返回负的 errno。
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -28,11 +28,11 @@ void* media_session_open(const char* params);
|
|||
|
||||
**参数**:
|
||||
|
||||
- `params` NULL, 暂未使用.
|
||||
- `params` 暂未使用,传 `NULL`。
|
||||
|
||||
**返回值**:
|
||||
|
||||
void* 控制器句柄, 失败时返回 NULL。
|
||||
成功时返回控制器句柄,失败时返回 `NULL`。
|
||||
|
||||
|
||||
### media_session_close
|
||||
|
|
@ -45,7 +45,7 @@ int media_session_close(void* handle);
|
|||
|
||||
**参数**:
|
||||
|
||||
- `handle` 控制器句柄
|
||||
- `handle` 控制器句柄。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -62,13 +62,13 @@ int media_session_set_event_callback(void* handle, void* cookie, media_event_cal
|
|||
|
||||
**参数**:
|
||||
|
||||
- `handle` 控制器句柄
|
||||
- `cookie` 回调参数 for `on_event`.
|
||||
- `handle` 控制器句柄。
|
||||
- `cookie` 回调上下文参数。
|
||||
- `on_event` 事件回调函数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
成功时返回 0,失败时返回负的错误码。
|
||||
成功时返回 `0`,失败时返回负的错误码。
|
||||
|
||||
|
||||
## 控制器接口 - 播放控制
|
||||
|
|
@ -83,7 +83,7 @@ int media_session_start(void* handle);
|
|||
|
||||
**参数**:
|
||||
|
||||
- `handle` 控制器句柄.
|
||||
- `handle` 控制器句柄。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -100,7 +100,7 @@ int media_session_stop(void* handle);
|
|||
|
||||
**参数**:
|
||||
|
||||
- `handle` 控制器句柄.
|
||||
- `handle` 控制器句柄。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -117,7 +117,7 @@ int media_session_pause(void* handle);
|
|||
|
||||
**参数**:
|
||||
|
||||
- `handle` 控制器句柄.
|
||||
- `handle` 控制器句柄。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -134,8 +134,8 @@ int media_session_seek(void* handle, unsigned position);
|
|||
|
||||
**参数**:
|
||||
|
||||
- `handle` 控制器句柄.
|
||||
- `position` 起始位置,单位为毫秒。
|
||||
- `handle` 控制器句柄。
|
||||
- `position` 目标位置,单位为毫秒。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -152,7 +152,7 @@ int media_session_prev_song(void* handle);
|
|||
|
||||
**参数**:
|
||||
|
||||
- `handle` 控制器句柄.
|
||||
- `handle` 控制器句柄。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -169,27 +169,26 @@ int media_session_next_song(void* handle);
|
|||
|
||||
**参数**:
|
||||
|
||||
- `handle` 控制器句柄.
|
||||
|
||||
|
||||
## 控制器接口 - 音量控制
|
||||
- `handle` 控制器句柄。
|
||||
|
||||
**返回值**:
|
||||
|
||||
成功时返回 `0`,失败时返回负的 errno。
|
||||
|
||||
|
||||
## 控制器接口 - 音量控制
|
||||
|
||||
### media_session_increase_volume
|
||||
|
||||
```c
|
||||
int media_session_increase_volume(void* handle);
|
||||
```
|
||||
|
||||
请求 increase 音量。
|
||||
请求增大音量。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 控制器句柄.
|
||||
- `handle` 控制器句柄。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -202,11 +201,11 @@ int media_session_increase_volume(void* handle);
|
|||
int media_session_decrease_volume(void* handle);
|
||||
```
|
||||
|
||||
请求 decrease 音量。
|
||||
请求减小音量。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 控制器句柄.
|
||||
- `handle` 控制器句柄。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -219,16 +218,20 @@ int media_session_decrease_volume(void* handle);
|
|||
int media_session_set_volume(void* handle, int volume);
|
||||
```
|
||||
|
||||
Rquest set 音量。
|
||||
请求设置音量。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 控制器句柄.
|
||||
- `handle` 控制器句柄。
|
||||
- `volume` 音量档位。
|
||||
|
||||
**返回值**:
|
||||
|
||||
成功时返回 0,失败时返回负的错误码。
|
||||
成功时返回 `0`,失败时返回负的错误码。
|
||||
|
||||
**注意**:
|
||||
|
||||
- 此接口尚未实现。
|
||||
|
||||
|
||||
## 控制器接口 - 状态查询
|
||||
|
|
@ -239,16 +242,16 @@ Rquest set 音量。
|
|||
int media_session_query(void* handle, const media_metadata_t** data);
|
||||
```
|
||||
|
||||
Query 元数据 from most 活跃状态 controllee。
|
||||
查询当前最活跃被控端的元数据。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 控制器句柄.
|
||||
- `data` 用于接收元数据指针的输出指针。
|
||||
- `handle` 控制器句柄。
|
||||
- `data` 用于接收元数据指针的输出参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
成功时返回 0,失败时返回负的错误码。
|
||||
成功时返回 `0`,失败时返回负的错误码。
|
||||
|
||||
|
||||
### media_session_get_state
|
||||
|
|
@ -257,16 +260,16 @@ Query 元数据 from most 活跃状态 controllee。
|
|||
int media_session_get_state(void* handle, int* state);
|
||||
```
|
||||
|
||||
获取 all status。
|
||||
获取当前播放状态。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 控制器句柄.
|
||||
- `state` 当前状态。
|
||||
- `handle` 控制器句柄。
|
||||
- `state` 输出参数,当前播放状态。
|
||||
|
||||
**返回值**:
|
||||
|
||||
成功时返回 0,失败时返回负的错误码。
|
||||
成功时返回 `0`,失败时返回负的错误码。
|
||||
|
||||
|
||||
### media_session_get_position
|
||||
|
|
@ -275,16 +278,16 @@ int media_session_get_state(void* handle, int* state);
|
|||
int media_session_get_position(void* handle, unsigned* position);
|
||||
```
|
||||
|
||||
获取 msec 位置。
|
||||
获取当前播放位置。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 控制器句柄.
|
||||
- `position` 当前位置,单位为毫秒。
|
||||
- `handle` 控制器句柄。
|
||||
- `position` 输出参数,当前位置,单位为毫秒。
|
||||
|
||||
**返回值**:
|
||||
|
||||
成功时返回 0,失败时返回负的错误码。
|
||||
成功时返回 `0`,失败时返回负的错误码。
|
||||
|
||||
|
||||
### media_session_get_duration
|
||||
|
|
@ -293,16 +296,16 @@ int media_session_get_position(void* handle, unsigned* position);
|
|||
int media_session_get_duration(void* handle, unsigned* duration);
|
||||
```
|
||||
|
||||
获取 msec 时长。
|
||||
获取当前音频源的总时长。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 控制器句柄.
|
||||
- `duration` 当前总时长,单位为毫秒。
|
||||
- `handle` 控制器句柄。
|
||||
- `duration` 输出参数,总时长,单位为毫秒。
|
||||
|
||||
**返回值**:
|
||||
|
||||
成功时返回 0,失败时返回负的错误码。
|
||||
成功时返回 `0`,失败时返回负的错误码。
|
||||
|
||||
|
||||
### media_session_get_volume
|
||||
|
|
@ -311,16 +314,16 @@ int media_session_get_duration(void* handle, unsigned* duration);
|
|||
int media_session_get_volume(void* handle, int* volume);
|
||||
```
|
||||
|
||||
获取 current 音量 index。
|
||||
获取当前音量。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 控制器句柄.
|
||||
- `volume` 音量档位。
|
||||
- `handle` 控制器句柄。
|
||||
- `volume` 输出参数,当前音量档位。
|
||||
|
||||
**返回值**:
|
||||
|
||||
成功时返回 0,失败时返回负的错误码。
|
||||
成功时返回 `0`,失败时返回负的错误码。
|
||||
|
||||
|
||||
## 被控端接口
|
||||
|
|
@ -331,16 +334,16 @@ int media_session_get_volume(void* handle, int* volume);
|
|||
void* media_session_register(void* cookie, media_event_callback on_event);
|
||||
```
|
||||
|
||||
注册 as a session controllee。
|
||||
注册为媒体会话被控端。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `cookie` Callback arguemnt of `on_event`.
|
||||
- `on_event` 事件回调函数。.
|
||||
- `cookie` 回调上下文参数。
|
||||
- `on_event` 事件回调函数,用于接收控制命令。
|
||||
|
||||
**返回值**:
|
||||
|
||||
成功时返回被控端句柄,失败时返回 NULL。
|
||||
成功时返回被控端句柄,失败时返回 `NULL`。
|
||||
|
||||
|
||||
### media_session_unregister
|
||||
|
|
@ -349,7 +352,7 @@ void* media_session_register(void* cookie, media_event_callback on_event);
|
|||
int media_session_unregister(void* handle);
|
||||
```
|
||||
|
||||
取消注册 会话 controllee。
|
||||
取消注册被控端。
|
||||
|
||||
**参数**:
|
||||
|
||||
|
|
@ -366,14 +369,14 @@ int media_session_unregister(void* handle);
|
|||
int media_session_notify(void* handle, int event, int result, const char* extra);
|
||||
```
|
||||
|
||||
通知 the result of control message. * After receive MEDIA_EVENT_* from `on_事件`, as controllee you should do something to handle the control message, after you acknowledge the control message, you should call this api to send response to 控制器。
|
||||
通知控制器控制命令的处理结果。被控端收到 `MEDIA_EVENT_*` 事件后,完成相应处理,再调用此接口向控制器发送响应。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 被控端句柄。
|
||||
- `event` MEDIA_EVENT_*
|
||||
- `event` 要响应的事件类型(`MEDIA_EVENT_*`)。
|
||||
- `result` 操作结果,成功时为 `0`,失败时为负的 errno。
|
||||
- `extra` 附加消息。
|
||||
- `extra` 附加消息字符串,不需要时传 `NULL`。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -386,41 +389,40 @@ int media_session_notify(void* handle, int event, int result, const char* extra)
|
|||
int media_session_update(void* handle, const media_metadata_t* data);
|
||||
```
|
||||
|
||||
Update 元数据 to session。
|
||||
向会话更新元数据。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 被控端句柄。
|
||||
- `data` 要更新的元数据。
|
||||
|
||||
|
||||
## 异步接口(基于 libuv)
|
||||
|
||||
以下接口仅在启用 `CONFIG_LIBUV` 时可用,控制器与被控端均有对应异步版本。
|
||||
|
||||
**返回值**:
|
||||
|
||||
成功时返回 `0`,失败时返回负的 errno。
|
||||
|
||||
|
||||
## 异步接口(基于 libuv)
|
||||
|
||||
以下接口仅在启用 `CONFIG_LIBUV` 时可用,控制器与被控端均有对应异步版本。
|
||||
|
||||
### media_uv_session_open
|
||||
|
||||
```c
|
||||
void* media_uv_session_open(void* loop, char* params, media_uv_callback on_open, void* cookie);
|
||||
```
|
||||
|
||||
打开 an async session controller。
|
||||
打开异步会话控制器。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `loop` 当前线程的 `uv_loop_t*` 事件循环句柄。
|
||||
- `params` 暂未使用.
|
||||
- `params` 暂未使用,传 `NULL`。
|
||||
- `on_open` 打开完成后触发的回调函数。
|
||||
- `cookie` 回调上下文,供 `on_open`、`on_event`、`on_close` 共用。
|
||||
|
||||
**返回值**:
|
||||
|
||||
成功时返回异步控制器句柄。
|
||||
成功时返回异步控制器句柄,失败时返回 `NULL`。
|
||||
|
||||
|
||||
### media_uv_session_close
|
||||
|
|
@ -429,16 +431,16 @@ void* media_uv_session_open(void* loop, char* params, media_uv_callback on_open,
|
|||
int media_uv_session_close(void* handle, media_uv_callback on_close);
|
||||
```
|
||||
|
||||
关闭 the async controller handle。
|
||||
关闭异步控制器。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 待销毁的异步控制器句柄。
|
||||
- `handle` 异步控制器句柄。
|
||||
- `on_close` 关闭完成后触发的回调函数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
成功时返回 0,失败时返回负的错误码。
|
||||
成功时返回 `0`,失败时返回负的错误码。
|
||||
|
||||
|
||||
### media_uv_session_listen
|
||||
|
|
@ -447,16 +449,16 @@ int media_uv_session_close(void* handle, media_uv_callback on_close);
|
|||
int media_uv_session_listen(void* handle, media_event_callback on_event);
|
||||
```
|
||||
|
||||
Listen to the 事件s from controllee。
|
||||
注册事件监听回调,接收被控端状态变化通知。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` Async 控制器句柄.
|
||||
- `on_event` 事件回调函数。.
|
||||
- `handle` 异步控制器句柄。
|
||||
- `on_event` 事件回调函数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
成功时返回 0,失败时返回负的错误码。
|
||||
成功时返回 `0`,失败时返回负的错误码。
|
||||
|
||||
|
||||
### media_uv_session_start
|
||||
|
|
@ -469,9 +471,9 @@ int media_uv_session_start(void* handle, media_uv_callback on_start, void* cooki
|
|||
|
||||
**参数**:
|
||||
|
||||
- `handle` Async 控制器句柄.
|
||||
- `handle` 异步控制器句柄。
|
||||
- `on_start` 结果回调函数。
|
||||
- `cookie` 回调参数 of `on_start`
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -488,9 +490,9 @@ int media_uv_session_stop(void* handle, media_uv_callback on_stop, void* cookie)
|
|||
|
||||
**参数**:
|
||||
|
||||
- `handle` Async 控制器句柄.
|
||||
- `handle` 异步控制器句柄。
|
||||
- `on_stop` 结果回调函数。
|
||||
- `cookie` 回调参数 of `on_stop`
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -507,9 +509,9 @@ int media_uv_session_pause(void* handle, media_uv_callback on_pause, void* cooki
|
|||
|
||||
**参数**:
|
||||
|
||||
- `handle` Async 控制器句柄.
|
||||
- `handle` 异步控制器句柄。
|
||||
- `on_pause` 结果回调函数。
|
||||
- `cookie` 回调参数 of `on_pause`
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -526,10 +528,10 @@ int media_uv_session_seek(void* handle, unsigned position, media_uv_callback on_
|
|||
|
||||
**参数**:
|
||||
|
||||
- `handle` 播放器句柄。
|
||||
- `position` 起始位置,单位为毫秒。
|
||||
- `handle` 异步控制器句柄。
|
||||
- `position` 目标位置,单位为毫秒。
|
||||
- `on_seek` 结果回调函数。
|
||||
- `cookie` 回调参数 of `on_seek`
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -546,9 +548,9 @@ int media_uv_session_prev_song(void* handle, media_uv_callback on_pre_song, void
|
|||
|
||||
**参数**:
|
||||
|
||||
- `handle` Async 控制器句柄.
|
||||
- `on_prev` 结果回调函数。
|
||||
- `cookie` 回调参数 of `on_prev`
|
||||
- `handle` 异步控制器句柄。
|
||||
- `on_pre_song` 结果回调函数。
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -565,9 +567,9 @@ int media_uv_session_next_song(void* handle, media_uv_callback on_next, void* co
|
|||
|
||||
**参数**:
|
||||
|
||||
- `handle` Async 控制器句柄.
|
||||
- `handle` 异步控制器句柄。
|
||||
- `on_next` 结果回调函数。
|
||||
- `cookie` 回调参数 of `on_next`
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -580,13 +582,13 @@ int media_uv_session_next_song(void* handle, media_uv_callback on_next, void* co
|
|||
int media_uv_session_increase_volume(void* handle, media_uv_callback on_increase, void* cookie);
|
||||
```
|
||||
|
||||
请求 increase 音量。
|
||||
请求增大音量。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 异步控制器句柄。
|
||||
- `on_increase` 结果回调函数。
|
||||
- `cookie` 回调参数 of `on_increase`
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -599,13 +601,13 @@ int media_uv_session_increase_volume(void* handle, media_uv_callback on_increase
|
|||
int media_uv_session_decrease_volume(void* handle, media_uv_callback on_decrease, void* cookie);
|
||||
```
|
||||
|
||||
请求 decrease 音量。
|
||||
请求减小音量。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 异步控制器句柄。
|
||||
- `on_decrease` 结果回调函数。
|
||||
- `cookie` 回调参数 of `on_decrease`
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -623,13 +625,17 @@ int media_uv_session_set_volume(void* handle, int volume, media_uv_callback on_s
|
|||
**参数**:
|
||||
|
||||
- `handle` 异步控制器句柄。
|
||||
- `Volume` 音量档位。
|
||||
- `on_volume` 结果回调函数。
|
||||
- `cookie` 回调参数 of `on_volume`
|
||||
- `volume` 音量档位。
|
||||
- `on_set_volume` 结果回调函数。
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
成功时返回 0,失败时返回负的错误码。
|
||||
成功时返回 `0`,失败时返回负的错误码。
|
||||
|
||||
**注意**:
|
||||
|
||||
- 此接口尚未实现。
|
||||
|
||||
|
||||
### media_uv_session_query
|
||||
|
|
@ -643,12 +649,12 @@ int media_uv_session_query(void* handle, media_uv_object_callback on_query, void
|
|||
**参数**:
|
||||
|
||||
- `handle` 异步控制器句柄。
|
||||
- `on_query` 接收元数据指针的回调函数。
|
||||
- `cookie` 回调参数.
|
||||
- `on_query` 结果回调函数,回调参数为元数据指针。
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
成功时返回 0,失败时返回负的错误码。
|
||||
成功时返回 `0`,失败时返回负的错误码。
|
||||
|
||||
|
||||
### media_uv_session_get_state
|
||||
|
|
@ -657,17 +663,21 @@ int media_uv_session_query(void* handle, media_uv_object_callback on_query, void
|
|||
int media_uv_session_get_state(void* handle, media_uv_int_callback on_state, void* cookie);
|
||||
```
|
||||
|
||||
获取 current state。
|
||||
获取当前播放状态。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` Async 控制器句柄.
|
||||
- `on_state` 结果回调函数。
|
||||
- `cookie` 回调参数 of `on_state`
|
||||
- `handle` 异步控制器句柄。
|
||||
- `on_state` 结果回调函数,回调参数为当前状态。
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
成功时返回 0,失败时返回负的错误码。
|
||||
成功时返回 `0`,失败时返回负的错误码。
|
||||
|
||||
**注意**:
|
||||
|
||||
- 此接口尚未实现,请使用 `media_uv_session_query` 替代。
|
||||
|
||||
|
||||
### media_uv_session_get_position
|
||||
|
|
@ -681,12 +691,16 @@ int media_uv_session_get_position(void* handle, media_uv_unsigned_callback on_po
|
|||
**参数**:
|
||||
|
||||
- `handle` 异步控制器句柄。
|
||||
- `on_position` 结果回调函数。
|
||||
- `cookie` 回调参数 of `on_position`
|
||||
- `on_position` 结果回调函数,回调参数为当前位置(毫秒)。
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
成功时返回 0,失败时返回负的错误码。
|
||||
成功时返回 `0`,失败时返回负的错误码。
|
||||
|
||||
**注意**:
|
||||
|
||||
- 此接口尚未实现,请使用 `media_uv_session_query` 替代。
|
||||
|
||||
|
||||
### media_uv_session_get_duration
|
||||
|
|
@ -695,17 +709,21 @@ int media_uv_session_get_position(void* handle, media_uv_unsigned_callback on_po
|
|||
int media_uv_session_get_duration(void* handle, media_uv_unsigned_callback on_duration, void* cookie);
|
||||
```
|
||||
|
||||
获取 current 时长。
|
||||
获取当前音频源的总时长。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 异步控制器句柄。
|
||||
- `on_duration` 结果回调函数。
|
||||
- `cookie` 回调参数 of `on_duration`
|
||||
- `on_duration` 结果回调函数,回调参数为总时长(毫秒)。
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
成功时返回 0,失败时返回负的错误码。
|
||||
成功时返回 `0`,失败时返回负的错误码。
|
||||
|
||||
**注意**:
|
||||
|
||||
- 此接口尚未实现,请使用 `media_uv_session_query` 替代。
|
||||
|
||||
|
||||
### media_uv_session_get_volume
|
||||
|
|
@ -714,17 +732,21 @@ int media_uv_session_get_duration(void* handle, media_uv_unsigned_callback on_du
|
|||
int media_uv_session_get_volume(void* handle, media_uv_int_callback on_get_volume, void* cookie);
|
||||
```
|
||||
|
||||
获取 current 音量。
|
||||
获取当前音量。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 异步控制器句柄。
|
||||
- `on_volume` 结果回调函数。
|
||||
- `cookie` 回调参数 of `on_volume`
|
||||
- `on_get_volume` 结果回调函数,回调参数为当前音量档位。
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
成功时返回 0,失败时返回负的错误码。
|
||||
成功时返回 `0`,失败时返回负的错误码。
|
||||
|
||||
**注意**:
|
||||
|
||||
- 此接口尚未实现,请使用 `media_uv_session_query` 替代。
|
||||
|
||||
|
||||
### media_uv_session_register
|
||||
|
|
@ -733,18 +755,18 @@ int media_uv_session_get_volume(void* handle, media_uv_int_callback on_get_volum
|
|||
void* media_uv_session_register(void* loop, const char* params, media_event_callback on_event, void* cookie);
|
||||
```
|
||||
|
||||
注册 as a session controllee to receive control message。
|
||||
注册为异步会话被控端,接收控制命令。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `loop` 当前线程的 `uv_loop_t*` 事件循环句柄。
|
||||
- `params` 未使用,请传 `NULL`。
|
||||
- `params` 暂未使用,传 `NULL`。
|
||||
- `on_event` 接收控制消息的回调函数。
|
||||
- `cookie` 回调参数.
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
void* Async controlee handle, 失败时返回 NULL。
|
||||
成功时返回异步被控端句柄,失败时返回 `NULL`。
|
||||
|
||||
|
||||
### media_uv_session_unregister
|
||||
|
|
@ -753,12 +775,12 @@ void* Async controlee handle, 失败时返回 NULL。
|
|||
int media_uv_session_unregister(void* handle, media_uv_callback on_release);
|
||||
```
|
||||
|
||||
取消注册 self。
|
||||
取消注册被控端。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 异步被控端句柄。
|
||||
- `on_release` 调用方资源释放回调函数。
|
||||
- `on_release` 资源释放完成后的回调函数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -771,16 +793,16 @@ int media_uv_session_unregister(void* handle, media_uv_callback on_release);
|
|||
int media_uv_session_notify(void* handle, int event, int result, const char* extra, media_uv_callback on_notify, void* cookie);
|
||||
```
|
||||
|
||||
通知 the result of control message. * After receive MEDIA_EVENT_* from `on_事件`, as controllee you should do something to handle the control message, after you acknowledge the control message, you should call this api to send response to 控制器。
|
||||
通知控制器控制命令的处理结果。被控端收到 `MEDIA_EVENT_*` 事件后,完成相应处理,再调用此接口向控制器发送响应。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 异步被控端句柄。
|
||||
- `event` 要通知的事件。
|
||||
- `result` 事件结果,成功时通常为 `0`,失败时为负的 errno。
|
||||
- `extra` 事件的附加字符串消息,不需要时传 `NULL`。
|
||||
- `event` 要响应的事件类型。
|
||||
- `result` 操作结果,成功时为 `0`,失败时为负的 errno。
|
||||
- `extra` 附加消息字符串,不需要时传 `NULL`。
|
||||
- `on_notify` 通知确认回调函数。
|
||||
- `cookie` 回调参数.
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
|
|
@ -793,17 +815,15 @@ int media_uv_session_notify(void* handle, int event, int result, const char* ext
|
|||
int media_uv_session_update(void* handle, const media_metadata_t* data, media_uv_callback on_update, void* cookie);
|
||||
```
|
||||
|
||||
Update 元数据 to session。
|
||||
向会话更新元数据。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `handle` 异步被控端句柄。
|
||||
- `data` 要更新的元数据。
|
||||
- `on_update` 更新确认回调函数。
|
||||
- `cookie` 回调参数.
|
||||
- `cookie` 回调上下文参数。
|
||||
|
||||
**返回值**:
|
||||
|
||||
成功时返回 `0`,失败时返回负的 errno。
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
## openvela 实现说明
|
||||
|
||||
- **DTMF**:生成 `0-9` / `*#ABCD` 对应的 DTMF 双音多频信号,音频格式固定为 `format=s16le:sample_rate=8000:ch_layout=mono`(由 `MEDIA_TONE_DTMF_FORMAT` 宏定义)
|
||||
- **调试接口**:`media_graph_dump` 和 `media_policy_dump` 用于打印内部状态,便于问题定位
|
||||
- **调试接口**:`media_graph_dump`、`media_player_dump`、`media_recorder_dump` 和 `media_policy_dump` 用于打印内部状态,便于问题定位
|
||||
- **通用命令**:`media_process_command` 向 media server 发送自定义命令,用于扩展能力(如触发 graph 内某个 filter 的操作)
|
||||
- **事件名查询**:`media_event_get_name` 把 `MEDIA_EVENT_*` 数值转成可读字符串,便于日志输出
|
||||
|
||||
|
|
@ -103,6 +103,33 @@ void media_policy_dump(const char* options);
|
|||
|
||||
- `options` dump 选项字符串。
|
||||
|
||||
|
||||
### media_player_dump
|
||||
|
||||
```c
|
||||
void media_player_dump(const char* options);
|
||||
```
|
||||
|
||||
打印 media player 内部状态,用于调试。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `options` dump 选项字符串。
|
||||
|
||||
|
||||
### media_recorder_dump
|
||||
|
||||
```c
|
||||
void media_recorder_dump(const char* options);
|
||||
```
|
||||
|
||||
打印 media recorder 内部状态,用于调试。
|
||||
|
||||
**参数**:
|
||||
|
||||
- `options` dump 选项字符串。
|
||||
|
||||
|
||||
## 通用命令
|
||||
|
||||
### media_process_command
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ TAPI 独立于 openvela telephony core stack,内部逻辑基于 DBUS LIB 对 C
|
|||
## openvela 实现说明
|
||||
|
||||
- **架构**:TAPI 基于 D-Bus 对 Telephony Core Stack(oFono)进行封装,以标准 C 接口对外提供
|
||||
- **多卡支持**:通过 `slot_id` 参数区分不同 SIM 卡槽
|
||||
- **SIM 卡标识**:通过 `slot_id` 参数区分不同 SIM 卡槽
|
||||
- **异步模型**:大部分操作通过回调函数异步返回结果
|
||||
|
||||
## 模块代码介绍
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
## openvela 实现说明
|
||||
|
||||
- **多卡支持**:部分接口不带 `slot_id`,使用默认卡;需要指定卡时通过 `tapi_call_set_default_slot` 切换
|
||||
- **SIM 卡标识**:部分接口不带 `slot_id`,使用默认卡;需要指定卡时通过 `tapi_call_set_default_slot` 切换
|
||||
- **同步/异步**:拨号、应答等耗时操作同时提供同步版本和 `_async` 版本(回调风格)
|
||||
- **按 ID 操作**:长生命周期通话通过返回的 call ID(字符串)唯一标识,`*_by_id` 接口据此执行操作
|
||||
- **DTMF**:拨号盘按键通过 `tapi_call_send_tones`(批量)或 `tapi_call_start_dtmf` / `tapi_call_stop_dtmf`(持续按键)触发
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ Cell Broadcast Service(CBS)是蜂窝网络的小区广播能力,常用于
|
|||
- **开关控制**:通过 `set_cell_broadcast_power_on` 启用/禁用小区广播接收
|
||||
- **主题订阅**:通过 `set_cell_broadcast_topics` 配置要接收的广播主题范围(按频道 ID)
|
||||
- **事件回调**:通过 `tapi_cbs_register` 注册事件回调,接收到的广播消息
|
||||
- **多卡支持**:所有接口带 `slot_id`,支持多 SIM 卡设备
|
||||
- **SIM 卡标识**:所有接口带 `slot_id`,支持多 SIM 卡设备
|
||||
- **相关协议**:底层对应 3GPP TS 23.041 定义的 Cell Broadcast 流程
|
||||
|
||||
## 开关控制
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
- **APN 上下文**:通过 `tapi_data_*_apn_context` 系列接口管理 APN 配置(增删改查)
|
||||
- **按需连接**:`tapi_data_request_network` / `tapi_data_release_network` 控制数据网络的建立与释放
|
||||
- **漫游控制**:通过 `tapi_data_enable_roaming` 显式开关数据漫游
|
||||
- **多卡支持**:涉及特定卡的操作使用 `slot_id` 参数;数据默认卡通过 `tapi_data_set_default_slot` 设置
|
||||
- **SIM 卡标识**:涉及特定卡的操作使用 `slot_id` 参数;数据默认卡通过 `tapi_data_set_default_slot` 设置
|
||||
- **状态订阅**:`tapi_data_register` / `tapi_data_unregister` 用于注册/取消状态变化事件
|
||||
|
||||
## APN 配置管理
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ IP 多媒体子系统(VoLTE/VoWiFi)管理。
|
|||
- **注册状态**:查询 IMS 是否已注册到网络,订阅注册状态变化事件
|
||||
- **业务开关**:`set_service_status` 控制具体业务(如语音、视频)的启用
|
||||
- **VoLTE 支持**:通过 `is_volte_available` 查询当前网络是否支持 VoLTE
|
||||
- **多卡支持**:所有接口带 `slot_id`
|
||||
- **SIM 卡标识**:所有接口带 `slot_id` 参数
|
||||
|
||||
## IMS 开关
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
## openvela 实现说明
|
||||
|
||||
- **基于 D-Bus**:TAPI Manager 通过 D-Bus 与 Telephony Core Stack(oFono)通信,对外以标准 C 接口封装
|
||||
- **多卡支持**:管理器层面不直接涉及 SIM 卡槽选择,涉及特定卡槽的操作在 `tapi_sim` 等子模块中使用 `slot_id` 参数
|
||||
- **SIM 卡标识**:管理器层面不直接涉及 SIM 卡槽选择,涉及特定卡槽的操作在 `tapi_sim` 等子模块中使用 `slot_id` 参数
|
||||
- **客户端句柄**:通过 `tapi_open` 获取 `tapi_context`,所有后续调用均以该 context 作为第一个参数
|
||||
- **事件订阅**:通过 `tapi_register` 注册事件回调,`tapi_unregister` 取消订阅
|
||||
- **同步 vs 异步**:多数接口是异步的(带回调),部分提供 `*_sync` 变体用于简单场景
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
- **选网模式**:支持自动选网(`select_auto`)和手动选网(`select_manual`)
|
||||
- **扫描**:`tapi_network_scan` 扫描可用的网络运营商
|
||||
- **小区信息**:`get_serving_cellinfos` 获取当前服务小区,`get_neighbouring_cellinfos` 获取相邻小区
|
||||
- **多卡支持**:大部分接口带 `slot_id`,区分不同 SIM 卡槽的网络状态
|
||||
- **SIM 卡标识**:大部分接口带 `slot_id`,区分不同 SIM 卡槽的网络状态
|
||||
- **事件订阅**:`tapi_network_register` / `tapi_network_unregister` 监听注册状态/信号强度变化
|
||||
|
||||
## 选网与扫描
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ SIM 卡电话簿管理接口,支持 ADN(普通电话簿)和 FDN(固定
|
|||
- **ADN**:普通电话簿(Abbreviated Dialling Numbers),存储在 SIM 卡上的常规号码
|
||||
- **FDN**:固定拨号号码(Fixed Dialling Numbers),启用后手机只能拨打 FDN 中的号码,受 PIN2 保护
|
||||
- **FDN 操作需要 PIN2**:`insert_fdn_entry` / `delete_fdn_entry` / `update_fdn_entry` 调用时需要传入 PIN2
|
||||
- **多卡支持**:所有接口带 `slot_id`
|
||||
- **SIM 卡标识**:所有接口带 `slot_id`
|
||||
- **异步回调**:所有操作使用 `tapi_async_function` 异步返回结果
|
||||
|
||||
## ADN 电话簿
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ SIM 卡状态查询和管理。
|
|||
|
||||
## openvela 实现说明
|
||||
|
||||
- **多卡支持**:所有接口均带 `slot_id`,支持多 SIM 卡设备
|
||||
- **SIM 卡管理**:所有接口均带 `slot_id` 参数,用于标识 SIM 卡
|
||||
- **PIN 管理**:提供 `enter_pin` / `change_pin` / `reset_pin` / `lock_pin` / `unlock_pin` 完整 PIN/PUK 流程
|
||||
- **APDU 通道**:通过 `open_logical_channel` / `close_logical_channel` / `transmit_apdu_*` 直接向 SIM 卡发送 APDU 命令
|
||||
- **UICC 开关**:通过 `get_uicc_enablement` / `set_uicc_enablement` 控制 SIM 卡的启用状态
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ Supplementary Services(补充业务)是 3GPP 蜂窝标准定义的增值通
|
|||
- **CLIR/CLIP**:主叫号码显示与限制,通过 `calling_line_restriction` 和 `calling_line_presentation_info` 接口
|
||||
- **USSD**:`tapi_ss_send_ussd` 发送 `*#xxxx#` 命令,`tapi_ss_cancel_ussd` 取消会话
|
||||
- **FDN**:固定拨号开关通过 `tapi_ss_enable_fdn` / `tapi_ss_query_fdn`
|
||||
- **多卡支持**:所有接口带 `slot_id`
|
||||
- **SIM 卡标识**:所有接口带 `slot_id`
|
||||
- **异步回调**:所有操作使用 `tapi_async_function`
|
||||
|
||||
## 呼叫限制
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ SIM Application Toolkit(STK / CAT)是运营商在 SIM 卡上预置的交互
|
|||
- **注册层级**:支持 per-slot Agent(通过 `tapi_stk_agent_register`)与 default Agent(系统默认 UI)
|
||||
- **主菜单**:`tapi_stk_get_main_menu*` 查询 SIM 卡提供的主菜单结构
|
||||
- **Proactive Command 响应**:`tapi_stk_handle_agent_*` 系列接口用于将 Agent 对 SIM 卡主动命令的响应回传给 SIM
|
||||
- **多卡支持**:所有接口带 `slot_id`
|
||||
- **SIM 卡标识**:所有接口带 `slot_id`
|
||||
|
||||
## Agent 注册
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ DHCP(Dynamic Host Configuration Protocol)客户端与服务器接口,覆
|
|||
## openvela 实现说明
|
||||
|
||||
- **IPv4 客户端**:`dhcpc_*` 系列封装完整的 DHCP 客户端状态机(DISCOVER/OFFER/REQUEST/ACK)
|
||||
- **IPv6 客户端**:`dhcp6c_*` 系列处理 IPv6 的 SLAAC / DHCPv6 流程
|
||||
- **IPv6 客户端**:`dhcp6c_*` 系列实现 DHCPv6 客户端协议流程
|
||||
- **服务器**:`dhcpd_*` 系列提供简单的 DHCP 服务器能力,可在热点/AP 模式下分配 IP
|
||||
- **异步调用**:`*_request_async` 接口提供回调式调用,避免阻塞当前线程
|
||||
- **配置依赖**:需启用 `CONFIG_NETUTILS_DHCPC` / `CONFIG_NETUTILS_DHCP6C` / `CONFIG_NETUTILS_DHCPD`
|
||||
|
|
|
|||
|
|
@ -216,7 +216,7 @@ int wapi_freq2chan(int sock, const char *ifname, double freq, int *chan);
|
|||
|
||||
- `sock` 套接字描述符(用于 ioctl 操作)。
|
||||
- `ifname` 网络接口名称。
|
||||
- `freq` 频率, in Hz, to be converted to a 信道编号.
|
||||
- `freq` 频率(Hz),将被转换为信道编号。
|
||||
- `chan` 输出参数。
|
||||
|
||||
### wapi_chan2freq
|
||||
|
|
@ -229,7 +229,7 @@ int wapi_chan2freq(int sock, const char *ifname, int chan, double *freq);
|
|||
|
||||
- `sock` 套接字描述符(用于 ioctl 操作)。
|
||||
- `ifname` 信道。
|
||||
- `chan` 信道 number to be converted to a frequency.
|
||||
- `chan` 信道编号,将被转换为频率。
|
||||
- `freq` 输出参数。
|
||||
|
||||
### wapi_get_essid
|
||||
|
|
@ -487,7 +487,7 @@ int wapi_scan_channel_init(int sock, const char *ifname, const char *essid, uint
|
|||
- `sock` 套接字描述符.
|
||||
- `ifname` 网络接口名称。
|
||||
- `essid` 要扫描的 ESSID。
|
||||
- `channels` 指向 an array of 信道编号s to scan.
|
||||
- `channels` 要扫描的信道编号数组。
|
||||
- `num_channels` 信道。
|
||||
|
||||
**返回值**:
|
||||
|
|
@ -523,7 +523,7 @@ int wapi_escan_channel_init(int sock, const char *ifname, uint8_t scan_type, con
|
|||
- `ifname` 网络接口名称。
|
||||
- `scan_type` 扫描类型。
|
||||
- `essid` 要扫描的 ESSID。
|
||||
- `channels` 指向 an array of 信道编号s to scan.
|
||||
- `channels` 要扫描的信道编号数组。
|
||||
- `num_channels` 信道。
|
||||
|
||||
**返回值**:
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
## 一、前提条件
|
||||
|
||||
1. 下载源码,请参见[快速入门](./../../quickstart/openvela_ubuntu_quick_start.md)。
|
||||
2. 在开始本教程之前,请从 [music_player](./../../../../../../packages_demos/tree/dev-ai-contest-2026/music_player) 获取示例代码。
|
||||
2. 在开始本教程之前,请从 [music_player](./../../../../../../packages_demos/tree/dev/music_player) 获取示例代码。
|
||||
|
||||
## 二、前置概念
|
||||
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@
|
|||
|
||||
### 2、需要定义的中断相关宏
|
||||
|
||||
除上面的函数实现,厂商还需定义一系列中断相关的宏,用于描述 NVIC(Nested vectored interrupt controller) 的配置,这些宏需定义在`chips/chip_name/include/irq.h` 文件中。可参考 [RTL8720C 示例](../../../../../nuttx/blob/dev-ai-contest-2026/arch/arm/src/rtl8720c/include/irq.h)。
|
||||
除上面的函数实现,厂商还需定义一系列中断相关的宏,用于描述 NVIC(Nested vectored interrupt controller) 的配置,这些宏需定义在`chips/chip_name/include/irq.h` 文件中。可参考 [RTL8720C 示例](../../../../../nuttx/blob/dev/arch/arm/src/rtl8720c/include/irq.h)。
|
||||
|
||||
以下是必须实现的宏及其功能说明:
|
||||
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ CONFIG_FRAME_POINTER=y
|
|||
CONFIG_SCHED_BACKTRACE=y
|
||||
```
|
||||
|
||||
更多信息参考:[RISC-V Backtrace 实现](../../../../../../nuttx/blob/dev-ai-contest-2026/arch/risc-v/src/common/riscv_backtrace.c)
|
||||
更多信息参考:[RISC-V Backtrace 实现](../../../../../../nuttx/blob/dev/arch/risc-v/src/common/riscv_backtrace.c)
|
||||
|
||||
### 4、Xtensa
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,6 @@
|
|||
| 意法半导体 (STMicroelectronics) | STM32F411CEU6 | [STM32F411CE](https://www.st.com/en/microcontrollers-microprocessors/stm32f411ce.html) | [在 STM32F411 上使用 openvela 点亮 LED](../quickstart/development_board/STM32F411.md) | 物联网、工业自动化 | [购买链接](https://item.taobao.com/item.htm?abbucket=11&id=594670660262&ns=1&pisk=g--sY9MMDTfFh3IYhNDUVsm6s9IjkvorC-6vEKEaHGITDxO2Tn7AgVAflIRhkhSwQB1vaB1T0qfaci9XiIRXnAXAMIdfgFuE4dvGmihzG0oyIpevwdA_WlpKHtBuMv7TzUdWfihramaUpNcNDIRWgwmLJTfdBtCADvwdUtjAHOIxd6BfErF9MIHC9tBfHrCYXJedH6UTBsBY9pB5UsBAHZHBp6XADsdAWv9pPvPC3V6vCYgJpnSrQjJdOoEvA9hcbdwLfT-PC9CWBhwaQxX15_pOOfhY-UbW6ZtmFkOBcs_VZN2-EMpk8CBCVcNlCep5XTttnrSJrBtfyggqIG-MBUQv2j4vNCx66U9U1us2fpKNKIw87dbv8hbkbXE12UvNbEd-TP59PtIPVu57qiUbdaqfd_kIdr4DOa-FTSi8kjbOKOnrdvNQoNBhd9MIdr4cW9XtivMQOrf..&priceTId=2147831d17537712154442218e1cfd&spm=a21n57.sem.item.50.51873903rAXiL0&utparam={"aplus_abtest"%3A"88650fbdf45c34af5c7b5b5527a5bc29"}&xxc=taobaoSearch) | [ST MCU 中国支持](mailto:mcu.china@st.com) |
|
||||
| 乐鑫科技 (Espressif) | [ESP32S3EYE](https://www.espressif.com.cn/zh-hans/dev-board/esp32-s3-eye-cn) | [ESP32S3](https://www.espressif.com.cn/zh-hans/products/socs/esp32-s3) | [在 ESP32-S3-EYE 开发板上移植 openvela](../quickstart/development_board/ESP32-S3-EYE.md) | AIoT、人机交互、智能家居 | [购买链接](https://item.taobao.com/item.htm?spm=a21n57.sem.item.1.3d75390372IH5V&priceTId=2147816e17537599042042013e18b1&utparam={"aplus_abtest"%3A"63d6c7ec4d03ab8b3f05e1c978046905"}&id=664295688431&ns=1&abbucket=5&xxc=taobaoSearch&pisk=g6ojYejoDsfX9HqOCrvPA5v-azq11L-ehOwtKAIVBoEAXdGZaczT_Ec_5fluWmrq3bNtTbNAbFVVflMssflsIK2T6fh__q8yYxD0jldF5H-EnbrNkflbWSHJBJ2UHLzA82hIcldeTh_PerA4XflBXBtRyJV8HReAXL18pJZTBlevF7e_KNCx6fp7yRy1HsFT68K8Q7QOW5U92geQH1ITMrpSe72TX5hTWLM-ZlsbUKNohpTpMPPB8XDYNGItDh48OaP8E8iSOrFLl7stU0wblWHxA9rsb8nrVyzPQQq-K4lYFktft-g-doesjpQ_1Pi0V-gksn4jpRhg00pOkW3qgunxROItFoNr60aAGQNKmYn32z-pdYnogxmSQOKTUXP-nmE6vpqbDSE7EcRlD5g-Wmz0jsd_s0M-DVsPMMPQLCb1Fyj_FWJWFNbihI1rYxEZcdaYE8RwFL_EIreuFWJWFNbgk82rQL958Af..) | [乐鑫开发者社区](https://www.espressif.com.cn/zh-hans/contact-us/technical-inquiries) |
|
||||
| 乐鑫科技 (Espressif) | [ESP32S3BOX](https://www.espressif.com.cn/zh-hans/news/ESP32-S3-BOX_video) | [ESP32S3](https://www.espressif.com.cn/zh-hans/products/socs/esp32-s3) | [请参考:在 ESP32-S3-EYE 开发板上移植 openvela](../quickstart/development_board/ESP32-S3-EYE.md) | AIoT、人机交互、智能家居 | [购买链接](https://item.taobao.com/item.htm?id=732842971319&pisk=gOJq2JVGWxHVbZ7AiL6a8Sea8mWA3OuCnd_1jhxGcZbcldTwjGsanSVco3xlxawsDtGOQF7yWZ1fnZwNQh8951v15drvUey_hqhvjRW1I2gIdvtYGOBiRBruwraAAiqmCibcqtI6UFpmpvtvDNE4SDOodlr9DuE0sNYGE_jAbOj0IZmPEGIGI-fgn3blyaXGj1j0r_jCvo2ciF4lrGS0IGV0nTblfiWGSFXi43bRbObiw4vHBzS1i0bPYQmK2MCV-nbzL3pPmpFv0ali_LRcgw2CzR2MUi-ZrOVgLf_H9Z1C8UD73O-lbU5Bg2y27hxps_JaomTHmEppsnkr-t9vmBfMKVFM8t8NtKfzjJBVEaXPqpm_9a9PlFvVZDwF1TvCttASwq113M8MHEraIexWAKCJQ2zlWIsdEGJtx57Nsg58WgmIXdd4S55c2g7I40o60-dJbzfdD5FOMmIPRmf065Cc2g7I40PT6sLA4wici&spm=a1z10.3-c.w4002-8715811646.9.4dc69a382dycIm) | [乐鑫开发者社区](https://www.espressif.com.cn/zh-hans/contact-us/technical-inquiries) |
|
||||
| 恒玄科技 (Bestechnic) | [BES2600WM MAIN BOARD V1.1](https://www.fortune-co.com/index.php?s=/Cn/Public/singlePage/catid/176.html) | BES2600WM-AX4F | [Readme](../../../../../vendor_bes/blob/dev-ai-contest-2026/boards/best2003_ep/aos_evb/Readme) | 智能穿戴、AI 玩具 | [联系代理商](https://www.fortune-co.com/Tech/projectDetail/id/64.html) | [联系代理商](https://www.fortune-co.com/Tech/projectDetail/id/64.html) |
|
||||
| 恒玄科技 (Bestechnic) | [BES2600WM MAIN BOARD V1.1](https://www.fortune-co.com/index.php?s=/Cn/Public/singlePage/catid/176.html) | BES2600WM-AX4F | [Readme](../../../../../vendor_bes/blob/dev/boards/best2003_ep/aos_evb/Readme) | 智能穿戴、AI 玩具 | [联系代理商](https://www.fortune-co.com/Tech/projectDetail/id/64.html) | [联系代理商](https://www.fortune-co.com/Tech/projectDetail/id/64.html) |
|
||||
| 旗芯微半导体 | [FC7300F8M-EVB](https://www.flagchip.com.cn/Pro/3/3.html) | [FC7300F8MDT](https://www.flagchip.com.cn/Pro/3/3.html) | [FC7300F8M-EVB 开发板 openvela 运行指南](../quickstart/development_board/fc7300f8m_evb_guide.md) | 域/区控制器、驾驶辅助系统、电池管理系统、电机控制等 | [联系代理商](https://www.flagchip.com.cn/Pro/3/3.html) | [联系代理商](https://www.flagchip.com.cn/Pro/3/3.html) |
|
||||
| 英飞凌半导体 | [TC4D9-EVB](https://itools.infineon.com/aurix_tc4xx_code_examples/documents/Board_Users_Manual_TriBoard-TC4X9-COM-V2_0_0.pdf) | [AURIX ™ TC4x](https://www.infineon.cn/products/microcontroller/32-bit-tricore/aurix-tc4x/tc4dx#products) | [TC4D9-EVB 开发板 openvela 运行指南](../quickstart/development_board/tc4d9_evb_guide.md) | 车辆运动控制器、区域控制器、车载网关等 | [联系代理商](https://www.infineon.cn/contact-us/where-to-buy) | [联系代理商](https://www.infineon.cn/contact-us/where-to-buy) |
|
||||
|
|
@ -19,20 +19,20 @@
|
|||
|
||||
#### 说明
|
||||
|
||||
- 为了便于在 QEMU 环境中快速验证自定义的成员函数与驱动注册功能,本示例将直接在 [drivers_initialize](../../../../../../../nuttx/blob/dev-ai-contest-2026/drivers/drivers_initialize.c) 函数中实现 `struct bt_driver_s` 的成员函数,并完成驱动注册。
|
||||
- 但在实际接入或使用时,建议在 [vendor](../../../../../../../vendor_template/blob/dev-ai-contest-2026/boards/chip_name/board_name/src) 目录下创建一个独立的文件进行代码编写,以便于维护和版本管理。
|
||||
- 为了便于在 QEMU 环境中快速验证自定义的成员函数与驱动注册功能,本示例将直接在 [drivers_initialize](../../../../../../../nuttx/blob/dev/drivers/drivers_initialize.c) 函数中实现 `struct bt_driver_s` 的成员函数,并完成驱动注册。
|
||||
- 但在实际接入或使用时,建议在 [vendor](../../../../../../../vendor_template/blob/dev/boards/chip_name/board_name/src) 目录下创建一个独立的文件进行代码编写,以便于维护和版本管理。
|
||||
|
||||
#### 操作步骤
|
||||
|
||||
1. 在 [drivers_initialize.c](../../../../../../../nuttx/blob/dev-ai-contest-2026/drivers/drivers_initialize.c) 文件中添加 [bt_driver.h](../../../../../../../nuttx/blob/dev-ai-contest-2026/include/nuttx/wireless/bluetooth/bt_driver.h) 头文件引用:
|
||||
1. 在 [drivers_initialize.c](../../../../../../../nuttx/blob/dev/drivers/drivers_initialize.c) 文件中添加 [bt_driver.h](../../../../../../../nuttx/blob/dev/include/nuttx/wireless/bluetooth/bt_driver.h) 头文件引用:
|
||||
|
||||
```C
|
||||
#include <nuttx/wireless/bluetooth/bt_driver.h> /* 添加bt_driver.h头文件引用 */
|
||||
```
|
||||
|
||||
2. 在 [drivers_initialize.c](../../../../../../../nuttx/blob/dev-ai-contest-2026/drivers/drivers_initialize.c) 文件中完成成员函数的实现编写。
|
||||
2. 在 [drivers_initialize.c](../../../../../../../nuttx/blob/dev/drivers/drivers_initialize.c) 文件中完成成员函数的实现编写。
|
||||
|
||||
在 openvela 中,`struct bt_driver_s` 的 `receive` 成员函数已经在 [uart_bth4.c](../../../../../../../nuttx/blob/dev-ai-contest-2026/drivers/serial/uart_bth4.c) 文件中提供了默认实现。因此,开发者或厂商无需重新定义或实现此方法。
|
||||
在 openvela 中,`struct bt_driver_s` 的 `receive` 成员函数已经在 [uart_bth4.c](../../../../../../../nuttx/blob/dev/drivers/serial/uart_bth4.c) 文件中提供了默认实现。因此,开发者或厂商无需重新定义或实现此方法。
|
||||
|
||||
```C
|
||||
/* 以下为示例实现,仅做示范。
|
||||
|
|
@ -68,7 +68,7 @@
|
|||
/* 4. receive成员函数在驱动注册时由openvela指定 */
|
||||
```
|
||||
|
||||
3. 在 [drivers_initialize.c](../../../../../../../nuttx/blob/dev-ai-contest-2026/drivers/drivers_initialize.c) 文件中,完成 `struct bt_driver_s` 结构体的定义。
|
||||
3. 在 [drivers_initialize.c](../../../../../../../nuttx/blob/dev/drivers/drivers_initialize.c) 文件中,完成 `struct bt_driver_s` 结构体的定义。
|
||||
|
||||
以下代码展示了一个完整的 `struct bt_driver_s` 结构体初始化示例,其中函数指针被赋值为上面定义的示例函数:
|
||||
|
||||
|
|
@ -94,13 +94,13 @@
|
|||
|
||||
- `bt_driver_register_with_id(FAR struct bt_driver_s *driver, int id)`:注册指定 id 编号。
|
||||
|
||||
`int bt_driver_register(FAR struct bt_driver_s *drv)` 类型定义可参考头文件 [bt_driver.h](../../../../../../../nuttx/blob/dev-ai-contest-2026/include/nuttx/wireless/bluetooth/bt_driver.h)。对于 `receive()` 成员函数,厂商或开发者无需定义,BTH4 驱动会为其初始化。调用关系如下图所示:
|
||||
`int bt_driver_register(FAR struct bt_driver_s *drv)` 类型定义可参考头文件 [bt_driver.h](../../../../../../../nuttx/blob/dev/include/nuttx/wireless/bluetooth/bt_driver.h)。对于 `receive()` 成员函数,厂商或开发者无需定义,BTH4 驱动会为其初始化。调用关系如下图所示:
|
||||
|
||||

|
||||
|
||||
### 示例
|
||||
|
||||
完成上述实现驱动示例代码编写后,需要在 [drivers_initialize.c](../../../../../../../nuttx/blob/dev-ai-contest-2026/drivers/drivers_initialize.c) 文件内的 `drivers_initialize()` 函数末尾,调用驱动注册 API 完成驱动的注册操作:
|
||||
完成上述实现驱动示例代码编写后,需要在 [drivers_initialize.c](../../../../../../../nuttx/blob/dev/drivers/drivers_initialize.c) 文件内的 `drivers_initialize()` 函数末尾,调用驱动注册 API 完成驱动的注册操作:
|
||||
|
||||
```C
|
||||
void drivers_initialize(void)
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ openvela 的设备驱动依赖于 Pseudo Root File System,类似于 Linux 的
|
|||
|
||||
**系统调用 -> VFS(Virtual File System)-> 驱动**。
|
||||
|
||||
为了理解驱动如何注册到文件系统中,需要先了解相关的数据结构。这些数据结构的定义位于 [`include/nuttx/fs/fs.h`](../../../../../../nuttx/blob/dev-ai-contest-2026/include/nuttx/fs/fs.h)文件中。
|
||||
为了理解驱动如何注册到文件系统中,需要先了解相关的数据结构。这些数据结构的定义位于 [`include/nuttx/fs/fs.h`](../../../../../../nuttx/blob/dev/include/nuttx/fs/fs.h)文件中。
|
||||
|
||||
#### 驱动注册与`inode`
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ openvela 提供通用的 **oneshot** 驱动,即一次性(非周期性)定
|
|||
- **Upper half**:面向应用,由 openvela 提供,无需芯片厂商修改。
|
||||
- **Lower half**:特定平台的硬件控制驱动,芯片厂商需适配提供。
|
||||
|
||||
**oneshot** 驱动相关接口信息在 [oneshot.h](../../../../../../../../nuttx/blob/dev-ai-contest-2026/include/nuttx/timers/oneshot.h) 文件中,同样也分为了 **Upper half** 和 **Lower half** 两层接口。
|
||||
**oneshot** 驱动相关接口信息在 [oneshot.h](../../../../../../../../nuttx/blob/dev/include/nuttx/timers/oneshot.h) 文件中,同样也分为了 **Upper half** 和 **Lower half** 两层接口。
|
||||
|
||||
### 2、Arch_alarm 定时器简介
|
||||
|
||||
|
|
@ -47,7 +47,7 @@ openvela 的 Upper half 部分中的 **`up_timer_initialize`** 函数,必须
|
|||
|
||||
## 三、Arch_alarm API
|
||||
|
||||
`arch_alarm` 提供一系列接口,以满足 sched 模块对定时器的需求。接口信息可在 [arch.h](../../../../../../../../nuttx/blob/dev-ai-contest-2026/include/nuttx/arch.h) 头文件中查找。
|
||||
`arch_alarm` 提供一系列接口,以满足 sched 模块对定时器的需求。接口信息可在 [arch.h](../../../../../../../../nuttx/blob/dev/include/nuttx/arch.h) 头文件中查找。
|
||||
|
||||
### 1、接口分类
|
||||
|
||||
|
|
@ -193,7 +193,7 @@ grep -rE "CONFIG_ONESHOT|CONFIG_ALARM_ARCH|CONFIG_ARCH_HAVE_TICKLESS|CONFIG_ARCH
|
|||
|
||||
##### 实例创建:调用 `oneshot_initialize`
|
||||
|
||||
在板级初始化阶段,需调用**厂商自定义的初始化函数**,完成 [struct oneshot_lowerhalf_s](../../../../../../../../nuttx/blob/dev-ai-contest-2026/include/nuttx/timers/oneshot.h#L226) 结构体的分配与初始化。该函数由 openvela 框架提供,原型如下:
|
||||
在板级初始化阶段,需调用**厂商自定义的初始化函数**,完成 [struct oneshot_lowerhalf_s](../../../../../../../../nuttx/blob/dev/include/nuttx/timers/oneshot.h#L226) 结构体的分配与初始化。该函数由 openvela 框架提供,原型如下:
|
||||
|
||||
```C
|
||||
/****************************************************************************
|
||||
|
|
@ -224,7 +224,7 @@ FAR struct oneshot_lowerhalf_s *oneshot_initialize(int chan, uint16_t resolution
|
|||
|
||||
##### 设备注册:调用 `oneshot_register`
|
||||
|
||||
将 `oneshot_initialize` 返回的实例与系统设备模型绑定,注册字符设备节点(如 `/dev/oneshot`),并关联文件操作接口 `struct file_operations g_oneshot_ops`。函数 [oneshot_register](../../../../../../../../nuttx/blob/dev-ai-contest-2026/drivers/timers/oneshot.c#L291) 原型如下:
|
||||
将 `oneshot_initialize` 返回的实例与系统设备模型绑定,注册字符设备节点(如 `/dev/oneshot`),并关联文件操作接口 `struct file_operations g_oneshot_ops`。函数 [oneshot_register](../../../../../../../../nuttx/blob/dev/drivers/timers/oneshot.c#L291) 原型如下:
|
||||
|
||||
```C
|
||||
/****************************************************************************
|
||||
|
|
@ -272,7 +272,7 @@ int oneshot_register(FAR const char *devname,
|
|||
|
||||
#### 2.2 参考实现与调试
|
||||
|
||||
- 结构体定义:`struct oneshot_lowerhalf_s` 的成员说明详见 [oneshot.h](../../../../../../../../nuttx/blob/dev-ai-contest-2026/include/nuttx/timers/oneshot.h#L226),需按硬件特性填充中断触发、定时器启动等函数指针。
|
||||
- 结构体定义:`struct oneshot_lowerhalf_s` 的成员说明详见 [oneshot.h](../../../../../../../../nuttx/blob/dev/include/nuttx/timers/oneshot.h#L226),需按硬件特性填充中断触发、定时器启动等函数指针。
|
||||
- 实例代码:具体驱动适配示例可参考[驱动适配实例-初始化章节](#1初始化流程),注意根据目标平台(如 ARM Cortex-M/RISC-V)调整硬件寄存器操作逻辑。
|
||||
- 调试建议:初始化失败时,检查 `CONFIG_ONESHOT`/`CONFIG_ALARM_ARCH` 是否正确使能,并利用串口日志打印 `oneshot_initialize` 的返回值。
|
||||
|
||||
|
|
@ -296,7 +296,7 @@ int oneshot_register(FAR const char *devname,
|
|||
|
||||
#### 3.2 核心接口说明
|
||||
|
||||
Upper-half 接口定义于 [arch.h](../../../../../../../../nuttx/blob/dev-ai-contest-2026/include/nuttx/arch.h#L1460),主要供调度器(Sched)调用。
|
||||
Upper-half 接口定义于 [arch.h](../../../../../../../../nuttx/blob/dev/include/nuttx/arch.h#L1460),主要供调度器(Sched)调用。
|
||||
|
||||
### 4、Lower-half 接口
|
||||
|
||||
|
|
@ -323,7 +323,7 @@ Upper-half 接口定义于 [arch.h](../../../../../../../../nuttx/blob/dev-ai-co
|
|||
- 厂商选择
|
||||
|
||||
- 根据硬件能力选择实现 `timespec` 或 `tick` 接口组。
|
||||
- 未实现的接口组可通过 openvela 内置的[转换函数](../../../../../../../../nuttx/blob/dev-ai-contest-2026/include/nuttx/timers/oneshot.h)自动映射。
|
||||
- 未实现的接口组可通过 openvela 内置的[转换函数](../../../../../../../../nuttx/blob/dev/include/nuttx/timers/oneshot.h)自动映射。
|
||||
|
||||
- 性能优化
|
||||
|
||||
|
|
@ -331,7 +331,7 @@ Upper-half 接口定义于 [arch.h](../../../../../../../../nuttx/blob/dev-ai-co
|
|||
|
||||
#### 4.2 核心接口说明
|
||||
|
||||
`struct oneshot_operations_s` 定义于 [oneshot.h](../../../../../../../../nuttx/blob/dev-ai-contest-2026/include/nuttx/timers/oneshot.h),其成员函数如下。
|
||||
`struct oneshot_operations_s` 定义于 [oneshot.h](../../../../../../../../nuttx/blob/dev/include/nuttx/timers/oneshot.h),其成员函数如下。
|
||||
|
||||
##### 定时器控制接口
|
||||
|
||||
|
|
@ -432,7 +432,7 @@ board_late_initialize (或 board_app_initialize)
|
|||
|
||||
#### 1.2 关键代码实现
|
||||
|
||||
- 硬件(Arch 层)定时器初始化,参考代码 [arch/risc-v/src/bl602/bl602_timerisr.c](../../../../../../../../nuttx/blob/dev-ai-contest-2026/arch/risc-v/src/bl602/bl602_timerisr.c#L57)。
|
||||
- 硬件(Arch 层)定时器初始化,参考代码 [arch/risc-v/src/bl602/bl602_timerisr.c](../../../../../../../../nuttx/blob/dev/arch/risc-v/src/bl602/bl602_timerisr.c#L57)。
|
||||
|
||||
```C
|
||||
/****************************************************************************
|
||||
|
|
@ -456,7 +456,7 @@ board_late_initialize (或 board_app_initialize)
|
|||
}
|
||||
```
|
||||
|
||||
- Oneshot 驱动实例化,参考代码 [arch/risc-v/src/bl602/bl602_oneshot_lowerhalf.c](../../../../../../../../nuttx/blob/dev-ai-contest-2026/arch/risc-v/src/bl602/bl602_oneshot_lowerhalf.c#L361)。
|
||||
- Oneshot 驱动实例化,参考代码 [arch/risc-v/src/bl602/bl602_oneshot_lowerhalf.c](../../../../../../../../nuttx/blob/dev/arch/risc-v/src/bl602/bl602_oneshot_lowerhalf.c#L361)。
|
||||
|
||||
```C
|
||||
struct oneshot_lowerhalf_s *oneshot_initialize(int chan,
|
||||
|
|
@ -520,7 +520,7 @@ board_late_initialize (或 board_app_initialize)
|
|||
|
||||
### 2、Lower-half 接口实现
|
||||
|
||||
操作接口绑定如下,详细代码请参考 [arch/risc-v/src/bl602/bl602_oneshot_lowerhalf.c](../../../../../../../../nuttx/blob/dev-ai-contest-2026/arch/risc-v/src/bl602/bl602_oneshot_lowerhalf.c#L96)。
|
||||
操作接口绑定如下,详细代码请参考 [arch/risc-v/src/bl602/bl602_oneshot_lowerhalf.c](../../../../../../../../nuttx/blob/dev/arch/risc-v/src/bl602/bl602_oneshot_lowerhalf.c#L96)。
|
||||
|
||||
```C
|
||||
/* "Lower half" driver methods */
|
||||
|
|
@ -545,7 +545,7 @@ openvela 提供标准定时器接口,支持高精度时间管理与设备控
|
|||
man timer_create
|
||||
```
|
||||
|
||||
详细代码请参见 [include/time.h](../../../../../../../../nuttx/blob/dev-ai-contest-2026/include/time.h#L233)。
|
||||
详细代码请参见 [include/time.h](../../../../../../../../nuttx/blob/dev/include/time.h#L233)。
|
||||
|
||||
```C
|
||||
/*
|
||||
|
|
@ -600,7 +600,7 @@ int timer_getoverrun(timer_t timerid);
|
|||
|
||||
### 2、IOCTL API
|
||||
|
||||
应用程序可以通过 `ioctl` 函数直接操作 Oneshot 定时器。使用该功能之前,需在系统启动(bringup)过程中注册 `/dev/oneshot` 设备节点。请参考头文件 [include/nuttx/timers/oneshot.h](../../../../../../../../nuttx/blob/dev-ai-contest-2026/include/nuttx/timers/oneshot.h#L41) 获取当前支持的 `ioctl` 命令。命令简介如下:
|
||||
应用程序可以通过 `ioctl` 函数直接操作 Oneshot 定时器。使用该功能之前,需在系统启动(bringup)过程中注册 `/dev/oneshot` 设备节点。请参考头文件 [include/nuttx/timers/oneshot.h](../../../../../../../../nuttx/blob/dev/include/nuttx/timers/oneshot.h#L41) 获取当前支持的 `ioctl` 命令。命令简介如下:
|
||||
|
||||
- `OSIOC_START`
|
||||
- 功能:启动 Oneshot 定时器。
|
||||
|
|
|
|||
|
|
@ -164,15 +164,15 @@ grep -rE "CONFIG_TIMER|CONFIG_TIMER_ARCH|CONFIG_ARCH_HAVE_TICKLESS|CONFIG_ARCH_H
|
|||
|
||||
在 **board** 初始化过程,需要调用具体 **Vendor** 实现的 `***_timer_initialize` 函数完成初始化。该函数会完成以下操作:
|
||||
|
||||
1. 分配并初始化 [struct timer_lowerhalf_s](../../../../../../../../nuttx/blob/dev-ai-contest-2026/include/nuttx/timers/timer.h) 结构实例。
|
||||
2. 利用 [timer_register](../../../../../../../../nuttx/blob/dev-ai-contest-2026/drivers/timers/timer.c) 函数将 `timer_lowerhalf_s` 实例注册为 Timer 驱动。
|
||||
1. 分配并初始化 [struct timer_lowerhalf_s](../../../../../../../../nuttx/blob/dev/include/nuttx/timers/timer.h) 结构实例。
|
||||
2. 利用 [timer_register](../../../../../../../../nuttx/blob/dev/drivers/timers/timer.c) 函数将 `timer_lowerhalf_s` 实例注册为 Timer 驱动。
|
||||
|
||||
- 注册过程会生成 `/dev/timer` 设备节点。
|
||||
- 同时将 `struct file_operations` 和 `g_timerops` 实例绑定到 `timer_lowerhalf_s` 实例。
|
||||
|
||||
在平台代码中,需要实现 `up_timer_initialize` 函数,用于调用 `up_timer_set_lowerhalf` 函数,将 `***_timer_initialize` 返回的实例绑定到系统中,作为系统定时器。
|
||||
|
||||
相关接口定义在:[/include/nuttx/timers/timer.h](../../../../../../../../nuttx/blob/dev-ai-contest-2026/include/nuttx/timers/timer.h)。
|
||||
相关接口定义在:[/include/nuttx/timers/timer.h](../../../../../../../../nuttx/blob/dev/include/nuttx/timers/timer.h)。
|
||||
|
||||
#### `timer_register` 函数说明
|
||||
|
||||
|
|
@ -244,7 +244,7 @@ FAR void *timer_register(FAR const char *path,
|
|||
|
||||
#### 接口定义
|
||||
|
||||
以下是 [struct timer_ops_s](../../../../../../../../nuttx/blob/dev-ai-contest-2026/include/nuttx/timers/timer.h) 的详细定义:
|
||||
以下是 [struct timer_ops_s](../../../../../../../../nuttx/blob/dev/include/nuttx/timers/timer.h) 的详细定义:
|
||||
|
||||
```C
|
||||
struct timer_ops_s
|
||||
|
|
@ -487,7 +487,7 @@ struct timer_lowerhalf_s *systick_initialize(bool coreclk,
|
|||
|
||||
在 ARMv7-M 的 Arch Timer 适配中,`lower-half` 方法的出现形式如下:
|
||||
|
||||
文件路径: [arch/arm/src/armv7-m/arm_systick.c](../../../../../../../../nuttx/blob/dev-ai-contest-2026/arch/arm/src/armv7-m/arm_systick.c)
|
||||
文件路径: [arch/arm/src/armv7-m/arm_systick.c](../../../../../../../../nuttx/blob/dev/arch/arm/src/armv7-m/arm_systick.c)
|
||||
|
||||
```C
|
||||
/* "Lower half" driver methods */
|
||||
|
|
@ -510,7 +510,7 @@ static const struct timer_ops_s g_systick_ops =
|
|||
|
||||
以下是定时相关 POSIX API 的简要概述,这些接口的具体使用方法请参考相关的 `man` 页面。
|
||||
|
||||
头文件位置:[include/time.h](../../../../../../../../nuttx/blob/dev-ai-contest-2026/include/time.h)
|
||||
头文件位置:[include/time.h](../../../../../../../../nuttx/blob/dev/include/time.h)
|
||||
|
||||
1. `timer_create`
|
||||
|
||||
|
|
@ -586,7 +586,7 @@ static const struct timer_ops_s g_systick_ops =
|
|||
|
||||
#### 支持的 IOCTL 命令
|
||||
|
||||
以下是当前支持的 IOCTL 命令,相关接口定义在 [include/nuttx/timers/timer.h](../../../../../../../../nuttx/blob/dev-ai-contest-2026/include/nuttx/timers/timer.h) 中:
|
||||
以下是当前支持的 IOCTL 命令,相关接口定义在 [include/nuttx/timers/timer.h](../../../../../../../../nuttx/blob/dev/include/nuttx/timers/timer.h) 中:
|
||||
|
||||
- `TCIOC_START`:启动定时器。
|
||||
- `TCIOC_STOP`:停止定时器。
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ openvela 的 Framebuffer 用户接口类似于 Linux 系统,通过 VFS(虚
|
|||
|
||||
### 2、下层驱动接口
|
||||
|
||||
openvela 的 Framebuffer 驱动接口用于管理 LCD 设备,设计相对简单。开发者可以参考 [video/fb.h](../../../../../../nuttx/blob/dev-ai-contest-2026/include/nuttx/video/fb.h) 和 [/drivers/video/fb.c](../../../../../../nuttx/blob/dev-ai-contest-2026/drivers/video/fb.c) 文件中的实现。以下是 `fb_register()` 函数的源码,展示了与 Framebuffer 设备驱动相关的重要部分:
|
||||
openvela 的 Framebuffer 驱动接口用于管理 LCD 设备,设计相对简单。开发者可以参考 [video/fb.h](../../../../../../nuttx/blob/dev/include/nuttx/video/fb.h) 和 [/drivers/video/fb.c](../../../../../../nuttx/blob/dev/drivers/video/fb.c) 文件中的实现。以下是 `fb_register()` 函数的源码,展示了与 Framebuffer 设备驱动相关的重要部分:
|
||||
|
||||
```C
|
||||
int fb_register(int display, int plane)
|
||||
|
|
@ -340,5 +340,5 @@ CONFIG_VIDEO_FB
|
|||
|
||||
以下是与 Framebuffer 驱动相关的代码仓库链接:
|
||||
|
||||
- [fb.c](../../../../../../nuttx/blob/dev-ai-contest-2026/drivers/video/fb.c):Framebuffer 驱动的实现文件。
|
||||
- [fb.h](../../../../../../nuttx/blob/dev-ai-contest-2026/include/nuttx/video/fb.h):Framebuffer 驱动的接口定义。
|
||||
- [fb.c](../../../../../../nuttx/blob/dev/drivers/video/fb.c):Framebuffer 驱动的实现文件。
|
||||
- [fb.h](../../../../../../nuttx/blob/dev/include/nuttx/video/fb.h):Framebuffer 驱动的接口定义。
|
||||
|
|
|
|||
|
|
@ -347,5 +347,5 @@ errout_with_state:
|
|||
|
||||
## 五、相关仓
|
||||
|
||||
- [nuttx/include/nuttx/lcd/lcd.h](../../../../../../nuttx/blob/dev-ai-contest-2026/include/nuttx/lcd/lcd.h)
|
||||
- [nuttx/drivers/lcd/lcd_framebuffer.c](../../../../../../nuttx/blob/dev-ai-contest-2026/drivers/lcd/lcd_framebuffer.c)
|
||||
- [nuttx/include/nuttx/lcd/lcd.h](../../../../../../nuttx/blob/dev/include/nuttx/lcd/lcd.h)
|
||||
- [nuttx/drivers/lcd/lcd_framebuffer.c](../../../../../../nuttx/blob/dev/drivers/lcd/lcd_framebuffer.c)
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ libuv 的核心是基于 [poll](https://man7.org/linux/man-pages/man2/poll.2.htm
|
|||
|
||||

|
||||
|
||||
openvela 的 Framebuffer 驱动框架提供了 `poll` 所需要的[接口](../../../../../../nuttx/blob/dev-ai-contest-2026/drivers/video/fb.c),用于监控 Framebuffer 是否处于可写状态:
|
||||
openvela 的 Framebuffer 驱动框架提供了 `poll` 所需要的[接口](../../../../../../nuttx/blob/dev/drivers/video/fb.c),用于监控 Framebuffer 是否处于可写状态:
|
||||
|
||||
```C
|
||||
/****************************************************************************
|
||||
|
|
@ -531,7 +531,7 @@ static void lcdc_te_irq(int irq, void *context, void *arg)
|
|||
|
||||
### 2、(不推荐)阻塞方式
|
||||
|
||||
使用信号量进行同步,相当于对 Framebuffer 进行加锁操作,渲染器每次开始渲染时都需要拿到锁才能进行绘制,否则就会处于阻塞状态,代码请参见此 [链接](../../../../../../nuttx/blob/dev-ai-contest-2026/arch/arm/src/stm32/stm32_ltdc.c)。
|
||||
使用信号量进行同步,相当于对 Framebuffer 进行加锁操作,渲染器每次开始渲染时都需要拿到锁才能进行绘制,否则就会处于阻塞状态,代码请参见此 [链接](../../../../../../nuttx/blob/dev/arch/arm/src/stm32/stm32_ltdc.c)。
|
||||
|
||||
## 五、相关仓库
|
||||
|
||||
|
|
|
|||
|
|
@ -291,7 +291,7 @@ openvela 提供多种资源同步机制,以确保多线程环境下的数据
|
|||
#### 参考
|
||||
|
||||
- 信号量的详细说明请参见[信号量机制](./resource_sync/semaphore_mechanism.md)。
|
||||
- 相关实现代码请参见 [openvela semaphore](../../../../../../../open-vela/nuttx/tree/dev-ai-contest-2026/sched/semaphore)。
|
||||
- 相关实现代码请参见 [openvela semaphore](../../../../../../../open-vela/nuttx/tree/dev/sched/semaphore)。
|
||||
|
||||
### 2、互斥体
|
||||
|
||||
|
|
@ -310,7 +310,7 @@ openvela 提供多种资源同步机制,以确保多线程环境下的数据
|
|||
|
||||
#### 参考
|
||||
|
||||
相关实现代码可参考 [openvela mutex](../../../../../../../open-vela/nuttx/tree/dev-ai-contest-2026/libs/libc/misc/lib_mutex.c)。
|
||||
相关实现代码可参考 [openvela mutex](../../../../../../../open-vela/nuttx/tree/dev/libs/libc/misc/lib_mutex.c)。
|
||||
|
||||
### 3、自旋锁(SpinLock)
|
||||
|
||||
|
|
@ -330,7 +330,7 @@ openvela 提供多种资源同步机制,以确保多线程环境下的数据
|
|||
|
||||
#### 参考
|
||||
|
||||
相关实现代码可参考 [openvela spinlock](../../../../../../../open-vela/nuttx/tree/dev-ai-contest-2026/include/nuttx/spinlock.h)。
|
||||
相关实现代码可参考 [openvela spinlock](../../../../../../../open-vela/nuttx/tree/dev/include/nuttx/spinlock.h)。
|
||||
|
||||
### 4、原子操作
|
||||
|
||||
|
|
@ -349,7 +349,7 @@ openvela 提供多种资源同步机制,以确保多线程环境下的数据
|
|||
#### 参考
|
||||
|
||||
- 原子操作的详细说明,请参见[原子操作接口](./resource_sync/atomic_operation.md)。
|
||||
- 相关接口代码请参见 [openvela atomic](../../../../../../../open-vela/nuttx/tree/dev-ai-contest-2026/include/nuttx/atomic.h)。
|
||||
- 相关接口代码请参见 [openvela atomic](../../../../../../../open-vela/nuttx/tree/dev/include/nuttx/atomic.h)。
|
||||
|
||||
### 5、开关中断(IRQ Control)
|
||||
|
||||
|
|
@ -367,7 +367,7 @@ openvela 通过 `up_irq_xxx()` 实现对本 CPU 的中断屏蔽控制,这些
|
|||
#### 参考
|
||||
|
||||
- 中断系统适配详情请参考[中断系统适配指南](./../../chip_porting/Interrupt_System_Adaptation_Guide.md)。
|
||||
- 接口代码请参考 [openvela irq 接口](../../../../../../../open-vela/nuttx/tree/dev-ai-contest-2026/include/nuttx/irq.h)。
|
||||
- 接口代码请参考 [openvela irq 接口](../../../../../../../open-vela/nuttx/tree/dev/include/nuttx/irq.h)。
|
||||
|
||||
### 6、开关调度(Scheduler Control)
|
||||
|
||||
|
|
@ -447,7 +447,7 @@ int nsh_builtin(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd,
|
|||
|
||||
#### 参考
|
||||
|
||||
实现代码请参考 [openvela sched lock](../../../../../../../open-vela/nuttx/tree/dev-ai-contest-2026/sched/sched/sched_lock.c) 和 [openvela sched unlock](../../../../../../../open-vela/nuttx/tree/dev-ai-contest-2026/sched/sched/sched_unlock.c)。
|
||||
实现代码请参考 [openvela sched lock](../../../../../../../open-vela/nuttx/tree/dev/sched/sched/sched_lock.c) 和 [openvela sched unlock](../../../../../../../open-vela/nuttx/tree/dev/sched/sched/sched_unlock.c)。
|
||||
|
||||
### 7、Pthread 互斥锁(Pthread Mutex)
|
||||
|
||||
|
|
@ -463,7 +463,7 @@ POSIX 线程标准提供的互斥锁机制,仅用于 Pthread 线程。
|
|||
|
||||
#### 参考
|
||||
|
||||
实现代码请参考 [openvela pthread](../../../../../../../open-vela/nuttx/tree/dev-ai-contest-2026/libs/libc/pthread)。
|
||||
实现代码请参考 [openvela pthread](../../../../../../../open-vela/nuttx/tree/dev/libs/libc/pthread)。
|
||||
|
||||
### 8、同步机制的选择
|
||||
|
||||
|
|
@ -525,7 +525,7 @@ openvela 支持三种工作队列类型,各具不同特性:
|
|||
#### 参考
|
||||
|
||||
- 工作队列的详细说明,可参考[工作队列](./IPC/work_queue.md)。
|
||||
- 实现代码请查看 [openvela wqueue](../../../../../../../open-vela/nuttx/tree/dev-ai-contest-2026/sched/wqueue)。
|
||||
- 实现代码请查看 [openvela wqueue](../../../../../../../open-vela/nuttx/tree/dev/sched/wqueue)。
|
||||
|
||||
### 2、消息队列
|
||||
|
||||
|
|
@ -551,7 +551,7 @@ openvela 支持三种工作队列类型,各具不同特性:
|
|||
#### 参考
|
||||
|
||||
- 消息队列的详细说明请参考[消息队列](./IPC/message_queue.md)。
|
||||
- 实现代码请参考 [openvela mqueue](../../../../../../../open-vela/nuttx/tree/dev-ai-contest-2026/sched/mqueue) 源码。
|
||||
- 实现代码请参考 [openvela mqueue](../../../../../../../open-vela/nuttx/tree/dev/sched/mqueue) 源码。
|
||||
|
||||
### 3、通信方案的选择
|
||||
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@ openvela 的原子操作采用分层实现策略,优先利用硬件特性,
|
|||
|
||||
开发者可以通过内核配置项 `CONFIG_LIBC_ARCH_ATOMIC` 来控制此行为。若启用此选项,系统将链接 `arch_atomic.c` 文件中定义的软件模拟函数,而非编译器内建函数。
|
||||
|
||||
- **源码路径**:[nuttx/libs/libc/machine/arch_atomic.c](../../../../../../../nuttx/blob/dev-ai-contest-2026/libs/libc/machine/arch_atomic.c)
|
||||
- **相关构建配置**:[nuttx/libs/libc/machine/Make.defs](../../../../../../../nuttx/blob/dev-ai-contest-2026/libs/libc/machine/Make.defs)
|
||||
- **源码路径**:[nuttx/libs/libc/machine/arch_atomic.c](../../../../../../../nuttx/blob/dev/libs/libc/machine/arch_atomic.c)
|
||||
- **相关构建配置**:[nuttx/libs/libc/machine/Make.defs](../../../../../../../nuttx/blob/dev/libs/libc/machine/Make.defs)
|
||||
|
||||
## 二、 使用方法
|
||||
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ void up_trigger_irq(int irq, cpu_set_t cpuset)
|
|||
|
||||
### 2、需要定义的中断相关宏
|
||||
|
||||
除上面的函数实现,厂商还需定义一系列中断相关的宏,用于描述 NVIC(Nested vectored interrupt controller) 的配置,这些宏需定义在`chips/chip_name/include/irq.h` 文件中。可参考[RTL8720C 示例](../../../../../../../nuttx/blob/dev-ai-contest-2026/arch/arm/src/rtl8720c/include/irq.h)。
|
||||
除上面的函数实现,厂商还需定义一系列中断相关的宏,用于描述 NVIC(Nested vectored interrupt controller) 的配置,这些宏需定义在`chips/chip_name/include/irq.h` 文件中。可参考[RTL8720C 示例](../../../../../../../nuttx/blob/dev/arch/arm/src/rtl8720c/include/irq.h)。
|
||||
|
||||
以下是必须实现的宏及其功能说明:
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
驱动程序通过 `pm.h` 中定义的回调结构体和注册函数与 PM 框架进行交互。
|
||||
|
||||
**相关头文件**:[openvela include/nuttx/power/pm.h](../../../../../../nuttx/blob/dev-ai-contest-2026/include/nuttx/power/pm.h)
|
||||
**相关头文件**:[openvela include/nuttx/power/pm.h](../../../../../../nuttx/blob/dev/include/nuttx/power/pm.h)
|
||||
|
||||
### 1、`pm_state_e` 电源状态枚举
|
||||
|
||||
|
|
@ -115,7 +115,7 @@ int pm_domain_register(int domain, FAR struct pm_callback_s *cb)
|
|||
|
||||
本节以 stm32f7 的串口驱动为例,展示如何一步步实现 PM 功能。
|
||||
|
||||
**源码参考**:[arch/arm/src/stm32f7/stm32_serial.c](../../../../../../nuttx/blob/dev-ai-contest-2026/arch/arm/src/stm32f7/stm32_serial.c)
|
||||
**源码参考**:[arch/arm/src/stm32f7/stm32_serial.c](../../../../../../nuttx/blob/dev/arch/arm/src/stm32f7/stm32_serial.c)
|
||||
|
||||
### 步骤 1:定义回调结构体和状态变量
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
**目标读者**:需要为特定硬件平台开发或适配电源管理功能的嵌入式系统开发者。
|
||||
|
||||
**相关头文件**:[openvela include/nuttx/power/pm.h](../../../../../../nuttx/blob/dev-ai-contest-2026/include/nuttx/power/pm.h)
|
||||
**相关头文件**:[openvela include/nuttx/power/pm.h](../../../../../../nuttx/blob/dev/include/nuttx/power/pm.h)
|
||||
|
||||
## 一、核心概念
|
||||
|
||||
|
|
@ -241,7 +241,7 @@ Governor 是 PM 框架的核心,它实现了不同的电源管理策略。open
|
|||
|
||||
- **默认行为**:如果开启了选项,`pm_initialize` 会默认所有 domain 使用该策略。
|
||||
|
||||
- **源码参考**:[openvela drivers/power/pm/greedy_governor.c](../../../../../../nuttx/blob/dev-ai-contest-2026/drivers/power/pm/greedy_governor.c)
|
||||
- **源码参考**:[openvela drivers/power/pm/greedy_governor.c](../../../../../../nuttx/blob/dev/drivers/power/pm/greedy_governor.c)
|
||||
|
||||
- **配置选项**:
|
||||
|
||||
|
|
@ -260,7 +260,7 @@ Governor 是 PM 框架的核心,它实现了不同的电源管理策略。open
|
|||
|
||||
- **默认行为**:若未启用 `greedy` 决策者但启用了 `activity` 决策者,则后者会成为所有域的默认选择。
|
||||
|
||||
- **源码参考**:[openvela drivers/power/pm/activity_governor.c](../../../../../../nuttx/blob/dev-ai-contest-2026/drivers/power/pm/activity_governor.c)
|
||||
- **源码参考**:[openvela drivers/power/pm/activity_governor.c](../../../../../../nuttx/blob/dev/drivers/power/pm/activity_governor.c)
|
||||
|
||||
- **说明**:每种时间可配置,通过配置传入进入/退出某个功耗状态的时间数据,所有 domain 都会被配置成同样的数据。
|
||||
|
||||
|
|
@ -298,7 +298,7 @@ Governor 是 PM 框架的核心,它实现了不同的电源管理策略。open
|
|||
pm_set_governor(PM_IDLE_DOMAIN, pm_stability_governor_initialize());
|
||||
```
|
||||
|
||||
- **源码参考**:[openvela drivers/power/pm/stability_governor.c](../../../../../../nuttx/blob/dev-ai-contest-2026/drivers/power/pm/stability_governor.c)
|
||||
- **源码参考**:[openvela drivers/power/pm/stability_governor.c](../../../../../../nuttx/blob/dev/drivers/power/pm/stability_governor.c)
|
||||
|
||||
- **关键实现细节**:当系统从 `SLEEP` 状态唤醒并返回 `IDLE` 时,无法利用 `last_state` 进行 `WFI` 维持时间检测。此时,它会从配置列表中选择一个阈值不为零的最深功耗级别(例如,如果 `SLEEP` 阈值为 0,`STANDBY` 阈值为 10,则会选择 `STANDBY`)作为新的检测基准。
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
初始化 openvela 仓库时出现以下错误:
|
||||
|
||||
```Bash
|
||||
repo init --partial-clone -u git@gitee.com:open-vela/manifests.git -b dev-ai-contest-2026 -m openvela.xml --git-lfs
|
||||
repo init --partial-clone -u git@gitee.com:open-vela/manifests.git -b dev -m openvela.xml --git-lfs
|
||||
```
|
||||
|
||||

|
||||
|
|
@ -86,7 +86,7 @@ fatal: unable to access 'https://gerrit.googlesource.com/git-repo/': Failed to c
|
|||
- Github:
|
||||
|
||||
```Bash
|
||||
repo init --partial-clone -u https://github.com/open-vela/manifests.git -b dev-ai-contest-2026 -m openvela.xml --git-lfs
|
||||
repo init --partial-clone -u https://github.com/open-vela/manifests.git -b dev -m openvela.xml --git-lfs
|
||||
|
||||
|
||||
# Install Git LFS (Large File Storage) for managing large files
|
||||
|
|
@ -100,7 +100,7 @@ fatal: unable to access 'https://gerrit.googlesource.com/git-repo/': Failed to c
|
|||
- Gitee:
|
||||
|
||||
```Bash
|
||||
repo init --partial-clone -u https://gitee.com/open-vela/manifests.git -b dev-ai-contest-2026 -m openvela.xml --git-lfs
|
||||
repo init --partial-clone -u https://gitee.com/open-vela/manifests.git -b dev -m openvela.xml --git-lfs
|
||||
|
||||
|
||||
# Install Git LFS (Large File Storage) for managing large files
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
#### 3. IDE 什么时候上线?
|
||||
|
||||
预计于 2026 年初正式上线。
|
||||
已上线。openvela 已正式发布 VS Code 插件,支持 Ubuntu 环境下完成项目创建、编译构建、系统调试与应用开发全流程,详见 [openvela VS Code 插件使用指南](../quickstart/vscode_plugin_usage.md)。
|
||||
|
||||
#### 4. 源码仓库的 Gitee 和 GitHub 版本有区别吗?
|
||||
|
||||
|
|
@ -147,7 +147,7 @@ openvela 操作系统屏蔽了底层架构差异,底层是 A 系列还是 M
|
|||
|
||||
#### 24. 快应用打包生成的 RPK 文件可以直接在 openvela 设备上运行吗?
|
||||
|
||||
目前暂时不行。快应用框架引擎(Runtime)计划于 **2026 年 2 月份** 左右以库的形式开源并集成进入系统。目前阶段建议使用模拟器进行学习和开发。
|
||||
目前暂时不行。快应用框架引擎(Runtime)计划于 **2026 年 6 月份** 左右以库的形式开源并集成进入系统。目前阶段建议使用模拟器进行学习和开发。
|
||||
|
||||
### 五、硬件适配与移植
|
||||
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@
|
|||
|
||||
### 1、理解 `esp32s3-eye` 板级代码结构
|
||||
|
||||
在进行配置之前,请先熟悉 `esp32s3-eye` 的板级支持包(BSP)[目录结构](../../../../../../nuttx/tree/dev-ai-contest-2026/boards/xtensa/esp32s3/esp32s3-eye)。这有助于您理解各个文件的作用。
|
||||
在进行配置之前,请先熟悉 `esp32s3-eye` 的板级支持包(BSP)[目录结构](../../../../../../nuttx/tree/dev/boards/xtensa/esp32s3/esp32s3-eye)。这有助于您理解各个文件的作用。
|
||||
|
||||
```bash
|
||||
esp32s3-eye/
|
||||
|
|
@ -184,8 +184,8 @@ rm nuttx/Make.defs
|
|||
|
||||
## 六、参考文档
|
||||
|
||||
- [esp32s3-eye](../../../../../../nuttx/tree/dev-ai-contest-2026/boards/xtensa/esp32s3/esp32s3-eye)
|
||||
- [defconfig](../../../../../../vendor_espressif/blob/dev-ai-contest-2026/boards/esp32s3/esp32s3-eye/configs/openvela/defconfig)
|
||||
- [esp32s3-eye](../../../../../../nuttx/tree/dev/boards/xtensa/esp32s3/esp32s3-eye)
|
||||
- [defconfig](../../../../../../vendor_espressif/blob/dev/boards/esp32s3/esp32s3-eye/configs/openvela/defconfig)
|
||||
- [Managing esptool on virtual environment](https://nuttx.apache.org/docs/latest/platforms/xtensa/esp32s3/index.html#managing-esptool-on-virtual-environment)
|
||||
|
||||
## 附录 A: Wi-Fi 功能 defconfig
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@
|
|||
|
||||
首先,在 `nuttx/boards/arm/stm32/` 目录下,创建一个名为 `stm32f407-robomaster` 的新目录,并建立如下的子目录和文件结构。
|
||||
|
||||
**代码路径**: [`nuttx/boards/arm/stm32/stm32f407-robomaster/`](./../../../../../../nuttx/tree/dev-ai-contest-2026/boards/arm/stm32/stm32f407-robomaster)
|
||||
**代码路径**: [`nuttx/boards/arm/stm32/stm32f407-robomaster/`](./../../../../../../nuttx/tree/dev/boards/arm/stm32/stm32f407-robomaster)
|
||||
|
||||
```Plain
|
||||
stm32f407-robomaster
|
||||
|
|
|
|||
|
|
@ -113,8 +113,8 @@
|
|||
|
||||
`openvela` 的代码遵循分层设计。了解关键目录有助于您进行后续的定制开发。
|
||||
|
||||
- **应用层 (Examples)**:[nuttx-apps/examples/leds](../../../../../../../open-vela/nuttx-apps/tree/dev-ai-contest-2026/examples/leds)
|
||||
- **板级支持包 (****BSP****)**:[nuttx/boards/arm/stm32/stm32f411-minimum](../../../../../../../open-vela/nuttx/tree/dev-ai-contest-2026/boards/arm/stm32/stm32f411-minimum)
|
||||
- **应用层 (Examples)**:[nuttx-apps/examples/leds](../../../../../../../open-vela/nuttx-apps/tree/dev/examples/leds)
|
||||
- **板级支持包 (****BSP****)**:[nuttx/boards/arm/stm32/stm32f411-minimum](../../../../../../../open-vela/nuttx/tree/dev/boards/arm/stm32/stm32f411-minimum)
|
||||
|
||||
下表简述了核心目录的功能:
|
||||
|
||||
|
|
@ -478,7 +478,7 @@
|
|||
|
||||
### 3、`packages/demos` 和 `nuttx/apps/examples` 目录有什么区别
|
||||
|
||||
- https://github.com/open-vela/nuttx-apps/tree/dev-ai-contest-2026/examples
|
||||
- https://github.com/open-vela/nuttx-apps/tree/dev/examples
|
||||
- 来源: NuttX 官方社区。
|
||||
- 内容: 包含由 NuttX 社区维护的、用于演示其核心功能的各种示例。
|
||||
- 性质: 通用、与上层应用无关。
|
||||
|
|
|
|||
|
|
@ -96,13 +96,13 @@ sudo mv repo /usr/local/bin
|
|||
此方式需要您先将 SSH 公钥添加至您的 GitHub 账户,请参考 [GitHub 官方文档](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account)。
|
||||
|
||||
```bash
|
||||
repo init -u ssh://git@github.com/open-vela/manifests.git -b dev-ai-contest-2026 -m openvela.xml --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/ --git-lfs
|
||||
repo init -u ssh://git@github.com/open-vela/manifests.git -b dev -m openvela.xml --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/ --git-lfs
|
||||
```
|
||||
|
||||
- 方式二:HTTPS
|
||||
|
||||
```bash
|
||||
repo init -u https://github.com/open-vela/manifests.git -b dev-ai-contest-2026 -m openvela.xml --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/ --git-lfs
|
||||
repo init -u https://github.com/open-vela/manifests.git -b dev -m openvela.xml --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/ --git-lfs
|
||||
```
|
||||
|
||||
#### 选项 B:从 Gitee 下载
|
||||
|
|
@ -112,13 +112,13 @@ sudo mv repo /usr/local/bin
|
|||
此方式需要您先将 SSH 公钥添加至您的 Gitee 账户,请参考 [Gitee 官方文档](https://gitee.com/help/articles/4191)。
|
||||
|
||||
```bash
|
||||
repo init -u ssh://git@gitee.com/open-vela/manifests.git -b dev-ai-contest-2026 -m openvela.xml --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/ --git-lfs
|
||||
repo init -u ssh://git@gitee.com/open-vela/manifests.git -b dev -m openvela.xml --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/ --git-lfs
|
||||
```
|
||||
|
||||
- 方式二:HTTPS
|
||||
|
||||
```bash
|
||||
repo init -u https://gitee.com/open-vela/manifests.git -b dev-ai-contest-2026 -m openvela.xml --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/ --git-lfs
|
||||
repo init -u https://gitee.com/open-vela/manifests.git -b dev -m openvela.xml --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/ --git-lfs
|
||||
```
|
||||
|
||||
#### 选项 C:从 GitCode 下载
|
||||
|
|
@ -128,13 +128,13 @@ sudo mv repo /usr/local/bin
|
|||
此方式需要您先将 SSH 公钥添加至您的 GitCode 账户,请参考 [GitCode 官方文档](https://docs.gitcode.com/docs/help/home/user_center/security_management/ssh)。
|
||||
|
||||
```bash
|
||||
repo init -u ssh://git@gitcode.com/open-vela/manifests.git -b dev-ai-contest-2026 -m openvela.xml --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/ --git-lfs
|
||||
repo init -u ssh://git@gitcode.com/open-vela/manifests.git -b dev -m openvela.xml --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/ --git-lfs
|
||||
```
|
||||
|
||||
- 方式二:HTTPS
|
||||
|
||||
```bash
|
||||
repo init -u https://gitcode.com/open-vela/manifests.git -b dev-ai-contest-2026 -m openvela.xml --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/ --git-lfs
|
||||
repo init -u https://gitcode.com/open-vela/manifests.git -b dev -m openvela.xml --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/ --git-lfs
|
||||
```
|
||||
|
||||
3. 执行同步命令,repo 将根据清单文件 (`openvela.xml`) 下载所有相关的源代码仓库。
|
||||
|
|
|
|||
Loading…
Reference in New Issue