Equipment networking method, electronic equipment and storage medium

By establishing a connection between multiple communication methods between multiple electronic devices, receiving and confirming messages is achieved, and the problem of high communication delay between peripheral devices and peripheral devices is solved, and communication reliability and user experience are improved.

CN119485786APending Publication Date: 2025-02-18HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411383492.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2021-04-28
Filing Date
2021-11-09
Publication Date
2025-02-18

AI Technical Summary

Technical Problem

When networking between multiple electronic devices, the communication delay between peripheral devices and peripheral devices is high, affecting the user experience.

Method used

By establishing a first communication connection between the first electronic device and the second electronic device, and connecting using the first communication method and the second communication method, receiving and confirming messages is realized to maintain the validity of the connection, thereby directly performing Service communication.

Benefits of technology

Reduces communication delay between peripheral devices and peripheral devices, and improves communication reliability and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119485786A_ABST
    Figure CN119485786A_ABST
Patent Text Reader

Abstract

The invention discloses a device networking method, electronic devices and a storage medium, relates to the technical field of communication, and can solve the problem that the communication time delay of a first electronic device and a second electronic device is relatively high. The method is applied to a communication system, and the communication system comprises a plurality of electronic devices. The method comprises the steps that first communication connection is established between first electronic equipment and second electronic equipment; the first communication connection comprises the connection of the first electronic equipment and the second electronic equipment through a first communication mode and a second communication mode; the first electronic equipment receives a message sent by the second electronic equipment in a first time period through a first communication mode; the first electronic equipment confirms that the first communication connection with the second electronic equipment is valid in a second time period according to the message; and the first electronic equipment performs service communication with the second electronic equipment in the second time period through the second communication mode.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application is a divisional application. The application number of the original application is 202111322529.1, and the original application date is November 9, 2021. The entire contents of the original application are incorporated into this application by reference.

[0002] This application claims the priority of the Chinese patent application filed with the State Intellectual Property Office on April 28, 2021, with application number 202110464411.6 and invention name “A soft bus method for realizing interconnection between multiple mobile terminals”, the entire contents of which are incorporated by reference in this application. Technical Field

[0003] The present application relates to the field of communication technology, and in particular to a device networking method, electronic equipment and storage medium. Background Art

[0004] With the development of smart devices, a user or family often has multiple electronic devices that can communicate with each other. Each type of electronic device generally has its own device characteristics, such as mobile phones are more portable, TV screens have better display effects, and speakers have better sound quality. In order to give full play to the device characteristics of different electronic devices, multiple electronic devices can be networked, so that multiple electronic devices can be interconnected for collaborative work.

[0005] Taking the networking process of a star topology as an example, when multiple electronic devices are networking, a preset electronic device (such as a TV, router or mobile phone, etc.) can be determined as a central device. Then, each electronic device except the central device can establish a communication connection (such as Bluetooth connection, Wi-Fi connection, etc.) with the central device as a peripheral device to form a local area network with a star topology. In this way, the central device can be used as a central node to manage and control various peripheral devices in the local area network and complete corresponding work tasks.

[0006] However, before each peripheral device communicates with another, it needs to discover, authenticate, and establish a communication connection before it can communicate with the other. This will result in a high communication delay between the peripheral devices, which will affect the user experience. Summary of the invention

[0007] The embodiments of the present application provide a device networking method, an electronic device and a storage medium, which are used to solve the problem of high communication delay between a first electronic device and a second electronic device.

[0008] To achieve the above objectives, the embodiments of the present application adopt the following technical solutions:

[0009] In a first aspect, a device networking method is provided, which is applied to a communication system; the communication system includes multiple electronic devices. The method includes: a first electronic device establishes a first communication connection with a second electronic device; the first communication connection includes the first electronic device and the second electronic device being connected via a first communication mode and a second communication mode; the first electronic device receives a message sent by the second electronic device within a first time period via the first communication mode; the first electronic device confirms that the first communication connection with the second electronic device is valid within a second time period according to the message; the first electronic device performs business communication with the second electronic device via the second communication mode within the second time period.

[0010] Based on the first aspect, when the first electronic device establishes a first communication connection with the second electronic device, the first electronic device receives a message sent by the second electronic device in a first time period through a first communication method, and the first electronic device can confirm that the first communication connection with the second electronic device is valid in the second time period according to the message, that is, the first electronic device confirms that the connection with the second electronic device is maintained (i.e., keep alive) in the second time period, so that the first electronic device can communicate with the second electronic device through the second communication method in the second time period. Since the first electronic device confirms that it is kept alive with the second electronic device in the second time period according to the message, the first electronic device and the second electronic device can directly communicate in business in the second time period, and there is no need to confirm the keep alive before each business communication, thereby improving the communication delay. In addition, since the first electronic device and the second electronic device establish a first communication connection through the first communication method and the second communication method, the first electronic device receives the message sent by the second electronic device, and the first electronic device and the second electronic device can use different communication methods for business communication, thereby improving the communication reliability.

[0011] In a possible design of the first aspect, before the first electronic device receives a message sent by the second electronic device through the first communication method within a first time period, the method also includes: the first electronic device broadcasts or unicasts a request message through the first communication method and the second communication method within the first time period; the request message is used to indicate that the first electronic device requests to maintain the first communication connection with the second electronic device.

[0012] In this design, the first electronic device can broadcast or unicast a request message in a first time period via the first communication method and the second communication method, so that the second electronic device can reply to the request message, thereby improving communication reliability.

[0013] In a possible design of the first aspect, when the first communication connection is valid within a second time period, the first electronic device saves connection information of the second communication connection; the first electronic device conducts business communication with the second electronic device through the second communication method within the second time period, including: the first electronic device restores the first communication connection established with the second electronic device according to the connection information and conducts business communication.

[0014] In this design, since the first electronic device can quickly restore the first communication connection established with the second electronic device and perform business communication based on the connection information (such as information of the second electronic device), the communication delay is further improved.

[0015] In a possible design manner of the first aspect, the priority of the first electronic device is higher than the priority of the second electronic device; the priority is used to indicate the hardware performance of the device, and the hardware performance of a device with a higher priority is higher than the hardware performance of a device with a lower priority; the hardware performance includes one or more of processor performance, memory performance, hard disk performance or network capabilities; the first electronic device establishes a first communication connection with the second electronic device, including: the first electronic device establishes a first communication connection with the second electronic device, and determines the priority of the second electronic device; the first electronic device confirms, according to a message, that the first communication connection with the second electronic device is valid within a second time period, including: when the first electronic device has a higher priority than the second electronic device according to the message, the first electronic device confirms, according to the message, that the first communication connection with the second electronic device is valid within the second time period.

[0016] In this design, when the first electronic device establishes a first communication connection with the second electronic device, it confirms the priority of the second electronic device. If the priority of the first electronic device is higher than that of the second electronic device, the first electronic device confirms, based on the message, that the first communication connection with the second electronic device is valid within the second time period. That is, the first electronic device with a higher priority confirms which of the first electronic device and the second electronic device sends request messages and receives messages, thereby further improving communication reliability.

[0017] In a possible design of the first aspect, the first time period is set periodically; the first time period is the first time period set; the method also includes: when the first electronic device is in the first time period that is the second time period set, the first electronic device determines to disconnect from the second electronic device; or, when the first electronic device is in the first time period that is the first time period set for N consecutive times, the first electronic device determines to disconnect from the second electronic device; or, when the first time period and the second time period at least partially overlap, and the first electronic device does not receive a response message in the first time period within the second time period, the first electronic device determines to disconnect from the second electronic device.

[0018] In this design, when the first electronic device does not receive a message sent by the second electronic device for a long time, the first electronic device determines to disconnect from the second electronic device, which is beneficial to improving communication reliability.

[0019] In a possible design of the first aspect, the method further includes: when the first electronic device and the second electronic device perform business communication again, the first electronic device re-establishes the first communication connection with the second electronic device.

[0020] In this design, when the first electronic device determines that it is disconnected from the second electronic device, if the first electronic device and the second electronic device conduct business communication again, the first electronic device re-establishes the first communication connection with the second electronic device, so that business communication can be carried out normally, thereby improving communication reliability.

[0021] In a possible design manner of the first aspect, the message includes a response message, an inquiry message, or a service message.

[0022] In this design, since the message can be a response message, an inquiry message or a business message, when the first electronic device receives a response message, an inquiry message or a business message sent by the second electronic device, the first electronic device can confirm that the first communication connection with the second electronic device is valid within the second time period, thereby further improving the communication reliability.

[0023] In a possible design of the first aspect, the method also includes: when the first electronic device remains stationary within a first time period, and the number of times the first electronic device receives a response message sent by the second electronic device is greater than a first preset number, the first electronic device adjusts the first time period to a third time period; the length of the third time period is greater than the length of the first time period.

[0024] In this design, when the first electronic device remains stationary for a long time, and the number of times the first electronic device receives the response message sent by the second electronic device is greater than the first preset number, the first electronic device can adjust the first time period to the third time period. Since the length of the third time period is greater than the length of the first time period, the first electronic device receives the message sent by the second electronic device in a reduced speed manner, which is conducive to reducing device power consumption.

[0025] In a possible design of the first aspect, the method also includes: when the first electronic device is in a preset scenario within a first time period, and the number of times the first electronic device receives a response message sent by the second electronic device is greater than a second preset number, the first electronic device adjusts the first time period to a fourth time period; the length of the fourth time period is less than the length of the first time period.

[0026] In this design, when the first electronic device is in a preset scenario for a long time, and the number of times the first electronic device receives a response message sent by the second electronic device is greater than a second preset number, the first electronic device may adjust the first time period to a fourth time period. Since the length of the fourth time period is less than the length of the first time period, the first electronic device uses an accelerated mode to receive the message sent by the second electronic device, thereby ensuring that the first electronic device remains connected to the second electronic device.

[0027] In a possible design of the first aspect, the method also includes: when the preset scene in which the first electronic device is located changes, the first electronic device restores the fourth time period to the first time period; the change in the preset scene includes the first electronic device changing from an off-screen display to a bright-screen display.

[0028] In this design, when the first electronic device changes from an off-screen display to a bright-screen display, the first electronic device resumes the first time period and receives messages within the first time period, which helps to reduce device power consumption.

