Networking method and terminal

By electing a central device from the terminal set and using the central device to exchange data sets with leaf devices, the problem of excessive link establishment between terminals during networking is solved, thereby improving networking efficiency.

WO2025200763A1PCT designated stage Publication Date: 2025-10-02HUAWEI TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2025/074437
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-05-10
Filing Date
2025-01-23
Publication Date
2025-10-02

AI Technical Summary

Technical Problem

In the prior art, multiple terminals participating in a network need to establish connections between each other, resulting in low networking efficiency.

Method used

By electing a central device from the terminal set, the central device establishes a connection with the leaf devices and exchanges data sets, reducing the number of link establishment times between terminals and improving networking efficiency.

Benefits of technology

The number of link establishment times between terminals is significantly reduced, and networking efficiency is improved, especially when each terminal in a terminal set does not need to establish a connection with every terminal to obtain the required networking data and authentication data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025074437_02102025_PF_FP_ABST
    Figure CN2025074437_02102025_PF_FP_ABST
Patent Text Reader

Abstract

The present application relates to the field of terminals. Provided are a networking method and a terminal. The method is applied to a first terminal in a terminal set, and the terminal set comprises at least three terminals. The method comprises: establishing a first connection with a second terminal, wherein the second terminal is any terminal, other than the first terminal, in the terminal set; and on the basis of the first connection, sending a first data set to the second terminal, and receiving a second data set sent by the second terminal, wherein the first data set or the second data set comprises networking data and / or authentication data of at least two terminals in the terminal set, the authentication data being used for authenticating the identity of the terminals. The technical solution provided in the present application can reduce the number of instances of link establishment between terminals in a terminal set during networking, thus improving networking efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Networking method and terminal

[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office on March 26, 2024, with application number 202410359206.7 and application name “A method and electronic device for reducing the data synchronization load of a self-organizing network”, and the Chinese patent application filed with the State Intellectual Property Office on May 10, 2024, with application number 202410578877.2 and application name “Networking method and terminal”, all contents of which are incorporated by reference into this application. Technical Field

[0002] The present application relates to the field of terminals, and in particular to a networking method and a terminal. Background Art

[0003] With the continuous development of terminal technology, various terminals have been widely used in various scenarios, including personal, home, and industrial use. In these scenarios, multiple terminals can be networked together to achieve connectivity and collaboration, providing users with more complex and richer services. However, as the number of terminals participating in ad hoc networks increases, the energy efficiency of the network is also receiving increasing attention.

[0004] In the prior art, multiple terminals participating in a network can establish connections between each other to exchange networking data or authentication data. The networking data in each terminal includes its address information, which can be used by other terminals to communicate with it, and the authentication data can be used to authenticate the terminal's identity. However, since each terminal needs to establish a separate connection with other terminals to obtain their networking data or authentication data, networking efficiency is very low. Summary of the Invention

[0005] In view of this, the present application provides a networking method and a terminal, which can reduce the number of link establishment times between terminals in a terminal set during the networking process and improve networking efficiency.

[0006] In order to achieve the above-mentioned objectives, in a first aspect, an embodiment of the present application provides a networking method, which is applied to a first terminal in a terminal set, and the terminal set includes at least three terminals. The method includes: establishing a first connection with a second terminal, and the second terminal is any terminal in the terminal set except the first terminal; based on the first connection, sending a first data set to the second terminal, and receiving a second data set sent by the second terminal, wherein the first data set or the second data set includes networking data and / or authentication data of at least two terminals in the terminal set, and the authentication data is used to authenticate the terminal identity.

[0007] In an embodiment of the present application, a first terminal may establish a first connection with a second terminal, send a first data set to the second terminal, and receive a second data set sent by the second terminal. The first data set or the second data set includes networking data and / or authentication data of at least two terminals in the terminal set. That is, the first terminal or the second terminal obtains the networking data and / or authentication data of the at least two terminals without having to establish a connection with both terminals, significantly reducing the number of link establishments between terminals in the terminal set during networking and improving networking efficiency.

[0008] In some embodiments, the first terminal is a central device, and the second terminal is a leaf device of the first terminal.

[0009] In some embodiments, the first data set and the second data set are at least partially different.

[0010] In some embodiments, the first data set includes networking data of the first terminal. In some embodiments, the second data set includes networking data of the second terminal.

[0011] In some embodiments, the first data set may include networking data of all terminals in the terminal set currently stored by the first terminal. In some embodiments, the second data set may include networking data of all terminals in the terminal set currently stored by the second terminal.

[0012] In some embodiments, the first data set includes authentication data of the first terminal.In some embodiments, the second data set includes authentication data of the second terminal.

[0013] In some embodiments, the first data set may include authentication data of all terminals currently stored by the first terminal. In some embodiments, the second data set may include authentication data of all terminals currently stored by the second terminal.

[0014] In some embodiments, the first data set includes pre-synchronization data of the first terminal.In some embodiments, the second data set includes pre-synchronization data of the second terminal.

[0015] In some embodiments, the first data set may include pre-synchronization data of all terminals in the terminal set currently stored by the first terminal. In some embodiments, the second data set may include pre-synchronization data of all terminals in the terminal set currently stored by the second terminal.

[0016] In some embodiments, the first data set includes networking data of each terminal in the terminal set and / or authentication data of each terminal in the terminal set, so that each terminal in the terminal set can obtain the networking data and / or authentication data of each terminal in the terminal set without establishing a connection with each terminal in the terminal set, thereby reducing the number of link establishment times and improving networking efficiency.

[0017] In some embodiments, before establishing the first connection with the second terminal, the method further includes: generating a challenge value for the first terminal; sending the challenge value to at least one terminal in the terminal set; when no election success message is received from a third terminal within a first time period starting from the moment the challenge value is sent, setting the first terminal as a central device, and the third terminal is any terminal in the terminal set that receives the challenge value.

[0018] In some embodiments, the method further includes: generating a challenge value for the first terminal; sending the challenge value to at least one terminal in the terminal set; and when an election success message sent by the third terminal is received within the first time period starting from the moment the challenge value is issued, setting the first terminal as a leaf device of the third terminal, and the third terminal is any terminal in the terminal set that receives the challenge value.

[0019] By selecting a central device from the terminal set, and then the central device initiates a link establishment request to the leaf device of the central device and exchanges data, the number of connections between the terminals in the terminal set is reduced from N*(N-1) to N-1.

[0020] In some embodiments, the amount of networking data stored by the first terminal is greater than the amount of networking data stored by the second terminal. In some embodiments, multiple terminals in a terminal set can first establish a link network in pairs and exchange data, and then configure the terminal that stores more networking data as a central device, and configure the other terminals in the multiple terminals as leaf devices of the central device, so that the central device can obtain the networking data of each terminal in the terminal set more quickly, and then the central device can send this networking data to the leaf devices, further improving the efficiency of networking.

[0021] In some embodiments, the first terminal is a non-low-power device, or the operating mode of the first terminal is a non-low-power mode. Since the central device may need to establish connections with multiple leaf devices and exchange data, the central device consumes more power than the leaf devices. To ensure that the central device can establish connections with other leaf devices and exchange data in a timely manner, the central device is a non-low-power device or operates in a non-low-power mode.

[0022] In some embodiments, the first data set or the second data set includes pre-synchronization data of at least two terminals in the terminal set, and the pre-synchronization data is used by the terminals to perform distributed services, and the distributed services are services collaboratively performed by at least two terminals.

[0023] That is, the first terminal and / or the second terminal in the terminal set can act as an agent to exchange pre-synchronization data with other terminals in the terminal set. The first terminal and / or the second terminal can obtain the pre-synchronization data of the other terminal without establishing a link with the other terminal, thereby reducing the number of link establishment times of the terminal set during the networking process, thereby improving the networking efficiency.

[0024] In some embodiments, the first data set includes pre-synchronization data of each terminal in the terminal set, so that each terminal in the terminal set can obtain the pre-synchronization data of each terminal in the terminal set without having to establish a connection with each terminal in the terminal set, thereby reducing the number of link establishment times and improving networking efficiency.

[0025] In some embodiments, the first data set includes pre-synchronization data of the first terminal. After sending the first data set to the second terminal, the method further includes: notifying the second terminal that the first terminal is online; and executing a first distributed service based on the pre-synchronization data of the first terminal, wherein the first distributed service is executed collaboratively by the first terminal and the second terminal.

[0026] In some embodiments, before sending the first data set to the second terminal, the method further includes: if the update frequency of the first part of the data of the first distributed service is less than the first update frequency, setting the first part of the data as pre-synchronization data of the first terminal.

[0027] The first terminal can determine the pre-synchronization data of the first terminal, and before notifying the second terminal to go online, synchronize the pre-synchronization data with the second terminal through a link establishment. After notifying the second terminal to go online, the first terminal can interact with the second terminal and process distributed services based on the synchronized pre-synchronization data. This reduces the frequency of establishing a connection with the second terminal for data synchronization after the first terminal goes online, improves the efficiency of networking between the first terminal and the second terminal and the efficiency of processing distributed services, saves equipment resources such as links occupied by data synchronization, and ensures the success rate of link establishment between the first terminal and the second terminal when processing other distributed services.

[0028] In some embodiments, after notifying the second terminal that the first terminal is online, the method further includes: establishing a second connection with the second terminal in response to a request for synchronization of the first distributed service with the second terminal; and sending a second part of data of the first distributed service to the second terminal based on the second connection, the second part of data not belonging to the first data set.

[0029] In some embodiments, the method further includes one or more of the following: when connected to a server, sending at least part of the data of a first data set to the server, and obtaining at least part of the data in a second data set from the server; wherein the connection includes the first terminal logging into an account from the server, the first terminal being powered on and connected to the server, and the server pushing a message to the first terminal.

[0030] In some embodiments, the method further includes one or more of the following: when connected to the server, sending one or more of the networking data, authentication data, and pre-synchronization data of the first terminal to the server, and obtaining one or more of the networking data, authentication data, and pre-synchronization data of at least one terminal in the terminal set from the server.

[0031] When connecting to a server, any terminal in a terminal set can upload its networking data, authentication data, and pre-synchronization data to the server, and retrieve the networking data, authentication data, and pre-synchronization data of at least one other terminal in the terminal set from the server. In other words, any two terminals in the terminal set can exchange and synchronize data through the server without having to establish a connection between them. This reduces the number of link establishments between terminals during networking and improves networking efficiency.

[0032] In some embodiments, the method further includes: in response to a request initiated by a second distributed service to establish a third connection with the second terminal, the second distributed service is in the foreground of the first terminal and there are no idle link resources at the first terminal, disconnecting the fourth connection between the first terminal and the fourth terminal; wherein the second distributed service is collaboratively executed by the first terminal and the second terminal, the fourth terminal is any terminal in the terminal set except the first terminal and the second terminal, the fourth connection is created by the third distributed service in the background of the first terminal, and the third distributed service is collaboratively executed by the first terminal and the fourth terminal; and establishing the third connection.

[0033] In some implementations, after establishing the third connection, the method further includes: if the first terminal has idle link resources, restoring the fourth connection.

[0034] When a first terminal detects a request initiated by a second distributed service, where the second distributed service is in the foreground of the first terminal and the request is for establishing a third connection with the second terminal, it can determine whether idle link resources are currently available. If no idle link resources exist, it can freeze at least some of the link resources occupied by the distributed service in the background, and establish a third connection with the second terminal in response to the request, thereby improving the success rate of link establishment triggered by the foreground distributed service.

[0035] In a second aspect, an embodiment of the present application provides a networking method, which is applied to a first terminal and a second terminal in a terminal set, where the terminal set includes at least three terminals, and the method includes: the first terminal establishes a first connection with the second terminal; the first terminal sends a first data set to the second terminal based on the first connection; the second terminal sends a second data set to the first terminal based on the first connection; wherein the first data set or the second data set includes networking data and / or authentication data of at least two terminals in the terminal set, and the authentication data is used to authenticate the terminal identity.

[0036] In some embodiments, the first data set includes networking data of each terminal in the terminal set and / or authentication data of each terminal in the terminal set.

[0037] In some implementations, the amount of networking data stored in the first terminal is greater than the amount of networking data stored in the second terminal.

[0038] In some embodiments, the first data set or the second data set includes pre-synchronization data of at least two terminals in the terminal set, and the pre-synchronization data is used by the terminals to perform distributed services, and the distributed services are services collaboratively performed by at least two terminals.

[0039] In some embodiments, the first data set includes pre-synchronization data of the first terminal. After sending the first data set to the second terminal, the method further includes: notifying the second terminal that the first terminal is online; and executing a first distributed service based on the pre-synchronization data of the first terminal, wherein the first distributed service is executed collaboratively by the first terminal and the second terminal.

[0040] In some embodiments, before sending the first data set to the second terminal, the method further includes: if the update frequency of the first part of the data of the first distributed service is less than the first update frequency, setting the first part of the data as pre-synchronization data of the first terminal.

[0041] In a third aspect, an embodiment of the present application provides a terminal having the function of implementing the terminal behavior in the above-mentioned aspects and possible implementation methods of the above-mentioned aspects. The function can be implemented by hardware, or the corresponding software can be executed by hardware. The hardware or software includes one or more modules or units corresponding to the above-mentioned functions. For example, a communication module, a processing module, etc., wherein the communication module can be used for the terminal to establish a connection and communicate with other devices, and the processing module can be used to process distributed services, determine pre-synchronization data, generate challenge values, allocate link resources, etc.

[0042] In a fourth aspect, an embodiment of the present application provides a terminal comprising: a memory and a processor, the memory being used to store a computer program; and the processor being used to execute any one of the methods described in the first aspect above when calling the computer program.

[0043] In a fifth aspect, an embodiment of the present application provides a chip system, which includes a processor coupled to a memory, and the processor executes a computer program stored in the memory to implement any method described in the first aspect above.

[0044] The chip system may be a single chip or a chip module composed of multiple chips.

[0045] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, which implements any of the methods described in the first aspect when the computer program is executed by a processor.

[0046] In a seventh aspect, an embodiment of the present application provides a computer program product, which, when executed on a terminal, enables the terminal to execute any one of the methods described in the first aspect above.

[0047] It can be understood that the beneficial effects of the second to seventh aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] FIG1 is a schematic diagram of the structure of a terminal provided in an embodiment of the present application;

