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