1# **Distributed screen components** 2 3## **Introduction** 4 5The system architecture is shown in the figure below: 6 7 8 9**ScreenRegionManager** : Manages the status of the display region mapped by the master terminal on the screen of the controlled terminal, including specifying the display for the display region, setting the width and height of the display region, decoding type and other parameters. 10 11**Distributed ScreenManager** : Manages the parameters and state of the screen on the controlled end, and is responsible for the creation and destruction of objects related to the master end. 12 13**ScreenService** : Distributed screen master SA service and distributed screen controlled SA service, responsible for handling IPC calls of distributed hardware management framework 14 15**SoftbusAdapter** : connects to the soft bus transmission interface, provides unified call interface encapsulation for screen images, input events, etc, and realizes the transmission and interaction of stream data and byte data between devices. 16 17**ScreenTransport** : Distributed screen transmission module, screen image data encoding, decoding, sending, receiving. 18 19**ScreenClient** : ScreenClient client for displaying screen image data projected from other devices on the device. 20 21## **Directory** 22 23``` 24/foundation/distributedhardware/distributed_screen 25├── common # Distributed screen common data definitions, including constants, error codes, logs, tools, and so on 26├── interface # Distributed screen SDK, including master side and controlled side service call interface调用接口 27├── sa_profile # SA configuration information for distributed screens 28├── services # Distributed screen main control terminal and controlled terminal function main business implementation 29│ └── common # Distributed screen function Main control end, controlled end shared function realization 30│ ├── databuffer # Screen data store definition 31│ └── screen_channel # Screen data transfer channel interface definition 32│ └── screenclient # Distributed screen agent client implementation 33│ └── screenservice # Distributed screen main function realization 34│ └── sinkservice # Distributed screen controlled end service function realization 35│ ├── dscreenservice # Distributed screen controller SA 36│ └── screenregionmgr # Distributed screen manages the display area of the controller 37│ └── sourceservice # Distributed screen master terminal service function realization 38│ ├── dscreenmgr # Distributed screen Main control terminal screen management 39│ └── dscreenservice # Distributed screen master SA 40│ └── screentransport # Distributed screen transfer components 41│ ├── screendatachannel # Screen data transfer channel for data transfer between transport components and codecs 42│ ├── screensinkprocessor # Distributed screen controlled data processing module, including decoding, etc 43│ ├── screensinktrans # Distributed screen data transmission component at the controlled end, including data transmission channel and data processing module Processor 44│ ├── screensourceprocessor # Distributed screen master terminal data processing module, including coding, etc 45│ └── screensourcetrans # Distributed screen main control terminal data transmission components, including data transmission channel and data processing module Processor 46│ └── softbusadapter # Soft bus interface adapter for screen transmission, touch event transmission to provide a unified transmission interface 47└── screenhandler # The distributed hardware information report and device status change notification are loaded by the distributed hardware management framework 48``` 49 50## **constraint** 51**language restrictions** : C++ 52 53**Networking environment** : Ensure that the devices are on the same LAN. 54 55**Operating system Restrictions** : OpenHarmony operating system. 56 57## **indicates** 58### **The concept that** 59 60Master terminal (source) : The control terminal, by invoking the distributed screen capability, uses the screen of the controlled terminal to display the screen content of the master terminal device. 61 62Controlled end (sink) : the controlled end receives the control of the main control end through the distributed screen and receives and displays the screen content of the main control end in the local interconnection window. 63 64### **Interface specification** 65The distributed screen implements the interface provided by the distributed hardware management framework. The distributed hardware management framework uniformly calls the interface to create and register the virtual screen hardware. 66 67### **Scenario Description** 68After device networking authentication, the main control device can specify the screen of the controlled device to Display the content drawn by Display. 69 70 71### **Process description** 72#### **1. Start the device** 73The system pulls up the SA service of the distributed screen, initializes the Source side, and initializes related modules. 74 75#### **2. Device networking online** 76After the device goes online, the distributed hardware management framework synchronizes the screen hardware information of the online device and enables it. After the device is enabled successfully, a virtual screen is added to the system and notified to the window subsystem, which manages the local screen and distributed screen in a unified manner. The northbound application can query the distributed screen through the interface provided by the window subsystem and use the distributed screen according to the interface provided by the window subsystem. 77 78#### **3. Screen data flow** 79(1) The graphics subsystem of the master terminal saves the screen data to be sent in the input Surface created by the encoder. 80 81(2) The master encoder encodes the input data and returns the encoding result to the transmission component ScreenSourceTrans. 82 83(3) ScreenSourcetrans, the transmission component of the master end, sends the encoded data to the SoftBusAdapter through the transmission channel ScreenDatachannel, and sends it to the controlled end device through the softbus subsystem. 84 85(4) After receiving the screendata, the softbus subsystem of the controlled device returns it to the ScreenDatachannel through the SoftBusAdapter. 86 87(5) The controlled transmission channel ScreenDatachannel will transfer the screendata obtained to the decoder for decoding. 88 89(6) The decoder decodes the screen data and saves the decoded data to the Surface of the decoder set by the display window of the controlled end agent. Finally, the screen will be displayed by the window. 90 91#### **4. Device offline** 92After the device is offline, the distributed hardware management framework disables the screen hardware of the offline device, removes the corresponding virtual screen locally, and notifies the window subsystem. In this case, the distributed screen of the offline device is unavailable. 93 94## **refers to warehouse** 95 96**Distributed hardware subsystem:** 97 98Equipment management 99[device_manager](https://gitee.com/openharmony/device_manager) 100 101A step-by-step hardware management framework 102[distributed_hardware_fwk](https://gitee.com/openharmony/distributed_hardware_fwk) 103 104Distributed camera 105[distributed_camera](https://gitee.com/openharmony/distributed_camera) 106 107**Distributed screen 108[distributed_screen](https://gitee.com/openharmony/distributed_screen)**