[0049] FIG2 is a structural block diagram of a communication system provided in an embodiment of the present application;

[0050] FIG3 is a block diagram of another communication system provided in an embodiment of the present application;

[0051] FIG4 is a block diagram of another communication system provided in an embodiment of the present application;

[0052] FIG5 is a schematic diagram of a network topology provided in an embodiment of the present application;

[0053] FIG6 is a schematic diagram of another network topology provided in an embodiment of the present application;

[0054] FIG7 is a flow chart of a networking method provided in an embodiment of the present application;

[0055] FIG8 is a flow chart of another networking method provided in an embodiment of the present application;

[0056] FIG9 is a schematic diagram of another network topology provided in an embodiment of the present application;

[0057] FIG10 is a schematic diagram of another network topology provided in an embodiment of the present application;

[0058] FIG11 is a flow chart of another networking method provided in an embodiment of the present application;

[0059] FIG12 is a flow chart of a method for configuring a central device according to an embodiment of the present application;

[0060] FIG13 is a flow chart of another method for configuring a central device provided in an embodiment of the present application;

[0061] FIG14 is a flow chart of a method for exchanging data provided in an embodiment of the present application;

[0062] FIG15 is a flow chart of another method for exchanging data provided in an embodiment of the present application;

[0063] FIG16 is a flow chart of another networking method provided in an embodiment of the present application;

[0064] FIG17 is a flow chart of another networking method provided in an embodiment of the present application;

[0065] FIG18 is a schematic diagram of the structure of another network topology provided in an embodiment of the present application;

[0066] FIG19 is a flow chart of another networking method provided in an embodiment of the present application;

[0067] FIG20 is a flow chart of a data synchronization method provided in an embodiment of the present application;

[0068] FIG21 is a flow chart of a link establishment method provided in an embodiment of the present application;

[0069] FIG22 is a flow chart of another link establishment method provided in an embodiment of the present application;

[0070] FIG23 is a flow chart of a method for allocating link resources according to an embodiment of the present application;

[0071] FIG24 is a flow chart of another method for allocating link resources provided in an embodiment of the present application;

[0072] FIG25 is a flow chart of another networking method provided in an embodiment of the present application;

[0073] Figure 26 is a flow chart of another networking method provided in an embodiment of the present application. DETAILED DESCRIPTION

[0074] The networking method provided in the embodiments of the present application can be applied to terminals such as mobile phones, tablet computers, wearable devices, vehicle-mounted devices, augmented reality (AR) / virtual reality (VR) devices, laptop computers, ultra-mobile personal computers (UMPCs), netbooks, and personal digital assistants (PDAs). The embodiments of the present application do not impose any restrictions on the specific types of terminals.

[0075] Please refer to Figure 1, which is a schematic diagram of the structure of a terminal 100 provided in this application. The terminal 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, a communication module 150, a subscriber identification module (SIM) card interface 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, and a display 194.

[0076] It should be understood that the structures illustrated in the embodiments of the present application do not constitute a specific limitation on the terminal 100. In other embodiments of the present application, the terminal 100 may include more or fewer components than shown, or may combine or separate certain components, or arrange the components differently. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0077] For example, one or more components other than the processor 110, communication module 150, and internal memory 121 in FIG1 may be omitted. For example, if the terminal 100 is a mobile phone, wearable device, or IoT device, the SIM card interface 160 may be included; if the terminal 100 is a laptop, the SIM card interface may not be included. Alternatively, if the terminal 100 is a smart speaker, the display screen 194 may be omitted, but if the terminal is a smart door lock, the display screen 194 may be included.

[0078] The processor 110 may include one or more processing units, for example: the processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Among them, different processing units can be independent devices or integrated into one or more processors. Among them, the controller can be the nerve center and command center of the terminal 100. The controller can generate an operation control signal based on the instruction opcode and timing signal to complete the control of instruction fetching and execution.

[0079] Processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in processor 110 is a cache memory. This memory can store instructions or data that have just been used or are being recycled by processor 110. If processor 110 needs to use the instruction or data again, it can directly access the memory. This reduces repeated accesses and reduces the waiting time of processor 110, thereby improving system efficiency.

[0080] The charging management module 140 is configured to receive charging input from a charger. The charger can be either a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 can receive charging input from the wired charger via the USB interface 130. In some wireless charging embodiments, the charging management module 140 can receive wireless charging input via the wireless charging coil of the terminal 100. While charging the battery 142, the charging management module 140 can also provide power to the terminal via the power management module 141.

[0081] The power management module 141 is used to connect the battery 142, the charging management module 140, and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, and provides power to the processor 110, the internal memory 121, the external memory, the display 194, the camera 193, and the communication module 150. The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle count, and battery health status (leakage, impedance). In some other embodiments, the power management module 141 can also be set in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 can also be set in the same device.

[0082] The communication module 150 can provide solutions for wireless communications such as 2G / 3G / 4G / 5G applied to the terminal 100. And / or, it can provide solutions for wireless communications such as wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared technology (IR), etc. applied to the terminal 100. The wireless communication function of the terminal 100 can be implemented through the communication module 150, the modem processor, and the baseband processor.

[0083] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The terminal 100 implements the display function through the GPU, the display screen 194, and the application processor.

[0084] The camera 193 is used to capture still images or videos. The terminal 100 can implement the shooting function through the ISP, the camera 193, the video codec, the GPU, the display 194 and the application processor.

[0085] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the terminal 100. The external memory card communicates with the processor 110 via the external memory interface 120 to implement data storage functions. For example, files such as music and videos can be stored on the external memory card.

