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