1# Mechbody Controller 2 3## Introduction 4 5The Mechanical Device Controller provides developers with a set of APIs for discovering and controlling compatible mechanical devices, enabling seamless connectivity and precise control of target devices. 6 7The Mechbody Controller includes the following common features: 8 9- Accessory information query 10- Perception and feedback of accessory status changes 11- Controlling accessory movements 12 13## System Architecture 14 15**Figure 1** OpenHarmony Mechbody Controller Architecture<a name="fig4460722185514"></a></b> 16 17 18- **Mechanic Kit**: A set of APIs provided by the Mechanical Device Control Service, offering applications the capability to discover and control mechanical devices through standardized interfaces. 19- **Mechanical Device Control Service**: The core service of the mechanical device controller. Currently, it supports managing mechanical devices, controlling their movement by setting position trajectories and motion speeds, and directing mechanical devices to rotate and follow individuals based on camera face recognition results. Motion management capabilities for mechanical devices and the ability to control their movement based on sound direction are under planning. 20- **Universal Interconnect APP**: An optional system application for OpenHarmony devices. It is responsible for discovering and filtering mechanical devices, enabling device developers to quickly identify accessory devices that comply with the OpenHarmony mechanical control protocol, and notifying the mechanical device control service to establish connections. 21- **System Application**: A device system application developed by device developers. System applications can perform advanced control of mechanical devices, such as trajectory control and speed control. 22- **Third-Party Application**: A third-party device application developed by OpenHarmony ecosystem developers. Third-party applications can query connected mechanical control devices and control the activation and deactivation of smart tracking features, among other functions. 23- **Bluetooth Communication Service and Camera Service**: Key capabilities relied upon by the mechanical device control service. It depends on the Bluetooth communication service for Bluetooth interactions with mechanical devices and on the camera service to obtain camera parameters and target detection results from the camera. 24- **Camera Driver**: A module in the system that implements face detection. If device developers need to support the face smart tracking capability of mechanical devices, they must implement face recognition functionality in the camera driver and report face detection results through the OpenHarmony Camera HDI standard interface. 25 26## Directory Structure 27 28The repository directory structure is as follows: 29 30```shell 31distributedhardware_mechbody_controller 32├── etc # Initialization configuration for mechbody controller service 33├── interface # Mechbody controller interfaces and NAPI conversion 34├── sa_profile # SA configuration for mechbody controller 35├── service # Implementation of mechbody controller interfaces 36├── test # Test code for mechbody controller 37``` 38 39## Constraints 40 41- Mechanical devices only supports equipment from specific manufacturers. 42 43- The development must support BLE (Bluetooth Low Energy). 44 45- The development device must have camera-based face detection capability and support reporting face metadata. 46 47- For the universal connectivity app development, the download path will be provided after release. 48 49- The southbound protocol will be provided later, as it is currently in the standardization process. 50 51## Usage Guide 52 53Three major categories of functional interfaces are provided. Developers can use one or more categories based on their requirements: 54 55- Application developers can use the accessory query interface to query corresponding accessory information. 56 57- When registering for accessory status change notifications, device status changes can be monitored through callbacks. 58 59- The accessory control interface is provided, allowing users to easily develop and control accessories using the interface. 60 61## Example Tutorials 62 63We provide the [Rotation Control Development Guide](https://gitcode.com/openharmony/docs/blob/master/zh-cn/application-dev/mechanicManager/rotation-control-guide.md). System applications can perform advanced control of mechanical devices, such as trajectory control and speed control. Additionally, the [Smart Tracking Development Guide]((https://gitcode.com/openharmony/docs/blob/master/zh-cn/application-dev/mechanicManager/camera-tracking-guide.md)) (supports third-party applications) is available. Third-party applications can query connected mechanical control devices and control the activation and deactivation of smart tracking features. These resources offer richer development references, helping developers understand functional logic and improve development efficiency. 64 65## API Reference 66 67The [System API Reference](https://gitcode.com/openharmony/docs/blob/ca6a74112dca41d78b4bb2ca2612aca7d2bce450/zh-cn/application-dev/reference/apis-mechanic-kit/js-apis-mechanicManager-sys.md) and [Non-System API Reference](https://gitcode.com/openharmony/docs/blob/ca6a74112dca41d78b4bb2ca2612aca7d2bce450/zh-cn/application-dev/reference/apis-mechanic-kit/js-apis-mechanicManager.md) provide interface documentation to help developers quickly find detailed descriptions and invocation methods for specific interfaces. 68 69## Related Repositories 70 71distributedhardware_mechbody_controller 72