[0086] The internal memory 121 can be used to store computer executable program codes, which include instructions. The processor 110 executes various functional applications and data processing of the terminal 100 by running the instructions stored in the internal memory 121. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area can store data created during the use of the terminal 100 (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.

[0087] The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. The audio module 170 can also be used to encode and decode audio signals. In some embodiments, the audio module 170 can be provided in the processor 110, or some functional modules of the audio module 170 can be provided in the processor 110.

[0088] The speaker 170A, also called a "speaker", is used to convert audio electrical signals into sound signals. The terminal 100 can listen to music or listen to hands-free calls through the speaker 170A.

[0089] The receiver 170B, also called a "handset", is used to convert audio electrical signals into sound signals. When the terminal 100 receives a call or a voice message, the user can place the receiver 170B close to the ear to hear the voice.

[0090] Microphone 170C, also known as "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can speak by putting their mouth close to the microphone 170C to input the sound signal into the microphone 170C. The terminal 100 can be provided with at least one microphone 170C. In other embodiments, the terminal 100 can be provided with two microphones 170C, which can not only collect sound signals but also realize noise reduction function. In other embodiments, the terminal 100 can also be provided with three, four or more microphones 170C to realize sound signal collection, noise reduction, and identification of sound sources, and realize directional recording function, etc.

[0091] The headphone jack 170D is used to connect a wired headphone and can be the USB interface 130 or a 3.5mm open mobile terminal platform (OMTP) standard interface or a cellular telecommunications industry association of the USA (CTIA) standard interface.

[0092] The terminal 100 can implement audio functions such as music playback and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.

[0093] The sensor module 180 may include a pressure sensor, a gyro sensor, an air pressure sensor, a magnetic sensor, an acceleration sensor, a distance sensor, a proximity light sensor, a fingerprint sensor, a temperature sensor, a touch sensor, an ambient light sensor, a bone conduction sensor, and the like.

[0094] Keys 190 include a power button, a volume button, etc. Keys 190 may be mechanical keys or touch keys. Terminal 100 may receive key inputs and generate key signal inputs related to user settings and function control of terminal 100.

[0095] SIM card interface 160 is used to connect a SIM card. A SIM card can be connected to and disconnected from terminal 100 by inserting or removing it from SIM card interface 160. In some embodiments, terminal 100 uses an eSIM, or embedded SIM card. The eSIM card can be embedded in terminal 100 and cannot be separated from terminal 100.

[0096] In order to facilitate understanding of the technical solutions in the embodiments of the present application, the application scenarios of the embodiments of the present application are first introduced below.

[0097] With the continuous development of terminal technology, various terminals have been widely used in various scenarios, including personal, home, and industrial use. In these scenarios, multiple terminals can be networked together to achieve connectivity and collaboration, providing users with more complex and richer services. However, as the number of terminals participating in ad hoc networks increases, the energy efficiency of the network is also receiving increasing attention.

[0098] The following describes communication systems in different scenarios such as personal, home, and industrial.

[0099] Please refer to Figure 2, which shows a schematic structural diagram of a communication system suitable for personal scenarios provided in an embodiment of the present application.

[0100] As shown in Figure 2, communication system 200 may include core network equipment 210, at least one access network equipment 220, and at least one terminal, such as a mobile phone 231, a smart TV 232, a tablet computer 233, a laptop computer 234, a smart watch 235, a smart headset 236, and a computer 237. The terminal may be directly or indirectly connected to access network equipment 220 for communication. Access network equipment 220 may be directly or indirectly connected to core network equipment 210 for terminal access to the network.

[0101] The present embodiment does not impose any specific restrictions on the communication method between the access network device 220 and the core network device 210. For example, the access network device 220 can establish a wireless link with the core network device 210 through the gateway 211, or the access network device 220 can directly establish a wireless link with the core network device 210.

[0102] Similarly, the embodiment of the present application does not impose any specific restrictions on the communication method between the terminal and the access network device 220.

[0103] In some embodiments, the terminal may directly establish a wireless link with the access network device 220 .

[0104] For example, as shown in FIG. 2 , the mobile phone 231 may directly establish a wireless link with the access network device 220 to implement communication between the mobile phone 231 and the access network device 220 .

[0105] In other embodiments, the terminal may establish a wireless link with the access network device 220 through the router 240 and the firewall 250 .

[0106] For example, as shown in FIG2 , a mobile phone 231 , a smart TV 232 , a tablet computer 233 , a laptop computer 234 , and a computer 237 may establish wireless links with the access network device 220 through a router 240 and a firewall 250 .

[0107] The present embodiment does not impose any specific restrictions on the communication method between the mobile phone 231, smart TV 232, tablet computer 233, laptop computer 234, and computer 237 and the router 240. For example, the mobile phone 231, smart TV 232, tablet computer 233, laptop computer 234, and computer 237 can each communicate with the router 240 via a Wi-Fi network.

[0108] In other embodiments, the terminal may establish a wireless link with the access network device 220 through an intermediate device.

[0109] For example, as shown in FIG2 , the tablet computer 233 , the smart watch 235 , and the smart headset 236 can establish a wireless link with the access network device 220 through the mobile phone 231 .

[0110] The present embodiment does not impose any specific restrictions on the communication method between the tablet computer 233, smart watch 235, smart headset 236, and the mobile phone 231. For example, the tablet computer 233 can communicate with the mobile phone 231 via Wi-Fi direct (Wi-Fi peer-to-peer, Wi-Fi p2p), and the smart watch 235 and smart headset 236 can communicate with the mobile phone 231 via BT.

[0111] For example, the communication system 200 may further include at least one data center 260. In this embodiment of the present application, the data center 260 may be communicatively connected to the access network device 220 to connect the data center 260 to the network. The data center 260 may be used for transmitting, receiving, storing, or processing data.

[0112] The embodiment of the present application does not impose any specific restrictions on the communication method between the data center 260 and the access network device 220. For example, the data center 260 can establish a wireless link with the access network device 220 through the router 240 and the firewall 250.

[0113] The embodiment of the present application does not impose any specific limitation on the communication method between the data center 260 and the router 240. For example, the data center 260 can communicate with the router 240 via a local area network (LAN).

[0114] Please refer to Figure 3, which shows a structural diagram of a communication system suitable for home scenarios provided in an embodiment of the present application.

[0115] As shown in Figure 3, communication system 300 may include core network equipment 310, at least one access network device 320, and at least one terminal: user A's mobile phone 331, smartwatch 332, and tablet computer 333; user B's mobile phone 341, laptop computer 342, and smart headset 343; and a family's shared smart TV 351 and air purifier 352. The terminal may communicate directly or indirectly with access network equipment 320. Access network equipment 320 may communicate directly or indirectly with core network equipment 310 to connect the terminal to the network.

[0116] The embodiment of the present application does not limit the communication method between the access network device 320 and the core network device 310. For example, the access network device 320 can establish a wireless link with the core network device 310 through the gateway 311, or the access network device 320 can directly establish a wireless link with the core network device 310.

[0117] Similarly, the embodiment of the present application does not impose any specific restrictions on the communication method between the terminal and the access network device 320.

[0118] For example, as shown in Figure 3, user A's mobile phone 331 and user B's mobile phone 341 can directly establish wireless links with access network device 320. For example, user B's mobile phone 341, user B's laptop 342, smart TV 351, and air purifier 352 can establish wireless links with access network device 320 through router 340 and firewall 350.

[0119] The present embodiment does not impose any specific restrictions on the communication method between user B's mobile phone 341, laptop computer 342, smart TV 351, and air purifier 352 and router 340. For example, user B's mobile phone 341, laptop computer 342, smart TV 351, and air purifier 352 can each communicate with router 340 via a Wi-Fi network.

[0120] For example, as shown in Figure 3, user A's tablet computer 333 and smartwatch 332 can establish a wireless link with access network device 320 through user A's phone 331. User B's laptop computer 342 and smart headset 343 can also establish a wireless link with access network device 320 through user B's phone 341.

[0121] This embodiment of the present application does not specifically limit the communication method between the tablet computer 333 and the smartwatch 332 and the mobile phone 331. For example, the tablet computer 333 can communicate with the mobile phone 331 via Wi-Fi p2p, and the smartwatch 332 can communicate with the mobile phone 331 via BT. Similarly, the laptop computer 342 can communicate with the mobile phone 341 via Wi-Fi p2p, and the smart headset 343 can communicate with the mobile phone 341 via BT.

[0122] For example, the communication system 300 may further include at least one data center 360. In this embodiment of the present application, the data center 360 may be communicatively connected to the access network device 320 to connect the data center 360 to the network. The data center 360 may be used for transmitting, receiving, storing, or processing data.

[0123] The embodiment of the present application does not impose any specific restrictions on the communication method between the data center 360 and the access network device 320. For example, the data center 360 can establish a wireless link with the access network device 320 through the router 340 and the firewall 350.

[0124] The embodiment of the present application does not impose any specific restrictions on the communication method between the data center 360 and the router 340. For example, the data center 360 can communicate with the router 340 via a LAN.

[0125] Please refer to Figure 4, which shows a schematic structural diagram of a communication system suitable for industrial scenarios provided in an embodiment of the present application.

[0126] As shown in FIG4 , the communication system 400 may include an industrial intranet. The industrial intranet may be used to connect terminals in an industrial production environment (hereinafter referred to as industrial equipment). At least one core network device 410 may be deployed in the industrial intranet. The communication system 400 may also include at least one access network device 420 and at least one industrial equipment, such as an industrial equipment

[0127] 431, industrial equipment 432, and industrial equipment 433. It should be understood that the industrial equipment can communicate directly or indirectly with the access network equipment 420. The access network equipment 420 can communicate directly or indirectly with the core network equipment 410 to connect the industrial equipment to the industrial intranet.

[0128] The embodiments of the present application do not impose any specific restrictions on the types of industrial equipment. For example, industrial equipment may include coal mining machines, machine tools, mechanical equipment, or instruments and meters.

[0129] The embodiment of the present application does not limit the communication method between the access network device 420 and the core network device 410. For example, the access network device 420 can establish a wireless link with the core network device 410 through the gateway 411, or the access network device 420 can directly establish a wireless link with the core network device 410.

[0130] Similarly, the embodiment of the present application does not impose any specific restrictions on the communication method between the industrial device and the access network device 420.

[0131] For example, as shown in FIG. 4 , industrial device 431 and industrial device 432 may establish a wireless link with access network device 420 through router 440 , core router 450 , and firewall 460 .

[0132] For example, as shown in FIG. 4 , industrial device 432 and industrial device 433 may establish a wireless link with access network device 420 through core router 450 and firewall 460 .

[0133] The embodiment of the present application does not impose any specific restrictions on the communication method between industrial device 431 and industrial device 432 and router 440. For example, industrial device 431 and industrial device 432 can communicate with router 440 respectively through a Wi-Fi network. Similarly, the embodiment of the present application does not impose any specific restrictions on the communication method between industrial device 432 and industrial device 433 and core router 450. For example, industrial device 432 can communicate with core router 450 through a LAN. For example, industrial device 433 can communicate with core router 450 through a controller area network (CAN) bus, a 485 bus, a programmable logic controller (PLC) or zigbee technology.

[0134] For example, communication system 400 may further include at least one data center 470. In this embodiment of the present application, data center 470 may be communicatively connected to access network device 420 to connect data center 470 to the network. Data center 470 may be used for transmitting, receiving, storing, or processing data.

[0135] The embodiment of the present application does not impose any specific restrictions on the communication method between the data center 470 and the access network device 420. For example, the data center 470 can establish a wireless link with the access network device 420 through the core router 450 and the firewall 460.

[0136] The embodiment of the present application does not impose any specific limitation on the communication method between the data center 470 and the core router 450. For example, the data center 470 can communicate with the core router 450 via a LAN.

[0137] In some embodiments, the communication system 400 may further include at least one terminal that is not used for industrial production (hereinafter referred to as non-industrial equipment), such as a laptop 480, a tablet computer 481, a mobile phone 482, and a smartwatch 483 as shown in FIG4 .

[0138] The embodiments of the present application do not impose any specific restrictions on the networking method of non-industrial equipment.

[0139] For example, non-industrial devices can be connected to an industrial intranet. The embodiments of the present application do not impose any specific restrictions on the manner in which non-industrial devices are connected to an industrial intranet.

[0140] For example, as shown in FIG4 , a laptop computer 480 , a tablet computer 481 and a mobile phone 482 can establish wireless links with the access network device 420 through the router 440 , the core router 450 and the firewall 460 to connect the laptop computer 480 , the tablet computer 481 and the mobile phone 482 to the industrial intranet respectively.

[0141] The embodiment of the present application does not impose any specific restrictions on the communication method between the laptop 480, tablet computer 481, and mobile phone 482 and the router 440. For example, the laptop 480, tablet computer 481, and mobile phone can communicate with the router 440 via a Wi-Fi network.

[0142] For example, as shown in Figure 4, mobile phone 482 can directly establish a wireless link with access network device 420 to connect mobile phone 482 to the industrial intranet. For example, smart watch 483 can indirectly establish a wireless link with access network device 420 through mobile phone 482 to connect smart watch 483 to the industrial intranet. This embodiment of the application does not specifically limit the communication method between smart watch 483 and mobile phone 482. For example, smart watch 483 can communicate with mobile phone 482 via BT.

[0143] For example, non-industrial devices can also be connected to the industrial extranet. For example, mobile phone 482 can be connected to the industrial extranet. The embodiment of the present application does not specifically limit the method of connecting non-industrial devices to the industrial extranet.

[0144] It should be noted that the classification of industrial equipment and non-industrial equipment shown in FIG4 is for illustrative purposes only and should not be construed as limiting the embodiments of the present application.

[0145] The access network device shown in Figures 2 to 4 can be any device with wireless transceiver functions. In some embodiments, the access network device can be used to access the terminal to the network so that the terminal can communicate with other devices in the network (such as the core network device mentioned above). For example, the access network device may include but is not limited to: a base station (BS), an evolved NodeB (eNodeB), a transmission reception point (TRP), a next generation NodeB (gNB) in a 5G mobile communication system, a next generation base station in a sixth generation (6G) mobile communication system, a base station in a future mobile communication system, or an access node in a WiFi system, etc.

[0146] The core network devices shown in Figures 2 to 4 may be devices with one or more network services. For example, network services may include account services, quick services (HUAWEI ability gallery, HAG), and device management services. Account services can be used to authenticate and manage accounts logged into terminals. Quick services can be used to send relevant data to terminals for implementing card-type quick services. Device management services can be responsible for device connection, disconnection, and status monitoring.

[0147] Taking communication systems in various scenarios, such as personal, home, and industrial, as an example, the network topology of a multi-terminal ad hoc network is shown in Figure 5. This network topology can include multiple, isolated wireless access points (APs). Each AP can connect to up to 20 terminals. Terminals connected to the same AP (e.g., Terminal 1 and Terminal 2 connected to AP 1) can discover and transmit data via Wi-Fi. Terminals connected to different APs (e.g., Terminal 6 connected to AP 1 and Terminal 7 and Terminal 8 connected to AP 2) can only connect via Bluetooth. When more than three terminals are connected via Bluetooth, insufficient Bluetooth air interface resources can occur, leading to low device online rates and low service connection success rates. The network topology shown in Figure 5 exhibits these issues, in part, due to Bluetooth air interface congestion caused by the mesh concurrency of multiple Bluetooth terminals and the serialization of Bluetooth channel commands. When multiple terminals belonging to the same account synchronize data such as distributed databases, galleries, cameras, calendars, memos, and weather data, Bluetooth air interface congestion can prevent these terminals from connecting or synchronizing in a timely manner. Another reason why the above-mentioned problems occur in the network topology shown in Figure 5 is that in some application scenarios (such as terminal store display scenarios), there are no network planning and network optimization measures. Terminals across wireless access points can only be networked via Bluetooth, which exceeds the support capability of the Bluetooth chip and affects the bandwidth of cross-channel collaborative devices, causing display jams.

[0148] From the user's perspective, when using a terminal for distributed services, the following problems may occur: during the device discovery phase, the terminal cannot discover the peer device; during the device connection phase, the terminal cannot connect to the peer device or the connection is slow; during the distributed service execution phase, disconnection and lag problems occur.

[0149] For example, when mobile phone 1 is executing super terminal services with a tablet computer, a speaker and mobile phone 2, the following situations may occur: mobile phone 1 cannot collapse other terminals such as a tablet computer, a speaker, mobile phone 2, etc.; mobile phone 1 can search for other terminals but cannot establish a connection with the other terminals; mobile phone 1 is disconnected during communication with other terminals.

[0150] For example, when a mobile phone and a computer are performing multi-screen collaboration services, the following situations may occur: the mobile phone cannot detect the computer; the mobile phone can detect the computer but cannot establish a connection with the computer; the connection between the mobile phone and the computer is unstable; files cannot be dragged and dropped from the mobile phone to the computer; files cannot be dragged and dropped from the computer to the mobile phone, and there is a lag when dragging files.

[0151] For example, in the business of projecting the screen from a mobile phone to a smart screen, the following situations may occur: the mobile phone cannot detect the smart screen; the mobile phone can detect the smart screen but cannot establish a connection with the smart screen; the projected screen displayed by the smart screen becomes stuck.

[0152] For example, when the door lock and the smart screen execute the distributed cat-eye service, the following situations may occur: the door lock cannot call the smart screen; the smart screen freezes when displaying the picture taken by the door lock.

[0153] The terminals conduct self-organized networking, including exchanging networking data, authentication data, or at least part of distributed service data. The networking data, authentication data, and distributed service data are described below.

[0154] Networking data can be used to establish a network connection between the terminal and other devices (such as another terminal). In some embodiments, the networking data may include the terminal's address information, such as the Internet Protocol (IP) address, Media Access Control (MAC) address, and link address. In some embodiments, the networking data may include the connection types supported by the terminal. In some embodiments, the networking data may also include the terminal's identity information, such as the terminal's terminal identifier and the terminal's device type.

[0155] The authentication data may be used to authenticate the identity of the terminal. In some implementations, the authentication data of the terminal may include a secret key corresponding to the terminal.

[0156] Distributed business is a business that is collaboratively processed by at least two terminals. Distributed business data refers to the data required by the terminal and other terminals to collaboratively process distributed business. In some embodiments, distributed business data can be stored in a data distribution and management system (DDMS). In some embodiments, distributed business data may include a document management system (DMS), a database management system (DBMS), metadata of the DBMS, basic device information (DP), clipboard data, distributed hardware data, notification service data, a distributed file system (DFS), binder object information of a remote interface call service, security level data, configuration data, static data, service version information, etc. One or more of the following. The metadata of the DBMS may include the table structure of distributed data. DFS is the configuration data of distributed files. Distributed hardware data can be used to configure the camera, speaker, microphone and other hardware of another terminal.

[0157] Among them, different distributed business data has different update frequencies. When the update frequency of the distributed business data is higher, the terminals need to synchronize and update the distributed business data more frequently. In some embodiments, for distributed business data with a lower update frequency, the terminals can synchronize before the distributed business corresponding to the distributed business data is triggered. This synchronization method can be called pre-synchronization, and this part of the distributed business data can be called pre-synchronization data. In some embodiments, for distributed business data with a higher update frequency, the terminal can synchronize the distributed business data with other terminals when the distributed business corresponding to the distributed business data is triggered. This synchronization method is also called on-demand synchronization.

[0158] Exemplarily, the pre-synchronization data may include one or more of clipboard data, device basic information, DBMS metadata, distributed hardware data, notification service data, binder object information of remote interface call service, security level data, at least part of configuration data, at least part of static data, service version information, etc.

[0159] It should be noted that the above is an example and not a limitation of the authentication data, networking data and pre-synchronization data of the terminal during the networking process. In actual applications, the authentication data, networking data and pre-synchronization data of the terminal during the networking process may include more or less data than the above.

[0160] In some embodiments, multiple terminals establish connections with each other to exchange networking data, each time taking 5 to 8 seconds. When the number of terminals participating in the ad hoc network is less than or equal to the maximum number of simultaneous connections that can be established by terminals, the time required for these multiple terminals to complete networking is relatively short. However, when the number of terminals participating in the ad hoc network exceeds the maximum number of simultaneous connections that can be established by each terminal, each terminal can only connect to a limited number of terminals simultaneously. However, for other terminals outside of these terminals, since concurrent connections have not been released, it is impossible to immediately establish connections with these other terminals, resulting in an excessively long ad hoc network duration.

[0161] For example, a self-organizing network between multiple terminals is shown in Figure 6. Assuming that the maximum number of connections established simultaneously by each terminal is 4, the time it takes for any two terminals to establish a connection and complete networking is 5s (seconds) to 8s. As shown in Figure 6a, the number of terminals participating in the self-organizing network is 2, and the self-organizing process requires establishing one connection, which takes 5s to 8s. As shown in Figure 6b, the number of terminals participating in the self-organizing network is 3, and the self-organizing process requires establishing three connections. However, since each terminal can establish a maximum of 4 connections simultaneously, the time taken is still 5s (seconds) to 8s. As shown in Figure 6c, the number of terminals participating in the self-organizing network is 6, which is greater than 4. Therefore, each terminal needs to first establish 4 connections to complete networking with 4 terminals, and then release these 4 connections and establish connections with other terminals. The networking process requires establishing 15 connections, which takes more than 5s to 8s.

[0162] In some implementations, the networking process between any two terminals may be as shown in FIG7 .

[0163] Terminal 1 and Terminal 2 need to establish two physical connections: an initial self-organizing physical connection to exchange authentication and networking data, and a second physical connection to exchange distributed service data for data synchronization after the self-organizing network reports that the devices are online. Because Terminal 1 and Terminal 2 need to establish multiple logical connections for data synchronization before they can execute distributed services based on the synchronized distributed service data, the online rate of distributed services is low.

[0164] Therefore, when the number of terminals participating in the self-organizing network is small, such as 3 terminals, the above-mentioned self-organizing process has little impact on the efficiency of the self-organizing network. However, when the number of terminals participating in the self-organizing network is large, such as greater than 4, the efficiency of the networking of multiple terminals based on the above-mentioned self-organizing process will be seriously reduced, including problems such as low equipment online rate and low distributed service online rate.

[0165] In order to solve at least some of the above technical problems, the present application provides a networking method, which can be used for networking multiple terminals in a terminal set.

[0166] In some embodiments, the terminal set may include multiple terminals within a preset range, and illustratively, the terminal set may include multiple terminals within a communication range of each other. In some embodiments, the terminal set may include multiple terminals belonging to the same user ID, and illustratively, the terminal set may include multiple terminals logged into the same account.

[0167] The following specific embodiments are used to describe the technical solution of the present application in detail. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.

[0168] Please refer to Figure 8, which is a flowchart of a networking method provided in an embodiment of the present application. It should be noted that the method is not limited to the specific order shown in Figure 8 and the following description. It should be understood that in some embodiments, the order of some steps in the method can be interchanged according to actual needs, or some steps can be omitted or deleted. The method includes the following steps:

[0169] S801: Each terminal in the terminal set determines its own pre-synchronization data.

[0170] In order to improve data synchronization efficiency and the online rate of distributed services, each terminal in the terminal set may determine at least part of the distributed service data in the terminal as pre-synchronization data, that is, aggregate the at least part of the distributed service data.

[0171] In some implementations, the step of each terminal in the terminal set determining its own pre-synchronization data in S801 may be omitted.

[0172] S802: The terminal aggregates and configures a central device and leaf devices of the central device.

[0173] In some embodiments, a terminal set includes a central device, and all other devices in the terminal set except the central device are leaf devices of the central device. That is, each terminal in the terminal set functions only as a central device or only as a leaf device. For example, as shown in FIG9 , the terminal set includes terminal 1, terminal 2, terminal 3, terminal 4, terminal 5, terminal 6, terminal 7, terminal 8, and terminal 9. Terminal 1 is the central device, and terminals 2, terminal 3, terminal 4, terminal 5, terminal 6, terminal 7, terminal 8, and terminal 9 are leaf devices of terminal 1.

[0174] In some embodiments, the terminal set includes multiple central devices, and each central device corresponds to multiple leaf devices. Among them, each terminal in the terminal set can serve as a central device and also as a leaf device of other central devices. For example, as shown in Figure 10, the terminal set includes terminal 1, terminal 2, terminal 3, terminal 4, terminal 5, terminal 6, terminal 7, terminal 8, terminal 9, terminal 10, terminal 11, terminal 12, terminal 13 and terminal 14. Among them, terminal 1 is the central device, and terminal 2, terminal 3, terminal 4 and terminal 5 serve as leaf devices of terminal 1; at the same time, terminal 2 is also the central device, and terminal 6, terminal 7 and terminal 8 are leaf devices of terminal 2; terminal 4 is also the central device, and terminal 9, terminal 10 and terminal 11 are leaf devices of terminal 4; terminal 7 is also the central device, and terminal 12, terminal 13 and terminal 14 are leaf devices of terminal 7.

[0175] S803, the central device and the leaf devices of the central device are networked through proxy networking and central end networking, so that each terminal in the terminal set obtains one or more of the networking data, authentication data and pre-synchronization data of other terminals in the terminal set.

[0176] Proxy networking: A first terminal in a terminal set can act as a proxy for a third terminal, sending one or more of the third terminal's networking data, authentication data, and pre-synchronization data to a second terminal. This allows the second terminal to obtain one or more of the third terminal's networking data, authentication data, and pre-synchronization data without establishing a connection with the third terminal. The first, second, and third terminals are any three terminals in the terminal set.

[0177] Center-end networking means that the center device actively initiates networking to the leaf device, thereby exchanging networking data, authentication data and pre-synchronization data with the leaf device.

[0178] The central device and the leaf devices of the central device are networked through proxy networking and center-end networking. That is, when the terminal set is configured with a central device and a leaf device, the central device can actively initiate networking to the leaf devices of the central device, thereby exchanging networking data, authentication data and pre-synchronization data with the leaf devices of the central device. During the exchange, the central device and the leaf devices of the central device can send the networking data, authentication data and pre-synchronization data of some or all terminals in the terminal set to the other end, so that each terminal in the terminal set can be networked with each other terminal in the terminal set without establishing a connection with each other terminal in the terminal set.

[0179] In some implementations, S803 can be replaced by: the central device and its leaf devices establish a network through proxy networking and central-end networking, allowing each terminal in the terminal set to obtain the networking data of other terminals in the terminal set. In other words, at least one of the authentication data and pre-synchronization data can be omitted. For example, if the step of each terminal in the terminal set determining its own pre-synchronization data is omitted in S801, the pre-synchronization data in S803 can be omitted.

[0180] S804, each terminal in the terminal set goes online.

[0181] When any two terminals in the terminal set obtain the networking data of the other terminal, the two terminals can communicate based on the networking data of the other terminal. Therefore, in some embodiments, after obtaining the networking data of the other terminal, the two terminals in the terminal set can notify the other terminal that the terminal is online.

[0182] When any two terminals in the terminal set obtain the authentication data of the other terminal, the two terminals can authenticate the identity of the other terminal and can communicate with each other in an encrypted manner. Therefore, in some embodiments, after obtaining the networking data and authentication data of the other terminal, the two terminals in the terminal set can notify the other terminal that the terminal has come online.

[0183] When any two terminals in the terminal set obtain the pre-synchronization data of the other terminal, they can immediately execute distributed services based on the pre-synchronization data after going online, without having to synchronize the pre-synchronization data again, thereby improving networking efficiency and the online rate of distributed services. Therefore, in some embodiments, after obtaining the networking data and pre-synchronization data of the other terminal, the two terminals in the terminal set can notify the other terminal that they have gone online.

[0184] In some implementations, the step of S804 of each terminal in the terminal set going online may be included in the step of S803 of the central device and the leaf devices of the central device networking through proxy networking and central end networking.

[0185] In some implementations, the step of each terminal in the terminal set going online in S804 may be omitted.

[0186] S805: At least two terminals in the terminal set execute a distributed service.

[0187] In some embodiments, if at least two terminals executing a distributed service have synchronized pre-synchronization data before going online, the distributed service can be executed based on the pre-synchronization data. Alternatively, in other embodiments, if at least two terminals executing a distributed service have not synchronized pre-synchronization data before going online, the at least two terminals can first synchronize the pre-synchronization data and then execute the distributed service based on the pre-synchronization data.

[0188] In some implementations, the distributed service may include a screen projection service, a super terminal service, a multi-screen collaboration service, or a distributed cat's eye service. Of course, in actual applications, the distributed service may also include other types of distributed services.

[0189] In some implementations, when a distributed service is in the foreground, link resources may be preferentially allocated to the distributed service to further improve the online rate and processing efficiency of the distributed service.

[0190] In some implementations, the step of at least two terminals in the terminal set executing the distributed service in S805 may be omitted.

[0191] S806: At least two terminals in the terminal set synchronize the remaining distributed service data except the pre-synchronization data.

[0192] From the above, it can be seen that at least two terminals in the terminal set have synchronized the pre-synchronization data before going online. The pre-synchronization data includes at least part of the distributed business data. When the at least two terminals execute distributed services after going online, they may need to synchronize the remaining part of the distributed business data. Therefore, after going online, the at least two terminals can also be triggered by the executed distributed services to synchronize at least part of the distributed business data except the pre-synchronization data.

[0193] In some implementations, if the step of synchronizing pre-synchronization data in S802 is not omitted, the step of synchronizing the remaining distributed service data other than the pre-synchronization data in S806, in which at least two terminals in the terminal set synchronize the remaining distributed service data, can be omitted. That is, after establishing a link and synchronizing the pre-synchronization data once in S802, the at least two terminals no longer synchronize any distributed data, thereby further conserving link resources, enabling timely allocation of link resources to distributed services in the foreground, and improving the uptime and processing efficiency of distributed services in the foreground.

[0194] In an embodiment of the present application, a central device (also referred to as a master device) can be determined among multiple terminals participating in the ad hoc network, and then a connection can be established with other device terminals through the central device, thereby reducing the number of link establishment times between terminals during the ad hoc network process and improving networking efficiency. In some embodiments, a terminal can act as an agent for another terminal to exchange data with other terminals, thereby reducing the number of connection establishment times during the ad hoc network process and improving networking efficiency. In some embodiments, before going online, a terminal establishes a connection with other terminals once and synchronizes pre-synchronization data once. After the terminal goes online, this part of data is no longer synchronized, thereby reducing repeated link establishment between terminals and improving the efficiency of terminal pair-to-pair networking. In some embodiments, the terminal can freeze the link resources occupied by the distributed service in the background and allocate the link resources to the distributed service in the foreground, thereby giving priority to the link establishment request of the foreground service, improving the link establishment efficiency when processing the foreground service, ensuring the foreground connection success rate and the device online rate, and improving the user experience of the foreground service. In some embodiments, when a terminal detects a connection event with a server, it can upload the terminal's authentication data, networking data, or pre-synchronization data to the server, and / or obtain the authentication data, networking data, or pre-synchronization data of other terminals from the server, thereby improving networking efficiency. That is, the terminal does not need to establish a connection with other terminals to exchange authentication data, networking data, or pre-synchronization data, thereby reducing the number of link establishment times between terminals during the self-networking process.

[0195] Please refer to Figure 11, which is a flowchart of a networking method provided in an embodiment of the present application. This method can be used as a detailed description of the aforementioned S803. Among them, the terminal set includes a central device and a leaf device. In some embodiments, the central device can serve as the first terminal and the leaf device can serve as the second terminal. In some embodiments, this method can be used for the terminal set to be networked without being connected to a server. It should be noted that this method is not limited to Figure 11 and the specific order described below. It should be understood that in some embodiments, the order of some steps in this method can be interchanged according to actual needs, or some steps therein can be omitted or deleted. The method comprises the following steps:

[0196] S1101: A central device establishes a first connection with a leaf device of the central device.

[0197] In some embodiments, the central device may send a link establishment request to a leaf device of the central device, thereby requesting to establish a first connection with the leaf device.

[0198] In some embodiments, the central device may establish a first connection with some or all of the leaf devices of the central device. In some embodiments, if the number of connections currently established by the central device is greater than or equal to the maximum number of connections that the central device can simultaneously establish, the central device may establish a first connection with a leaf device after at least some of the established connections are released.

[0199] In some embodiments, the speed of a connection (including the first connection) between any two terminals in the terminal set can be greater than the transmission speed of a connection established to save energy, such as a Bluetooth low energy (BLE) connection. This higher transmission speed connection, also known as a high-speed connection, can reduce the latency of a single link establishment between terminals, thereby improving networking efficiency. Exemplarily, the high-speed link can include HML.

[0200] S1102: The central device exchanges data with its leaf devices.

[0201] In some embodiments, the central device exchanges data with the leaf devices of the central device, including the central device sending a first data set to the leaf devices of the central device and receiving a second data set sent by the leaf device. In some embodiments, the first data set or the second data set includes networking data of at least two terminals in the terminal set. When the central device exchanges data with the leaf devices, it can exchange the networking data of multiple terminals through one link establishment, rather than only exchanging the networking data of the central device and the networking data of the leaf devices. That is, the central device and the leaf device can act as agents for other terminals in the terminal set to exchange networking data. The central device and the leaf device can obtain the networking data of the other terminals without establishing a link with the other terminals, thereby reducing the number of link establishment times of the terminal set during the networking process, thereby improving networking efficiency.

[0202] In some embodiments, the first data set and the second data set are at least partially different.

[0203] In some embodiments, the first data set includes networking data of the central device. In some embodiments, the second data set sent by the leaf device includes networking data of the leaf device.

[0204] In some embodiments, the first data set may include networking data of all terminals in the terminal set currently stored by the central device. In some embodiments, the second data set includes networking data of all terminals in the terminal set currently stored by the leaf device.

[0205] In some embodiments, if the central device obtains the networking data of each terminal in the terminal set, the first data set may include the networking data of each terminal in the terminal set, so that each terminal in the terminal set can obtain the networking data of each terminal in the terminal set without having to establish a connection with each terminal in the terminal set, thereby reducing the number of link establishment times and improving networking efficiency.

[0206] In some embodiments, the first data set or the second data set includes authentication data of at least two terminals in the terminal set. Similarly, when the central device exchanges data with the leaf device, it can exchange authentication data of multiple terminals by establishing a link once, rather than only exchanging the authentication data of the central device and the authentication data of the leaf device. That is, the central device and the leaf device can act as agents for other terminals in the terminal set to exchange authentication data. The central device and the leaf device can obtain the authentication data of the other terminal without establishing a link with the other terminal, thereby reducing the number of link establishment times of the terminal set during the networking process, thereby improving networking efficiency.

[0207] In some embodiments, the first data set includes authentication data of the central device. In some embodiments, the second data set sent by the leaf device includes authentication data of the leaf device.

[0208] In some embodiments, the first data set may include authentication data of all terminals in the terminal set currently stored by the central device. In some embodiments, the second data set includes authentication data of all terminals in the terminal set currently stored by the leaf device.

[0209] In some embodiments, if the central device obtains the authentication data of each terminal in the terminal set, the first data set includes the authentication data of each terminal in the terminal set, so that each terminal in the terminal set can obtain the authentication data of each terminal in the terminal set without establishing a connection with each terminal in the terminal set, thereby reducing the number of link establishment times and improving networking efficiency.

[0210] In some embodiments, the first data set or the second data set includes pre-synchronization data of at least two terminals in the terminal set. Similarly, when the central device exchanges data with the leaf device, it can exchange the pre-synchronization data of multiple terminals by establishing a link once, rather than only exchanging the pre-synchronization data of the central device and the pre-synchronization data of the leaf device. That is, the central device and the leaf device can act as agents for other terminals in the terminal set to exchange pre-synchronization data. The central device and the leaf device can also obtain the pre-synchronization data of the other terminals without establishing a link with the other terminals, thereby reducing the number of link establishment times of the terminal set during the networking process, thereby improving networking efficiency. In some embodiments, the operation of exchanging pre-synchronization data between the central device and the leaf device can also be called data synchronization.

[0211] In some implementations, the first data set includes pre-synchronization data of the central device. In some implementations, the second data set sent by the leaf device includes the pre-synchronization data of the leaf device.

[0212] In some embodiments, the first data set may include pre-synchronization data of all terminals in the terminal set currently stored by the central device. In some embodiments, the second data set includes pre-synchronization data of all terminals in the terminal set currently stored by the leaf device.

[0213] In some embodiments, if the central device obtains the pre-synchronization data of each terminal in the terminal set, the first data set includes the pre-synchronization data of each terminal in the terminal set, so that each terminal in the terminal set can obtain the pre-synchronization data of each terminal in the terminal set without establishing a connection with each terminal in the terminal set, thereby reducing the number of link establishment times and improving networking efficiency.

[0214] In an embodiment of the present application, the central device can establish a first connection with the leaf device of the central device, and exchange data with the leaf device based on the first connection, wherein the central device can send networking data, authentication data or pre-synchronization data of other terminals in the terminal set to the leaf device, and the leaf device can also send networking data, authentication data or pre-synchronization data of other terminals in the terminal set to the central device. Therefore, each terminal in the terminal set does not need to establish a connection with all other terminals in the terminal set to exchange data with all other terminals, which significantly reduces the number of links established between terminals in the terminal set during the networking process and improves networking efficiency.

[0215] For example, the terminal set shown in Figure 9 includes Terminal 1, Terminal 2, Terminal 3, Terminal 4, Terminal 5, Terminal 6, Terminal 7, Terminal 8, and Terminal 9. Terminal 1 is the central device, and Terminal 2 and Terminal 3. Terminals 4, 5, 6, 7, 8, and 9 are leaf devices of the central device. Each terminal can only function as a central device or a leaf device. The maximum number of simultaneous connections for each terminal is 4. Terminal 1 has more than 4 leaf devices, so Terminal 1 can first exchange data with some of the terminals in the terminal set.

[0216] Assume that each terminal currently only stores the terminal's networking data, authentication data, and pre-synchronization data.

[0217] Terminal 1 may first establish a first connection with terminal 2, terminal 3, terminal 4, and terminal 5, and exchange data with terminal 2, terminal 3, terminal 4, and terminal 5. In some embodiments, terminal 1 sends a first data set to terminal 2, terminal 3, terminal 4, and terminal 5, respectively. The first data set includes networking data, authentication data, and pre-synchronization data for terminal 1. In some embodiments, terminal 1 may receive a second data set sent by terminal 2, terminal 3, terminal 4, and terminal 5, wherein the second data set sent by each terminal includes the authentication data and pre-synchronization data of the terminal. At this point, terminal 1 stores the networking data, authentication data, and pre-synchronization data of terminal 1, terminal 2, terminal 3, terminal 4, and terminal 5.

[0218] Next, the terminal releases the first connections with terminal 2, terminal 3, terminal 4, and terminal 5, establishes first connections with terminal 6, terminal 7, terminal 8, and terminal 9, and exchanges data with terminal 6, terminal 7, terminal 8, and terminal 9. In some embodiments, terminal 1 sends a first data set to terminal 6, terminal 7, terminal 8, and terminal 9, respectively, where the first data set includes networking data, authentication data, and pre-synchronization data of terminal 1, terminal 2, terminal 3, terminal 4, and terminal 5. In some embodiments, terminal 1 receives a second data set sent by terminal 6, terminal 7, terminal 8, and terminal 9, where the second data set sent by each terminal includes the networking data, authentication data, and pre-synchronization data of the terminal. At this point, terminal 1 stores the networking data, authentication data, and pre-synchronization data of each terminal in the terminal set.

[0219] Terminal 1 again exchanges data with terminals 2, 3, 4, 5, 6, 7, 8, and 9, respectively. This includes sending a first data set to terminals 2, 3, 4, 5, 6, 7, 8, and 9. The first data set includes the networking number, authentication number, and pre-synchronization data of each terminal in the terminal set. At this point, each terminal in the terminal set stores the networking data, authentication data, and pre-synchronization data of the other terminals in the terminal set.

[0220] It can be seen that in the terminal set shown in Figure 9, only terminal 1 establishes a connection with each of the terminals in terminal 2, terminal 3, terminal 4, terminal 5, terminal 6, terminal 7, terminal 8, and terminal 9, while terminals 2, terminal 3, terminal 4, terminal 5, terminal 6, terminal 7, terminal 8, and terminal 9 only need to establish a connection with terminal 1 to obtain the networking data of terminals 1, terminal 2, terminal 3, terminal 4, terminal 5, terminal 6, terminal 7, terminal 8, and terminal 9. That is, terminal 1 acts as a proxy for the networking of other terminals, so that the 9 terminals in the terminal set only need to establish 16 connections to complete the network data exchange. In contrast, if the 9 terminals exchange network data by connecting two by two, 36 connections need to be established to complete the network data exchange. Therefore, the networking method of the terminal set shown in Figure 9 significantly reduces the number of connections to be established.

[0221] For example, in the terminal set shown in FIG10 , the terminal set includes terminal 1, terminal 2, terminal 3, terminal 4, terminal 5, terminal 6, terminal 7, terminal 8, terminal 9, terminal 10, terminal 11, terminal 12, terminal 13, and terminal 14. Terminal 1 is a central device, and terminals 2, 3, 4, and 5 are leaf devices of terminal 1. Furthermore, terminal 2 is also a central device, and terminals 6, 7, and 8 are leaf devices of terminal 2. Terminal 4 is also a central device, and terminals 9, 10, and 11 are leaf devices of terminal 4. Terminal 7 is also a central device, and terminals 12, 13, and 14 are leaf devices of terminal 7. Compared with FIG9 , it can be seen that at least some of the terminals in FIG10 can serve as both central devices and leaf devices. If the number of simultaneous connections established by each terminal is less than or equal to 4, when the terminal set includes a large number of terminals, such as more than 10, adopting the networking method shown in FIG10 can reduce the time spent waiting for connections to be released, thereby further improving networking efficiency.

[0222] Assume that each terminal currently only stores the networking data of the terminal.

[0223] The manner in which each central device in FIG10 exchanges data with the leaf devices of the central device may be similar to or the same as the manner in which the central device in FIG9 exchanges data with the central device.

[0224] After terminal 7 exchanges data with terminals 12, 13, and 14, terminal 7 may store the networking data, authentication data, and pre-synchronization data of terminals 7, 12, 13, and 14. After terminal 2 exchanges data with terminals 6, 7, and 8, terminal 2 may store the networking data, authentication data, and pre-synchronization data of terminals 2, 6, 7, 12, 13, 14, and 8. After terminal 4 exchanges data with terminals 9, 10, and 11, terminal 4 may store the networking data, authentication data, and pre-synchronization data of terminals 4, 9, 10, and 11. After terminal 1 exchanges data with terminals 2, 3, and 4, terminal 1 may obtain the networking data of each terminal in the terminal set.

[0225] Terminal 1 continues to exchange data with terminals 2, 3, 4, and 5, enabling them to obtain the networking data, authentication data, and pre-synchronization data of each terminal in the terminal set. Terminal 2 continues to exchange data with terminals 6, 7, and 8, enabling them to obtain the networking data, authentication data, and pre-synchronization data of each terminal in the terminal set. Terminal 7 continues to exchange data with terminals 12, 13, and 14, enabling them to obtain the networking data, authentication data, and pre-synchronization data of each terminal in the terminal set. Terminal 4 continues to exchange data with terminals 9, 10, and 11, enabling them to obtain the networking data, authentication data, and pre-synchronization data of each terminal in the terminal set. At this point, each terminal in the terminal set stores the networking data, authentication data, and pre-synchronization data of the other terminals in the terminal set.

[0226] It can be seen that in the terminal set shown in FIG10, if the number of terminals included in the terminal set is N, and each link establishment time between the terminals is t seconds, then when the terminal set is networked in the manner shown in FIG10, the total time required is T1=t*(floor(log3(N / 4))+1), and when the terminal set is networked by connecting to other terminals to exchange networking data, the total time required is T2=

[0227] t*N(N-1) / 2. For example, in a LAN home scenario, assuming N is 20 and t is 1 second, T1 is 2 seconds and T2 is 190 seconds. In a non-LAN home scenario, assuming N is 20 and t is 3 seconds, T1 is 6 seconds and T2 is 570 seconds. In a LAN industrial scenario, assuming N is 200 and t is 1 second, T1 is 4 seconds and T2 is 5.8 hours. In a non-LAN industrial scenario, assuming N is 200 and t is 3 seconds, T1 is 12 seconds and T2 is 16.58 hours. In another LAN industrial scenario, assuming N is 2000 and t is 1 second, T1 is 5 seconds and T2 is 555 hours. In another non-LAN industrial scenario, assuming N is 2000 and t is 3 seconds, T1 is 15 seconds and T2 is 1665 hours.

[0228] In the above example, when each terminal in the terminal set exchanges data with another terminal, it can send all the networking data, authentication data, and pre-synchronization data of all terminals in the terminal set that it currently stores (for example, before the terminal establishes a connection with the other terminal) to the other terminal, that is, the amount of stored data is equal to the amount of sent data. In other embodiments, the terminal can also send the networking data, authentication data, and pre-synchronization data of some terminals in the terminal set that it currently stores to the other terminal, that is, the amount of stored data is greater than the amount of sent data. Alternatively, in other embodiments, the terminal currently stores networking data, authentication data, and pre-synchronization data and can send one or more of the stored networking data, authentication data, and pre-synchronization data to the other terminal. For example, it can only send networking data to the other terminal.

[0229] Please refer to Figure 12, which is a flowchart of a method for configuring a central device provided in an embodiment of the present application. This method can be used as a detailed description of the aforementioned S802, and is used to configure a central device in a terminal set. It should be noted that this method is not limited to the specific order described in Figure 12 and below. It should be understood that in some embodiments, the order of some steps in this method can be interchanged according to actual needs, or some steps can be omitted or deleted. The method includes the following steps:

[0230] S1201: The first terminal generates a challenge value of the first terminal.

[0231] In some implementations, the first terminal may be any terminal in a terminal set.

[0232] In some embodiments, the first terminal may generate a challenge value of the first terminal when it does not receive an election success message from the central device within a second time period starting from the moment of the last reception of an election success message (e.g., a victory message) from the central device, i.e., trigger the election of a new central device when contact with the central device is lost. Alternatively, in other embodiments, the first terminal may generate a challenge value of the first terminal when joining a terminal set. Of course, in actual applications, the first terminal may also generate a challenge value of the first terminal at other times to trigger the election of a central device. The timing and manner of triggering the election of a central device in the embodiment of the present application are not limited.

[0233] In some embodiments, the first terminal may generate a challenge value according to a preset challenge value generation rule. For example, the challenge value may include a terminal identifier of the first terminal or a random number.

[0234] In other embodiments, the challenge value may be positively correlated with the number of networking data, the number of authentication data and / or the number of pre-synchronization data stored in the first terminal, that is, when the number of networking data, the number of authentication data and / or the number of pre-synchronization data stored in the first terminal is larger, the first terminal is more likely to become a central device, so that the selected central device can obtain the networking data, authentication data and pre-synchronization data of each terminal in the terminal set more quickly, thereby further improving the networking efficiency.

[0235] Alternatively, in other implementations, the first terminal may also generate the challenge value in other ways.

[0236] S1202: The first terminal sends a challenge value to at least one terminal in the terminal set.

[0237] In some embodiments, the first terminal may send the challenge value in the form of a broadcast, and terminals within the broadcast range of the first terminal may receive the challenge value. Alternatively, in other embodiments, the first terminal may send the challenge value to at least one terminal in the terminal set in other ways.

[0238] The third terminal may be a terminal in the terminal set that receives the challenge value from the first terminal. The third terminal may generate its own challenge value. If the challenge value of the third terminal is less than or equal to the challenge value of the first terminal, the third terminal becomes a leaf device. If the challenge value of the third terminal is greater than the challenge value of the first terminal, the third terminal may send its own challenge value to at least one terminal in the terminal set, thereby initiating a new round of elections.

[0239] S1203: When the first terminal does not receive an election success message sent by the third terminal within a first time period from the moment of sending the challenge value, the first terminal is set as a central device.

[0240] As can be seen from the above, the third terminal that receives the challenge value of the first terminal becomes a leaf device when the challenge value of the third terminal is less than or equal to the challenge value of the first terminal. Therefore, if the first terminal does not receive the election success message sent by the third terminal within the first time period starting from the moment the challenge value is issued, the challenge values ​​of the other terminals are less than or equal to the challenge value of the first terminal. Therefore, the challenge of the first terminal is successful, and the first terminal can configure the first terminal as a central device. In some embodiments, if the first terminal becomes a central device, it can send an election success message to at least one terminal in the terminal set, thereby declaring the first terminal as a central device to the at least one terminal.

[0241] In some implementations, the first duration may be a preset duration.

[0242] S1204: When the first terminal receives an election success message sent by the third terminal within a first time period starting from the moment the challenge value is sent, the first terminal is configured as a leaf device of the third terminal.

[0243] As can be seen from the above, the third terminal that receives the challenge value of the first terminal becomes a leaf device when the challenge value of the third terminal is less than or equal to the challenge value of the first terminal, and initiates a new round of elections when the challenge value of the third terminal is greater than the challenge value of the first terminal. Therefore, after the first round of elections, the terminals in the terminal set whose challenge values ​​are less than or equal to the challenge value of the first terminal will no longer participate in the subsequent election process, and the terminals in the terminal set whose challenge values ​​are greater than the challenge value of the first terminal will participate in the new round of elections until the terminal with the largest challenge value becomes the central device. Therefore, if the first terminal receives an election success message sent by the third terminal within the first time period starting from the moment the challenge value is issued, the challenge of the first terminal fails, and the first terminal sets the first terminal as the leaf device of the third terminal.

[0244] In an embodiment of the present application, a central device can be selected from the terminal set, and then the central device initiates a link establishment request to the leaf device of the central device and exchanges data, reducing the number of connections between the terminals in the terminal set from N*(N-1) to N-1.

[0245] For example, in the terminal set shown in Figure 9, terminal 1 broadcasts its challenge value, triggering the first round of elections. Terminals 2, 3, 4, 5, 6, 7, 8, and 9 receive the challenge value from terminal 1 and each generates its own corresponding challenge value.

[0246] In the first round of elections, if the challenge values ​​generated by Terminal 2, Terminal 3, Terminal 4, Terminal 5, Terminal 6, Terminal 7, Terminal 8, and Terminal 9 are all less than or equal to the challenge value of Terminal 1, then Terminal 2, Terminal 3, Terminal 4, Terminal 5, Terminal 6, Terminal 7, Terminal 8, and Terminal 9 will each configure themselves as leaf devices. After Terminal 1 issues its challenge value, it does not receive any challenge values ​​from other terminals. Therefore, Terminal 1's challenge succeeds and Terminal 1 is configured as the central device. If the challenge values ​​of Terminal 2, Terminal 3, Terminal 4, Terminal 5, Terminal 6, and Terminal 7 are all less than or equal to the challenge value of Terminal 1, and the challenge values ​​of Terminal 8 and Terminal 9 are greater than the challenge value of Terminal 1, then Terminal 1, Terminal 2, Terminal 3, Terminal 4, Terminal 5, Terminal 6, and Terminal 7 will each be configured as a leaf device, and Terminal 8 will broadcast its challenge value, thus triggering the second round of elections.

[0247] In the second round of election, Terminal 9 compares its challenge value with that of Terminal 8. If Terminal 9's challenge value is less than or equal to Terminal 8's, Terminal 8 configures itself as the central device and broadcasts an election message, notifying the other terminals in the terminal set that Terminal 8 is the central device. If Terminal 9's challenge value is greater than Terminal 8's challenge value, Terminal 8 configures itself as a leaf device, and Terminal 9 broadcasts its challenge value, triggering the third round of election.

[0248] In the third round of election, since the other terminals in the terminal set have become leaf devices and no longer participate in the election, terminal 9 configures itself as the central device.

[0249] Please refer to Figure 13, which is a flowchart of another method for configuring a central device provided in an embodiment of the present application. This method can be used as a detailed description of the aforementioned S802, and is used to configure the central device in a terminal set based on the amount of data stored in the terminal. It should be noted that this method is not limited to Figure 13 and the specific order described below. It should be understood that in some embodiments, the order of some steps in this method can be interchanged according to actual needs, or some steps can be omitted or deleted. The method includes the following steps:

[0250] S1301: A first terminal and a second terminal exchange data, where the first terminal and the second terminal are any two terminals in a terminal set.

[0251] In some implementations, the first terminal may establish a first connection with the second terminal, send a first data set to the second terminal through the first connection, and receive a second data set sent by the second terminal.

[0252] In some implementations, the first data set or the second data set includes networking data of at least two terminals in the terminal set.

[0253] In some embodiments, the first data set includes networking data of the first terminal. In some embodiments, the second data set includes networking data of the second terminal.

[0254] In some embodiments, the first data set may include networking data of all terminals in the terminal set currently stored by the first terminal. In some embodiments, the second data set may include networking data of all terminals in the terminal set currently stored by the second terminal.

[0255] In some embodiments, the first data set or the second data set includes authentication data of at least two terminals in the terminal set.

[0256] In some embodiments, the first data set includes authentication data of the first terminal.In some embodiments, the second data set includes authentication data of the second terminal.

[0257] In some embodiments, the first data set may include authentication data of all terminals currently stored by the first terminal. In some embodiments, the second data set may include authentication data of all terminals currently stored by the second terminal.

[0258] In some embodiments, the first data set or the second data set includes pre-synchronization data of at least two terminals in the terminal set.

[0259] In some embodiments, the first data set includes pre-synchronization data of the first terminal.In some embodiments, the second data set includes pre-synchronization data of the second terminal.

[0260] In some embodiments, the first data set may include pre-synchronization data of all terminals in the terminal set currently stored by the first terminal. In some embodiments, the second data set may include pre-synchronization data of all terminals in the terminal set currently stored by the second terminal.

[0261] In some implementations, the first terminal may broadcast a link establishment request to the second terminal. Upon receiving the request, the second terminal determines whether it has already exchanged data with the first terminal. If so, the second terminal does not continue to establish the first connection with the first terminal. Otherwise, the second terminal establishes the first connection with the first terminal and exchanges or synchronizes data with the first terminal.

[0262] In some embodiments, the first terminal may encrypt the terminal identifier (e.g., media access control address) of the first terminal using the first terminal's credential information and broadcast the encrypted terminal identifier to the second terminal. When the second terminal receives the broadcast, it may decrypt the encrypted terminal identifier using the first terminal's credential information to obtain the first terminal's terminal identifier. Based on the first terminal's terminal identifier, the second terminal determines whether the first terminal's networking data is already stored. If the second terminal already has the first terminal's networking data stored, it does not continue to establish the first connection with the first terminal. Otherwise, the second terminal continues to establish the first connection with the first terminal.

[0263] S1302: If the amount of networking data stored in the first terminal is greater than the amount of networking data stored in at least one terminal in the terminal set, the first terminal configures the first terminal as a central device.

[0264] When the amount of networking data stored in the first terminal is greater than the amount of networking data stored in at least one terminal in the terminal set, configuring the first terminal as a central device can enable the first terminal to obtain the networking data of each terminal in the terminal set more quickly through fewer operations, and can also send the networking data of each terminal in the terminal set to each terminal in the terminal set more quickly through the first terminal, thereby further improving the efficiency of networking.

[0265] In some implementations, the amount of networking data stored in the first terminal may be greater than the amount of networking data stored in any leaf device of the first terminal (eg, the second terminal).

[0266] In an embodiment of the present application, multiple terminals in a terminal set can first establish a link network in pairs and exchange data, and then configure the terminal that stores more networking data as a central device, and configure the other terminals in the multiple terminals as leaf devices of the central device, so that the central device can obtain the networking data of each terminal in the terminal set more quickly, and then the central device sends these networking data to the leaf devices, further improving the efficiency of the network.

[0267] For example, take terminal 2, terminal 6, terminal 7, and terminal 8 in the terminal set shown in Figure 10 as an example. Terminal 2, terminal 6, terminal 7, and terminal 8 can exchange data in the manner described in S1301 (as shown in Figure 14), and then configure the central device or leaf device in the manner described in S1302 (as shown in Figure 15).

[0268] Suppose that before networking, Terminal 2, Terminal 6, Terminal 7, and Terminal 8 each only store their own networking and authentication data. In the first round, Terminal 6 exchanges data with Terminal 7, causing both Terminal 6 and Terminal 7 to store their respective authentication and networking data. In the second round, Terminal 7 exchanges data with Terminal 8, causing both Terminal 7 and Terminal 8 to store their respective authentication and networking data. In the third round, Terminal 8 exchanges data with Terminal 2, causing both Terminal 2 and Terminal 8 to store their respective authentication and networking data. In the fourth round, Terminal 6 exchanges data with Terminal 2, causing Terminal 6 to also store their respective authentication and networking data. In the fifth round, when Terminal 2 and Terminal 6 detect each other's link establishment request again, they no longer attempt to establish a link because they have already established a link and exchanged data once and both Terminal 2 and Terminal 6 already store their respective authentication and networking data.

[0269] If, after one or more rounds of pairwise chain building and networking of terminal 2, terminal 6, terminal 7 and terminal 8, as shown in FIG15 , terminal 2 stores the authentication data and networking data of terminal 2 and terminal 6, terminal 7 stores the authentication data and networking data of terminal 6, terminal 8 stores the authentication data and networking data of terminal 2 and terminal 7, among which terminal 2 stores the largest amount of networking data, terminal 2 is used as the central device, and terminal 6, terminal 7 and terminal 8 are used as leaf devices of terminal 2.

[0270] When terminal 2 becomes the central device, it can request to establish a link with terminals 6, 7, and 8, and send its authentication data and networking data to them, so that terminals 6, 7, and 8 also obtain their authentication data and networking data. Because any two terminals among terminals 2, 6, 7, and 8 have each other's networking data, they can establish a link and communicate based on this networking data.

[0271] In some implementations, the central device may be configured in a terminal set by combining the methods shown in FIG. 12 and FIG. 13 .

[0272] In some embodiments, multiple terminals in a terminal set can exchange data in pairs in the manner described in S1301, so that at least one terminal stores networking data, authentication data, or pre-synchronization data of at least two terminals, and then trigger an election in the manner described in S1201-S1204 to determine the central device and leaf devices.

[0273] For example, in the terminal set shown in Figure 9, at least some of the terminals among terminal 1, terminal 2, terminal 3, terminal 4, terminal 5, terminal 6, terminal 7, terminal 8 and terminal 9 first exchange data in the manner described in S1301, and then any terminal in the terminal set triggers an election and elects a central device in accordance with the methods described in S1201-S1204.

[0274] For example, in the terminal set shown in FIG10 , any terminal in the terminal set first triggers an election according to the methods described in S1201-S1204 and elects terminal 1 as the central device, and terminals 2, 3, 4, and 5 as leaf devices of terminal 1. Subsequently, terminals 2, 6, 7, and 8 configure terminal 2 as the central device and terminals 6, 7, and 8 as leaf devices of terminal 2 according to the methods described in S1301-S1302. Similarly, terminal 7 is configured as the central device, and terminals 12, 13, and 14 are configured as leaf devices of terminal 7; terminal 4 is configured as the central device, and terminals 9, 10, and 11 are configured as leaf devices of terminal 4.

[0275] In some embodiments, the device type of the central device (such as the first device) is a non-low-power device or the working mode of the central device is a non-low-power mode. Since the central device may need to establish connections with multiple leaf devices and exchange data, the power consumption generated by the central device is greater than that of the leaf device. In order to ensure that the central device can establish connections and exchange data with other leaf devices in a timely manner, the device type of the central device is a non-low-power device or the working mode of the central device is a non-low-power device. In some embodiments, any terminal in the terminal set can participate in the election and become a central device when it is determined that the terminal is not a low-power device or is not in low-power mode; or, the terminal can switch from low-power mode to normal mode after becoming a central device.

[0276] Please refer to Figure 16, which is a flowchart of another networking method provided in an embodiment of the present application. Among them, the terminals in the terminal set can exchange data through the server 600. In some embodiments, this method can be used to replace S802-S803 in the above-mentioned steps, so that the terminal set can be networked when connected to the server 600. It should be noted that this method is not limited to Figure 16 and the specific order described below. It should be understood that in some embodiments, the order of some steps in this method can be interchanged according to actual needs, or some steps can be omitted or deleted. The method includes the following steps:

[0277] S1601 , when the second terminal 800 is connected to the server 600 , the second terminal 800 uploads networking data, authentication data, and pre-synchronization data to the server 600 .

[0278] The second terminal 800 may be any terminal in the terminal set.

[0279] In some embodiments, events of connection between a terminal such as the second terminal 800 and the server 600 may include the terminal server 600 logging into an account (i.e., an account login event), the server 600 pushing a message to the terminal (i.e., a message push event), and the terminal being powered on and connected to the server (i.e., a power-on networking event).

[0280] In some implementations, the second terminal 800 may send part of the networking data, authentication data, and pre-synchronization data of the second terminal 800 to the server 600 .

[0281] S1602 , when the first terminal 700 is connected to the server 600 , the first terminal 700 uploads networking data, authentication data and pre-synchronization data to the server 600 , and obtains networking data, authentication data and pre-synchronization data of the second terminal 800 from the server 600 .

[0282] The first terminal 700 may be any terminal in the terminal set except the second terminal 800 .

[0283] In some embodiments, the first terminal 700 may upload the networking data, authentication data, and part of the pre-synchronization data of the first terminal 700 to the server 600. In some embodiments, the first terminal 700 may obtain the networking data, authentication data, and part of the pre-synchronization data of the second terminal 800 from the server 600.

[0284] In some embodiments, the terminals in the terminal set belong to the same user identifier. If the first terminal 700 detects a connection event with the server 600, it can obtain part of the networking data, authentication data and pre-synchronization data of at least one terminal belonging to the user identifier from the server 600.

[0285] In the embodiment of the present application, when any terminal in the terminal set is connected to the server 600, it can upload its networking data, authentication data, and pre-synchronization data to the server 600, and obtain the networking data, authentication data, and pre-synchronization data of at least one other terminal in the terminal set from the server 600. In other words, any two terminals in the terminal set can complete data exchange and data synchronization through the server 600 without the need for the two terminals to establish a connection, thereby reducing the number of link establishments between terminals during the networking process and improving networking efficiency.

[0286] As can be seen from the foregoing, in the method shown in FIG8 , each terminal in the terminal set can exchange data through the central device, while in the method shown in FIG16 , each terminal in the terminal set can exchange data through server 600. In some embodiments, the methods shown in FIG8 and FIG16 can be combined. In some embodiments, each terminal in the terminal set can first obtain the authentication data, networking data, and pre-synchronization data of other terminals using the method shown in FIG16 . If a connection event with server 600 is not detected, the authentication data, networking data, and pre-synchronization data of other terminals can be obtained again using the method shown in FIG8 .

[0287] Please refer to Figure 17, which is a flowchart of another networking method provided in an embodiment of the present application. Among them, this method can be obtained by combining the methods shown in Figures 8 and 16. It should be noted that this method is not limited to the specific order shown in Figure 17 and the following. It should be understood that in some embodiments, the order of some steps in this method can be interchanged according to actual needs, or some steps can be omitted or deleted. The method includes the following steps:

[0288] S1701: Each terminal in the terminal set uploads its networking data to the server.

[0289] In some implementations, the manner in which each terminal executes S1701 may be the same as or similar to the manner in which the second terminal uploads the networking data to the server in S1601 described above.

[0290] S1702: The central device obtains the networking data of each terminal in the terminal set from the server.

[0291] In some implementations, the central device executes S1702 in a manner that is the same as or similar to the manner in which the first terminal obtains the networking data of other terminals, such as the second terminal, from the server in S1602 .

[0292] S1703: The central device establishes a connection with the leaf device of the central device.

[0293] In some implementations, the manner in which the central device executes S1703 can refer to the relevant description in the aforementioned S1101.

[0294] S1704: The central device sends the networking data of each terminal in the terminal set to the leaf devices of the central device.

[0295] In some implementations, the manner in which the central device executes S1704 can refer to the relevant description in the aforementioned S1102.

[0296] In some implementations, S1703 may be executed first, then S1701 and S1702, and then S1704.

[0297] In combination with the methods shown in the aforementioned Figures 8, 16 and 17, in an embodiment of the present application, as shown in Figure 18, the server or the central device in the terminal set can obtain the networking data, authentication data and pre-synchronization data of at least one terminal in the terminal set. Each device in the terminal set can obtain the networking data, authentication data and pre-synchronization data of other terminals through the server or the central device without establishing a connection with other terminals, which means that the number of links established between terminals is reduced, thereby improving networking efficiency.

[0298] Please refer to Figure 19, which is a flowchart of another networking method provided in an embodiment of the present application. This method can be used as a detailed description of the method shown in Figure 8. It should be noted that this method is not limited to the specific order shown in Figure 19 and described below. It should be understood that in some embodiments, the order of some steps in this method can be interchanged according to actual needs, or some steps can be omitted or deleted.

[0299] S1901: The first terminal 700 determines pre-synchronization data of the first terminal 700.

[0300] The first terminal 700 may be any terminal in the terminal set. The first terminal 700 may determine at least part of distributed service data of a distributed service executed in collaboration with other terminals as pre-synchronization data.

[0301] In some embodiments, taking the first distributed task as an example, the first terminal 700 may determine the update frequency of the first portion of the first distributed business data. If the update frequency of the first portion of the data is less than the first update frequency, the first portion of the data is set as pre-synchronization data for the first terminal 700. In some embodiments, the first update frequency may be pre-set. For example, as shown in FIG19 , the first terminal 700 may determine one or more of clipboard data, basic device information, DBMS metadata, distributed hardware data, notification service data, binder object information of a remote interface call service, security level data, etc. as pre-synchronization data.

[0302] In some implementations, relevant technical personnel may configure at least part of the distributed service data as pre-synchronization data. Alternatively, in other implementations, the pre-synchronization data may be determined in other ways.

[0303] S1902: The first terminal 700 exchanges data with the second terminal 800 (not shown in FIG. 19 ).

[0304] The second terminal 800 may be any terminal in the terminal set except the first terminal 700 .

[0305] In some embodiments, the first terminal 700 can establish a first connection with the second terminal 800, and send one or more of the first terminal 700's networking data, authentication data, and pre-synchronization data to the second terminal 800 via the first connection, and receive one or more of the second terminal 800's networking data, authentication data, and pre-synchronization data sent by the second terminal 800. In some embodiments, the first terminal 700 can broadcast an ad hoc network heartbeat to the second terminal 800, and if the second terminal 800 receives the ad hoc network heartbeat broadcast, it can establish the first connection with the first terminal 700. Alternatively, in other embodiments, the first terminal 700 and the second terminal 800 can trigger networking and establish the first connection through other methods.

[0306] In some embodiments, the first terminal 700 can obtain one or more of the networking data, authentication data, and pre-synchronization data of the second terminal 800 from the central device or server 600 (not shown in FIG. 19 ) in the manner shown in FIG. 8 , FIG. 16 , or FIG. 17 . The second terminal 800 can obtain one or more of the networking data, authentication data, and pre-synchronization data of the first terminal 700 from the central device or server 600 . In some embodiments, the first terminal 700 is a central device, and the second terminal 800 is a leaf device of the first terminal 700 . The first terminal 700 can establish a first connection with the second terminal 800 . The first terminal 700 sends a first data set to the second terminal 800 via the first connection, and receives a second data set sent by the second terminal 800 . When the first terminal 700 and the second terminal 800 exchange data through the central device or server 600 , the first terminal 700 and the second terminal 800 do not need to establish the first connection, thereby improving networking efficiency.

[0307] In some embodiments, taking data synchronization as an example, the first terminal 700 may first synchronize data with the second terminal 800 through the server 600, as shown by the solid line in FIG20. When data synchronization with the second terminal 800 cannot be performed through the server 600, the first terminal 700 may then establish a connection with the second terminal 800 and synchronize data with the second terminal 800, as shown by the dotted line in FIG20. For example, referring to FIG20, upon detecting a connection event with the server 600, such as an account login event, a power-on event, or an event in which the server 600 pushes a message, the first terminal 700 may send pre-synchronization data of the first terminal 700 to the server 600 and obtain pre-synchronization data of the second terminal 800 (or other terminals belonging to the same account as the first terminal 700). Alternatively, the first terminal 700 may establish a first connection with the second terminal 800 through the communication module, send the pre-synchronization data of the first terminal 700 to the second terminal 800 through the first connection, and receive the pre-synchronization data of the second terminal 800 sent by the second terminal 800. Among them, when the first terminal 700 and the second terminal 800 synchronize data through the server 600, there is no need for the first terminal 700 and the second terminal 800 to establish a first connection for data synchronization, which reduces the number of link establishment times between the first terminal 700 and the second terminal 800 and saves link resources.

[0308] In some embodiments, the first terminal 700, the second terminal 800 and the server 600 may compress the pre-synchronization data before sending the pre-synchronization data to other devices, thereby sending the compressed pre-synchronization data to the other devices. Accordingly, the other devices can receive the compressed pre-synchronization data and decompress it to obtain the pre-synchronization data.

[0309] S1903 , the first terminal 700 notifies the second terminal 800 that the first terminal 700 is online.

[0310] The first terminal 700 can synchronize data with the second terminal 800 before notifying the second terminal 800 that it is going online, so that after going online, the first terminal 700 can interact with the second terminal 800 and process distributed services based on the synchronized pre-synchronization data, thereby reducing the frequency of establishing a connection with the second terminal 800 for data synchronization after the first terminal 700 goes online, improving the networking efficiency of the first terminal 700 and the second terminal 800, and the online and processing efficiency of distributed services, saving equipment resources such as links occupied by data synchronization, and ensuring the success rate of link establishment between the first terminal 700 and the second terminal 800 when processing other distributed services.

[0311] In some implementations, after sending the pre-synchronization data of the first terminal 700 to the second terminal 800 , the first terminal 700 may notify the second terminal 800 that the first terminal 700 is online.

[0312] S1904 , the first terminal 700 and the second terminal 800 execute a first distributed service based on the pre-synchronization data of the first terminal 700 and / or the pre-synchronization data of the second terminal 800 .

[0313] The first distributed service is collaboratively executed by the first terminal 700 and the second terminal 800 .

[0314] Since the first terminal 700 has synchronized data with the second terminal 800 before going online, the first terminal 700 has obtained the pre-synchronization data of the second terminal 800, and the second terminal 800 has obtained the pre-synchronization data of the first terminal 700. Therefore, after the first terminal 700 goes online, it does not need to synchronize with the second terminal 800 again, but can process the first distributed service based on the pre-synchronization data of the first terminal 700 and / or the pre-synchronization data of the second terminal 800 that have been synchronized.

[0315] In some implementations, S1804 may be omitted.

[0316] S1905 , the first terminal 700 responds to a request to synchronize target data with the second terminal 800 triggered by the fourth distributed service, and the target data is not pre-synchronized data. The first terminal 700 synchronizes the target data with the second terminal 800 .

[0317] The fourth distributed service is collaboratively executed by the first terminal 700 and the second terminal 800 .

[0318] After the first terminal 700 notifies the second terminal 800 that it is online, if the first terminal 700 detects a request for synchronizing target data with the second terminal 800 triggered by the fourth distributed service, the first terminal 700 may determine whether to respond to the request based on whether the target data is pre-synchronization data that has been synchronized before going online. In some embodiments, if the target data is the pre-synchronization data of the first terminal 700, that is, the target data belongs to the first data set, the first terminal 700 may not respond to the request, that is, after going online, the pre-synchronization data is not synchronized with the second terminal 800 again. In some embodiments, if the target data is not the pre-synchronization data of the first terminal 700, that is, the target data does not belong to the first data set, the first terminal 700 may establish a second connection with the second terminal 800, and synchronize the target data to the second terminal 800 based on the second connection. For example, the first terminal 700 may send the target data to the second terminal 800.

[0319] In some embodiments, the first terminal 700 establishes a second connection with the second terminal in response to a request for synchronization of the first distributed service with the second terminal, and sends a second portion of data of the first distributed service to the second terminal based on the second connection, where the second portion of data does not belong to the first data set.

[0320] In some implementations, S1905 can be omitted. That is, after the first terminal 700 goes online, regardless of whether the target data requested for synchronization is pre-synchronized data, it does not respond to the request to synchronize the target data, thereby further saving device resources such as links occupied by data synchronization and ensuring the success rate of link establishment when the first terminal 700 and the second terminal 800 process other distributed services.

[0321] In an embodiment of the present application, the first terminal 700 can determine the pre-synchronization data of the first terminal 700, and before notifying the second terminal 800 to go online, synchronize the pre-synchronization data with the second terminal 800 through a link establishment, so that after notifying the second terminal 800 to go online, it can interact with the second terminal 800 and process distributed services based on the synchronized pre-synchronization data, thereby reducing the frequency of establishing a connection with the second terminal 800 for data synchronization after the first terminal 700 goes online, improving the efficiency of networking between the first terminal 700 and the second terminal 800 and the efficiency of processing distributed services, saving equipment resources such as links occupied by data synchronization, and ensuring the success rate of link establishment between the first terminal 700 and the second terminal 800 when processing other distributed services.

[0322] Please refer to Figure 21, which is a flowchart of a link establishment method provided in an embodiment of the present application. This method can be used for terminals in the aforementioned terminal set to negotiate a key when establishing a link. It should be noted that this method is not limited to the specific sequence described in Figure 21 and below. It should be understood that in some embodiments, the order of some steps in this method can be interchanged according to actual needs, or some steps can be omitted or deleted.

[0323] S2101: The first terminal 700 sends an ad hoc network heartbeat broadcast to the second terminal 800.

[0324] S2102: If the second terminal 800 determines that data synchronization with the first terminal 700 is completed, the second terminal 800 notifies the first terminal 700 that the second terminal 800 is online.

[0325] The first terminal 700 and the second terminal 800 can complete networking and go online through S2101-2102. In order to improve the efficiency of terminal online, before going online, the first terminal 700 and the second terminal 800 may not negotiate a key. Instead, after going online, when the first terminal 700 and the second terminal 800 establish a connection for the first time, the first terminal 700 and the second terminal 800 negotiate a key and communicate through the following S2103-S2104.

[0326] S2103: If the first terminal 700 detects an operation triggering link establishment, it establishes a connection with the second terminal 800.

[0327] In some implementations, the operation of triggering link establishment may be performed by a user or any distributed service.

[0328] In some embodiments, the connection may include the first connection or the second connection described above.

[0329] S2104 , the first terminal 700 negotiates a secret key with the second terminal 800 .

[0330] In some embodiments, the first terminal 700 may send a first key to the second terminal 800 , and the first key may be used to decrypt data from the first terminal 700 or to encrypt data sent to the first terminal 700 .

[0331] In some embodiments, the first terminal 700 may obtain a second key sent by the second terminal 800 , and the second key may be used to decrypt data from the second terminal 800 or to encrypt data sent to the second terminal 800 .

[0332] In some implementations, the first terminal 700 and the second terminal 800 may also negotiate other types of keys.

[0333] S2105: The first terminal 700 communicates with the second terminal 800 based on the negotiated key.

[0334] In an embodiment of the present application, the first terminal 700 and the second terminal 800 may not negotiate the key from the beginning of networking to before going online, but may wait until after going online and negotiate the key when the first terminal 700 and the second terminal 800 establish a connection for the first time. That is, by postponing the step of negotiating the key to after going online, the efficiency of going online is improved.

[0335] Please refer to Figure 22, which is a flowchart of another link establishment method provided in an embodiment of the present application. This method can be used to establish a link between terminals in the aforementioned terminal set. In some embodiments, the connection may include an HML. It should be noted that this method is not limited to the specific order described in Figure 22 and below. It should be understood that in some embodiments, the order of some steps in this method can be interchanged according to actual needs, or some steps can be omitted or deleted.

[0336] S2201 : The first terminal 700 obtains the second key of the second terminal 800 from the server 600 , and the second terminal 800 obtains the first key of the first terminal 700 from the server 600 .

[0337] Taking the first terminal 700 as an example, in some embodiments, the first terminal 700 can obtain the second key of the second terminal 800 from the server 600 when detecting a connection event between the first terminal 700 and the server 600, such as a login account. In some embodiments, the first terminal 700 can obtain the second key of the second terminal 800 from the server 600 through an authentication service and store the second key.

[0338] S2202: When the first terminal 700 or the second terminal 800 detects an operation that triggers link establishment, it queries the key from the authentication service.

[0339] S2203: When the authentication service in the first terminal 700 or the second terminal 800 passes the key authentication, the first terminal 700 or the second terminal 800 may send an encrypted connection guidance broadcast to the other terminal.

[0340] S2204: The first terminal 700 and the second terminal 800 establish a connection.

[0341] In some embodiments, the connection may include the first connection or the second connection described above.

[0342] Please refer to Figure 23, which is a flow chart of a method for allocating link resources provided in an embodiment of the present application. In some embodiments, the method can serve as a detailed description of the aforementioned S805. In some embodiments, the method can be used for responding to a link establishment request issued by a background service after the first terminal goes online when there are idle link resources. It should be noted that the method is not limited to Figure 23 and the specific order described below. It should be understood that in some embodiments, the order of some steps in the method can be interchanged according to actual needs, or some steps therein can be omitted or deleted.

[0343] S2301: If the first terminal detects a request initiated by a second distributed service, the second distributed service is in the background of the first terminal, and the request is for establishing a third connection with the second terminal, then the first terminal determines whether a physical link exists between the first terminal and the second terminal. If so, the process proceeds to 2302; otherwise, the process proceeds to 2304.

[0344] The second distributed service is collaboratively executed by the first terminal and the second terminal, where the first terminal and the second terminal may be any two terminals in the terminal set.

[0345] In some embodiments, the third connection may include the first connection or the second connection described above.

[0346] S2302: The first terminal determines the type of the physical link. If the type of the physical link is the first type, S2303 is executed; if the type of the physical link is the second type, S2304 is executed.

[0347] In some embodiments, the first type may include WiFi or USB, and the second type may include a BR type.

[0348] S2303: The first terminal creates a socket.

[0349] S2304: The first terminal determines whether there are idle link resources. If so, execute S2305; otherwise, execute S2306.

[0350] In some implementations, the second connection type includes a BR type, and the second type of link resource may include an RFCOM.

[0351] S2305: The first terminal establishes a third connection with the second terminal.

[0352] In some embodiments, the first terminal may establish a connection with the second terminal at a higher transmission speed based on the transmission speeds corresponding to the multiple types of connections. If the connection with the higher transmission speed cannot be established, a connection with a lower transmission speed may be established. For example, the first terminal may first establish an HML type connection with the second terminal. If the HML connection cannot be established, a point-to-point (P2P) type connection may be established with the second terminal. If the P2P type connection still cannot be established, a BR type connection may be established with the second terminal.

[0353] S2306: The first terminal returns a link establishment failure to the second distributed service.

[0354] In an embodiment of the present application, when a first terminal detects a request initiated by a second distributed service, where the second distributed service is in the background of the first terminal and the request is for establishing a connection with the second terminal, the first terminal may determine whether there are currently idle link resources. If there are no idle link resources, the first terminal may not respond to the request, thereby limiting the link resources occupied by the distributed service in the background.

[0355] Please refer to Figure 24, which is a flowchart of another method for allocating link resources provided in an embodiment of the present application. In some embodiments, the method can serve as a detailed description of the aforementioned S805. In some embodiments, the method can be used after the first terminal goes online, for a link establishment request issued by a foreground service or initiated by a user, to respond to the request when there are idle link resources, and to freeze some of the link resources occupied by the background service when there are no idle link resources, and then respond to the request. The first terminal can be any terminal in the terminal set. It should be noted that the method is not limited to Figure 24 and the specific order described below. It should be understood that in some embodiments, the order of some steps in the method can be interchanged according to actual needs, or some steps therein can be omitted or deleted.

[0356] S2401: If the first terminal detects a request initiated by a second distributed service, the second distributed service is in the foreground of the first terminal, and the request is for establishing a third connection with the second terminal, then the first terminal determines whether a physical link exists between the first terminal and the second terminal. If so, the first terminal executes S2402; otherwise, the first terminal executes S2404.

[0357] The second distributed service is collaboratively executed by the first terminal and the second terminal, where the first terminal and the second terminal may be any two terminals in the terminal set.

[0358] In some embodiments, the third connection may include the first connection or the second connection described above.

[0359] S2402: The first terminal determines the type of the physical link. If the type of the physical link is the first type, S2403 is executed; if the type of the physical link is the second type, S2404 is executed.

[0360] S2403: The first terminal creates a socket.

[0361] S2404: The first terminal determines whether there are idle link resources. If so, execute S2405; otherwise, execute S2406.

[0362] S2405: The first terminal establishes a third connection with the second terminal.

[0363] S2406: The first terminal freezes the link resources occupied by the background distributed service. If the freezing is successful, execute S2405; otherwise, execute S2407.

[0364] In some embodiments, the first terminal may freeze link resources occupied by a third distributed service, where the third distributed service is any distributed service running in the background of the first terminal and the third distributed service is collaboratively executed by the first terminal and a fourth terminal, where the fourth terminal is any terminal in the terminal set other than the first terminal and the second terminal. In some embodiments, the first terminal may disconnect a fourth connection between the first terminal and the fourth terminal established by the third distributed service request.

[0365] S2407: The first terminal switches the physical link. If the switch is successful, execute S2405; otherwise, execute S2408.

[0366] S2408: The first terminal returns a message indicating that the link establishment failed to the third distributed service.

[0367] In some implementations, after freezing the link resources occupied by the third distributed service and establishing a connection with the second terminal, the first terminal may restore the fourth connection established by the third distributed service if idle link resources are detected.

[0368] In an embodiment of the present application, when a first terminal detects a request initiated by a second distributed service, the second distributed service is in the foreground of the first terminal, and the request is for requesting to establish a third connection with the second terminal, it can determine whether there are currently idle link resources. If there are no idle link resources, the link resources occupied by at least part of the distributed service in the background can be frozen, and the third connection with the second terminal can be established in response to the request, thereby improving the success rate of link establishment triggered by the foreground distributed service.

[0369] Please refer to Figure 25, which is a flowchart of another networking method provided in an embodiment of the present application. Among them, this method can be used for networking the first terminal and the second terminal in a terminal set, and the terminal set includes at least three terminals, and the first terminal and the second terminal are any two terminals in the terminal set. It should be noted that this method is not limited to Figure 25 and the specific order described below. It should be understood that in some embodiments, the order of some steps in this method can be interchanged according to actual needs, or some steps therein can be omitted or deleted. The method includes the following steps:

[0370] S2501: A first terminal establishes a first connection with a second terminal.

[0371] In some implementations, the manner in which the first terminal and the second terminal execute S2501 may be the same as or similar to the manner in which the central device and the leaf device establish the first connection in the aforementioned S1101.

[0372] S2502, the first terminal sends a first data set to the second terminal based on the first connection, and receives a second data set sent by the second terminal, wherein the first data set or the second data set includes networking data and / or authentication data of at least two terminals in the terminal set, and the authentication data is used to authenticate the terminal identity.

[0373] In some implementations, the manner in which the first terminal and the second terminal execute S2502 may be the same as or similar to the manner in which the central device and the leaf device exchange data in the aforementioned S1102.

[0374] In an embodiment of the present application, a first terminal may establish a first connection with a second terminal, send a first data set to the second terminal, and receive a second data set sent by the second terminal. The first data set or the second data set includes networking data and / or authentication data of at least two terminals in the terminal set. That is, the first terminal or the second terminal obtains the networking data and / or authentication data of the at least two terminals without having to establish a connection with both terminals, significantly reducing the number of link establishments between terminals in the terminal set during networking and improving networking efficiency.

[0375] Please refer to Figure 26, which is a flowchart of another networking method provided in an embodiment of the present application. Among them, the method can be used for networking the first terminal 700 and the second terminal 800 in a terminal set, and the terminal set includes at least three terminals, and the first terminal 700 and the second terminal 800 are any two terminals in the terminal set. It should be noted that the method is not limited to Figure 26 and the specific order described below. It should be understood that in some embodiments, the order of some steps in the method can be interchanged according to actual needs, or some steps therein can be omitted or deleted. The method includes the following steps:

[0376] S2601: The first terminal 700 establishes a first connection with the second terminal 800.

[0377] In some implementations, the manner in which the first terminal 700 and the second terminal 800 execute S2601 may be the same as or similar to the manner in which the central device and the leaf device establish the first connection in the aforementioned S1101.

[0378] S2602: The first terminal 700 sends a first data set to the second terminal 800 based on the first connection, and the second terminal 800 sends a second data set to the first terminal 700 based on the first connection. The first data set or the second data set includes one or more of networking data and / or authentication data pre-synchronization data of at least two terminals in the terminal set, and the authentication data is used to authenticate the terminal identity.

[0379] In some implementations, the manner in which the first terminal 700 and the second terminal 800 execute S2602 may be the same as or similar to the manner in which the central device and the leaf device exchange data in the aforementioned S1102.

[0380] In an embodiment of the present application, the first terminal 700 can establish a first connection with the second terminal 800, send a first data set to the second terminal 800, and receive a second data set sent by the second terminal 800. The first data set or the second data set includes networking data and / or authentication data of at least two terminals in the terminal set. That is, the first terminal 700 or the second terminal 800 obtains the networking data and / or authentication data of the at least two terminals without having to establish a connection with both terminals, significantly reducing the number of link establishment times between terminals in the terminal set during the networking process and improving networking efficiency.

[0381] Based on the same inventive concept, an embodiment of the present application further provides a terminal comprising: a memory and a processor, wherein the memory is used to store a computer program; and the processor is used to execute the method described in the above method embodiment when calling the computer program.

[0382] The terminal provided in this embodiment can execute the above method embodiment, and its implementation principle and technical effects are similar, which will not be repeated here.

[0383] Based on the same inventive concept, an embodiment of the present application further provides a chip system, which includes a processor coupled to a memory, and executes a computer program stored in the memory to implement the method described in the above method embodiment.

[0384] The chip system may be a single chip or a chip module composed of multiple chips.

[0385] An embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the method described in the above method embodiment is implemented.

[0386] An embodiment of the present application further provides a computer program product, which, when executed on a terminal, enables the terminal to implement the method described in the above method embodiment.

[0387] If the above-mentioned integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, the steps of the above-mentioned various method embodiments can be implemented. Wherein, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable storage medium may include at least: any entity or device capable of carrying the computer program code to the terminal, a recording medium, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electric carrier signal, a telecommunication signal and a software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk.

[0388] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of some embodiments.

[0389] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0390] In the embodiments provided in this application, it should be understood that the disclosed devices / equipment and methods can be implemented in other ways. For example, the device / equipment embodiments described above are merely schematic. For example, the division of the modules or units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0391] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and / or components, but does not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or collections thereof.

