• 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-660430

source/12-May-2024-1,7181,338

BUILD.gnD12-May-20242.8 KiB8372

LICENSED12-May-202410.1 KiB177150

README.mdD12-May-20246 KiB12993

README_zh.mdD12-May-20244.8 KiB12993

bundle.jsonD12-May-20241.7 KiB5655

README.md

1# dms\_fwk\_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 Distributed Scheduler is used for cross-device component management. It allows the local device to access or control remote components, and enables application collaboration in distributed scenarios. 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 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 Distributed Scheduler</p>
31</td>
32</tr>
33<tr id="row104169564177"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p17416125614179"><a name="p17416125614179"></a><a name="p17416125614179"></a>safwk_lite</p>
34</td>
35<td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p04163569170"><a name="p04163569170"></a><a name="p04163569170"></a>Implementation of the foundation process</p>
36</td>
37</tr>
38</tbody>
39</table>
40
41The source code directory structure of the Distributed Scheduler is as follows:
42
43```
44├── BUILD.gn
45├── include
46│  ├── dmslite.h        # Header file for the open APIs provided by the Distributed Scheduler
47│  ├── dmslite_check_remote_permission.h     # Header file for the permission management module of the Distributed Scheduler
48│  ├── dmslite_famgr.h                       # Header file for the FA management module of the Distributed Scheduler
49│  ├── dmslite_inner_common.h                # Internal common file for the Distributed Scheduler
50│  ├── dmslite.h                             # Header file for the implementation of the Distributed Scheduler Service (also called the Distributed Manager Service)
51│  ├── dmslite_log.h                         # Header file for the log module
52│  ├── dmslite_msg_parser.h                  # Header file for the distributed message parsing module
53│  ├── dmslite_tlv_common.h                  # Header file for the TLV data parsing module
54│  └── dmslite_session.h                     # Header file for the inter-device communication module
55├── README.md
56├── LICENSE
57├── source
58    ├── distributed_schedule_service.c
59    ├── dmslite.c
60    ├── dmslite_check_remote_permission.c
61    ├── dmslite_famgr.c
62    ├── dmslite_msg_parser.c
63    ├── dmslite_tlv_common.c
64    └── dmslite_session.c
65```
66
67## Constraints<a name="section1718733212019"></a>
68
69**Programming language**: C/C++
70
71**Networking environment**: The primary and secondary devices must be on the same LAN and can ping each other.
72
73**Operating system**: OpenHarmony
74
75**Limitations and constraints on remote startup**:
76
77-   Only Feature Abilities \(FAs\) can be started remotely. Remote startup is unavailable to abilities using the Service template.
78-   Before the remote startup, ensure that the distributed networking between the primary and secondary devices is successful. Otherwise, the remote startup fails.
79
80## Usage<a name="section10729231131110"></a>
81
82-   **Compiling and Building the Distributed Scheduler**
83
84The code of the Distributed Scheduler is stored in the following directory:
85
86```
87foundation/distributedschedule/dmsfwk_lite
88```
89
90When compiling and building the code for a specific platform, you need to specify the target platform.
91
92```
93hb build
94```
95
96-   **Primary device development**  \(taking FA startup as an example\)
97
98Create 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.
99
100```
101import ohos.aafwk.ability.Ability;
102import ohos.aafwk.content.Want;
103import ohos.bundle.ElementName;
104
105// Create a Want instance that will be passed to the startAbility method.
106Want want = new Want();
107ElementName name = new ElementName(remote_device_id, "ohos.dms.remote_bundle_name", "remote_ability_name");
108want.setElement(name); // Add information about the target FA for startup to the Want instance.
109want.setFlags(Want.FLAG_ABILITYSLICE_MULTI_DEVICE); // Set the multi-device startup flag. If this flag is not set, remote FA startup will be unavailable.
110
111// Start the remote FA on the secondary device.
112startAbility(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.
113```
114
115-   **Prerequisites**
116
117The target FA with the specified bundle name must have been installed on the secondary device.
118
119-   **Execution**  \(taking FA startup as an example\)
120
121Call the  **startAbility**  method on the primary device to start the target FA on the secondary device.
122
123## Repositories Involved<a name="section176111311166"></a>
124
125[Distributed Scheduler subsystem](en-us_topic_0000001115719369.md)
126
127**[dms\_fwk\_lite](https://gitee.com/openharmony/distributedschedule_dms_fwk_lite)**
128
129

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