• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# DSoftBus<a name="EN-US_TOPIC_0000001090266209"></a>
2
3-   [Introduction](#section11660541593)
4-   [Architecture](#section342962219551)
5-   [Directory Structure](#section161941989596)
6-   [Constraints](#section119744591305)
7-   [Usage Guidelines](#section1312121216216)
8    -   [RPC](#section129654513264)
9    -   [DSoftBus](#section36252592710)
10
11-   [Repositories Involved](#section1371113476307)
12
13## Introduction<a name="section11660541593"></a>
14
15The DSoftBus subsystem provides communication capabilities for OpenHarmony, including WLAN, Bluetooth, DSoftBus, and remote procedure call \(RPC\).
16
17WLAN: basic WLAN functions, peer-to-peer \(P2P\) connection, and WLAN notification, enabling your application to communicate with other devices through a WLAN
18
19Bluetooth: classic Bluetooth and Bluetooth Low Energy \(BLE\)
20
21DSoftBus: distributed communications between near-field devices, and device discovery, connection setup, networking, and data transmission capabilities regardless of communication modes
22
23RPC: communications between processes on a device or across devices
24
25## Architecture<a name="section342962219551"></a>
26
27**Figure  1**  DSoftBus subsystem architecture<a name="fig4460722185514"></a>
28
29
30![](figures/dsoftbus.png)
31
32## Directory Structure<a name="section161941989596"></a>
33
34The main code directory structure of the DSoftBus subsystem is as follows:
35
36```
37/foundation/communication
38├── bluetooth       # Bluetooth code
39├── dsoftbus        # DSoftBus code
40├── ipc             # IPC code
41└── wifi            # WLAN code
42```
43
44## Constraints<a name="section119744591305"></a>
45
46-   Networking: Devices must be in the same LAN.
47
48## Usage Guidelines<a name="section1312121216216"></a>
49
50### RPC<a name="section129654513264"></a>
51
52In RPC, the requesting process \(client\) can obtain the proxy of the process that provides the service \(server\). Through the proxy, the two processes can communicate with each other.
53
541.  Implement the server and its capabilities.
552.  To be more specific, the client obtains a proxy of the server. This proxy provides the same capabilities as the server. Then the client can call a method of the server by accessing the corresponding method of the proxy. The proxy forwards the request to the server.
563.  The server processes the received request and returns the result to the proxy via the driver.
574.  The proxy returns the result to the client.
58
59### DSoftBus<a name="section36252592710"></a>
60
61-   Networking
62
631.  After the service is started, obtain the list of online devices.
642.  Register a listener for device status changes.
653.  Obtain the device ID, name, and type.
664.  Obtain extended information about the device, such as the device type, networking type, and device capability.
675.  Delete the registered listener.
68
69-   Transmission
70
711.  Create a session server and register a callback.
722.  After a device goes online, open a session with the device.
733.  Send data through the session.
744.  Close the session if you no longer need it.
755.  Remove the created session server if you no longer want to use distributed transmission \(such as exiting the process\).
76
77## Repositories Involved<a name="section1371113476307"></a>
78
79**DSoftBus subsystem**
80
81communication\_bluetooth
82
83communication\_dsoftbus
84
85communication\_ipc
86
87communication\_wifi
88
89