[0392] It will also be understood that the term "and / or" used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.

[0393] As used in this specification and the appended claims, the term "if" can be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting," depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "upon determination" or "in response to determining" or "upon detection of [described condition or event]" or "in response to detecting [described condition or event]," depending on the context.

[0394] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.

[0395] References to "one embodiment" or "some embodiments" in this specification mean that a particular feature, structure, or characteristic described in conjunction with that embodiment is included in one or more embodiments of the present application. Thus, phrases such as "in one embodiment," "in some embodiments," "in other embodiments," and "in other embodiments" appearing in various places in this specification do not necessarily refer to the same embodiment, but rather mean "one or more but not all embodiments," unless otherwise specifically emphasized. The terms "including," "comprising," "having," and variations thereof all mean "including but not limited to," unless otherwise specifically emphasized.

[0396] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some or all of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A networking method, characterized in that: Applied to a first terminal in a terminal set, the terminal set including at least three terminals, the method comprising: Establishing a first connection with a second terminal, where the second terminal is any terminal in the terminal set except the first terminal; Based on the first connection, a first data set is sent to the second terminal, and a second data set sent by the second terminal is received, wherein the first data set or the second data set includes networking data and / or authentication data of at least two terminals in the terminal set, and the authentication data is used to authenticate the terminal identity.