[0029] In a possible design of the first aspect, the method further includes: when the scene in which the first electronic device is located changes, the first electronic device restores the fourth time period to the first time period; the change in the preset scene includes a change in the usage status of the first electronic device.

[0030] In this design, when the usage status of the first electronic device changes, the first electronic device resumes the first time period and receives messages within the first time period, which is beneficial to reducing device power consumption.

[0031] In a possible design of the first aspect, the method also includes: when the scene in which the first electronic device is located changes, the first electronic device rediscovers the surrounding devices and establishes a first communication connection; the scene changes include changes in absolute position, spatial position, and transportation; the first electronic device receives messages sent from surrounding devices within a first time period via a first communication method.

[0032] In this design, when the absolute position of the first electronic device changes, the spatial position changes, and the means of transportation changes, the first electronic device rediscovers the surrounding devices and establishes a first communication connection; the first electronic device receives messages sent from the surrounding devices within a first time period via the first communication method, so that the first electronic device can maintain connection with the surrounding devices, thereby improving communication reliability.

[0033] In a possible design of the first aspect, the method also includes: when the last electronic device among all electronic devices that establish a first communication connection with the first electronic device is offline, the first electronic device rediscovers surrounding devices and establishes a first communication connection; the first electronic device receives messages sent from surrounding devices within a first time period through the first communication method.

[0034] In this design, when all electronic devices that establish a first communication connection with the first electronic device are offline, the first electronic device rediscovers the surrounding devices and establishes the first communication connection; then, the first electronic device receives messages sent from the surrounding devices within the first time period through the first communication method, so that the first electronic device can maintain connection with the surrounding devices, thereby improving communication reliability.

[0035] In a possible design of the first aspect, the method also includes: when the network status of the communication system in which multiple electronic devices are located changes, the first electronic device sends a network change message to the second electronic device, and reconfirms the physical communication method when establishing the first communication connection with the second electronic device.

[0036] In this design, when the network status of multiple electronic devices changes (such as network interruption, network delay, etc.), the first electronic device notifies the second electronic device of the network change and reconfirms the physical communication method when establishing the first communication connection with the second electronic device, thereby improving communication reliability.

[0037] In a possible design of the first aspect, the method also includes: the first electronic device determines the wake-up period of the first electronic device based on a periodic connection established between the first application on the first electronic device and the cloud server of the first application; the first application is any application on the first electronic device; the first electronic device synchronizes the wake-up period to the second electronic device; the wake-up period is the same as the periodically set first time period.

[0038] In this design, the first electronic device sets a periodic first time period according to the wake-up cycle, that is, the wake-up cycle is the same as the period of the periodically set first time period, so that the first electronic device and the second electronic device receive messages within the wake-up cycle, which is beneficial to reducing device power consumption.

[0039] In a possible design of the first aspect, the method also includes: the first electronic device displays a first interface in response to a user's operation on a second application; the first interface includes at least one electronic device that maintains a first communication connection with the first electronic device; the at least one electronic device includes a second electronic device; and the first electronic device performs business communications with the second electronic device in response to the user's operation on the second electronic device.

[0040] In this design, since the first interface of the first electronic device can directly display at least one electronic device that maintains a first communication connection with the first electronic device, and the at least one electronic device includes a second electronic device, when the first electronic device wants to conduct business communication with the second electronic device, it does not need to scan the second electronic device first, and can directly conduct business communication with it, thereby reducing the user's waiting time and improving the user experience.

[0041] In a possible design manner of the first aspect, the first interface also includes at least one electronic device disconnected from the first electronic device.

[0042] In this design, since the first interface also displays at least one electronic device disconnected from the first electronic device, when the user holds the first electronic device and needs to conduct business communications with any one of the at least one electronic device, the user can directly click on the electronic device to establish a first communication connection between the electronic device and the first electronic device, thereby improving the user experience.

[0043] In a possible design of the first aspect, the first interface also includes indication information; the indication information is used to indicate that a third electronic device is being scanned; the third electronic device is a device among multiple electronic devices that is disconnected from the first electronic device; or, the third electronic device is a device that establishes a first communication connection with the first electronic device for the first time.

[0044] In this design, the user can know the third electronic device that is disconnected from the first electronic device or the electronic device that establishes the first communication connection with the first electronic device for the first time based on the instruction information displayed on the first interface, which is conducive to further improving the user experience.

[0045] In a possible design of the first aspect, the first electronic device includes a processor; the processor includes multiple processing cores; the multiple processing cores include a low-power core; the method also includes: the first electronic device receives a message sent by the second electronic device within a first time period via the low-power core.

[0046] In this design, by setting the mechanism for keeping the first electronic device and the second electronic device alive on a low-power core, it is helpful to reduce the power consumption of the devices.

[0047] In a second aspect, an electronic device is provided, which is a first electronic device; the electronic device includes a memory and one or more processors; the memory stores a computer program code, the computer program code includes computer instructions, and when the computer instructions are executed by the processor, the electronic device executes the following steps: the first electronic device establishes a first communication connection with the second electronic device; the first communication connection includes the first electronic device and the second electronic device being connected via a first communication method and a second communication method; the first electronic device receives a message sent by the second electronic device within a first time period via the first communication method; the first electronic device confirms that the first communication connection with the second electronic device is valid within a second time period based on the message; the first electronic device conducts business communications with the second electronic device via the second communication method within the second time period.

[0048] In a possible design of the second aspect, before the first electronic device receives a message sent by the second electronic device via the first communication method within a first time period, when the computer instruction is executed by the processor, the electronic device further performs the following steps: the first electronic device broadcasts or unicasts a request message via the first communication method and the second communication method within the first time period; the request message is used to indicate that the first electronic device requests to maintain the first communication connection with the second electronic device.

[0049] In a possible design of the second aspect, when the first communication connection is valid within the second time period, the first electronic device saves connection information of the second communication connection; when the computer instructions are executed by the processor, the electronic device specifically performs the following steps: the first electronic device restores the first communication connection established with the second electronic device according to the connection information and conducts business communication.

[0050] In a possible design manner of the second aspect, the priority of the first electronic device is higher than the priority of the second electronic device; the priority is used to indicate the hardware performance of the device, and the hardware performance of a device with a higher priority is higher than the hardware performance of a device with a lower priority; the hardware performance includes one or more of processor performance, memory performance, hard disk performance or network capabilities; when the computer instruction is executed by the processor, the electronic device specifically performs the following steps: the first electronic device establishes a first communication connection with the second electronic device, and determines the priority of the second electronic device; when the computer instruction is executed by the processor, the electronic device specifically performs the following steps: when the first electronic device has a higher priority than the second electronic device, the first electronic device confirms, based on the message, that the first communication connection with the second electronic device is valid within the second time period.

[0051] In a possible design manner of the second aspect, the first time period is set periodically; the first time period is the first time period set; when the computer instruction is executed by the processor, the electronic device further performs the following steps: when the first electronic device is in the first time period that is the second time period set, the first electronic device determines to disconnect from the second electronic device; or, when the first electronic device is in the first time period that is the first time period set for N consecutive times, the first electronic device determines to disconnect from the second electronic device; or, when the first time period and the second time period at least partially overlap, and the first electronic device does not receive a response message in the first time period within the second time period, the first electronic device determines to disconnect from the second electronic device.

[0052] In a possible design of the second aspect, when the computer instructions are executed by the processor, the electronic device further performs the following steps: when the first electronic device and the second electronic device perform business communication again, the first electronic device re-establishes the first communication connection with the second electronic device.

[0053] In a possible design of the second aspect, the message includes a response message, an inquiry message, or a service message.

[0054] In a possible design of the second aspect, when the computer instructions are executed by the processor, the electronic device further performs the following steps: when the first electronic device remains stationary within a first time period, and the number of times the first electronic device receives a response message sent by the second electronic device is greater than a first preset number, the first electronic device adjusts the first time period to a third time period; the length of the third time period is greater than the length of the first time period.

[0055] In a possible design of the second aspect, when the computer instructions are executed by the processor, the electronic device also performs the following steps: when the first electronic device is in a preset scene within a first time period, and the number of times the first electronic device receives a response message sent by the second electronic device is greater than a second preset number, the first electronic device adjusts the first time period to a fourth time period; the length of the fourth time period is less than the length of the first time period.

[0056] In a possible design of the second aspect, when the computer instructions are executed by the processor, the electronic device further performs the following steps: when the preset scene in which the first electronic device is located changes, the first electronic device restores the fourth time period to the first time period; the change in the preset scene includes the first electronic device changing from an off-screen display to a bright-screen display.

[0057] In a possible design of the second aspect, when the computer instructions are executed by the processor, the electronic device further performs the following steps: when the scene in which the first electronic device is located changes, the first electronic device restores the fourth time period to the first time period; the change in the preset scene includes a change in the usage status of the first electronic device.

[0058] In a possible design of the second aspect, when the computer instructions are executed by the processor, the electronic device also performs the following steps: when the scene in which the first electronic device is located changes, the first electronic device rediscovers the surrounding devices and establishes a first communication connection; the scene changes include changes in absolute position, changes in spatial position, and changes in transportation; the first electronic device receives messages sent from surrounding devices within a first time period via a first communication method.

[0059] In a possible design of the second aspect, when the computer instructions are executed by the processor, the electronic device also performs the following steps: when the last electronic device among all electronic devices that establish a first communication connection with the first electronic device is offline, the first electronic device rediscovers the surrounding devices and establishes the first communication connection; the first electronic device receives messages sent from the surrounding devices within a first time period via the first communication method.

[0060] In a possible design of the second aspect, when the computer instructions are executed by the processor, the electronic device also performs the following steps: when the network status of the communication system in which multiple electronic devices are located changes, the first electronic device sends a network change message to the second electronic device, and reconfirms the physical communication method when establishing the first communication connection with the second electronic device.

[0061] In a possible design of the second aspect, when the computer instructions are executed by the processor, the electronic device also performs the following steps: the first electronic device determines the wake-up cycle of the first electronic device based on a periodic connection established between a first application on the first electronic device and a cloud server of the first application; the first application is any application on the first electronic device; the first electronic device synchronizes the wake-up cycle to the second electronic device; the wake-up cycle is the same as the first time period set periodically.

