未验证 提交 30aa7c5b 编写于 作者: O openharmony_ci 提交者: Gitee

!9734 [翻译完成】#I5QD7P

Merge pull request !9734 from Annie_wang/PR9264
......@@ -4,33 +4,33 @@
### Function
The motion recognition module provides motion recognition and control capabilities. Currently, OpenHarmony supports recognition of pick-up, flip, shake, and rotation.
The motion module provides motion recognition and control capabilities. Currently, OpenHarmony supports recognition of pick-up, flip, shake, and rotation.
The motion recognition driver is developed based on the hardware driver foundation (HDF). It shields hardware differences and provides APIs for the Multimodal Sensor Data Platform (MSDP) to implement capabilities such as enabling or disabling motion recognition, and subscribing to or unsubscribing from motion recognition data.
The motion driver is developed based on the hardware driver foundation (HDF). It shields hardware differences and provides APIs for the Multimodal Sensor Data Platform (MSDP) to implement capabilities such as enabling or disabling motion recognition, and subscribing to or unsubscribing from motion recognition data.
The figure below shows the motion recognition driver architecture. The framework layer provides MSDP services, and interacts with the Motion Stub through the Motion Proxy in the User Hardware Driver Foundation (UHDF). The Motion Stub calls the Motion HDI Impl APIs to provide motion recognition capabilities for upper-layer services.
The figure below shows the motion driver architecture. The framework layer provides MSDP services, and interacts with the Motion Stub through the Motion Proxy in the User Hardware Driver Foundation (UHDF). The Motion Stub calls the Motion HDI Impl APIs to provide motion recognition capabilities for upper-layer services.
**Figure 1** Motion recognition driver architecture
**Figure 1** Motion driver architecture
![](figures/motion_recognition_driver_architecture.png)
![](figures/motion_driver_architecture.png)
### Working Principles
The figure below illustrates how a motion recognition driver works.
The figure below illustrates how a motion driver works.
**Figure 2** How a motion recognition driver works
**Figure 2** How a motion driver works
![](figures/motion_recognition_driver_work.png)
![](figures/motion_driver_work.png)
1. MSDP: The MSDP service obtains a Motion HDI service instance from the Motion Proxy and calls the Motion HDI API.
2. IDL: The IService Manager allocates a Motion HDI instance requested by the MSDP service, and the Motion Proxy forwards the instance to the MSDP service. After the MSDP service calls the HDI API provided by the Motion Proxy, Motion Stub is called through Inter-Process Communication (IPC) to invoke the Motion Service API. The code is automatically generated by a tool and does not need to be developed by the component vendor.
3. HDI Service: HDI Service consists of Motion Interface Driver, Motion Service, and Motion Impl. Motion Interface Driver provides the motion recognition driver code. A **HdfDriverEntry** structure is defined to implement the **Init**, **Bind**, and **Release** functions. The **HDF_INIT** macro is used to load the driver in the functions. Motion Service provides the motion recognition service interface class. The specific implementation is described in Motion Impl. The code of HDI Service must be developed by the component vendor.
3. HDI Service: HDI Service consists of Motion Interface Driver, Motion Service, and Motion Impl. Motion Interface Driver provides the motion driver code. A **HdfDriverEntry** structure is defined to implement the **Init**, **Bind**, and **Release** functions. The **HDF_INIT** macro is used to load the driver in the functions. Motion Service provides the motion recognition service interface class. The specific implementation is described in Motion Impl. The code of HDI Service must be developed by the component vendor.
## Development Guidelines
### When to Use
The motion recognition driver provides capabilities for the MSDP service to enable or disable motion recognition and subscribe to or unsubscribe from motion recognition data. It can be used for motion recognition when a user picks up, flips, shakes, and rotates a device.
The motion driver provides capabilities for the MSDP service to enable or disable motion recognition and subscribe to or unsubscribe from motion recognition data. It can be used for motion recognition when a user picks up, flips, shakes, and rotates a device.
### Available APIs
......@@ -59,7 +59,7 @@ The motion recognition directory structure is as follows:
│ └── unittest\hdi # HDI unit test code for the motion recognition module.
```
The following describes how to develop a user-mode motion recognition driver based on the HDF. For details, see [motion_interface_driver.cpp](https://gitee.com/openharmony/drivers_peripheral/blob/master/motion/hdi_service/motion_interface_driver.cpp).
The following describes how to develop a user-mode motion driver based on the HDF. For details, see [motion_interface_driver.cpp](https://gitee.com/openharmony/drivers_peripheral/blob/master/motion/hdi_service/motion_interface_driver.cpp).
To develop the user-mode driver for motion recognition, implement the **Bind**, **Init**, **Release**, and **Dispatch** functions. The **Bind** function provides service capabilities. The **Init** function initializes the driver before the driver is loaded. The **Release** function releases resources when the **Init** function fails.
......@@ -99,7 +99,7 @@ int HdfMotionInterfaceDriverInit(struct HdfDeviceObject *deviceObject)
return HDF_SUCCESS;
}
// Bind the services provided by the motion recognition driver to the HDF.
// Bind the services provided by the motion driver to the HDF.
int HdfMotionInterfaceDriverBind(struct HdfDeviceObject *deviceObject)
{
HDF_LOGI("HdfMotionInterfaceDriverBind enter");
......@@ -131,7 +131,7 @@ int HdfMotionInterfaceDriverBind(struct HdfDeviceObject *deviceObject)
return HDF_SUCCESS;
}
// Release the resources used by the motion recognition driver.
// Release the resources used by the motion driver.
void HdfMotionInterfaceDriverRelease(struct HdfDeviceObject *deviceObject)
{
HDF_LOGI("HdfMotionInterfaceDriverRelease enter");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册