2. The method according to claim 1, characterized in that The first data set includes networking data of each terminal in the terminal set and / or authentication data of each terminal in the terminal set.

3. The method according to claim 1 or 2, characterized in that Before establishing the first connection with the second terminal, the method further includes: generating a challenge value for the first terminal; Sending the challenge value to at least one terminal in the terminal set; When no election success message is received from the third terminal within a first time period starting from the moment the challenge value is issued, the first terminal is set as a central device, and the third terminal is any terminal in the terminal set that receives the challenge value.

4. The method according to claim 1 or 2, characterized in that The method further comprises: generating a challenge value for the first terminal; Sending the challenge value to at least one terminal in the terminal set; When an election success message is received from a third terminal within the first time period starting from the moment the challenge value is issued, the first terminal is set as a leaf device of the third terminal, and the third terminal is any terminal in the terminal set that receives the challenge value.

5. The method according to any one of claims 2 to 4, characterized in that: The amount of networking data stored in the first terminal is greater than the amount of networking data stored in the second terminal.

6. The method according to any one of claims 2 to 5, characterized in that: The first terminal is a non-low power consumption device, or the working mode of the first terminal is a non-low power consumption mode.

7. The method according to any one of claims 1 to 6, characterized in that: The first data set or the second data set includes pre-synchronization data of at least two terminals in the terminal set, where the pre-synchronization data is used by the terminals to execute a distributed service, where the distributed service is a service executed collaboratively by at least two terminals.