[0062] In a possible design of the second aspect, when the computer instructions are executed by the processor, the electronic device also performs the following steps: the first electronic device displays a first interface in response to a user's operation on a second application; the first interface includes at least one electronic device that maintains a first communication connection with the first electronic device; the at least one electronic device includes a second electronic device; and the first electronic device performs business communications with the second electronic device in response to the user's operation on the second electronic device.

[0063] In a possible design manner of the second aspect, the first interface also includes at least one electronic device disconnected from the first electronic device.

[0064] In a possible design of the second aspect, the first interface also includes indication information; the indication information is used to indicate that a third electronic device is being scanned; the third electronic device is a device among multiple electronic devices that is disconnected from the first electronic device; or, the third electronic device is a device that establishes a first communication connection with the first electronic device for the first time.

[0065] In a possible design of the second aspect, the first electronic device includes a processor; the processor includes multiple processing cores; the multiple processing cores include a low-power core; when the computer instructions are executed by the processor, the electronic device also performs the following steps: the first electronic device receives a message sent by the second electronic device within a first time period through the low-power core.

[0066] In a third aspect, a communication system is provided, comprising multiple electronic devices; the multiple electronic devices include a first electronic device and a second electronic device; the first electronic device is any one of the multiple electronic devices, and the second electronic device is other electronic devices among the multiple electronic devices except the first electronic device; the first electronic device is used to execute the device networking method described in the above-mentioned first aspect or a possible design of the first aspect.

[0067] In a fourth aspect, a computer-readable storage medium is provided, comprising computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes the device networking method as described in the first aspect or a possible design of the first aspect.

[0068] In a fifth aspect, a computer program product is provided, which includes computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes the device networking method as described in the first aspect or a possible design of the first aspect.

[0069] It can be understood that the beneficial effects that can be achieved by the electronic device described in the second aspect and any possible design thereof, the communication system described in the third aspect, the computer-readable storage medium described in the fourth aspect, and the computer program product described in the fifth aspect can refer to the beneficial effects in the first aspect and any possible design thereof, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0070] Figure 1 A schematic diagram of the structure of a network consisting of an AP and a STA provided in an embodiment of the present application;

[0071] Figure 2A schematic diagram of the process of AP and STA networking provided in an embodiment of the present application;

[0072] Figure 3 A schematic diagram of the structure of a network consisting of a master and a slave provided in an embodiment of the present application;

[0073] Figure 4 A schematic diagram of the master and slave networking process provided in the embodiment of the present application;

[0074] Figure 5 A schematic diagram of a mobile phone interface provided in an embodiment of the present application;

[0075] Figure 6 A schematic diagram of the structure of a super terminal provided in an embodiment of the present application;

[0076] Figure 7 A schematic diagram of the structure of another super terminal provided in an embodiment of the present application;

[0077] Figure 8 A schematic diagram of the structure of another super terminal provided in an embodiment of the present application;

[0078] Fig. 9 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;

[0079] Fig.10 A schematic diagram of the structure of a communication system provided in an embodiment of the present application;

[0080] Fig.11a A schematic diagram of a device networking method provided in an embodiment of the present application;

[0081] Fig.11b A schematic diagram of the relationship between a first time period and a second time period provided in an embodiment of the present application;

[0082] Fig.11c Another schematic diagram of the relationship between the first time period and the second time period provided in an embodiment of the present application;

[0083] Fig.11d A schematic diagram of the relationship between a first time period and a second time period provided in another embodiment of the present application;

[0084] Fig.12 A schematic diagram of a device handshake connection process provided in an embodiment of the present application;

[0085] Fig.13 A schematic diagram of another device handshake connection process provided in an embodiment of the present application;

[0086] Fig.14A schematic diagram of a process flow of another device handshake connection provided in an embodiment of the present application;

[0087] Fig.15 A schematic diagram of triggering a heartbeat inquiry during a wake-up cycle provided in an embodiment of the present application;

[0088] Fig.16 A schematic diagram of another mobile phone interface provided in an embodiment of the present application;

[0089] Fig.17 A schematic diagram of the structure of a chip system provided in an embodiment of the present application. DETAILED DESCRIPTION

[0090] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application. Among them, in the description of the present application, unless otherwise specified, " / " indicates that the objects associated before and after are in an "or" relationship, for example, A / B can represent A or B; "and / or" in the present application is only a kind of association relationship describing the associated objects, indicating that there can be three relationships, for example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. And, in the description of the present application, unless otherwise specified, "multiple" refers to two or more than two. "At least one of the following" or its similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b, or c can represent: a, b, c, ab, ac, bc, or abc, where a, b, c can be single or multiple. In addition, in order to facilitate the clear description of the technical solutions of the embodiments of the present application, in the embodiments of the present application, the words "first", "second" and the like are used to distinguish the same items or similar items with substantially the same functions and effects. Those skilled in the art will understand that the words "first", "second" and the like do not limit the quantity and execution order, and the words "first", "second" and the like do not necessarily limit the differences. At the same time, in the embodiments of the present application, the words "exemplary" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or design solutions. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a concrete manner for ease of understanding.

[0091] In addition, the network architecture and business scenarios described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Ordinary technicians in this field can know that with the evolution of network architecture and the emergence of new business scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.

[0092] The star-topology LAN can be a network composed of wireless access points (AP) and stations (STA) through wireless fidelity (Wi-Fi) communication; it can also be a network composed of master and slave devices (slave) through classic Bluetooth (basic rate, BR) / low-power Bluetooth (bluetooth low energy, BLE) communication. In some embodiments, the network composed of AP-STA-cloud server and the network composed of master and slave can be called a "vertical" network.

[0093] Among them, the networking process of the star topology LAN includes device discovery, device authentication and device connection maintenance (referred to as keep-alive). Among them, device discovery refers to the central device discovering the surrounding peripheral devices (or the peripheral device discovering the surrounding central devices); device authentication refers to the central device authenticating the discovered peripheral devices. If the authentication is successful, the central device can establish a connection with the peripheral device; device connection maintenance refers to the business communication between the central device and the peripheral device by sending messages, so that the central device and the peripheral device always maintain a connection relationship.

[0094] The network composed of AP and STA can be a wireless local area network (WLAN). Figure 1 As shown, STA1, STA2, .., STAN can establish a communication connection with AP via Wi-Fi; then, STA1, STA2, .., STAN can communicate with AP and access the remote cloud server through AP. Among them, AP can be a wireless router or an electronic device with a Wi-Fi function module. Figure 2 The AP is a wireless router as an example.

[0095] Combination Figure 1 ,like Figure 2As shown, STA scans the surrounding APs through Wi-Fi, and then the AP sends a service set identifier (SSID) to the STA. After receiving the SSID sent by the AP, the STA selects the corresponding SSID and enters the password for authentication; if the authentication is successful (that is, the password is correct), the STA negotiates the communication channel with the AP and communicates through the communication channel. Finally, the AP sends a beacon frame to the STA, and the STA periodically listens to the beacon frame sent by the AP to keep alive. In some embodiments, Figure 2 The manner in which the STA discovers, connects to, and keeps the AP alive may also be referred to as a Soft AP manner.

[0096] exist Figure 2 In the network composed of AP and STA shown in the figure, on the one hand, when AP and STA keep alive, the power consumption of AP will be high, and when two STAs need to communicate for business, they must first discover and authenticate each other. Then they can communicate for business, which leads to high communication delay of STA. On the other hand, AP and STA can only be networked through WLAN, and cannot be networked through other communication media.

[0097] like Figure 3 As shown in the figure, slaveA, slaveB, ..., slaveN can establish a communication connection with the master through BLE / BR, and then slaveA, slaveB, ..., slaveN can communicate with the master. Figure 3 ,like Figure 4 As shown, the slave can send a broadcast message (such as ADV_IND or ADV_DIRECT_IND) in the broadcast channel, and the broadcast message is used to indicate that the slave is in a connectable state; the master can scan in the broadcast channel. When the master receives the broadcast message, it means that the master finds the slave and sends a scan request (scan request) to the slave; when the slave receives the scan request, it replies with a scan response (scan response) to the master that sent the connection request. Among them, the scan response replied by the slave can be, for example, CONNECT_REQ. Then, the master sends a connection request to the slave. When the slave receives the connection request, the master and the slave agree to establish a connection in the same channel and communicate. Exemplarily, the master and the slave can communicate using the generic attribute profile (GATT). When the master and the slave are networked through the BLE communication method, in some embodiments, it is still as shown Figure 4 As shown in the figure, the master will periodically send connection events to the slave, and the slave will periodically listen to the connection events sent by the master to keep alive. In addition, when the master and slave are networked through the BR communication method, the master and slave will always be in the keep alive state.

[0098] exist Figure 3 In the network composed of the master and slave shown in the figure, if slaveA, slaveB, ..., slaveN and the master include multiple devices of the same type, multiple devices of the same type are prone to mismatch; and the slaves cannot communicate directly with each other, and need to establish communication through the remote cloud server. On the other hand, if the communication medium of slaveA, slaveB, ..., slaveN and the master is different, the slave and the master cannot be networked.

[0099] Based on the above, it can be known that in a network composed of AP and STA, or a network composed of master and slave, when the central device does not exist (for example, the device is not powered on, or the device is damaged), the network does not exist, so that the peripheral devices cannot communicate with each other. When the central device exists (for example, working normally), and the network composed of peripheral devices and central devices exists, the central device in the local area network with a star topology can communicate with the peripheral devices, but the peripheral devices cannot communicate directly with each other. For example, in the Wi-Fi networking (i.e., AP and STA networking) scenario, STA1 and STA2 cannot communicate directly with each other. In the Bluetooth networking (i.e., slave and master networking) scenario, slaveA and slaveB cannot communicate directly with each other. Furthermore, every time a peripheral device and a peripheral device (such as STA1 and STA2, slaveA and slaveB) attempt to communicate with each other, the peripheral devices need to discover each other; that is, the peripheral devices must scan or discover each other before they can negotiate communication. This will cause the communication delay between peripheral devices to be uncontrollable. If a user uses a communication application to have communication demands, the user may need to wait for a long time (seconds or even minutes), which reduces the user experience.

