• Home
Name Date Size #Lines LOC

..--

figures/12-May-2024-

include/12-May-2024-804441

interfaces/innerkits/12-May-2024-7955

moduletest/dtbschedmgr_lite/12-May-2024-659429

source/12-May-2024-1,7211,341

BUILD.gnD12-May-20242.8 KiB8372

LICENSED12-May-202410.1 KiB177150

README.mdD12-May-20245.4 KiB12488

README_zh.mdD12-May-20244.5 KiB12488

bundle.jsonD12-May-20241.6 KiB5655

README.md

1# dmsfwk\_lite<a name="EN-US_TOPIC_0000001128264105"></a>
2
3-   [Introduction](#section11660541593)
4-   [Directory Structure](#section1464106163817)
5-   [Constraints](#section1718733212019)
6-   [Usage](#section10729231131110)
7-   [Repositories Involved](#section176111311166)
8
9## Introduction<a name="section11660541593"></a>
10
11The Lite Distributed Scheduler is used for cross-device component management. It allows the local device to start remote feature ability. The following figure shows the modules in the Distributed Scheduler.
12
13![](figures/en-us_image_0000001081284974.png)
14
15## Directory Structure<a name="section1464106163817"></a>
16
17The following table describes the directory structure of the Lite Distributed Scheduler.
18
19**Table 1**  Directory structure of the major source code
20
21<a name="table43531856201716"></a>
22<table><thead align="left"><tr id="row20416556201718"><th class="cellrowborder" valign="top" width="50%" id="mcps1.1.3.1.1"><p id="p10416456121716"><a name="p10416456121716"></a><a name="p10416456121716"></a>Directory</p>
23</th>
24<th class="cellrowborder" valign="top" width="50%" id="mcps1.1.3.1.2"><p id="p1841645631717"><a name="p1841645631717"></a><a name="p1841645631717"></a>Description</p>
25</th>
26</tr>
27</thead>
28<tbody><tr id="row64161056151718"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p4160914132218"><a name="p4160914132218"></a><a name="p4160914132218"></a>dmsfwk_lite</p>
29</td>
30<td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p541645611177"><a name="p541645611177"></a><a name="p541645611177"></a>Implementation of the Lite Distributed Scheduler</p>
31</td>
32</tr>
33</tbody>
34</table>
35
36The source code directory structure of the Lite Distributed Scheduler is as follows:
37
38```
39├── BUILD.gn
40├── include
41│  ├── dmslite.h        # Header file for the open APIs provided by the Lite Distributed Scheduler
42│  ├── dmslite_check_remote_permission.h     # Header file for the permission management module of the Lite Distributed Scheduler
43│  ├── dmslite_famgr.h                       # Header file for the FA management module of the Lite Distributed Scheduler
44│  ├── dmslite_inner_common.h                # Internal common file for the Lite Distributed Scheduler
45│  ├── dmslite.h                             # Header file for the implementation of the Lite Distributed Scheduler Service (also called the Distributed Manager Service)
46│  ├── dmslite_log.h                         # Header file for the log module
47│  ├── dmslite_msg_parser.h                  # Header file for the distributed message parsing module
48│  ├── dmslite_tlv_common.h                  # Header file for the TLV data parsing module
49│  └── dmslite_session.h                     # Header file for the inter-device communication module
50├── README.md
51├── LICENSE
52├── source
53    ├── distributed_schedule_service.c
54    ├── dmslite.c
55    ├── dmslite_check_remote_permission.c
56    ├── dmslite_famgr.c
57    ├── dmslite_msg_parser.c
58    ├── dmslite_tlv_common.c
59    └── dmslite_session.c
60```
61
62## Constraints<a name="section1718733212019"></a>
63
64**Programming language**: C/C++
65
66**Networking environment**: The primary and secondary devices must be on the same LAN and can ping each other.
67
68**Operating system**: OpenHarmony
69
70**Limitations and constraints on remote startup**:
71
72-   Only Feature Abilities \(FAs\) can be started remotely.
73-   Before the remote startup, ensure that the distributed networking between the primary and secondary devices is successful. Otherwise, the remote startup fails.
74
75## Usage<a name="section10729231131110"></a>
76
77-   **Compiling and Building the Distributed Scheduler**
78
79The code of the Lite Distributed Scheduler is stored in the following directory:
80
81```
82foundation/ability/dmsfwk_lite
83```
84
85When compiling and building the code for a specific platform, you need to specify the target platform.
86
87```
88hb build
89```
90
91-   **Primary device development**  \(taking FA startup as an example\)
92
93Create a  **Want**  instance to set the remote device ID, bundle name, and ability class name of the target FA and set the  **Want.FLAG\_ABILITYSLICE\_MULTI\_DEVICE**  flag to enable distributed startup.
94
95```
96import ohos.aafwk.ability.Ability;
97import ohos.aafwk.content.Want;
98import ohos.bundle.ElementName;
99
100// Create a Want instance that will be passed to the startAbility method.
101Want want = new Want();
102ElementName name = new ElementName(remote_device_id, "ohos.dms.remote_bundle_name", "remote_ability_name");
103want.setElement(name); // Add information about the target FA for startup to the Want instance.
104want.setFlags(Want.FLAG_ABILITYSLICE_MULTI_DEVICE); // Set the multi-device startup flag. If this flag is not set, remote FA startup will be unavailable.
105
106// Start the remote FA on the secondary device.
107startAbility(want); // Start the specified FA based on the want parameter. If the name and type of the want parameter are different from those used in the IDE, use the parameter name and type in the IDE.
108```
109
110-   **Prerequisites**
111
112The target FA with the specified bundle name must have been installed on the secondary device.
113
114-   **Execution**  \(taking FA startup as an example\)
115
116Call the  **startAbility**  method on the primary device to start the target FA on the secondary device.
117
118## Repositories Involved<a name="section176111311166"></a>
119
120**Lite Distributed Scheduler subsystem**
121
122[dmsfwk\_lite]
123
124

README_zh.md

1# 轻量级分布式组件管理部件<a name="ZH-CN_TOPIC_0000001128264105"></a>
2
3-   [简介](#section11660541593)
4-   [目录](#section1464106163817)
5-   [约束](#section1718733212019)
6-   [使用](#section10729231131110)
7-   [相关仓](#section176111311166)
8
9## 简介<a name="section11660541593"></a>
10
11轻量级分布式组件管理模块负责跨设备启动FA的能力,支持分布式场景下的应用协同。轻量级分布式调度模块组成如下图所示:
12
13![](figures/zh-cn_image_0000001081284974.png)
14
15## 目录<a name="section1464106163817"></a>
16
17轻量级分布式组件管理源代码目录结构如下表所示:
18
19**表1**主要源代码目录结构
20
21<a name="table43531856201716"></a>
22<table><thead align="left"><tr id="row20416556201718"><th class="cellrowborder" valign="top" width="50%" id="mcps1.1.3.1.1"><p id="p10416456121716"><a name="p10416456121716"></a><a name="p10416456121716"></a>名称</p>
23</th>
24<th class="cellrowborder" valign="top" width="50%" id="mcps1.1.3.1.2"><p id="p1841645631717"><a name="p1841645631717"></a><a name="p1841645631717"></a>描述</p>
25</th>
26</tr>
27</thead>
28<tbody><tr id="row64161056151718"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p4160914132218"><a name="p4160914132218"></a><a name="p4160914132218"></a>dmsfwk_lite</p>
29</td>
30<td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p541645611177"><a name="p541645611177"></a><a name="p541645611177"></a>轻量级分布式组件管理</p>
31</td>
32</tr>
33</tbody>
34</table>
35
36其中轻量级分布式组件管理的源代码目录结构如下:
37
38```
39├── BUILD.gn
40├── include
41│  ├── dmslite.h        # 轻量级分布式组件管理对外接口
42│  ├── dmslite_check_remote_permission.h     # 轻量级分布式组件管理权限管理模块
43│  ├── dmslite_famgr.h                       # 轻量级分布式组件管理FA管理模块
44│  ├── dmslite_inner_common.h                # 轻量级分布式组件管理内部通用文件
45│  ├── dmslite.h                             # 轻量级分布式组件管理服务实现
46│  ├── dmslite_log.h                         # 日志模块
47│  ├── dmslite_parser.h                  # 分布式消息解析模块
48│  ├── dmslite_tlv_common.h                  # TLV格式数据解析模块
49│  └── dmslite_session.h                     # 跨设备通信收发模块
50├── readme.md
51├── LICENSE
52├── source
53    ├── distributed_schedule_service.c
54    ├── dmslite.c
55    ├── dmslite_check_remote_permission.c
56    ├── dmslite_famgr.c
57    ├── dmslite_msg_parser.c
58    ├── dmslite_tlv_common.c
59    └── dmslite_session.c
60```
61
62## 约束<a name="section1718733212019"></a>
63
64**语言限制**:C/C++语言
65
66**组网环境**:必须确保设备在同一个局域网中,主从设备能互相ping通
67
68**操作系统限制**:OpenHarmony操作系统
69
70**远程启动的约束与限制:**
71
72-   支持远程启动FA
73-   远程启动前必须确保主设备与从设备间分布式组网成功,否则无法远程启动
74
75## 使用<a name="section10729231131110"></a>
76
77-   **轻量级分布式组件管理模块编译**
78
79轻量级分布式组件管理模块,其代码所在目录如下:
80
81```
82foundation/ability/dmsfwk_lite
83```
84
85在针对不同平台进行编译时,需要提前指定目标平台:
86
87```
88hb build
89```
90
91-   **主设备程序开发**(以拉起FA为例)
92
93构造意图参数want,设置需要启动的远端设备ID,包名,元能力类名信息,以及分布式标志位Want.FLAG\_ABILITYSLICE\_MULTI\_DEVICE以使能分布式启动
94
95```
96import ohos.aafwk.ability.Ability;
97import ohos.aafwk.content.Want;
98import ohos.bundle.ElementName;
99
100// 构造want参数
101Want want = new Want();
102ElementName name = new ElementName(remote_device_id, "ohos.dms.remote_bundle_name", "remote_ability_name");
103want.setElement(name); // 将待启动的FA信息添加到Want中
104want.setFlags(Want.FLAG_ABILITYSLICE_MULTI_DEVICE); // 设置分布式标记,若不设置将无法使用分布式能力
105
106// 启动远程设备FA
107startAbility(want); // 按照Want启动指定FA,want参数命名以实际开发平台API为准
108```
109
110-   **预置条件**
111
112从设备侧需安装对应包名的FA
113
114-   **运行**(以拉起FA为例)
115
116执行主设备侧的startAbility即可拉起从设备FA
117
118## 相关仓<a name="section176111311166"></a>
119
120轻量级分布式组件管理
121
122[**dmsfwk\_lite**](https://gitee.com/openharmony/ability_dmsfwk_lite)
123
124