8. The method according to claim 7, characterized in that The first data set includes pre-synchronization data of each terminal in the terminal set.

9. The method according to claim 7 or 8, characterized in that The first data set includes pre-synchronization data of the first terminal. After sending the first data set to the second terminal, the method further includes: Notifying the second terminal that the first terminal is online; A first distributed service is executed based on the pre-synchronization data of the first terminal, where the first distributed service is collaboratively executed by the first terminal and the second terminal.

10. The method according to claim 9, characterized in that Before sending the first data set to the second terminal, the method further includes: If the update frequency of the first part of the data of the first distributed service is less than the first update frequency, the first part of the data is set as pre-synchronization data of the first terminal.

11. The method according to claim 9 or 10, characterized in that After notifying the second terminal that the first terminal is online, the method further includes: In response to a request of the first distributed service to synchronize with the second terminal, establishing a second connection with the second terminal; Based on the second connection, a second portion of data of the first distributed service is sent to the second terminal, where the second portion of data does not belong to the first data set.

12. The method according to any one of claims 1 to 11, characterized in that: The method may further comprise one or more of the following: When connected to a server, sending at least part of the first data set to the server, wherein the connection includes the first terminal logging into an account on the server, the first terminal being powered on and connected to the server, and the server pushing a message to the first terminal; At least part of the data in the second data set is obtained from the server.