[0100] For example, taking a mobile phone as an example, Figure 5As shown, when the user holds a mobile phone and needs to turn on the TV, the mobile phone interface displays a scanning control 1. After the user clicks the scanning control 1, the mobile phone starts to handshake with the surrounding online devices (that is, the mobile phone starts to scan the surrounding online devices). After a period of scanning time, the mobile phone interface will display the devices that have completed the handshake connection with the mobile phone. Then, after the user clicks on any device on the mobile phone interface (such as a computer), the mobile phone can communicate with the device. It can be seen that when the mobile phone scans the surrounding online devices, the user needs to wait for a long time, which will reduce the user experience.

[0101] It should be noted that in Figure 5 In the example, the interface displayed by the mobile phone also includes devices that are in business communication with the mobile phone (such as Bluetooth headsets and air purifiers).

[0102] Based on this, the embodiment of the present application provides a device networking method, which is applied to a communication network; the communication network does not rely on a general AP-STA, or a star network composed of master-slave. The method can enable multiple electronic devices to automatically form a communication network (referred to as a self-organizing network), that is, any two electronic devices between multiple electronic devices can discover, authenticate and establish a long connection with each other, and the long connection is a periodic handshake connection (also known as a handshake keep-alive). In this way, in the self-organizing network, any two electronic devices among multiple electronic devices can perform business communications; and, since any two electronic devices among multiple electronic devices periodically perform handshake connections, that is, each electronic device can know in advance which online devices are around, so that two electronic devices that need to perform business communications can directly perform business communications without first discovering and authenticating each other, and then performing business communications, thereby eliminating the discovery and authentication stages of the devices in the communication stage, reducing the uncertainty of mutual discovery and authentication of devices, and improving communication reliability while reducing communication delays, and improving user experience.

[0103] For example, by building a soft bus into the device, the devices can form a self-organized network. The soft bus has the ability to discover and connect, and can provide a high-throughput, low-latency, high-reliability, secure and reliable communication channel between various electronic devices, and provide a distributed intelligent communication highway network with wireless proximity localized access effect between various electronic devices. When the soft bus is built into the electronic device, the electronic device has the ability to discover and be discovered.

[0104] It should be noted that, in the embodiment of the present application, the self-organizing network of multiple electronic devices can be a self-organizing network between multiple peripheral devices, or a self-organizing network between a central device and multiple peripheral devices. For example, a self-organizing network between STA1, STA2, ···, and STAN; or, a self-organizing network between slaveA, slaveB, ···, slaveN, and master. In addition, in the present application, the new network formed between multiple electronic devices is also referred to as a "horizontal" network; wherein, a "horizontal" network refers to a network that is automatically formed between electronic devices without relying on a remote cloud server. Exemplarily, a self-organizing network of multiple electronic devices can be a self-organizing network between devices with equal communication roles, such as between peer devices (STA) in an AP-STA "vertical" network; or, between peer devices (slave) in a master-slave "vertical" network; or, in the absence of an existing AP-STA network or a master-slave network, a network that is networked between isolated peer devices with no role and communication capabilities.

[0105] Before describing the embodiments of the present application, the application scenarios of the embodiments of the present application are first described.

[0106] The device networking method provided in the embodiment of the present application can be applied to different fields (such as 1+8+N consumer products and industrial equipment, etc.). Among them, "1" refers to mobile phones; "8" refers to car computers, speakers, headphones, watches / bracelets, tablets, large screens, personal computers (personal computers, PCs), augmented reality (AR) devices / virtual reality (VR) devices, etc.; "N" refers to the Internet of Things (IoT).

[0107] On this basis, the application scenarios to which the method is applicable include but are not limited to: office scenarios, sports scenarios, family scenarios, entertainment scenarios, educational scenarios, and industrial production scenarios. It should be noted that multiple electronic devices can form a "super terminal" in different scenarios, and the various electronic devices in the "super terminal" can be interconnected to work together. Exemplarily, when multiple electronic devices form a "super terminal", a certain electronic device (such as a TV, a router, a mobile phone, etc.) can be determined as a central control device, and each electronic device except the central control device can be used as a slave device to establish a communication connection with the central control device (such as a Bluetooth connection, a Wi-Fi connection, etc.). In this way, the central control device can be used as a central node to manage and control other slave devices and complete corresponding tasks. In some embodiments, the user can install an application (application, APP) in the central control device, and the user can operate the slave device connected to it in the APP of the central control device, which greatly improves the user experience.

[0108] It should be noted that the central control may be, for example, a rich device, and the subordinate device may be, for example, a thin device. In general, the priority of a rich device is greater than that of a thin device. For example, a rich device refers to a device with a strong central processing unit (CPU), memory, hard disk, and network capabilities. A thin device refers to a device with a weak CPU, memory, hard disk, and network capabilities. Exemplarily, rich devices may be, for example, mobile phones, tablet computers (PADs), personal computers (PCs), smart screens, etc. Thin devices may be, for example, smart watches, headphones, smart glasses, etc. This application does not limit this.

[0109] In some embodiments, Figure 6 As shown, a mobile phone of rich devices is selected as the central control device. On this basis, the user can operate the TV, tablet, computer and wireless Bluetooth headset in the APP installed on the mobile phone. For example, the user can turn on the TV through the installed APP on the mobile phone.

[0110] It should be understood that in different scenarios, the electronic devices that make up the "super terminal" are different. For example, in a home scenario, Figure 7As shown, the electronic devices that make up the "super terminal" include mobile phones, tablet computers (PAD) / personal computers (PC), smart screens, and smart home appliances (such as smart lights, smart switches, smart refrigerators, smart ovens, smart door locks, smart curtains, etc.). Taking the mobile phone as a rich device as an example, PAD / PC, smart screens, and smart home appliances establish a connection with the mobile phone through access technology (for example, Wi-Fi, Bluetooth, USB, Ethernet, etc.), and then the user only needs to operate the mobile phone to control other devices in real time. For example, the user can operate the mobile phone to turn on (or off) smart lights, smart switches, etc. For another example, in a sports scene, such as Figure 8 As shown in FIG, the terminal devices that make up the "super terminal" include mobile phones, smart watches, headphones, smart bracelets, etc. Taking the mobile phone as an example of a rich device, smart watches, headphones, and smart bracelets establish a connection with the mobile phone through access technologies (for example, Wi-Fi, Bluetooth, USB, Ethernet, etc.), and then the user only needs to operate the mobile phone to control other devices in real time. For example, the user can operate the mobile phone to turn on the headphones so that the user can listen to music (or make calls) through the headphones.

[0111] Exemplarily, the device networking method provided in the embodiments of the present application can be applied to mobile phones, tablets, personal computers (PCs), personal digital assistants (PDAs), smart watches, netbooks, wearable electronic devices, augmented reality (AR) devices, virtual reality (VR) devices, vehicle-mounted devices, smart cars, smart speakers and other electronic devices, and the embodiments of the present application do not impose any restrictions on this.

[0112] like Fig. 9 , which is a schematic diagram of the structure of an electronic device 100. The electronic device 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, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 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, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc.

[0113] Among them, the above-mentioned sensor module 180 may include sensors such as a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L and a bone conduction sensor 180M.

[0114] It is to be understood that the structure illustrated in this embodiment does not constitute a specific limitation on the electronic device 100. In other embodiments, the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or separate some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0115] 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 processor (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. Different processing units may be independent devices or integrated into one or more processors.

[0116] The controller may be the nerve center and command center of the electronic device 100. The controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.

[0117] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

[0118] In some embodiments, the processor 110 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.

[0119] It is understandable that the interface connection relationship between the modules illustrated in this embodiment is only a schematic illustration and does not constitute a structural limitation of the electronic device. In other embodiments, the electronic device may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.

[0120] The charging management module 140 is used to receive charging input from a charger. The charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 may receive charging input from a wired charger through the USB interface 130. In some wireless charging embodiments, the charging management module 140 may receive wireless charging input through a wireless charging coil of an electronic device. While the charging management module 140 is charging the battery 142, it may also power the electronic device through the power management module 141.

[0121] 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 supplies power to the processor 110, the internal memory 121, the external memory, the display screen 194, the camera 193, and the wireless communication module 160. The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle number, battery health status (leakage, impedance), etc. 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.

[0122] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.

[0123] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.

[0124] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, etc. the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation.

[0125] The mobile communication module 150 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some functional modules of the mobile communication module 150 can be set in the same device as at least some modules of the processor 110.

[0126] The modem processor may include a modulator and a demodulator. Among them, the modulator is used to modulate the low-frequency baseband signal to be sent into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to a speaker 170A, a receiver 170B, etc.), or displays an image or video through a display screen 194. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 110 and be set in the same device as the mobile communication module 150 or other functional modules.

[0127] The wireless communication module 160 can provide wireless communication solutions for application in the electronic device 100, including 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 technology (NFC), infrared technology (IR), etc.

[0128] The wireless communication module 160 may be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the electromagnetic wave signal and performs filtering, and sends the processed signal to the processor 110. The wireless communication module 160 may also receive a signal to be sent from the processor 110, modulate the signal, amplify the signal, and convert it into an electromagnetic wave for radiation via the antenna 2.

[0129] In some embodiments, the antenna 1 of the electronic device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the electronic device 100 can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology. The GNSS may include a global positioning system (GPS), a global navigation satellite system (GLONASS), a Beidou navigation satellite system (BDS), a quasi-zenith satellite system (QZSS) and / or a satellite based augmentation system (SBAS).

[0130] The electronic device 100 implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.

[0131] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Mini-LED, Micro-OLED, Micro-OLED, quantum dot light-emitting diodes (QLED), etc.

[0132] The electronic device 100 can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor.

[0133] ISP is used to process the data fed back by camera 193. For example, when taking a photo, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to ISP for processing and converts it into an image visible to the naked eye. ISP can also perform algorithm optimization on the noise, brightness, and skin color of the image. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, ISP can be set in camera 193.

[0134] The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then passes the electrical signal to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the electronic device may include 1 or N cameras 193, where N is a positive integer greater than 1.

[0135] Digital signal processors are used to process digital signals. In addition to processing digital image signals, they can also process other digital signals. For example, when an electronic device selects a frequency point, a digital signal processor is used to perform Fourier transform on the frequency point energy.

