laitimes

Huawei experts explain the OpenHarmony open source Hongmeng hardware resource pooling model

IT House April 28 news, recently, OpenAtom OpenHarmony for the first time to interpret the OpenHarmony 3.1 Release technology features. According to the data, as of now, OpenHarmony has attracted more than 40 main warehouse code contributors, gathered 1.6 million + community users, established 44 special interest groups, and downloaded 63 million times worldwide, with 55,000 + code submissions.

Li Gang, a member of the OpenHarmony Distributed Hardware Management SIG and a distributed hardware expert at Huawei Technologies Co., Ltd., analyzed the OpenHarmony hardware resource pooling model, a key feature of The OpenHarmony 3.1 Release release.

OpenAtom OpenHarmony (hereinafter referred to as "OpenHarmony"), as a distributed operating system for the era of all scenarios, full connectivity and full intelligence, integrates the capabilities of various different terminal devices to achieve hardware mutual assistance and resource sharing, providing users with a smooth all-scenario experience.

Here, experts have revealed how OpenHarmony enables multi-device collaboration by introducing OpenHarmony's hardware resource pooling model. (The following is from the Official Micro of OpenAtom OpenHarmony)

1. Evolution of hardware resource access

Hardware resource access is key to multi-device collaboration. Since the development of OpenHarmony, hardware resource access has evolved from "one-to-one" to "many-to-many".

1.1 One-to-one

In the early stage of the design, in order to solve the problem of collaboration between the two devices, we used the distributed device virtualization capability provided by OpenHarmony to integrate the hardware resources of the two devices to achieve "one-to-one" hardware resource access. This is the prototype of the hardware resource pooling model.

Huawei experts explain the OpenHarmony open source Hongmeng hardware resource pooling model

Figure 1 "One-to-one" hardware resource access

1.2 Many-to-many

With the continuous deepening of all-scenario smart life, the "one-to-one" access to device hardware resources can no longer meet the business needs of some complex scenarios. OpenHarmony continues to explore and innovate distributed technology, by enhancing the original distributed device virtualization capabilities, the various hardware resources of multiple devices, such as screens, cameras, amplifiers, keyboards, sensors and memory, are abstracted, forming a unified hardware resource pool in the "Super Virtual Terminal", and supporting the on-demand allocation and recombination of hardware resources, truly realizing the global call of hardware resources. Multiple devices that make up a "hyper virtual terminal" can access a variety of hardware resources in the hardware resource pool, which is "many-to-many" hardware resource access.

Huawei experts explain the OpenHarmony open source Hongmeng hardware resource pooling model

Figure 2 Hardware Resource Pooling (Many-to-Many)

Based on "hardware resource pooling", developers can select and match appropriate capability modules in the hardware resource pool according to different business scenarios, and give full play to the capability advantages of different devices to build a new user experience.

2. Hardware resource pooling model

Based on the innovative concept of "hardware resource pooling", OpenHarmony combines hardware virtualization, hardware resource management and hardware data management capabilities to build a hardware resource pooling model, providing a unified hardware capability open interface to the outside world, allowing developers to easily achieve efficient development.

As shown in Figure 3, the hardware resource pooling model abstracts the hardware resources of various types of devices, provides various distributed services for northbound applications, such as distributed cameras, distributed screens, distributed audio, and distributed inputs, while providing unified device management and distributed hardware frameworks.

Huawei experts explain the OpenHarmony open source Hongmeng hardware resource pooling model

Figure 3 Hardware resource pooling model

The following is an introduction to the components of the hardware resource pooling model.

2.1 Device Management

Device management(i.e., DeviceManager) services that provide capabilities such as device discovery, authentication management, trusted device management, and device state management.

Huawei experts explain the OpenHarmony open source Hongmeng hardware resource pooling model

Figure 4 Device Management (DeviceManager)

OpenHarmony provides developers with a set of device management interfaces for distributed inter-device listening, discovery, and authentication, as shown in Figure 5.

Huawei experts explain the OpenHarmony open source Hongmeng hardware resource pooling model

Figure 5 Device Management Interface

Sample code for using the device management interface is as follows:

Create a DeviceManager instance: deviceManager.createDeviceManager('com.ohos.xxxx', (err, dm) = > { this.log("createDeviceManager err:"+ JSON.stringify(err) + ' --success:' + JSON.stringify(dm )) if (err) return; dmClass = dm; dmClass.on('serviceDie', data => this.log ("serviceDie on:" + JSON.stringify(data))}); // Query trusted device list var array = dmClass.getTrustedDeviceListSync();// Get local device information var localDeviceInfo = dmClass.getLocalDeviceInfoSync();// Start device discovery (peripheral untrusted devices found) var subscribeId = 0; dmClass.on('deviceFound', (data) => { if (data == null) { this.log("deviceFound error data=null") return; } this.logList.push("deviceFound:" + JSON.stringify(data)); }); dmClass.on('discoverFail', (data) => { this.log("discoverFail on:" + JSON.stringify(data)); }); subscribeId = Math.floor(Math.random() * 10000 + 1000)var info = { "subscribeId": subscribeId, "mode": 0xAA, "medium": 0, "freq": 2, "isSameAccount": false, "isWakeRemote": true, "capability": 0}; dmClass.startDeviceDiscovery(info);// Stop device discovery (needed to be paired with the startDeviceDiscovery interface) dmClass.stopDeviceDiscovery(subscribeId);// Device authentication var deviceInfo ={ "deviceId": "XXXXXXXX", " deviceName": "", deviceType: 0};let extraInfo = { "Icon": new Uint8Array(), // icon, optional parameter, optional "Thumbnail": new Uint8Array(), // thumbnail, optional parameter, optional parameter, can not fill in "Name": "xxxxxxxx", // peer device application name "Description": "xxxxxxxx", // Description "business": '0', "displayOwner": 0,}// Device deauthentication dmClass.unAuthenticateDevice(this.deviceInfo);

For more details on DeviceManager, please refer to the following code warehouse:

https://gitee.com/openharmony/device_manager

2.2 Distributed Hardware Framework

The distributed hardware framework provides hardware resource management capabilities such as access management, capability query, status management, rights management, and version management for the hardware resource pooling model, as shown in Figure 6:

Huawei experts explain the OpenHarmony open source Hongmeng hardware resource pooling model

Figure 6 Distributed Hardware Framework

The modules of the distributed hardware framework are described as follows:

Huawei experts explain the OpenHarmony open source Hongmeng hardware resource pooling model

Figure 9 Module Description of a Distributed Camera

For more details on distributed cameras, please refer to the Distributed Camera Code Warehouse:

https://gitee.com/openharmony/distributed_camera

2.4 Distributed Screens

Distributed screens provide software abstraction capabilities for hardware resources of screen devices, and provide system mirroring, screen mirroring, screen splitting, and other capabilities for the OpenHarmony system framework. The framechart of the distributed screen is as follows:

Huawei experts explain the OpenHarmony open source Hongmeng hardware resource pooling model

Figure 10 Distributed Screens

The modules of the distributed screen are described as follows:

Huawei experts explain the OpenHarmony open source Hongmeng hardware resource pooling model

Figure 11 The module description of the distributed screen

For more details on the distributed screen, please refer to the following code silo:

https://gitee.com/openharmony/distributed_screen

Read on