13. The method according to any one of claims 1 to 12, characterized in that: The method further comprises: In response to a request initiated by a second distributed service to establish a third connection with the second terminal, the second distributed service is in the foreground of the first terminal and there are no idle link resources on the first terminal, disconnecting a fourth connection between the first terminal and a fourth terminal; wherein the second distributed service is collaboratively executed by the first terminal and the second terminal, the fourth terminal is any terminal in the terminal set other than the first terminal and the second terminal, the fourth connection is established by a third distributed service in the background of the first terminal, and the third distributed service is collaboratively executed by the first terminal and the fourth terminal; The third connection is established.

14. The method according to claim 13, characterized in that After establishing the third connection, the method further includes: If the first terminal has idle link resources, the fourth connection is restored.

15. A networking method, characterized in that: Applied to a first terminal and a second terminal in a terminal set, the terminal set including at least three terminals, the method comprising: The first terminal establishes a first connection with the second terminal; The first terminal sends a first data set to the second terminal based on the first connection; The second terminal sends a second data set to the first terminal based on the first connection; The first data set or the second data set includes networking data and / or authentication data of at least two terminals in the terminal set, and the authentication data is used to authenticate the terminal identity.

16. The method according to claim 15, characterized in that The first data set includes networking data of each terminal in the terminal set and / or authentication data of each terminal in the terminal set.