[0136] Video codecs are used to compress or decompress digital videos. The electronic device 100 may support one or more video codecs. In this way, the electronic device can play or record videos in multiple coding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.

[0137] NPU is a neural network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transmission mode between neurons in the human brain, it can quickly process input information and continuously self-learn. NPU can realize applications such as intelligent cognition of electronic devices, such as image recognition, face recognition, voice recognition, text understanding, etc.

[0138] 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 electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function, such as storing music, video and other files in the external memory card.

[0139] The internal memory 121 may be used to store computer executable program codes, which include instructions. The processor 110 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121. For example, in an embodiment of the present application, the processor 110 may execute the instructions stored in the internal memory 121, and the internal memory 121 may include a program storage area and a data storage area.

[0140] The program storage area may 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 may store data created during the use of the electronic device 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.

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

[0142] 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 arranged in the processor 110, or some functional modules of the audio module 170 can be arranged in the processor 110. The speaker 170A, also known as the "speaker", is used to convert audio electrical signals into sound signals. The receiver 170B, also known as the "earpiece", is used to convert audio electrical signals into sound signals. The microphone 170C, also known as the "microphone" or "microphone", is used to convert sound signals into electrical signals.

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

[0144] The button 190 includes a power button, a volume button, etc. The button 190 can be a mechanical button. It can also be a touch button. The motor 191 can generate a vibration prompt. The motor 191 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback. The indicator 192 can be an indicator light, which can be used to indicate the charging status, power changes, messages, missed calls, notifications, etc. The SIM card interface 195 is used to connect the SIM card. The SIM card can be connected to and separated from the electronic device 100 by inserting it into the SIM card interface 195 or pulling it out from the SIM card interface 195. The electronic device 100 can support 1 or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 195 can support Nano SIM cards, Micro SIM cards, SIM cards, etc.

[0145] The device networking method provided in the embodiment of the present application is described in detail below in conjunction with the drawings of the specification.

[0146] A device networking method provided in an embodiment of the present application is applied in a communication system 200, such as Fig.10 As shown, the communication system 200 includes multiple electronic devices (for example, mobile phones, headphones, smart screens, bracelets, tablets, etc.); wherein, the multiple electronic devices can discover each other and authenticate each other. If the authentication is successful, any two of the multiple electronic devices can establish a communication connection (for example, a first communication connection) with each other and keep them alive, thereby completing the networking process of the communication system 200.

[0147] The above-mentioned multiple electronic devices may specifically include a first electronic device and a second electronic device. The first electronic device is any electronic device among the above-mentioned multiple electronic devices, and the second electronic device is any electronic device among the above-mentioned multiple electronic devices except the first electronic device. Taking the multiple electronic devices including device 1, device 2 and device 3 as an example, illustratively, the first electronic device may be device 1, and the second electronic device may be device 2; or, the first electronic device is device 2, and the second electronic device is device 3; or, the first electronic device is device 3, and the second electronic device is device 2; or, the first electronic device and the second electronic device may be a combination of any other two devices among device 1, device 2 and device 3, which is not limited in the embodiments of the present application.

[0148] Among them, the first electronic device has the ability to discover the second electronic device, and at the same time, the first electronic device can also be discovered by the second electronic device. Correspondingly, the second electronic device has the ability to discover the first electronic device, and at the same time, the second electronic device can also be discovered by the first electronic device. On this basis, the mutually discovered first electronic device and second electronic device can be authenticated, and if the authentication is successful, the first electronic device and the second electronic device establish a communication connection.

[0149] Exemplarily, the first electronic device and the second electronic device may establish a communication connection through at least two physical communication modes. Among them, the at least two physical communication modes may include a first communication mode and a second communication mode, that is, the first electronic device and the second electronic device are connected through the first communication mode and the second communication mode. The at least two physical communication modes may be a connected physical layer communication mode or a connectionless physical layer communication mode. The connected physical layer communication mode may be, for example, a Wi-Fi connection or other physical layer connection modes; the connectionless physical layer communication mode may be, for example, a Bluetooth (BR, BLE, etc.) connection, a network port connection, or other physical connection modes, which is not limited in this application.

[0150] Fig.11a A schematic diagram of a device networking method provided in an embodiment of the present application is shown in FIG. Fig.11a As shown, the method includes:

[0151] S10. The first electronic device sends a discovery message to the second electronic device.

[0152] The discovery message is used to indicate that the first electronic device can be discovered by other electronic devices.

[0153] At the same time, the second electronic device scans surrounding devices. When the second electronic device receives the discovery message sent by the first electronic device, the second electronic device discovers the first electronic device through scanning.

[0154] Correspondingly, the second electronic device sends a discovery message to the first electronic device. Meanwhile, the first electronic device scans surrounding devices. When the first electronic device receives the discovery message sent by the second electronic device, the first electronic device discovers the second electronic device through scanning.

[0155] It can be seen that the first electronic device and the second electronic device can both act as sender devices to send discovery messages, and can also act as scanner devices to scan. In this way, the first electronic device and the second electronic device both have the ability to discover and be discovered. Accordingly, each of the multiple electronic devices has the ability to discover and be discovered.

[0156] S20: The first electronic device sends an authentication message to the second electronic device.

[0157] The authentication message is used to indicate the device information of the first electronic device; the device information includes the SSID, account information and communication medium (also referred to as communication method) of the first electronic device.