17. The method according to claim 15 or 16, characterized in that The amount of networking data stored in the first terminal is greater than the amount of networking data stored in the second terminal.

18. The method according to any one of claims 15 to 17, characterized in that: The first data set or the second data set includes pre-synchronization data of at least two terminals in the terminal set, where the pre-synchronization data is used by the terminals to execute a distributed service, where the distributed service is a service executed collaboratively by at least two terminals.

19. The method according to claim 18, characterized in that The first data set includes pre-synchronization data of the first terminal. After sending the first data set to the second terminal, the method further includes: Notifying the second terminal that the first terminal is online; A first distributed service is executed based on the pre-synchronization data of the first terminal, where the first distributed service is collaboratively executed by the first terminal and the second terminal.

20. The method according to claim 19, characterized in that Before sending the first data set to the second terminal, the method further includes: If the update frequency of the first part of the data of the first distributed service is less than the first update frequency, the first part of the data is set as pre-synchronization data of the first terminal.

21. A terminal, characterized in that: include: A memory and a processor, wherein the memory is used to store a computer program; and the processor is used to execute the method according to any one of claims 1 to 14 when calling the computer program.

22. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 14 is implemented.

23. A computer program product, characterized in that When the computer program product is run on a terminal, the terminal is enabled to execute the method according to any one of claims 1 to 14.

Citation Information

Patent Citations

  • Networking method and terminal

    CN120711543A

  • Distributed cluster head election method based on wireless ad hoc network

    CN110943920A

  • Electing a leader node in a mobile ad-hoc communications network

    WO2015058806A1

  • Network node election method and node device

    WO2020134713A1

  • CN202410359206A