[0158] Among them, SSID is used to indicate the name of the first electronic device (for example, Huawei P30); account information is used to indicate the account information of the user using the first electronic device (for example, the user's mobile phone number, email address, etc.). The communication medium is used to indicate the line when the first electronic device performs network communication. Exemplarily, the communication medium includes but is not limited to the following: wireless local area network (WLAN), peer to peer (P2P), BR, BLE, power line communication (PLC).

[0159] Correspondingly, the second electronic device sends an authentication message to the first electronic device. The authentication message sent by the second electronic device can refer to the example of the authentication message sent by the first electronic device, which will not be described in detail here.

[0160] After the first electronic device and the second electronic device exchange device information with each other, the first electronic device performs authentication according to the device information sent by the second electronic device; at the same time, the second electronic device performs authentication according to the device information sent by the first electronic device. If the SSIDs of the first electronic device and the second electronic device are the same, the first electronic device and the second electronic device automatically establish a communication connection. Exemplarily, when the first electronic device is Huawei P30 and the second electronic device is Huawei MAX, the first electronic device and the second electronic device automatically establish a communication connection. If the SSIDs of the first electronic device and the second electronic device are different, the first electronic device and the second electronic device establish a communication connection through user authorization. Exemplarily, the user can select the SSID of the second electronic device in the first electronic device and enter the password so that the first electronic device and the second electronic device establish a communication connection. If the account information of the first electronic device and the second electronic device is the same, that is, the first electronic device and the second electronic device belong to the same user, then the first electronic device and the second electronic device can directly establish a communication connection.

[0161] Exemplarily, the first electronic device and the second electronic device can establish a communication connection through at least two physical communication modes (such as the first communication mode and the second communication mode) described in the above embodiment. For the example description of at least two physical communication modes, reference can be made to the above embodiment, which will not be repeated here one by one.

[0162] S30: The first electronic device and the second electronic device establish a long connection.

[0163] Among them, establishing a long connection specifically refers to the first electronic device and the second electronic device maintaining a first communication connection.

[0164] Exemplarily, the first electronic device and the second electronic device may periodically trigger a heartbeat query so that the first electronic device and the second electronic device can maintain a long connection state. Among them, long connection refers to a discovery or connection means with a regularity and beat (i.e., periodicity). In the present application, long connection is applicable to various physical layer communication modes with and without connection. Among them, connection may be, for example, a Wi-Fi connection; and no connection may be, for example, a Bluetooth connection, an Ethernet port connection, etc. Of course, connection and no connection may also be other connection modes, which are not limited in the present application. For example, the first electronic device and the second electronic device may maintain a long connection through the first communication mode and the second communication mode. The first communication mode and the second communication mode are not limited to the traditional connection maintenance mode defined in accordance with the communication protocol of the physical communication mode, respectively, and may also be to save only the connection information. These connection information are used to quickly restore the long connection established by the physical communication mode, or to quickly use the physical communication mode for long connection. Exemplarily, the connection information may be, for example, the relevant parameters or relevant information (such as the information of the opposite device) required to establish and restore the connection.

[0165] For example, when the first electronic device and the second electronic device establish a communication connection through the communication mode of BLE, the first electronic device and the second electronic device can establish a long connection through the broadcast (advertisement) frame of BLE. For another example, when the first electronic device and the second electronic device establish a communication connection through the communication mode of BR, BR will always maintain the long connection between the first electronic device and the second electronic device. For another example, when the first electronic device and the second electronic device establish a communication connection through communication modes such as USB, Ethernet, WLAN, PLC, and the first electronic device and the second electronic device communicate through the user datagram protocol (user datagram protocol, UDP), the first electronic device and the second electronic device can establish a long connection through a connectionless Internet of Things protocol (constrained application protocol, Coap) message. For another example, when the first electronic device and the second electronic device establish a communication connection through communication modes such as USB, Ethernet, WLAN, PLC, and the first electronic device and the second electronic device communicate through IP, the first electronic device and the second electronic device can establish a long connection through the transmission control protocol (transmission control protocol, TCP), and use the keepalive mechanism to maintain the long connection. For another example, when the first electronic device and the second electronic device establish a communication connection via P2P, P2P will directly enable the first electronic device and the second electronic device to establish a long connection.

[0166] The periodic triggering of heartbeat inquiries by the first electronic device and the second electronic device refers to: the first electronic device receives a message sent by the second electronic device in a first time period through a first communication method; then, the first electronic device confirms that the first communication connection with the second electronic device is valid in the second time period according to the message. It should be noted that the message sent by the second electronic device received by the first electronic device in the first time period through the first communication method can be a message in various forms (for example, a response message, an inquiry message, or a business message, etc.).

[0167] In some embodiments, the first time period is set periodically. The length of the first time period may be constant or may change dynamically (e.g., increase or decrease). In the first time period set periodically, the interval between two adjacent first time periods is from the start of this time to the start of the next time; or from the end of this time to the end of the next time. This application does not limit this.

[0168] In some embodiments, Fig.11bAs shown, the start time of the second time period is the same as the time when the first electronic device receives the message, and the end time of the second time period is a period of time after the first electronic device receives the message. For example, the end time of the second time period is greater than or equal to the start time (or end time) of the Nth first time period. Fig.11b An example is taken where the end time of the second time period is equal to the start time of the Nth first time period.

[0169] In other embodiments, Fig.11c As shown, the start time of the second time period is the same as the start time of the current first time period (for example, the first first time period), and the end time of the second time period is a period of time after the start time of the current first time period. For example, the end time of the second time period is greater than or equal to the start time (or end time) of the Nth first time period. Fig.11c An example is taken where the end time of the second time period is equal to the start time of the Nth first time period.

[0170] In some other embodiments, Fig.11d As shown, the start time of the second time period is the same as the end time of the current first time period (for example, the first first time period), and the end time of the second time period is a period of time after the end time of the current first time period. For example, the end time of the second time period is greater than or equal to the start time (or end time) of the Nth first time period. Fig.11d An example is taken where the end time of the second time period is equal to the start time of the Nth first time period.

[0171] When the first electronic device confirms that the first communication connection with the second electronic device is valid in the second time period according to the message, the first electronic device performs business communication with the second electronic device through the second communication method in the second time period. Exemplarily, the first electronic device can quickly restore the first communication connection established with the second electronic device according to the saved connection information and perform business communication.

[0172] In some embodiments, the first time period is set periodically, assuming that the above-mentioned first time period is the first time period set; the method also includes: when the first electronic device does not receive a message in the first time period that is the second time period set, the first electronic device determines to disconnect from the second electronic device; or, when the first electronic device does not receive a message in the first time period that is the first time period set for N consecutive times (N>1), the first electronic device determines to disconnect from the second electronic device; or, when the first time period and the second time period at least partially overlap, and the first electronic device does not receive a message in the first time period within the second time period, the first electronic device determines to disconnect from the second electronic device.

[0173] On this basis, when the first electronic device and the second electronic device perform service communication again, the first electronic device re-establishes the first communication connection with the second electronic device.

[0174] It should be noted that the re-establishment of the first communication connection between the first electronic device and the second electronic device refers to the first electronic device and the second electronic device re-scanning and discovering each other, and then authenticating each other. If the authentication is successful, the first electronic device and the second electronic device re-establish the first communication connection. Different from the first electronic device restoring the first communication connection established with the second electronic device, the first electronic device restoring the first communication connection established with the second electronic device refers to the first electronic device and the second electronic device not needing to perform mutual scanning and discovery, as well as the mutual authentication process, but sending a request message through the first electronic device, and receiving a reply message from the second electronic device to restore the first communication connection. That is, the restoration of the first communication connection between the first electronic device and the second electronic device can be understood as the first communication connection established between the first electronic device and the second electronic device always exists, and the first communication connection is maintained (i.e., keep alive) by receiving messages within the first time period.

[0175] In some embodiments, multiple electronic devices all act as sender devices to send handshake request messages (e.g., send request messages), and multiple electronic devices all act as receiver devices to reply handshake response messages (e.g., reply messages). In other embodiments, multiple electronic devices all act as broadcaster devices to broadcast handshake response messages. In still other embodiments, multiple electronic devices negotiate to use one of the multiple electronic devices as a master device, and the other devices in the multiple electronic devices except the master device as slave devices; on this basis, the master device can send a handshake request message to each slave device; and then, each slave device replies with a handshake response message to the master device.

[0176] It should be noted that the first electronic device is any one of the multiple electronic devices, the second electronic device is any one of the multiple electronic devices except the first electronic device, and the establishment of a long connection between the first electronic device and the second electronic device indicates that a long connection can be established between any two of the multiple electronic devices. Fig.12 , Fig.13 as well as Fig.14 , a process of establishing a long connection between any two electronic devices among multiple electronic devices is described in detail.

[0177] In some embodiments, taking multiple electronic devices including device 1 and device 2 as an example, Fig.12 As shown, device 1 sends a handshake request message to device 2, and device 2 replies with a handshake response message to device 1; correspondingly, device 2 sends a handshake request message to device 1, and device 1 replies with a handshake response message to device 2.

[0178] The handshake request message may be, for example, "whether online". When device 1 sends a handshake request message to device 2, device 1 asks device 2 whether it is online. Then, device 2 detects its own network card status. When the network card status of device 2 is connected, device 2 replies with a handshake response message, that is, device 2 replies "online"; when the network card status of device 2 is not connected, device 2 does not reply to the handshake response message, that is, device 2 is "offline". In this way, by sending a handshake request message and replying to a handshake response message, device 1 and device 2 can know that each other is "online", and then device 1 and device 2 complete the handshake connection.

[0179] It should be noted that "online" means that the electronic device is within the coverage of the communication network (or the electronic device is connected to the communication network), has communication capabilities, and can communicate. "Offline" means that the electronic device is not within the coverage of the communication network (or the electronic device is not connected to the communication network), and cannot communicate.

[0180] In this embodiment, each of the multiple electronic devices will send a handshake request message. When each of the multiple electronic devices replies to a handshake response message, a handshake connection is completed between every two electronic devices in the multiple electronic devices. It should be noted that the above-mentioned handshake response message can be, for example, an inquiry message. The handshake connection is completed between device 1 and device 2, that is, device 1 confirms that the first communication connection with device 2 is valid within the second time period according to the message (such as the inquiry message). On this basis, device 1 and device 2 can directly conduct business communications.

[0181] In some other embodiments, each of the multiple electronic devices broadcasts a handshake response message; then, the first electronic device receives the handshake response message broadcasted by other electronic devices except the first electronic device. For example, the multiple electronic devices include device 1, device 2, and device 3. Fig.13 As shown, device 1 broadcasts a handshake response message, device 2 broadcasts a handshake response message, and device 3 broadcasts a handshake response message. On this basis, device 1 receives the handshake response message broadcast by device 2 and device 3, device 2 receives the handshake response message broadcast by device 1 and device 3, and device 3 receives the handshake response message broadcast by device 1 and device 2. In this way, a handshake connection can be completed between device 1, device 2, and device 3.

[0182] It should be noted that the corresponding handshake response message can refer to the above embodiment, which will not be described in detail here. It should be understood that when an electronic device broadcasts a handshake response message, it means that the electronic device is "online"; when an electronic device does not broadcast a handshake response message, it means that the electronic device is "offline".

[0183] In this embodiment, if each of the multiple electronic devices broadcasts a handshake response message, it means that each electronic device is "online", and then each electronic device can receive the handshake response message broadcast by other electronic devices other than the electronic device, so that every two electronic devices in the multiple electronic devices can complete the handshake connection with each other. It should be noted that the above-mentioned handshake response message can be, for example, a response message (acknowledge character, ACK). For example, the handshake connection between device 1 and device 2 is completed, that is, device 1 confirms that the first communication connection with device 2 is valid in the second time period according to the message (such as the response message). On this basis, device 1 and device 2 can directly conduct business communications.

[0184] In some other embodiments, multiple electronic devices determine a master device through negotiation, and the remaining electronic devices except the master device serve as slave devices. For example, the multiple electronic devices include a master device, slave device 1 and slave device 2. Fig.14 As shown, the master device sends a handshake request message to slave device 1, and master device 1 sends a handshake request message to slave device 2. Then, after slave device 1 and slave device 2 receive the handshake request message sent by the master device, slave device 1 sends a handshake response message to the master device, and slave device 2 sends a handshake response message to the master device.

[0185] It should be noted that the examples of the handshake request message and the handshake response message can refer to the above embodiment, which will not be described in detail here. When the slave device replies to the master device with a handshake response message, it means that the slave device is "online"; when the slave device does not reply to the master device with a handshake response message, it means that the slave device is "offline".

[0186] In this embodiment, if all slave devices in the multiple electronic devices reply to the master device with a handshake response message, it means that all slave devices are "online", and then all slave devices can complete the handshake connection with the master device. It should be noted that the above-mentioned handshake response message can be, for example, a response message. For example, the handshake connection between device 1 and device 2 is completed, that is, device 1 confirms that the first communication connection with device 2 is valid in the second time period according to the message (such as the response message). On this basis, device 1 and device 2 can directly conduct business communication.

[0187] In addition, multiple electronic devices determine a master device through negotiation. For example, the electronic device with the highest priority among multiple electronic devices can be determined as the master device; or a master device can be determined by other means, which is not limited in this application. Among them, the priority is used to indicate the hardware performance of the device, and the hardware performance of the device with a high priority is higher than the hardware performance of the device with a low priority. Hardware performance includes one or more of processor performance, memory performance, hard disk performance or network capabilities. Exemplarily, the processor performance (such as CPU main frequency), hard disk performance or network capabilities of the device with a high priority are stronger than the processor performance (such as CPU main frequency), hard disk performance or network capabilities of the device with a low priority.

[0188] In some embodiments, during the process of establishing a first communication connection between a first electronic device and a second electronic device, the first electronic device confirms the priority of the second electronic device. At the same time, during the process of establishing a first communication connection between the first electronic device and the second electronic device, the second electronic device confirms the priority of the first electronic device. When the first electronic device confirms that the priority of the first electronic device is higher than the priority of the second electronic device, the first electronic device confirms that the first communication connection with the second electronic device is valid within the second time period according to the message. That is, the first electronic device with a higher priority is used to send a request message and receive a message.

[0189] It should be noted that when the first electronic device and the second electronic device are performing business communication (for example, through BR, BLE or P2P), the first electronic device can confirm that the first communication connection with the second electronic device is valid within the second time period by receiving the business message sent by the second electronic device.

[0190] Based on the above, in an embodiment of the present application, multiple electronic devices automatically form a communication network (referred to as a self-organizing network), that is, any two electronic devices among the multiple electronic devices can discover, authenticate and establish a long connection with each other, and the long connection is a periodic handshake connection (also known as a handshake keep-alive). In this way, in the self-organizing network, any two electronic devices among the multiple electronic devices can perform business communications; and, since any two electronic devices among the multiple electronic devices periodically perform handshake connections, that is, each electronic device can know in advance which online devices are around, in this way, two electronic devices that need to perform business communications can directly perform business communications without first discovering and authenticating each other, and then performing business communications, thereby eliminating the discovery and authentication stages of the devices during the communication stage, reducing the uncertainty of mutual discovery and authentication of the devices, and improving communication reliability while reducing communication delays, and enhancing user experience.

[0191] In some embodiments, during the process of handshaking and connecting (i.e., maintaining the first communication connection) between the first electronic device and the second electronic device, the first electronic device and the second electronic device can perform handshaking and connecting through the first communication method or the second communication method. Exemplarily, the first communication method can be any one of WLAN, P2P, BR, BLE, and PLC; the second communication method can be any one of WLAN, P2P, BR, BLE, and PLC. In some embodiments, the first communication method and the second communication method can be the same or different.

[0192] It should be noted that since the reliability of each communication medium is different, when the electronic device uses different communication media for handshaking and connecting, the power consumption of the electronic device is different. Based on this, when the electronic device performs handshaking and connecting, it can use a communication medium with lower power consumption of the electronic device. In some embodiments, when the electronic device uses different communication media for handshaking and connecting, the order of the communication media corresponding to the power consumption of the electronic device from small to large is: BLE < BR < Wi-Fi < P2P < PLC. On this basis, when the electronic device includes multiple communication media, the electronic device can select a communication medium with lower power consumption for handshaking and connecting, so as to reduce the power consumption of the electronic device.

[0193] As can be seen from the above embodiments, the first electronic device and the second electronic device have exchanged device information with each other before establishing a long connection, and the device information includes the communication media supported by the electronic device. That is to say, the first electronic device knows the communication media supported by the second electronic device, and the second electronic device knows the communication media supported by the first electronic device. Therefore, the first electronic device and the second electronic device can perform handshaking and connecting according to the mutually exchanged communication media.

[0194] Taking the communication medium supported by the first electronic device including WLAN, P2P, BR, BLE, and PLC; the communication medium supported by the second electronic device including WLAN, P2P, BR, BLE, and PLC as an example, in some embodiments, the first electronic device can use the communication medium of BLE to send a handshake request message to the second electronic device, and the second electronic device can use the communication medium of WLAN to reply a handshake response message. In other embodiments, the first electronic device uses the communication medium of BLE to send a handshake request message to the second electronic device, and the second electronic device uses BLE, WLAN, or other communication media to reply a handshake response message. In other embodiments, the first electronic device uses the communication medium of BLE, WLAN, and P2P to send a handshake request message to the second electronic device, and the second electronic device uses the communication medium of P2P to reply a handshake response message. In other embodiments, the first electronic device uses the communication medium of BLE, WLAN, and P2P to send a handshake request message to the second electronic device, and the second electronic device uses the communication medium of BLE, WLAN, and P2P to reply a handshake response message. In other embodiments, the first electronic device uses the communication medium of BLE, WLAN, and P2P to send a handshake request message to the second electronic device, and the second electronic device uses the communication medium of BLE, WLAN, and P2P to reply a handshake response message.

[0195] In an embodiment of the present application, the first electronic device may trigger a heartbeat query according to a first time period. In some embodiments, the first electronic device may dynamically adjust the first time period for triggering the heartbeat query according to a state of the first electronic device. The first electronic device includes being in a stationary state and being in a preset scene.

[0196] For example, when the first electronic device is in a static state for a long time, the first electronic device may trigger the heartbeat query in a dynamic deceleration mode. When the first electronic device is in a preset scene for a long time, the first electronic device may trigger the heartbeat query in a dynamic acceleration mode.

[0197] Taking the first time period of 5 minutes as an example, for example, if the first electronic device remains stationary within the first time period, and the number of heartbeat inquiries performed by the first electronic device according to the first time period is greater than the first preset number (for example, three times), then the first electronic device can adjust the first time period to a third time period (for example, adjusted to 10 minutes). On this basis, if the first electronic device is still stationary, and the number of heartbeat inquiries performed by the first electronic device according to the third time period is greater than the first preset number (for example, three times), then the first electronic device can continue to increase the length of the third time period (for example, increase it to 30 minutes), and so on.

[0198] Still taking the first time period of 5 minutes as an example, for example, if the first electronic device is in a preset scene within the first time period, and the number of times the first electronic device receives messages sent by the second electronic device is greater than the second preset number, the first electronic device adjusts the first time period to the fourth time period (for example, from 5 minutes to 3 minutes). On this basis, if the first electronic device is still in a stationary state, and the number of times the first electronic device performs heartbeat inquiries according to the fourth time period is greater than the second preset number (for example, three times), then the first electronic device can continue to reduce the length of the fourth time period (for example, from 3 minutes to 1 minute), and so on.

[0199] In some embodiments, when the preset scene in which the first electronic device is located changes, the first electronic device restores the fourth time period to the first time period. Exemplarily, the preset scene changes include: the first electronic device changes from an off screen display to a bright screen display, the use state of the first electronic device (such as a user using the first electronic device to read text, watch a video, and have a voice call, etc.) changes, the absolute position of the first electronic device (such as a horizontal position) changes, the spatial position of the first electronic device (such as longitude and latitude coordinates) changes, and the transportation vehicle (such as a bus, a car, an airplane, and an elevator, etc.) in which the first electronic device is located changes.

[0200] For example, when the user holds the first electronic device and the screen display changes from off to on, the first electronic device resumes the first time period. For another example, when the user holds the first electronic device and changes from reading a text to watching a video, the first electronic device resumes the first time period. For another example, when the user holds the first electronic device and walks, the first electronic device resumes the first time period. For another example, when the user holds the first electronic device and changes from riding a bus to riding a car, the first electronic device resumes the first time period.

[0201] In some embodiments, when the absolute position of the first electronic device changes, or the spatial position changes, or the means of transportation changes, the first electronic device rediscovers the surrounding devices and establishes a first communication connection. Then, the first electronic device receives the response messages sent by the surrounding devices within the first time period through the first communication method.

[0202] In some embodiments, when the last electronic device among all electronic devices that establish communication connections with the first electronic device is offline, the first electronic device rediscovers the surrounding devices and establishes a first communication connection; the first electronic device receives response messages sent from the surrounding devices within a first time period via the first communication method.

[0203] In some embodiments, when the network status of a communication system in which multiple electronic devices are located changes, the first electronic device sends a network change message to the second electronic device and reconfirms the physical communication method when establishing the first communication connection with the second electronic device.

[0204] In some embodiments, the processor of the electronic device may be a general-purpose central processing unit (CPU), a microprocessor, etc. For example, the CPU may be a single-core processor (single-CPU) or a multi-core (multi-CPU) processor. In the case where the CPU is a multi-core processor, the module for triggering the heartbeat inquiry of the first electronic device may be set on a low-power core (e.g., Sensor Hub, M3 core). In this way, the power consumption of the device can be reduced.

[0205] On this basis, since each electronic device needs to perform over-the-air technology (OTA) to upgrade the electronic device and SIM card data, and the APP installed on the electronic device needs to communicate with the remote cloud server, it is necessary to periodically wake up the processor (such as CPU) and related communication modules (such as Wi-Fi chip) of the electronic device. Based on this, in an embodiment of the present application, a heartbeat query can be triggered within the wake-up cycle of the electronic device (that is, the wake-up cycle is the same as the period of the periodically set first time period), thereby reducing the power consumption of the device.

[0206] It should be noted that the CPU wake-up function of the electronic device is preferably set inside the chip, and secondly it can be set on the low-power core, and thirdly it can be set on the APP, so as to minimize the number and time of CPU wake-up of the electronic device.

[0207] Exemplarily, multiple electronic devices can agree on the same wake-up cycle through negotiation. For example, multiple electronic devices first negotiate to determine a master device, and the remaining devices except the master device are slave devices. Then, the master device first determines its own wake-up cycle, and then the master device sends its own wake-up cycle to each slave device, so that the wake-up cycles of multiple electronic devices are the same. In some embodiments, the master device can determine the wake-up cycle of the master device based on the periodic connection established between the APP installed on the master device and the remote cloud server.

[0208] The APP installed on the main device is the WeChat application For example, the remote cloud server will periodically push messages to the main device, and the main device will send messages to the WeChat application according to the remote cloud server. The wake-up period is determined by the period of push messages. In some embodiments, the main device may determine the wake-up period based on the period of a remote cloud server pushing messages to an APP installed on the main device; or the main device may determine the wake-up period based on the period of a remote cloud server pushing messages to multiple APPs installed on the main device. In the case where the main device determines the wake-up period based on the period of a remote cloud server pushing messages to multiple APPs installed on the main device, exemplarily, the multiple APPs installed on the main device may negotiate with the remote cloud service to set the period of the remote cloud service pushing messages to the multiple APPs installed on the main device to the same period.

[0209] like Fig.15 FIG. 1 is a schematic diagram of triggering a heartbeat query during a wake-up cycle provided by an embodiment of the present application. Fig.14 It can be seen that the first electronic device and the second electronic device have the same wake-up period (for example, 5 minutes), and the first electronic device and the second electronic device synchronize their wake-up clocks and align their wake-up windows; wherein the wake-up window includes the wake-up state and the background state. On this basis, the first electronic device and the second electronic device trigger a heartbeat query in the background state.

[0210] In addition, Fig.15 As shown, the first electronic device and the second electronic device align the wake-up windows while also aligning the windows for triggering heartbeat inquiries. That is, the first electronic device and the second electronic device trigger heartbeat inquiries at the same time. In this way, by dynamically adjusting the duty cycle, the CPU (or chip) can be used with the lowest power consumption.

[0211] It should be noted that, when the first electronic device is in a stationary state for a long time, the first electronic device will use a deceleration mode to trigger the heartbeat inquiry. That is to say, the period of the first electronic device triggering the heartbeat inquiry will continue to extend (for example, from 5 minutes to 10 minutes, then to 30 minutes, 1 hour or even longer). On this basis, if the heartbeat inquiry period of the first electronic device (that is, the period of the periodically set first time period) is greater than the wake-up period (for example, the heartbeat inquiry period is 10 minutes, and the wake-up period is 5 minutes), the first electronic device will forcibly wake up the first electronic device to trigger the heartbeat inquiry.

[0212] In this embodiment, since the wake-up cycle of each electronic device in the multiple electronic devices is aligned and the wake-up cycle of each electronic device is the same; on this basis, each electronic device can trigger a heartbeat inquiry within the wake-up cycle, thereby further reducing the power consumption of the device.

[0213] Taking the application scenario as a home scenario and the first electronic device as a mobile phone as an example, for example, Fig.16As shown in the figure, when the user logs in to the APP on the mobile phone to control the home smart device, the APP interface of the mobile phone will directly display the devices (such as smart screens, tablets, computers, speakers) that have completed the handshake connection with the mobile phone. In other words, the APP interface of the mobile phone will directly display the smart home devices that are currently online. Then, the user can directly click on any online device to enable the mobile phone to communicate with the device. For example, the user can click on the speaker to play the music on the mobile phone through the speaker.

[0214] In some embodiments, Fig.16 As shown, the APP interface of the mobile phone will also display smart home devices (such as mobile phones, etc.) that are not currently online. Among them, the display method of online smart devices is inconsistent with that of offline smart devices. For example, offline smart devices are displayed in gray. In addition, in some embodiments, the APP interface of the mobile phone will also display indication information. The indication information is used to indicate that the mobile phone is scanning other devices around. It should be understood that the other device is a device that has not established a communication connection with the mobile phone; or a device that has previously established a communication connection with the mobile phone but has subsequently disconnected.

[0215] It should be noted that in Fig.16 In the example, the APP interface of the mobile phone also includes a device (such as a Bluetooth headset, an air purifier, etc.) that is in business communication with the mobile phone. For example, the user can use the Bluetooth headset to listen to music or make a call.

[0216] In this embodiment, when the user needs to use a mobile phone to open any smart home device, the APP interface of the mobile phone will directly display the currently online devices. In this way, the user can open the device directly through the mobile phone, saving the time of the mobile phone scanning online devices, thereby reducing the user's waiting time and improving the user experience.

[0217] The present application embodiment provides an electronic device, which may include: a memory and one or more processors. The memory is used to store computer program code, and the computer program code includes computer instructions. When the processor executes the computer instructions, the electronic device can perform the various functions or steps performed by the electronic device in the above method embodiment. The structure of the electronic device can refer to Fig. 9 The structure of the electronic device 100 is shown.

[0218] The present application also provides a chip system, such as Fig.17 As shown, the chip system 1800 includes at least one processor 1801 and at least one interface circuit 1802. The processor 1801 may be Fig. 9The interface circuit 1802 may be, for example, an interface circuit between the processor 110 and the external memory 120 ; or an interface circuit between the processor 110 and the internal memory 121 .

[0219] The processor 1801 and the interface circuit 1802 can be interconnected via lines. For example, the interface circuit 1802 can be used to receive signals from other devices (such as a memory of an electronic device). For another example, the interface circuit 1802 can be used to send signals to other devices (such as the processor 1801). Exemplarily, the interface circuit 1802 can read instructions stored in the memory and send the instructions to the processor 1801. When the instructions are executed by the processor 1801, the electronic device can execute the various steps performed by the mobile phone 180 in the above embodiment. Of course, the chip system can also include other discrete devices, which is not specifically limited in the embodiments of the present application.

[0220] An embodiment of the present application further provides a computer storage medium, which includes computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes each function or step executed by the electronic device in the above method embodiment.

[0221] The embodiment of the present application also provides a computer program product. When the computer program product is run on a computer, the computer is enabled to execute each function or step executed by the electronic device in the above method embodiment.

[0222] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0223] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, 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.

[0224] The units described as separate components may or may not be physically separated, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0225] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0226] If the 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 readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.

[0227] The above contents are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application shall be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims

1. A device networking method, characterized in that: The method comprises: The first electronic device establishes a first communication connection with the second electronic device; the first communication connection includes the first electronic device and the second electronic device being connected via a first communication mode and a second communication mode; The first electronic device receives, by means of a first communication method, a message sent by the second electronic device within a first time period; The first electronic device confirms, according to the message, that the first communication connection with the second electronic device is valid within a second time period; The first electronic device performs service communication with the second electronic device through the second communication method during the second time period.

2. The method according to claim 1, characterized in that Before the first electronic device receives the message sent by the second electronic device in the first time period through the first communication mode, the method further includes: The first electronic device broadcasts or unicasts a request message in the first time period through the first communication mode or the second communication mode; the request message is used to indicate that the first electronic device requests to maintain the first communication connection with the second electronic device.

3. The method according to claim 1 or 2, characterized in that: In a case where the first communication connection is valid within the second time period, the first electronic device stores connection information of the first communication connection; The first electronic device performs service communication with the second electronic device through the second communication method within the second time period, including: The first electronic device restores the first communication connection established with the second electronic device according to the connection information and performs service communication.

4. The method according to claim 1 or 2, characterized in that: The priority of the first electronic device is higher than the priority of the second electronic device; the priority is used to indicate the hardware performance of the device, and the hardware performance of the device with a higher priority is higher than the hardware performance of the device with a lower priority; the hardware performance includes one or more of processor performance, memory performance, hard disk performance or network capability; The first electronic device establishes a first communication connection with the second electronic device, including: The first electronic device establishes the first communication connection with the second electronic device, and determines the priority of the second electronic device; The first electronic device confirming, according to the message, that the first communication connection with the second electronic device is valid within a second time period includes: In a case where the first electronic device has a higher priority than the second electronic device, the first electronic device confirms, according to the message, that the first communication connection with the second electronic device is valid within a second time period.

5. The method according to claim 1 or 2, characterized in that: The first time period is set periodically; the first time period is the first time period set; the method further includes: When the first electronic device does not receive a message during the first time period which is the second first time period set, the first electronic device determines to disconnect from the second electronic device; or, When the first electronic device does not receive a message in the first time period that is set N times in a row, the first electronic device determines to disconnect from the second electronic device; N>1; or, When the first time period and the second time period at least partially overlap, and the first electronic device does not receive a message in the first time period within the second time period, the first electronic device determines to disconnect from the second electronic device.

6. The method according to claim 5, characterized in that The method further comprises: When the first electronic device performs service communication with the second electronic device again, the first electronic device re-establishes the first communication connection with the second electronic device.

7. The method according to claim 1 or 2, characterized in that: The message includes a response message, an inquiry message or a service message.

8. The method according to claim 1 or 2, characterized in that: The method further comprises: When the first electronic device remains stationary within a first time period, and the number of times the first electronic device receives messages sent by the second electronic device is greater than a first preset number, the first electronic device adjusts the first time period to a third time period; the length of the third time period is greater than the length of the first time period.

9. The method according to claim 1 or 2, characterized in that: The method further comprises: When the first electronic device is in a preset scenario within a first time period, and the number of times the first electronic device receives messages sent by the second electronic device is greater than a second preset number, the first electronic device adjusts the first time period to a fourth time period; the length of the fourth time period is less than the length of the first time period.

10. The method according to claim 9, characterized in that The method further comprises: When the preset scene in which the first electronic device is located changes, the first electronic device restores the fourth time period to the first time period; the change in the preset scene includes the first electronic device changing from an off-screen display to a bright-screen display.

11. The method according to claim 9, characterized in that The method further comprises: When the preset scene in which the first electronic device is located changes, the first electronic device restores the fourth time period to the first time period; the change in the preset scene includes a change in the use state of the first electronic device.

12. The method according to claim 9, characterized in that The method further comprises: When the preset scene in which the first electronic device is located changes, the first electronic device rediscovers surrounding devices and establishes the first communication connection; the change in the preset scene includes a change in absolute position, a change in spatial position, or a change in transportation; The first electronic device receives messages sent from surrounding devices within the first time period through a first communication method.

13. The method according to claim 1 or 2, characterized in that: The method further comprises: When the last electronic device among all electronic devices that establish the first communication connection with the first electronic device is offline, the first electronic device rediscovers surrounding devices and establishes the first communication connection; The first electronic device receives messages sent from surrounding devices within the first time period through a first communication method.

14. The method according to claim 1, characterized in that The method is applied to a communication system including a plurality of electronic devices, and the method further includes: When the network status of the communication system in which the multiple electronic devices are located changes, the first electronic device sends a network change message to the second electronic device and reconfirms the physical communication method when establishing the first communication connection with the second electronic device.

15. The method according to claim 5, characterized in that The method further comprises: The first electronic device determines a wake-up period of the first electronic device according to a periodic connection established between a first application on the first electronic device and a cloud server of the first application; the first application is any application on the first electronic device; The first electronic device synchronizes the wake-up cycle to the second electronic device; the wake-up cycle is the same as the first time period set periodically.

16. The method according to claim 15, characterized in that The method further comprises: The first electronic device displays a first interface in response to a user's operation on a second application; the first interface includes at least one electronic device that maintains the first communication connection with the first electronic device; the at least one electronic device includes a second electronic device; The first electronic device performs business communication with the second electronic device in response to a user's operation on the second electronic device.

17. The method according to claim 16, characterized in that The first interface also includes at least one electronic device disconnected from the first electronic device.

18. The method according to claim 16 or 17, characterized in that The method is applied to a communication system including a plurality of electronic devices. The first interface also includes indication information; the indication information is used to indicate that a third electronic device is being scanned; the third electronic device is a device among the multiple electronic devices that is disconnected from the first electronic device; or, the third electronic device is a device that establishes the first communication connection with the first electronic device for the first time.

19. The method according to claim 1, 2 or 14, characterized in that: The first electronic device includes a processor; the processor includes a plurality of processing cores; the plurality of processing cores include a low power consumption core; the method further includes: The first electronic device receives the message sent by the second electronic device within the first time period through the low power consumption core.

20. An electronic device, characterized in that: The electronic device is a first electronic device; the electronic device includes a memory and one or more processors; the memory stores computer program code, and the computer program code includes computer instructions, and when the computer instructions are executed by the processor, the electronic device executes the method as described in any one of claims 1-19.

21. A computer-readable storage medium, characterized in that: The method comprises computer instructions, which, when executed on an electronic device, cause the electronic device to execute the method as claimed in any one of claims 1 to 19.

22. A computer program product, characterized in that The computer program product comprises computer instructions, and when the computer instructions are executed on an electronic device, the electronic device is caused to perform the method according to any one of claims 1 to 19.