Link switching method, system and related device

By dynamically switching the routing of logical interfaces in electronic devices, seamless link switching is achieved, which solves the high power consumption of high-precision P2P links and data problems during link switching, and improves transmission efficiency and user experience.

CN118741631APending Publication Date: 2024-10-01HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310379844.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-03-31
Publication Date
2024-10-01

AI Technical Summary

Technical Problem

The existing technology needs to maintain a high-precision P2P link at all times during the data transmission process, resulting in excessive power consumption and prone to data lag or loss during link switching.

Method used

By implementing the link switching method in electronic equipment, the routing settings of the logical interface are used to switch physical links and dynamically dismantle and build links to avoid maintaining multiple physical links all the time and achieve seamless link switching. Specific methods include detecting conditions and changing the route pointed by the logical interface, establishing or disconnecting the corresponding physical link to ensure the continuity of data transmission.

Benefits of technology

It effectively saves power consumption, avoids data freezes and losses, and achieves seamless link switching. It is suitable for various scenarios such as screencasting and shared Internet access.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118741631A_ABST
    Figure CN118741631A_ABST
Patent Text Reader

Abstract

The invention discloses a link switching method, a link switching system and a related device. The first electronic equipment comprises a first logic interface, a first physical interface and a third physical interface. The second electronic device comprises a second logic interface, a second physical interface and a fourth physical interface. The first physical interface and the second physical interface are used for establishing a first link, and the third physical interface and the fourth physical interface are used for establishing a second link. And under the condition that the first link is established and the route of the first logic interface pointing to the second logic interface is the address of the second physical interface, the first electronic equipment calls the first logic interface to transmit data to the second electronic equipment through the first link. And when the transmission link needs to be switched, after the second link is established, the first electronic equipment sets a route from the first logic interface to the second logic interface as an address of the fourth physical interface, and calls the first logic interface to transmit data to the second electronic equipment through the second link. Thus, multiple links do not need to be maintained, and power consumption is saved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communication technology, and in particular to a link switching method, system and related devices. Background Art

[0002] With the continuous development of communication technology, data transmission between electronic devices is becoming more and more frequent. During the data transmission process, multiple links can be established between the sender (the electronic device that sends data) and the receiver (the electronic device that receives data), and the sender can transmit the target data through one of the links. If the current link cannot meet the transmission requirements, the sender needs to switch to another link.

[0003] Taking the screen projection scenario as an example, a LAN link and a wireless fidelity peer-to-peer (P2P) link can be established between the sender and the receiver. The P2P link has higher transmission accuracy and requires higher power consumption. During the screen projection process, the sender can always maintain the P2P link and the LAN link with the receiver. In this way, when the sender determines that the target data does not need to be transmitted with high precision, the sender can transmit the target data through the LAN link; when the sender determines that the target data needs to be transmitted with high precision, the sender can transmit the target data through the P2P link.

[0004] However, the above method requires that the P2P link be maintained throughout the data transmission process, which requires too much power consumption. Summary of the invention

[0005] The present application provides a link switching method, system and related devices, which realize seamless switching of links during data transmission and save power consumption.

[0006] In a first aspect, the present application provides a link switching method, which is applied to a first electronic device, wherein the first electronic device includes a first logical interface, a first physical interface and a third physical interface; the method includes: calling the first logical interface to send data to the second electronic device through a first link, the first link being a physical link between the first physical interface and the second physical interface of the second electronic device, a logical link being established between the first logical interface and the second logical interface of the second electronic device, and a route from the first logical interface to the second logical interface being set to the address of the second physical interface; when it is detected that the first condition is met, setting the route from the first logical interface to the second logical interface to the address of the fourth physical interface in the second electronic device; calling the first logical interface to send data to the second electronic device through a second link, the second link being a physical link between the third physical interface and the fourth physical interface.

[0007] In this way, there is no need to always maintain multiple physical links, and link switching only requires changing the route from the first logical interface to the second logical interface, which can avoid data jamming, loss, etc. and achieve seamless link switching.

[0008] In a possible implementation, before setting the route from the first logical interface to the second logical interface as the address of the fourth physical interface in the second electronic device, the method further includes: establishing a second link between the third physical interface and the fourth physical interface.

[0009] In this way, when it is detected that the first condition is met, establishment of the second link can be triggered.

[0010] In a possible implementation, after calling the first logical interface to send data to the second electronic device through the second link, the method further includes: disconnecting the first link with the second electronic device.

[0011] In this way, the first link can be disconnected when there is no need to transmit data through the first link.

[0012] In a possible implementation, before calling the first logical interface to send data to the second electronic device through the first link, the method further includes: establishing a first link between the first physical interface and the second physical interface.

[0013] In one possible implementation, calling the first logical interface to send data to the second electronic device through the first link specifically includes: when the first electronic device adopts the first screen projection mode to project the screen to the second electronic device, calling the first logical interface to send data to the second electronic device through the first link; the first condition includes: switching the first screen projection mode to the second screen projection mode, and the first screen projection mode is different from the second screen projection mode.

[0014] In a possible implementation, the first screen projection mode is a streaming mode, the second screen projection mode is a mirroring mode, the first link is a local area network link, and the second link is a point-to-point P2P link.

[0015] In this way, in the screen projection scenario, the link for transmitting data can be switched by switching the screen projection mode.

[0016] In one possible implementation, the first condition includes: receiving an operation of a user switching link; and / or the first link is interfered with; and / or when the bandwidth of the first link is smaller than the bandwidth of the second link, the amount of data is greater than a preset value; and / or the transmission rate of the first link is smaller than a preset rate; and / or the transmission quality of the first link is lower than a preset quality.

[0017] In a possible implementation, the method further includes: upon detecting that the second condition is met, setting a route from the first logical interface to the second logical interface to the address of the second physical interface; and calling the first logical interface to send data to the second electronic device through the first link.

[0018] In one possible implementation, the second condition includes: receiving an operation of a user switching link; and / or the second link is interfered with; and / or when the bandwidth of the second link is less than the bandwidth of the first link, the amount of data is greater than a preset value; and / or the transmission rate of the second link is less than a preset rate; and / or the transmission quality of the second link is lower than a preset quality.

[0019] In this way, during the process of transmitting data through the second link, if it is detected that the second condition is met, the first electronic device can switch the transmission link back to the first link.

[0020] In one possible implementation, the first electronic device also includes a fifth physical interface; the method also includes: detecting that the third condition is met, setting the route from the first logical interface to the second logical interface to the address of the sixth physical interface in the second electronic device; calling the first logical interface to send data to the second electronic device through a third link, and the third link is a physical link between the fifth physical interface and the sixth physical interface.

[0021] In this way, during the process of transmitting data through the first link or the second link, if it is detected that the third condition is met, the first electronic device can switch the transmission link to the third link.

[0022] In one possible implementation, the third condition includes: receiving an operation of switching links by a user; and / or, the first link is interfered with; and / or, when the bandwidth of the first link is smaller than the bandwidth of the third link, the amount of data is greater than a preset value; and / or, the transmission rate of the first link is smaller than a preset rate; and / or, the transmission quality of the first link is lower than a preset quality; and / or, the third link has the highest priority or weight.

[0023] In a possible implementation, before setting the route from the first logical interface to the second logical interface as the address of the fourth physical interface in the second electronic device, the method further includes: acquiring the address of the fourth physical interface through the first link or the second link.

[0024] In a possible implementation, before the route from the first logical interface to the second logical interface is set as the address of the second physical interface in the second electronic device, the method further includes: acquiring the address of the second physical interface through the first link.

[0025] In a second aspect, the present application provides a multi-link transmission system, including: a first electronic device and a second electronic device, the first electronic device including a first logical interface, a first physical interface and a third physical interface, the second electronic device including a second logical interface, a second physical interface and a fourth physical interface;

[0026] The first electronic device is used to call the first logical interface to send data to the second electronic device through the first link, the first link is a physical link between the first physical interface and the second physical interface, a logical link is established between the first logical interface and the second logical interface, and the route from the first logical interface to the second logical interface is the address of the second physical interface;

[0027] The first electronic device is used to detect whether the first condition is met, and if the first condition is met, the first electronic device is used to set the route from the first logical interface to the second logical interface to the address of the fourth physical interface in the second electronic device;

[0028] The first electronic device is used to call the first logical interface to send data to the second electronic device through the second link, where the second link is a physical link between the third physical interface and the fourth physical interface;

[0029] The second electronic device is used to receive data sent by the first electronic device.

[0030] In a possible implementation, before setting the route from the first logical interface to the second logical interface as the address of the fourth physical interface in the second electronic device, the first electronic device is further configured to establish a second link between the third physical interface and the fourth physical interface.

[0031] In a possible implementation, after calling the first logical interface to send data to the second electronic device through the second link, the first electronic device is further configured to disconnect the first link between the first electronic device and the second electronic device.

[0032] In a possible implementation, before calling the first logical interface to send data to the second electronic device through the first link, the first electronic device is further configured to establish a first link between the first physical interface and the second physical interface.

[0033] In one possible implementation, when the first electronic device is used to project the screen to the second electronic device using the first projection mode, the first logical interface is called to send data to the second electronic device through the first link; the first condition includes: switching the first projection mode to the second projection mode, and the first projection mode is different from the second projection mode.

[0034] In a possible implementation, the first screen projection mode is a streaming mode, the second screen projection mode is a mirroring mode, the first link is a local area network link, and the second link is a point-to-point P2P link.

[0035] In one possible implementation, the first condition includes: receiving an operation of a user switching link; and / or the first link is interfered with; and / or when the bandwidth of the first link is smaller than the bandwidth of the second link, the amount of data is greater than a preset value; and / or the transmission rate of the first link is smaller than a preset rate; and / or the transmission quality of the first link is lower than a preset quality.

[0036] In one possible implementation, the first electronic device is further used to detect that the second condition is met and set the route from the first logical interface to the second logical interface to the address of the second physical interface; the first electronic device is further used to call the first logical interface to send data to the second electronic device through the first link.

[0037] In one possible implementation, the second condition includes: receiving an operation of a user switching link; and / or the second link is interfered with; and / or when the bandwidth of the second link is less than the bandwidth of the first link, the amount of data is greater than a preset value; and / or the transmission rate of the second link is less than a preset rate; and / or the transmission quality of the second link is lower than a preset quality.

[0038] In one possible implementation, the first electronic device also includes a fifth physical interface; the second electronic device also includes a sixth physical interface; the first electronic device is also used to detect that the third condition is met, and set the route from the first logical interface to the second logical interface to the address of the sixth physical interface in the second electronic device; the first electronic device is also used to call the first logical interface to send data to the second electronic device through a third link, and the third link is a physical link between the fifth physical interface and the sixth physical interface.

[0039] In one possible implementation, the third condition includes: receiving an operation of switching links by a user; and / or, the first link is interfered with; and / or, when the bandwidth of the first link is smaller than the bandwidth of the third link, the amount of data is greater than a preset value; and / or, the transmission rate of the first link is smaller than a preset rate; and / or, the transmission quality of the first link is lower than a preset quality; and / or, the third link has the highest priority or weight.

[0040] In a possible implementation, before setting the route from the first logical interface to the second logical interface as the address of the fourth physical interface in the second electronic device, the first electronic device is further configured to obtain the address of the fourth physical interface through the first link or the second link.

[0041] In a possible implementation, before the route from the first logical interface to the second logical interface is set as the address of the second physical interface in the second electronic device, the first electronic device is further configured to obtain the address of the second physical interface through the first link.

[0042] In a third aspect, the present application provides an electronic device, which is a first electronic device, comprising one or more processors, one or more memories, and multiple physical interfaces. The one or more memories are coupled to the one or more processors, and the one or more memories are used to store computer program codes, and the computer program codes include computer instructions, and when the one or more processors execute the computer instructions, the communication device executes the link switching method in any possible implementation of any of the above aspects.

[0043] In a fourth aspect, an embodiment of the present application provides a computer storage medium, including computer instructions, which, when executed on a first electronic device, enables the first electronic device to execute a link switching method in any possible implementation of any of the above aspects.

[0044] In a fifth aspect, an embodiment of the present application provides a computer program product. When the computer program product is run on a first electronic device, the first electronic device executes the link switching method in any possible implementation of any of the above aspects.

[0045] The beneficial effects of the second to fifth aspects can refer to the beneficial effects of the first aspect mentioned above. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] Figure 1 A schematic diagram of a communication network provided in an embodiment of the present application;

[0047] Figure 2 A schematic diagram of the system architecture of a multi-link transmission system 10 provided in an embodiment of the present application;

[0048] Figure 3A A schematic diagram of a communication connection between an interface of an electronic device 100 and an interface of an electronic device 200 provided in an embodiment of the present application;

[0049] Figure 3B A schematic diagram of the connection between a screen projection application and a physical interface in an electronic device 100 provided in an embodiment of the present application;

[0050] Figure 3C A schematic diagram of a communication connection between an interface of another electronic device 100 and an interface of an electronic device 200 provided in an embodiment of the present application;

[0051] Figure 4A-4B A schematic diagram of a model of a link switching method provided in an embodiment of the present application;

[0052] Figure 5 A flowchart of a link switching method provided in an embodiment of the present application;

[0053] Figure 6A schematic diagram of the hardware structure of an electronic device 100 provided in an embodiment of the present application;

[0054] Figure 7 A schematic diagram of a software architecture of an electronic device 100 provided in an embodiment of the present application;

[0055] Figure 8 A schematic flowchart of a link switching method performed by a first electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0056] The technical solutions in the embodiments of the present application will be described clearly and in detail below in conjunction with the accompanying drawings. In the description of the embodiments of the present application, unless otherwise specified, " / " means or, for example, A / B can mean A or B; "and / or" in the text is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, "multiple" means two or more than two.

[0057] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as suggesting or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features, and in the description of the embodiments of the present application, unless otherwise specified, "plurality" means two or more.

[0058] In order to facilitate understanding of the embodiments of the present application, some professional terms involved in the embodiments of the present application are explained below.

[0059] Physical interface: The interface that actually exists on an electronic device.

[0060] Logical interface: A logical interface refers to a virtual interface that can realize data exchange functions but does not exist physically and needs to be established through configuration. In the embodiment of the present application, a logical interface can correspond to multiple physical interfaces. When another electronic device can establish a communication connection with any of the multiple physical interfaces, the other electronic device can communicate with the logical interface through the communication connection.

[0061] Physical link: A physical link is a communication connection between electronic devices based on a physical interface. It is a real link that can be used to transmit data and realize mutual communication between electronic devices.

[0062] Logical link: A logical link is a communication connection between electronic devices based on a logical interface, and is not a real link. In the embodiment of the present application, a logical link can realize mutual communication between electronic devices through a physical link.

[0063] Routing: Routing, also known as routing information, is information going to the destination and is used to indicate the direction of the destination.

[0064] Wireless fidelity (Wi-Fi) technology: Wi-Fi technology is the most widely used wireless network transmission technology today. Wi-Fi is a trademark of the Wi-Fi Alliance manufacturer as a brand certification for products. It is a wireless local area network technology created based on the IEEE 802.11 standard. Due to the close relationship between the two systems, some people often use Wi-Fi as a synonym for the IEEE 802.11 standard.

[0065] Wireless local area network (WLAN): WLAN refers to the use of wireless communication technology to interconnect electronic devices to form a network system that can communicate with each other and share resources. The essential feature of wireless local area network is that electronic devices are no longer connected to the network using communication cables, but are connected wirelessly, making the construction of the network and the movement of electronic devices more flexible.

[0066] Wireless access point (AP): A WLAN system may include an AP and station electronic devices. An AP may be used to access an external network. For example, an AP may be a home router.

[0067] Station device, also called station (STA): A WLAN system may include AP and STA, and STA may access the network through AP.

[0068] WLAN basic service set (WLAN BSS): WLAN BSS is a basic service unit of a WLAN network.

[0069] Wireless Fidelity peer-to-peer (P2P, also known as Wi-Fidirect): Wireless Fidelity peer-to-peer technology, also known as peer-to-peer (P2P) technology, is a peer-to-peer connection technology based on Wi-Fi technology launched by the Wi-Fi Alliance. This peer-to-peer connection technology allows electronic devices to be directly connected to each other, so that electronic devices can communicate one-to-one or one-to-many without the help of a local area network or AP. For wireless electronic devices that support Wi-Fi, this peer-to-peer connection technology supports wireless electronic devices to interconnect in a peer-to-peer manner like Bluetooth. Compared with Bluetooth, this connection has greatly improved transmission speed and transmission distance, and its power consumption is also higher than Bluetooth.

[0070] Peer-to-peer network (P2P group): A P2P protocol connection (also written as P2P connection) can be established between two electronic devices to form a peer-to-peer network. In a P2P network, one electronic device will play the role of an AP in the traditional sense, called a group owner (GO), and the other electronic device is called a group client (GC). The GC can connect to the GO like an AP. A peer-to-peer network can also include multiple GCs, that is, the GO and GC can be one-to-one or one-to-many.

[0071] P2P link: A P2P protocol connection established between two electronic devices based on P2P technology can also be called a P2P link.

[0072] LAN link: A physical link between any two electronic devices in a WLAN network that can be used for communication can be called a LAN link.

[0073] Wi-Fi link: A Wi-Fi connection between two electronic devices based on Wi-Fi technology can also be called a Wi-Fi link. A generalized Wi-Fi link can include the above-mentioned P2P link. In some embodiments, the communication connection between electronic devices in a WLAN network is a Wi-Fi connection established based on traditional Wi-Fi technology. In this case, a generalized Wi-Fi link can also include the above-mentioned LAN link.

[0074] P2P technology and traditional Wi-Fi technology are not mutually exclusive. GO can provide services to several GCs like an AP. At the same time, GO can also be an AP in a WLAN network, or connect to other APs as a STA in a WLAN network.

[0075] For example, Figure 1As shown, the point-to-point network may include electronic device a and electronic device b, and P2P technology is used to establish a P2P protocol connection between electronic device a and electronic device b. In the point-to-point network, electronic device a may be a GO and electronic device b may be a GC. A wireless local area network basic service set (WLAN basic service set, WLAN BSS) may include electronic device a and electronic device c, and Wi-Fi technology is used to establish a Wi-Fi connection between electronic device a and electronic device c, and in the WLAN BSS, electronic device c is an AP and electronic device a is an STA.

[0076] Depend on Figure 1 It can be seen that the same electronic device can use different communication technologies to establish communication connections with other electronic devices in different communication networks, forming different types of links. Moreover, the same electronic device can also play different roles in different communication networks. It is understandable that electronic device a and electronic device b can also establish other types of links, such as Bluetooth links, etc., which are not limited in this application.

[0077] A multi-link transmission system provided by an embodiment of the present application is introduced below.

[0078] Figure 2 The system architecture of the multi-link transmission system 10 is shown.

[0079] like Figure 2 As shown, the multi-link transmission system 10 may include an electronic device 100, an electronic device 200, and an electronic device 300. A communication connection may be established between the electronic device 100 and the electronic device 200. The electronic device 100 and the electronic device 200 may also establish a communication connection with the electronic device 300, respectively. In some embodiments, the communication connection between the electronic device 100 and the electronic device 200 may be a P2P protocol connection, and the electronic device 100, the electronic device 200, and the electronic device 300 may form a WLAN network with the electronic device 300 as an AP and other electronic devices as STAs. In the WLAN network, the communication connection between the electronic device 100 and the electronic device 300, and the communication connection between the electronic device 200 and the electronic device 300 may be a Wi-Fi connection.

[0080] In the above case, the link between the electronic device 100 and the electronic device 200 may include two links: a local area network link and a P2P link. The P2P link is a P2P protocol connection between the electronic device 100 and the electronic device 200, and the local area network link is a Wi-Fi connection between the electronic device 100 and the electronic device 300 and a Wi-Fi connection between the electronic device 300 and the electronic device 200. When the electronic device 100 transmits target data along the local area network link, the electronic device 100 can send the target data to the electronic device 300 through the Wi-Fi connection between the electronic device 100 and the electronic device 300, and then send the target data to the electronic device 200 through the Wi-Fi connection between the electronic device 300 and the electronic device 200. When the electronic device 100 transmits target data along the P2P link, the electronic device 100 can send the target data to the electronic device 200 through the P2P connection between the electronic device 100 and the electronic device 200.

[0081] In the multi-link transmission system 10, the electronic device 100 may be Figure 2 The smart phone, the electronic device 200 may be Figure 2 The smart TV shown, the electronic device 300 may be Figure 2 In some embodiments, the electronic device 100, the electronic device 200, and the electronic device 300 may also be connected to Figure 2 The present application does not limit the different types of electronic devices in the illustrated embodiments.

[0082] Understandably, Figure 2 The illustrated embodiment is only an example of how multiple links can exist between the electronic device 100 and the electronic device 200. In the embodiment of the present application, the P2P link and the LAN link between the electronic device 100 and the electronic device 200 can also be replaced by other links (such as a Bluetooth link, etc.). In addition, more than two links can be included between the electronic device 100 and the electronic device 200, and the multi-link transmission system 10 can also include more or fewer electronic devices, which is not limited in the present application.

[0083] It should be noted that any link between the electronic device 100 and the electronic device 200 can be dynamically established and dismantled, that is, when the link needs to be used to transmit data, the link is established, and when the link is not needed, the link can be disconnected. In this way, during the data transmission process, it is not necessary to always maintain multiple links, which can reduce power consumption.

[0084] In the process of transmitting target data from electronic device 100 to electronic device 200, for example, in data transmission scenarios including multiple links such as screen projection, shared Internet access, multi-device collaboration, and business synchronization of distributed devices, due to different requirements for power consumption, transmission quality, transmission speed and other factors in different scenarios, electronic device 100 needs to switch the link for transmitting data (hereinafter referred to as transmission link), for example, switching link 1 to link 2, or switching link 2 to link 1. In the process of switching links, problems such as data loss or data jamming may occur.

[0085] The following describes the link switching method during data transmission in conjunction with the screen projection scenario. In the screen projection scenario, link 1 can be a LAN link, and link 2 can be a P2P link. Among them, the P2P link has higher link quality and shorter latency, but it requires high power consumption to maintain the P2P link. The link quality of the LAN link is lower than that of the P2P link, but the power consumption required to maintain the LAN link is very low.

[0086] In the scenario where the electronic device 100 projects the screen to the electronic device 200, the electronic device 100 can project the screen to the electronic device 200 through the streaming mode or the mirroring mode. Among them, the mirroring mode is to capture the local screen, or some specific application drawing, and send it to the receiving end for decoding and display after encoding. The electronic device 100 and the electronic device 200 can project the screen through the mirroring mode based on any one of the screen projection protocols such as miracast, cast+, and airplay. The streaming mode is that the electronic device 100 sends the resource to be played or the address of the resource to be played to the electronic device 200, and the electronic device 200 can use the default player to play the resource to be played after obtaining the resource to be played. The streaming mode does not require encoding. When the electronic device 100 and the electronic device 200 are in the same local area network, the electronic device 100 and the electronic device 200 can project the screen through the streaming mode based on any one of the screen projection protocols such as DLNA and airplay.

[0087] Since the mirror mode has higher requirements on the link quality and latency of data transmission, while the streaming mode only needs to ensure successful data transmission, when the electronic device 100 uses the mirror mode to project the screen to the electronic device 200, the electronic device 100 can select a link with higher link quality, that is, transmit the target data through the P2P link between the electronic device 100 and the electronic device 200. When the electronic device 100 uses the streaming mode to project the screen to the electronic device 200, the electronic device 100 can select a link with lower power consumption, that is, transmit the target data through the LAN link between the electronic device 100 and the electronic device 200.

[0088] When the electronic device 100 is projecting the screen to the electronic device 200, it can switch between the mirror mode and the streaming mode. For example, when the electronic device 100 detects the user's operation of switching the projection mode (for example, the operation of playing a video, the first input operation for the projection mode control, or the operation of opening a video application), the screen can be projected in the streaming mode; when the electronic device 100 detects the user's operation of switching the projection mode (for example, the second input operation for the projection mode control, the operation of exiting the video playback interface, or the operation of exiting the video application, etc.), it can switch from the streaming mode to the mirror mode, etc. Therefore, when the electronic device 100 switches the projection mode from the mirror mode to the streaming mode, it is necessary not only to switch the projection protocol but also to switch the transmission link, that is, to switch the transmission link from the P2P link to the LAN link; when the electronic device 100 switches the projection mode from the streaming mode to the mirror mode, it is necessary to switch the transmission link from the LAN link to the P2P link.

[0089] Figure 3A A schematic diagram of a communication connection between an interface of an electronic device 100 and an interface of an electronic device 200 in a screen projection scenario is shown.

[0090] like Figure 3A As shown, the electronic device 100 may include at least two physical interfaces, and the two physical interfaces may include an interface P2P-0-1 and an interface wlan0. The interface P2P-0-1 is a P2P interface that can be used to establish a P2P link. The P2P interface may be a physical interface configured by the electronic device 100 when the establishment of a P2P link is triggered. The interface wlan0 is a WLAN interface that can be used to establish a local area network link. Among them, the Internet protocol (IP) address of the interface P2P-0-1 may be 192.168.43.1, and the IP address of the interface wlan0 may be 7.247.142.86. It should be noted that the IP address here is only an example. In actual application scenarios, the IP address of the interface may also be a different IP address. The specific IP address is not limited in the embodiments of the present application.

[0091] The electronic device 200 may include at least two physical interfaces, which may include an interface P2P-1-1 and an interface wlan1. In the electronic device 200, the IP address of the interface P2P-1-1 may be 192.168.43.30, and the IP address of the interface wlan1 may be 7.247.142.86. The electronic device 100 may establish a LAN link between the interface wlan0 and the interface wlan1 in the electronic device 200. Similarly, the electronic device 100 may also establish a P2P link between the interface P2P-0-1 and the interface P2P-1-1.

[0092] Figure 3B A schematic diagram of the connection relationship between a screen projection application and a physical interface inside an electronic device 100 is shown.

[0093] like Figure 3B As shown, in the electronic device 100, the screen projection application can establish socket 1 with the interface P2P-0-1, and the screen projection application can establish socket 2 with the interface wlan0. When the electronic device 100 transmits target data through the P2P link, the screen projection application can send the target data to the interface P2P-0-1 through socket 1, and then transmit it from the interface P2P-0-1 to the electronic device 200 through the P2P link between the electronic device 200. When the electronic device 100 transmits target data through the LAN link, the screen projection application can send the target data to the interface wlan0 through socket 2, and then transmit it from the interface wlan0 to the electronic device 200 through the LAN link between the electronic device 200.

[0094] In some embodiments, the electronic device 100 can simultaneously maintain Figure 3A The LAN link and P2P link between the electronic device 100 and the electronic device 200 are shown. Exemplarily, the electronic device 100 currently transmits the target data through the LAN link. When the screen projection application determines to switch the transmission link (for example, receiving the user's operation to switch the screen projection mode, detecting that the conditions for switching the transmission link are met, etc.), the screen projection application can send the next frame of data in the target data to the interface P2P-0-1, and then transmit it to the electronic device 200 through the P2P link. In this way, the transmission link can be switched during the data transmission process, and data loss can be avoided.

[0095] However, the power consumption required to maintain a P2P link is much greater than that required to maintain a LAN link. For example, in a wireless LAN, the power consumption required to maintain the connection between a STA and an AP is about 10+mAh (milliampere-hours). Under the same circumstances, the power consumption required to maintain the GO and GC in a P2P network is about 100+mAh. Therefore, the power consumption required to maintain both a LAN link and a P2P link is very high.

[0096] In some other embodiments, the electronic device 100 may control the dynamic establishment and dismantling of the P2P link.

[0097] For example, Figure 3C As shown, a LAN link or a P2P link can be established between the electronic device 100 and the electronic device 200. The physical interface corresponding to the above communication link can refer to the above Figure 3AThe relevant contents of the illustrated embodiment will not be described here in detail. Among them, the electronic device 100 can control the dynamic establishment and dismantling of the P2P link, that is, when data needs to be transmitted through the P2P link, the electronic device 100 establishes and maintains the P2P link with the electronic device 200; when data does not need to be transmitted through the P2P link, the electronic device 100 can disconnect the P2P link with the electronic device 200. In this way, during the data transmission process, it is not necessary to always maintain the P2P link, which can reduce the power consumption required during the data transmission process.

[0098] However, using the above switching method, when the screen projection mode switches from streaming mode to mirror mode, the screen projection application is sending data through the LAN link, and it is necessary to notify to stop sending data on the LAN link and enable the P2P link to send data. Since it takes a certain amount of time to establish a P2P link (for example, 3 seconds), data jams may occur during data transmission, and the electronic device 200 at the receiving end may have a black screen or a distorted screen. Therefore, the use of dynamic dismantling and reconstruction of P2P links requires matching additional collaborative transmission mechanisms, which increases the complexity of the solution and is not very applicable.

[0099] In the shared Internet access scenario, there are similar problems as in the above-mentioned screen projection scenario. Exemplarily, the electronic device 100 can share the network with the electronic device 200 through a P2P link and a Bluetooth link, and the electronic device 200 can obtain the target data required by the user of the electronic device 200 through the P2P link or the Bluetooth link. Since the user's Internet access behavior on the electronic device 200 is random, and there is a large difference in the amount of target data required for different behaviors, for example, when the user watches a video through the electronic device 200, the amount of target data is large, which is a high-traffic scenario; when the user chats through the electronic device 200, the amount of target data is small, which is a low-traffic scenario. In a high-traffic scenario, the electronic device 100 uses a P2P link to transmit the target data, and in a low-traffic scenario, the electronic device 100 uses a Bluetooth link to transmit the target data. If the electronic device 100 maintains a Bluetooth link and a P2P link at the same time, the power consumption will be too high due to the high power consumption characteristics of the P2P link. If the electronic device 100 adopts the method of dynamically dismantling and reconstructing the P2P link, since it is impossible to determine when the high-traffic scenario and the low-traffic scenario will switch, data freezing or loss is inevitable, which will bring a poor user experience to the user.

[0100] It is understandable that the shared Internet access embodiment here is only an example. In the embodiment of the present application, the shared Internet access scenario may also include more links, or include other types of links, and the present application does not limit this.

[0101] The present application provides a link switching method, in which a first electronic device includes a first logical interface, a first physical interface and a third physical interface. The second electronic device includes a second logical interface, a second physical interface and a fourth physical interface. The first physical interface and the second physical interface can be used to establish a first link, and the third physical interface and the fourth physical interface can be used to establish a second link. The first logical interface and the second logical interface can be used to establish a logical link. When the first link has been established, the first electronic device sets the route from the first logical interface to the second logical interface to the address of the second physical interface, and calls the first logical interface to transmit data to the second electronic device through the first link. When it is necessary to switch the transmission link, after determining that the second link has been established, the first electronic device sets the route from the first logical interface to the second logical interface to the address of the fourth physical interface, and calls the first logical interface to transmit data to the second electronic device through the second link.

[0102] By adopting the link switching method provided by the present application, during the data transmission process, the first link and / or the second link can be dynamically dismantled and rebuilt, and there is no need to always maintain multiple links, and the power consumption is not high. Moreover, since the link switching can be achieved by changing the route from the first logical interface to the second logical interface, the method can also achieve seamless switching of the link without data jamming or loss. The link switching method provided by the present application can be applied to multiple scenarios such as screen projection scenarios, multi-device collaboration scenarios, and shared Internet access scenarios.

[0103] The following is a model schematic diagram of the link switching method provided in an embodiment of the present application.

[0104] Figure 4A A schematic diagram of a communication model between an interface of an electronic device 100 and an interface of an electronic device 200 provided in an embodiment of the present application is shown.

[0105] like Figure 4AAs shown, the electronic device 100 may have a logical interface conInt0, and the logical interface conInt0 may correspond to multiple physical interfaces of the electronic device 100, including interface wlan0 and interface P2P-0-1. The electronic device 200 may have a logical interface conInt1, and the logical interface conInt1 may correspond to multiple physical interfaces of the electronic device 200, including interface wlan1 and interface P2P-1-1. Among them, interface wlan1 can be used to establish a LAN link, and interface P2P-1-1 can be used to establish a P2P link. It should be noted that when the electronic device 200 can establish a physical link with any physical interface corresponding to the logical interface conInt0, the electronic device 200 can communicate with the logical interface conInt0 through the physical link; similarly, when the electronic device 100 can establish a physical link with any physical interface corresponding to the logical interface conInt1, the electronic device 100 can communicate with the logical interface conInt1 through the physical link. In some embodiments, the logical interface conInt0 may correspond to all physical interfaces in the electronic device 100 , and / or the logical interface conInt1 may correspond to all physical interfaces in the electronic device 200 .

[0106] The electronic device 100 and the electronic device 200 can determine the IP addresses of the logical interface conInt0 and the logical interface conInt1 through negotiation. For example, the IP address of the logical interface conInt0 can be 1.1.1.1, and the IP address of conInt1 can be 2.2.2.2. Afterwards, the electronic device 100 can establish a logical link between the logical interface conInt0 and the logical interface conInt1. The logical link can correspond to one or more physical links. The one or more physical links are physical links established between the physical interface corresponding to the logical interface conInt0 and the physical interface corresponding to the logical interface conInt1, such as a local area network link and a P2P link, etc. It should be noted that if the logical interface conInt0 and the logical interface conInt1 also correspond to other types of physical interfaces, the physical link corresponding to the logical link can also include other types of physical links, such as a Bluetooth link, etc.

[0107] The data transmitted by the logical link is actually transmitted through one of the one or more physical links. When at least one physical link among the one or more physical links has been established, the logical link can transmit data through one of the established physical links. The route of the logical interface conInt0 pointing to the logical interface conInt1 in the electronic device 100 can be used to indicate the physical link of the electronic device 100 to the logical interface conInt1. The electronic device 100 can indicate the physical link of the electronic device 100 to send the target data to the logical interface conInt1 by setting the route of the logical interface conInt0 pointing to the logical interface conInt1. Specifically, when the electronic device 100 sets the route of the logical interface conInt0 pointing to the logical interface conInt1 to the IP address of the interface wlan1 in the electronic device 200, the physical link of the electronic device 100 to the logical interface conInt1 is a local area network link; when the route of the logical interface conInt0 pointing to the logical interface conInt1 is set to the IP address of the interface P2P-1-1 in the electronic device 200, the physical link of the electronic device 100 to the logical interface conInt1 is a P2P link. It should be noted that when a logical link corresponds to more than two physical links, the electronic device 100 can determine the link after switching based on routing priority, link weight, etc. The specific method can be referred to the following embodiment and will not be described in detail here.

[0108] Exemplarily, taking the switching of the transmission link from the LAN link to the P2P link as an example, before the link switching, a LAN link is established between the electronic device 100 and the electronic device 200 based on the interface wlan0 and the interface wlan1, and the route from the logical interface conInt0 to the logical interface conInt1 is the IP address of the interface wlan1. In this case, the data transmitted on the logical link can be transmitted through the LAN link, that is, the electronic device 100 can call the logical interface conInt0 to send data to the electronic device 200 based on the LAN link. When it is detected that the link switching condition is met (for example, receiving the user's link switching operation, detecting that the activity of the current transmission link is reduced, detecting that the current transmission link is disturbed, etc.), the electronic device 100 can establish a P2P link based on the interface P2P-0-1 and the interface P2P-1-1. After detecting that the P2P link is established, the electronic device 100 can set the route from the logical interface conInt0 to the logical interface conInt1 to the IP address of the interface P2P-1-1. At this time, the data transmitted on the logical link can be transmitted through the P2P link, that is, the electronic device 100 can call the logical interface conInt0 to send data to the electronic device 200 based on the P2P link.

[0109] As another example, taking the switching of the transmission link from the P2P link to the LAN link as an example, before the link switching, a P2P link is established between the electronic device 100 and the electronic device 200, and the route from the logical interface conInt0 to the logical interface conInt1 is the IP address of the interface P2P-1-1 in the electronic device 200, and the electronic device 100 can call the logical interface conInt0 to send data to the electronic device 200 based on the P2P link. When it is detected that the link switching condition is met and it is detected that the LAN link has been established, the electronic device 100 can set the route from the logical interface conInt0 to the logical interface conInt1 to the IP address of the interface wlan1. At this time, the electronic device 100 can call the logical interface conInt0 to send data to the electronic device 200 based on the LAN link.

[0110] In this way, when the electronic device 100 transmits data to the electronic device 200, the transmission link can be switched by changing the route of the logical interface conInt0 to point to the logical interface conInt1. Moreover, it is not necessary to always maintain the P2P link, saving power consumption. In addition, it can also avoid problems such as data jamming and achieve seamless switching of the link.

[0111] Figure 4B A schematic diagram of a communication model between a sending-end application and an interface in an electronic device 100 provided in an embodiment of the present application is shown.

[0112] like Figure 4B As shown, the electronic device 100 may include a transmitting end application and a logical interface conInt0, the logical interface conInt0 may correspond to multiple physical interfaces of the electronic device 100, including the interface wlan0, and after triggering the establishment of the P2P link, the multiple physical interfaces may also include the interface P2P-0-1, and the relationship between the logical interface conInt0 and the interface wlan0 and the interface P2P-0-1 may refer to the above Figure 4A Related description in the illustrated embodiment.

[0113] The sending end application in the electronic device 100 is a data sending end. The sending end application can establish a communication connection with the logical interface conInt0, such as socket 3.

[0114] Exemplarily, taking the case where the transmission link is switched from a LAN link to a P2P link, before the link is switched, the route from the logical interface conInt0 to the logical interface conInt1 is set to the address of the interface wlan1 in the electronic device 200. In this case, the specific process of the electronic device 100 calling the logical interface conInt0 to send the target data to the electronic device 200 is as follows: the sending end application can send the target data and the target address to the logical interface conInt0 through socket3, and the target address is the IP address of the logical interface conInt1; the logical interface conInt0 determines to send the target data to the logical interface conInt1 based on the target address. And based on the route from the logical interface conInt0 to the logical interface conInt1 (the IP address of the interface wlan1), it is determined that the physical link leading to the logical interface conInt1 is a LAN link. In the case of determining to use the LAN link to send the target data, the logical interface conInt0 sends the received target data to the interface wlan0 of the electronic device 100, and the interface wlan0 of the electronic device 100 sends the target data to the electronic device 200 through the LAN link.

[0115] When it is detected that the link switching condition is met, the electronic device 100 can trigger the establishment of a P2P link. After detecting that the P2P link is established, the electronic device 100 can set the route from the logical interface conInt0 to the logical interface conInt1 to the IP address of the interface P2P-1-1. In this case, the specific process of the electronic device 100 calling the logical interface conInt0 to send the target data to the electronic device 200 is as follows: the sending application can send the target data and the target address to the logical interface conInt0 through socket3, and the target address is the IP address of the logical interface conInt1, and the target address is used to indicate the destination of the target data; the logical interface conInt0 determines to send the target data to the logical interface conInt1 based on the target address. And based on the route from the logical interface conInt0 to the logical interface conInt1 (the IP address of the interface P2P-1-1), it is determined that the physical link leading to the logical interface conInt1 is a P2P link. When it is determined to use the P2P link to send the target data, the logical interface conInt0 sends the received target data to the interface P2P-0-1 of the electronic device 100; the interface P2P-0-1 of the electronic device 100 sends the target data to the electronic device 200 through the P2P link.

[0116] As another example, taking the example of the transmission link switching from a P2P link to a LAN link, before the link switching, a P2P link is established between the electronic device 100 and the electronic device 200, and the route pointing to the logical interface conInt1 is set to the IP address of the interface P2P-1-1. In this case, the specific process of the electronic device 100 calling the logical interface conInt0 to send the target data to the electronic device 200 is as follows: the sending application can send the target data and the target address to the logical interface conInt0 through socket3, and the target address is the IP address of the logical interface conInt1; the logical interface conInt0 determines to send the target data to the logical interface conInt1 based on the target address, and determines that the physical link to the logical interface conInt1 is a P2P link based on the route from the logical interface conInt0 to the logical interface conInt1 (the IP address of the interface P2P-1-1). When it is determined to use the P2P link to send the target data, the logical interface conInt0 sends the received target data to the interface P2P-0-1 of the electronic device 100; the interface P2P-0-1 of the electronic device 100 sends the target data to the electronic device 200 through the P2P link.

[0117] When it is detected that the link switching condition is met and the LAN link has been established, the electronic device 100 can set the route of the logical interface conInt0 pointing to the logical interface conInt1 to the IP address of the interface wlan1. In this case, the specific process of the electronic device 100 calling the logical interface conInt0 to send the target data to the electronic device 200 is as follows: the sending end application can send the target data and the target address to the logical interface conInt0 through socket3, and the target address is the IP address of the logical interface conInt1; the logical interface conInt0 determines to send the target data to the logical interface conInt1 based on the target address, and determines that the physical link leading to the logical interface conInt1 is the LAN link based on the route of the logical interface conInt0 pointing to the logical interface conInt1 (the IP address of the interface wlan1). In the case of determining to use the LAN link to send the target data, the logical interface conInt0 sends the received target data to the interface wlan0 of the electronic device 100, and the interface wlan0 of the electronic device 100 sends the target data to the electronic device 200 through the LAN link.

[0118] In this way, when the electronic device 100 transmits data to other electronic devices, the sending-end application in the electronic device 100 can send data to one of the physical interfaces corresponding to the logical interface conInt0 through the communication connection between the logical interface conInt0, and transmit the data to the electronic device 200 through the link between the physical interface and the electronic device 200. Moreover, before and after the link switching, the target address of the target data sent by the sending-end application is the IP address of the logical interface conInt1, the sending-end application does not need to perceive the switching of the transmission link, and does not need an additional coordinated transmission mechanism to ensure the normal transmission of data, and can achieve seamless switching of the transmission link.

[0119] It is understandable that the above FIG. 4A to FIG. 4B The illustrated embodiment is merely an illustrative example of how the link for transmitting target data can be switched by changing the route pointing to the logical interface in the electronic device 200. In the embodiment of the present application, the link between the electronic device 100 and the electronic device 200 may also include a Bluetooth link, or may include more links than in the above embodiment, or may include links of a different type than in the above embodiment, and the present application does not limit this.

[0120] The following is a flow chart of a link switching method provided in an embodiment of the present application.

[0121] like Figure 5 As shown, the specific process of the link switching method may include the following steps:

[0122] S501 , the electronic device 100 receives an operation 1 in which a user sends target data to the electronic device 200 .

[0123] Operation 1 is used to trigger the electronic device 100 to send target data to the electronic device 200. In the screen projection scenario, operation 1 may be an operation of the user projecting the screen to the electronic device 200.

[0124] S502 , in response to operation 1 , the electronic device 100 establishes a link 1 with the electronic device 200 , where the link 1 is a physical link between the interface 1 of the electronic device 100 and the interface 2 of the electronic device 200 .

[0125] Step S502 is an optional operation. In some embodiments, if there is a physical link established between the electronic device 100 and the electronic device 200 when the electronic device 100 receives the operation 1, the electronic device 100 uses the physical link as link 1 and executes the following steps.

[0126] It should be noted that, in the embodiment of the present application, the communication connection between the electronic device 100 and the electronic device 200 may include a physical link and a logical link. Among them, the physical link refers to a real link that can be used for communication, such as a local area network link, a Bluetooth link, a P2P link, etc.; the logical link refers to a link established between logical interfaces that does not actually exist. The logical link may correspond to one or more physical links, and the logical link may achieve communication through one of the one or more physical links.

[0127] The physical link may include multiple types, and the type of the physical link in the embodiment of the present application may also be referred to as the link type. The physical link may include: a LAN link, a P2P link, a Bluetooth low energy (BLE) link, etc.

[0128] The link type of link 1 is determined by the type of interface 1. The type of interface 1 is the same as that of interface 2. For example, the types of interface 1 and interface 2 may be WLAN interfaces, Bluetooth interfaces, or other types of interfaces.

[0129] The following is an exemplary introduction to the establishment of link 1.

[0130] In some embodiments, link 1 may be a Bluetooth link, such as the above-mentioned BLE link. The electronic device 100 may establish a Bluetooth low energy (BLE) link, also known as a Bluetooth link, with the electronic device 200. The establishment method of the BLE link may refer to the existing method.

[0131] In some embodiments, link 1 may also be a local area network link.

[0132] If a Wi-Fi connection is established between the electronic device 100 and the AP (for example, the electronic device 300), and the electronic device 200 also establishes a Wi-Fi connection with the AP, then the electronic device 100 and the electronic device 200 can establish a local area network link based on the Wi-Fi connection between the two parties and the AP after determining that both parties have established a Wi-Fi connection with the AP. Among them, the electronic device 100 and the electronic device 200 can send the device capability information of their own devices to each other in the form of broadcast, including the address of the interface in the device, the type of interface, and the established connection, etc. The specific content of the device capability information can refer to the relevant description of the following step S506. The electronic device 100 can determine that the electronic device 200 also has a Wi-Fi connection with the same AP based on the received device capability information of the electronic device 200; the electronic device 200 can determine that the electronic device 100 also has a Wi-Fi connection with the same AP based on the received device capability information of the electronic device 100.

[0133] If there is an AP near the electronic device 100 and the electronic device 200, and at least one of the electronic device 100 and the electronic device 200 has not established a Wi-Fi connection with the AP, the electronic device can first establish a Wi-Fi connection with the AP, and then the electronic device 100 and the electronic device 200 can establish a local area network link based on the Wi-Fi connection between both parties and the AP.

[0134] If there is no AP near the electronic device 100 and the electronic device 200, the electronic device 100 can first establish a Bluetooth link with the electronic device 200, negotiate to determine the AP and STA on the Bluetooth link, and then the electronic device 100 can establish a LAN link with the electronic device 200.

[0135] The process of establishing a Wi-Fi connection between the electronic device 100 (or the electronic device 200) and the AP may refer to the following process of establishing a Wi-Fi connection between a STA and an AP:

[0136] 1. The STA sends an authorization request to the AP to request the AP to grant the STA permission to join the WLAN network where the AP is located.

[0137] 2. The AP authorizes the STA to grant the STA the right to join the WLAN network where the AP is located.

[0138] 3. The STA sends a connection request to the AP to request the AP to establish a communication connection with the STA.

[0139] 4. The AP sends a connection response to the STA to notify the STA that the AP agrees to establish a communication connection with the STA.

[0140] 5. STA and AP start communicating with each other.

[0141] The communication connection between the STA and the AP is established, and the STA and the AP can communicate with each other through the communication connection.

[0142] It is understandable that the embodiments here are only examples. In the embodiments of the present application, the electronic device 100 may also use other methods to establish a local area network link with the electronic device 200, or establish a Bluetooth link or other types of links with the electronic device 200, etc., and the present application does not limit this.

[0143] S503 , the electronic device 100 creates a logical interface 1 .

[0144] Logical interface 1 may correspond to multiple physical interfaces in electronic device 100, including interface 1. In some embodiments, logical interface 1 may correspond to all physical interfaces in electronic device 100. Optionally, in this case, electronic device 100 may also create logical interface 1 before link 1 is established.

[0145] S504 , the electronic device 200 creates a logical interface 2 .

[0146] Logical interface 2 may correspond to multiple physical interfaces of electronic device 200, including interface 2. In some embodiments, logical interface 2 may correspond to all physical interfaces of electronic device 200. Optionally, in this case, electronic device 200 may also create logical interface 2 before link 1 is established.

[0147] S505 , the electronic device 100 and the electronic device 200 determine the address of the logical interface 1 and the address of the logical interface 2 through negotiation through the link 1 .

[0148] After link 1 is established, electronic device 100 and electronic device 200 may determine the address of logical interface 1 and the address of logical interface 2 through negotiation on link 1. The address of the logical interface may be an IP address.

[0149] After determining the address of the logical interface 1 and the address of the logical interface 2 , the electronic device 100 can obtain the address of the logical interface 2 , and the electronic device 200 can obtain the address of the logical interface 1 .

[0150] S506 , the electronic device 100 sends a message 1 to the electronic device 200 , including device capability information of the electronic device 100 .

[0151] The electronic device 100 may send a message 1 to the electronic device 200 via the link 1 .

[0152] Message 1 may carry device capability information of the electronic device 100. The device capability information may include a device identifier, interface information of the device (e.g., the number of physical interfaces in the device, the type and address of each physical interface, etc., and optionally, may also include any one or more of the following: Bluetooth capability of the device, power of the device, energy that can be stored by the device, etc. In some embodiments, message 1 may also include a correspondence between the logical interface 1 and multiple physical interfaces in the electronic device 100, which is used to indicate multiple physical interfaces corresponding to the logical interface 1.

[0153] The type of the physical interface may be used to indicate the type of link that can be established by the physical interface. For example, a WLAN type physical interface may be used to establish a LAN link, a Bluetooth type physical interface may be used to establish a Bluetooth link, etc. It should be noted that since the P2P interface is generally configured temporarily, the message 1 generally does not include the interface information of the P2P type physical interface.

[0154] It should be noted that, in some embodiments, steps S506 to S507 may be performed before link 1 is established, for example, in the discovery phase of electronic device 100 and electronic device 200, the device capability information of the local device is sent to nearby electronic devices in the form of broadcast. In some embodiments, steps S506 to S507 may also be performed after link 1 is established, that is, the device capability information of the local device is sent to the opposite device through link 1.

[0155] S507 , the electronic device 200 sends a message 2 to the electronic device 100 , including device capability information of the electronic device 200 .

[0156] The electronic device 200 may send the message 2 to the electronic device 100 via the link 1. The device capability information of the electronic device 200 may refer to the relevant description of the device capability information of the electronic device 100 in the above step S506.

[0157] The device capability information of electronic device 100 and device capability information of electronic device 200 obtained in step S506 and step S507 can be used to determine one or more physical links that can be established between electronic device 100 and electronic device 200, and the addresses of physical interfaces at both ends of the one or more physical links.

[0158] S508 , the electronic device 100 and the electronic device 200 establish a logical link between the logical interface 1 and the logical interface 2 .

[0159] After the addresses of logical interface 1 and logical interface 2 are determined through negotiation, electronic device 100 and electronic device 200 may establish a communication connection between logical interface 1 and logical interface 2. That is, step S508 may be performed after step S505.

[0160] It should be noted that the communication connection between the logical interface 1 and the logical interface 2 is a logical link, and the logical link may correspond to one or more physical links. When data is transmitted through the logical link, the physical link corresponding to the logical link actually transmits the data. The physical link corresponding to the logical link depends on the physical interface corresponding to the logical interface 1 and the physical interface corresponding to the logical interface 2. In some embodiments, the logical interface 1 corresponds to all physical interfaces in the electronic device 100, and the logical interface 2 corresponds to all physical interfaces in the electronic device 200. At this time, the physical link corresponding to the logical link includes all physical links that can be established between the electronic device 100 and the electronic device 200.

[0161] The one or more physical links corresponding to the logical link may include link 1.

[0162] Since the logical link is a link from logical interface 1 to logical interface 2, the route from logical interface 1 to logical interface 2 can be used to indicate the physical link from electronic device 100 to logical interface 2. Therefore, electronic device 100 can indicate the physical link from electronic device 100 to logical interface 2 by setting the route from logical interface 1 to logical interface 2. For the specific corresponding relationship, refer to the following steps.

[0163] S509 , the electronic device 100 sets the route from logical interface 1 to logical interface 2 as the address of interface 2 .

[0164] The address of interface 2 may be the IP address of interface 2. The address of interface 2 may be acquired in the above step S507, that is, the device capability information of the electronic device 200 may include the address of interface 2.

[0165] In some embodiments, the electronic device 100 can use a static route setting method to set the route from the logical interface 1 to the logical interface 2 to the address of the interface 2. Exemplarily, the electronic device 100 can use the "route" instruction to set the route from the logical interface 1 to the logical interface 2 based on the syntax "ip route target network segment address subnet mask next hop address". Among them, the next hop address is used to indicate the address of the next electronic device, and the target network segment address, also known as the destination address, is used to identify the destination address or destination network of the target data. The subnet mask (subnet mask), also known as the network mask, address mask, and subnet mask, together with the destination address, identifies the address of the network segment where the destination host or router is located. Since the electronic device 100 is to send the target data to the logical interface 2 of the electronic device 200, the next hop is the logical interface 2 of the electronic device 200. By setting the next hop address to the address of the interface 2, the route from the logical interface 1 to the logical interface 2 can be set to the address of the interface 2.

[0166] It can be understood that the above embodiment is only an illustrative example of a method for setting a route from logical interface 1 to logical interface 2. In an embodiment of the present application, a method different from the above embodiment can also be used to set a route from logical interface 1 to logical interface 2, and the present application does not limit this.

[0167] S510 , the electronic device 100 calls the logical interface 1 to send target data to the electronic device 200 through the link 1 .

[0168] The sending end application in the electronic device 100 can set the address of the logical interface 2 as the target address. The sending end application can send the target address and target data to the logical interface 1, and send the target data to the logical interface 2 through the logical interface 1.

[0169] In the case where the route from logical interface 1 to logical interface 2 is set to the address of interface 2, after receiving the target data and the target address, logical interface 1 can determine to send to logical interface 2 based on the target address. Logical interface 1 can determine that the outbound interface of the target data is interface 1 based on the route from logical interface 1 to logical interface 2, send the target data to interface 1, and send the target data to interface 2 through link 1 between interface 1 and interface 2, so as to achieve the purpose of sending the target data from logical interface 1 to logical interface 2. Among them, the outbound interface refers to the physical interface of the electronic device 100 to send the target data to logical interface 2.

[0170] The following describes a method for determining an outgoing interface (a physical interface through which electronic device 100 sends target data to electronic device 200) based on a route from logical interface 1 to logical interface 2.

[0171] In some embodiments, a routing table from logical interface 1 to logical interface 2 may be stored in electronic device 100 , and electronic device 100 may determine an outbound interface based on the routing table and the route from logical interface 1 to logical interface 2 .

[0172] Illustratively, Table 1 shows the content composition of a routing table.

[0173] Table 1

[0174] Destination Address Next hop routing Outbound interface Logical interface 2 address Address of interface 2 Interface 1 Logical interface 2 address Address of interface 4 Interface 3

[0175] As shown in Table 1, the routing table may include a destination address, a next-hop route, and an output interface. Among them, the destination address is the destination address of the target data sent by the sending application in the electronic device 100. The next-hop route is used to indicate the route of the next hop. The output interface is used to indicate the physical interface in the electronic device 100 used to send data to the next hop. In an embodiment of the present application, the destination address of the target data sent by the sending application is the address of logical interface 2; the next hop is the logical interface 2 of the electronic device 200, and the next-hop route is the route from logical interface 1 to logical interface 2; the output interface may include multiple physical interfaces corresponding to logical interface 1. According to Table 1, when the destination address is the address of logical interface 2 and the next-hop route is the address of interface 2, the output interface used to send the target data is interface 1; when the destination address is the address of logical interface 2 and the next-hop route is the address of interface 4, the output interface used to send the target data is interface 3.

[0176] It can be understood that Table 1 is only an example. In the embodiment of the present application, the routing table stored in the electronic device 100 may also include more or fewer interface addresses, or include a correspondence different from the embodiment shown in Table 1, and may also include other contents such as protocols, subnet masks, priorities, etc., which are not limited in the present application.

[0177] Therefore, after the route from logical interface 1 to logical interface 2 is set to the address of interface 2 , electronic device 100 can call logical interface 1 and send target data to electronic device 200 through link 1 .

[0178] S511 , the electronic device 100 detects that a link switching condition is met, and determines to switch the transmission link to link 2 , where link 2 is a physical link between interface 3 of the electronic device 100 and interface 4 of the electronic device 200 .

[0179] The link switching condition may include any one or more of the following: receiving an operation of switching the transmission link by the user (for example, switching the screen projection mode in the screen projection scenario, etc.), the current transmission link (for example, link 1) is interfered, the transmission rate of the current transmission link is less than the preset rate, the power consumption of the current transmission link is greater than the preset power consumption value, the transmission quality of the current transmission link is lower than the preset quality, etc. Among them, the transmission quality of the link can be determined based on the transmission speed and error (for example, bit error rate, etc.) of the link.

[0180] In some embodiments, the link switching condition may also include: the bandwidth of the current transmission link does not match the data volume of the target data. For example, if the data volume of the target data is greater than a preset value, and the bandwidth of the current transmission link (e.g., link 1) is less than the preset bandwidth, the transmission link is switched to a link with a larger bandwidth (e.g., link 2). For another example, if the data volume of the target data is less than a preset value, and the bandwidth of the current transmission link is much greater than the preset bandwidth, the electronic device 100 may switch the transmission link to a link with a slightly smaller bandwidth to avoid wasting resources.

[0181] After detecting that the link switching condition is met, the electronic device 100 may determine to switch the transmission link to link 2. Link 2 is different from link 1.

[0182] In some embodiments, if the physical links corresponding to the logical link only include link 1 and link 2 (for example, only two physical links can be established between the electronic device 100 and the electronic device 200), then after detecting that the link switching condition is met, the electronic device 100 can determine that the transmission link after switching is link 2. If the physical links corresponding to the logical link include more than two physical links, the link switching condition can also include the routing priorities of different physical links or the weights of different physical links. The routing priority or weight can be used to determine the link with the highest priority / highest weight among multiple physical links (except the current transmission link) as the transmission link after switching. Among them, the routing priority of the link or the weight of the link can be determined based on a preset priority or weight, or can be calculated based on the weights of different physical links in different scenarios. The specific method can refer to the relevant description in the following embodiments, which will not be described in detail here.

[0183] S512, the electronic device 100 determines whether link 2 has been established.

[0184] After determining to switch the transmission link to link 2, the electronic device 100 can determine whether link 2 has been established. Exemplarily, the electronic device 100 can send a detection request to the interface 4 through the interface 3, and determine whether the detection response replied by the electronic device 200 is received to determine whether the link 2 is established. If the electronic device 100 receives the detection response sent by the electronic device 200, the electronic device 100 can determine that the link 2 is established; if the electronic device 100 cannot receive the detection response sent by the electronic device 200, the electronic device 100 determines that the link 2 has not been established.

[0185] When it is determined that link 2 has been established, the electronic device 100 may execute the following step S514 and subsequent steps.

[0186] When it is determined that link 2 has not been established, the electronic device 100 may execute the following step S513 and subsequent steps.

[0187] S513, the electronic device 100 and the electronic device 200 establish link 2.

[0188] The link type of link 2 is different from the link type of link 1.

[0189] In some embodiments, link 2 may be a P2P link. The following is an exemplary introduction to a method for establishing a P2P link provided in an embodiment of the present application. The process for establishing a P2P link may include the following steps:

[0190] 1. The electronic device 100 establishes a BLE connection with the electronic device 200.

[0191] This step is optional. In some embodiments, the electronic device 100 and the electronic device 200 may also transmit the connection information of the GC and the GO via the link 1 .

[0192] 2. The electronic device 100 receives the GC connection information sent by the electronic device 200, including the media access control address, status, channel and other information of the electronic device 200.

[0193] The media access control address (MAC) is also called a physical address.

[0194] 3. The electronic device 100 sends the connection information of the GO to the electronic device 200, including the MAC address, status, channel and other information of the electronic device 100.

[0195] 4. The electronic device 100 creates a P2P network.

[0196] 5. The electronic device 100 and the electronic device 200 perform a four-step handshake.

[0197] The four-step handshake can be used to create keys to encrypt data transmitted on the P2P link.

[0198] 6. The electronic device 100 establishes a P2P link with the electronic device 200.

[0199] It is understandable that this is only an exemplary way of establishing a P2P link. In the embodiment of the present application, the P2P link can also be established in other ways, which are not limited in the present application. After the P2P link is established, the electronic device 100 can obtain the address of the P2P interface in the electronic device 200.

[0200] In some embodiments, link 2 may also be other types of links, such as a Bluetooth link, a local area network link, etc. In this case, the method for establishing link 2 may refer to the method for establishing link 1 mentioned above, or may refer to the method for establishing other types of links. This application does not limit this.

[0201] S514 , the electronic device 100 sets the route from logical interface 1 to logical interface 2 as the address of interface 4 .

[0202] After determining that link 2 is established and determining that the switched transmission link is link 2, the electronic device 100 can set the route from logical interface 1 to logical interface 2 to the address of interface 4. The address of interface 4 can be the IP address of interface 4. The address of interface 4 can also be obtained in the above step S507, that is, the device capability information of the electronic device 200 can include the address of interface 4. In other embodiments, if interface 4 is a P2P interface, interface 4 is configured when the P2P link is triggered to be established, and the address of interface 4 can be obtained through the P2P link after the P2P link is established. The way in which the electronic device 100 sets the route from logical interface 1 to logical interface 2 can refer to the relevant description in the above step S509.

[0203] S515 , the electronic device 100 calls the logical interface 1 to send the target data to the electronic device 200 through the link 2 .

[0204] In the case where the route from logical interface 1 to logical interface 2 is set to the address of interface 4, the electronic device 100 can determine that the physical link corresponding to the logical link between logical interface 1 and logical interface 2 is link 2 between interface 3 and interface 4. At this time, the sending end application in the electronic device 100 can set the address of logical interface 2 as the target address, and send the target data to logical interface 2 through logical interface 1. After receiving the target data and the target address, logical interface 1 can determine to send to logical interface 2 based on the target address, and determine the transmission link to be link 2 based on the route from logical interface 1 to logical interface 2, that is, logical interface 1 can send the target data to interface 3, and send the target data to interface 2 through link 2 between interface 3 and interface 4, so as to achieve the purpose of sending the target data to logical interface 2 through logical interface 1.

[0205] The method of determining the outbound interface based on the route from logical interface 1 to logical interface 2 can refer to the relevant description in the above step S510, which will not be repeated here.

[0206] S516 , the electronic device 100 disconnects the link 1 with the electronic device 200 .

[0207] Step S516 is an optional step.

[0208] After the electronic device 100 switches the transmission link to link 2, the electronic device 100 may disconnect link 1. In some embodiments, the electronic device 100 may also disconnect link 1 when it is detected that a dismantling condition is met. The dismantling condition may include any one or more of the following: the electronic device 100 does not detect data transmission through link 1 within a preset time period, the power consumption of link 1 is maintained greater than the preset power consumption, the link type of link 1 belongs to a preset link type, etc.

[0209] It should be noted that, when the transmission link is link 2, the electronic device 100 can also switch the transmission link to link 1 or other links by changing the route from logical interface 1 to logical interface 2 when detecting that the link switching condition is met, and this application does not limit this. The specific switching method can refer to the above-mentioned related steps and will not be repeated here.

[0210] By adopting the link switching method provided in the embodiment of the present application, the transmission link can be switched by changing the route of the logical interface 1 of the electronic device 100 to point to the logical interface 2. The route switching occurs at the IP layer, and the transport layer and above (including the sending application) will not perceive the link switching, which will not affect the application's sending of target data. It can also achieve seamless switching of the link to avoid data freezes and data loss.

[0211] In some embodiments, two or more physical links may be established between the electronic device 100 and the electronic device 200. In this case, in the above step S511, after detecting that the link switching condition is met, the electronic device 100 may determine the transmission link after switching from the multiple physical links. The electronic device 100 may store weights of different types of links, and determine the transmission link as link 2 based on the preset weights. For example, if the weight of the LAN link stored in the electronic device 100 is higher than the weight of the P2P link, the electronic device 100 may determine the LAN link as the transmission link. In some embodiments, the weights of different links may be different in different situations. For example, in a high-traffic transmission scenario, the weight of the LAN link is higher than the Bluetooth link, and in a low-power transmission scenario, the weight of the P2P link is the smallest. The electronic device 100 may determine the link with the highest weight as the transmission link based on the weights of different links in the current situation and in this situation.

[0212] Table 2 shows the weights of different types of links when the amount of target data is different.

[0213] Table 2

[0214]

[0215] As shown in Table 2, the transmission links between the electronic device 100 and the electronic device 200 include a local area network link, a P2P link, and a Bluetooth link. When the data volume of the target data is greater than the preset value, the weight of the local area network link is 7, the weight of the P2P link is 8, and the weight of the Bluetooth link is 2; when the data volume of the target data is less than the preset value, the weight of the local area network link is 5, the weight of the P2P link is 3, and the weight of the Bluetooth link is 9. Considering only the data volume of the target data, if the current transmission link is a Bluetooth link and it is detected that the link switching condition is met, when the data volume of the target data is greater than the preset value, the electronic device 100 can determine that the P2P link with a higher weight is the transmission link after switching.

[0216] It is understandable that Table 2 is only an example. In the embodiment of the present application, when the amount of target data is greater than or less than the preset value, the weights corresponding to different links may also be weights different from those in the above embodiment. In addition, the electronic device 100 may also store more link types and situations than Table 2 (for example, high power transmission, low power transmission, high efficiency transmission, etc.), as well as weights and weights of different types of links in different situations. At this time, the electronic device 100 may calculate the weighted sum of different links and determine that the link with the highest weighted sum is the transmission link after switching, which is not limited in the present application.

[0217] In other embodiments, the logical link between logical interface 1 and logical interface 2 may also correspond to more links, or to links of a type different from that described in the above embodiments. The link may also be determined by the electronic device 100 based on the weights of different types of links. The specific method may refer to the above embodiments.

[0218] The link switching method provided in the embodiment of the present application can be applied to screen projection scenarios.

[0219] During the process of projecting the screen from the electronic device 100 to the electronic device 200, the electronic device 100 can switch the transmission link of the target data (the projected screen data in this scenario) based on the switching of the projected screen mode. FIG. 3A to FIG. 3C As can be seen from the illustrated embodiment, the screen projection mode may include a mirror mode and a stream mode. In the mirror mode, the electronic device 100 may determine that the link for transmitting the target data is a P2P link, and in the stream mode, the link for transmitting the target data may be a LAN link. Figure 5 According to the method shown, the electronic device 100 can switch to the corresponding link according to the change of the screen projection mode.

[0220] Exemplarily, there is a logical link between the logical interface 1 of the electronic device 100 and the logical interface 2 of the electronic device 200, the electronic device 100 is in the streaming mode, and the route from the logical interface 1 to the logical interface 2 is set to the address of the WLAN type interface in the electronic device 200, the electronic device 100 uses the local area network link to transmit the target data to the electronic device 200. When it is detected that the screen projection mode is switched to the mirror mode, the electronic device 100 can trigger the establishment of a P2P link with the electronic device 200. After the P2P link is established, the electronic device 100 can obtain the address of the P2P type interface in the electronic device 200, and set the route from the logical interface 1 to the logical interface 2 to the address of the P2P type interface. In this way, the electronic device 200 can transmit the target data to the electronic device 200 through the P2P link. Similarly, when the electronic device 100 detects that the screen projection mode is switched to the streaming mode again, the electronic device 100 can set the route from the logical interface 1 to the logical interface 2 to the address of the WLAN type interface in the electronic device 200, and transmit the target data through the local area network link. In addition, when the electronic device 100 does not use the P2P link to transmit the target data, the electronic device 100 may disconnect the P2P link with the electronic device 200 to reduce power consumption.

[0221] It is understandable that this is only an example of the above Figure 5 The method shown can be applied to screen projection scenarios. In some screen projection scenarios, the link switching condition may also include other conditions. For details, please refer to Figure 5 The link switching conditions shown are not repeated here.

[0222] The link switching method provided in the embodiment of the present application can also be applied to multi-device collaboration scenarios.

[0223] In a multi-device collaboration scenario, multiple transmission links, such as a local area network link and a P2P link, may also be established between the electronic device 100 and the electronic device 200 .

[0224] In the above multi-device collaboration scenario, the electronic device 100 can project the screen to the electronic device 200, and during the projection process, the electronic device 100 can also send files to the electronic device 200. Exemplarily, when the electronic device 100 projects the screen to the electronic device 200 in mirror mode, the electronic device 100 can send data to the electronic device 200 through the P2P link. At this time, if the electronic device 100 receives the user's operation of sending a file to the electronic device 200, the electronic device 100 can switch the transmission link from the P2P link to the LAN link. The link switching method can refer to the relevant description in the above embodiment.

[0225] It can be understood that the above embodiment is only an example. The link switching method provided in the embodiment of the present application can also be applied to other multi-device collaboration scenarios, and the transmission link can also include other wireless communication links such as Bluetooth links, which is not limited in the present application.

[0226] The link switching method provided in the embodiment of the present application can also be applied to business synchronization scenarios between distributed devices.

[0227] In the service synchronization scenario of distributed devices, multiple links can be established between the electronic device 100 and the electronic device 200, such as a P2P link and a Bluetooth link, etc. The electronic device 100 can achieve service synchronization with the electronic device 200 through the multiple links, for example, sending an installation package to the electronic device 200, performing user configuration on the electronic device 200 through the electronic device 100, etc.

[0228] In the process of transmitting target data from electronic device 100 to electronic device 200, there is a logical link between logical interface 1 of electronic device 100 and logical interface 2 of electronic device 200. Electronic device 100 can implement link switching by changing the route from logical interface 1 to logical interface 2. For specific steps, please refer to the above Figure 5 The electronic device 100 can detect the link switching condition to determine whether to switch the transmission link of the target data (or determine which link to switch to). The link switching condition can refer to the above Figure 5 The embodiment shown.

[0229] Exemplarily, taking the case where the link switching condition includes the data volume of the target data, the electronic device 100 can determine that the transmission link is a P2P link when it detects that the data volume of the target data is greater than a preset value; when it detects that the data volume of the target data is less than a preset value, it can determine that the transmission link is a Bluetooth link, and so on.

[0230] It is understandable that the embodiment here is only an example. In the embodiment of the present application, the link switching condition may also include more or other factors, and the link switching condition may be different in different scenarios. For example, in a low power consumption scenario, the electronic device 100 tends to switch the link to a link with lower power consumption, and so on.

[0231] The link switching method provided in the embodiment of the present application can also be applied to shared Internet access scenarios.

[0232] Internet access sharing can include the following methods: gateway-based Internet access sharing, proxy server-based Internet access sharing, and router-based Internet access sharing, etc. Gateway-based Internet access sharing refers to using a device (such as a computer or other network device, etc.) that is directly connected to an Internet access device (such as a Modem, ISDN, ADSL Modem, etc.) as the gateway of the entire network. Other devices in the network must pass through the gateway to connect to the Internet.

[0233] Sharing Internet access through a proxy server means using a device that is directly connected to the Internet (such as a computer) as a proxy server. Other devices that need to share the Internet access all access the Internet through this proxy server. That is, all Internet access requests sent by other devices in the network must be "transmitted" through the proxy server, which is equivalent to the proxy server itself accessing the Internet.

[0234] Routing shared Internet access refers to providing shared Internet access to multiple user devices through network devices and routing functions. This type of device with routing function usually refers to a broadband router with dial-up function, or it can be other Internet devices with dial-up function. The characteristics and advantages of routing shared Internet access are that each user device can access the Internet freely without setting up a separate "host". User devices can directly dial up to the Internet through Internet devices or routers (or dedicated lines).

[0235] In a shared Internet access scenario, multiple different types of links can be established between the electronic device 100 and the electronic device 200, such as a LAN link, a P2P link, a Bluetooth link, etc., which are not limited in this application. The electronic device 100 can provide Internet access services for the electronic device 200 (and other electronic devices). In a gateway-type shared Internet access mode, the electronic device 100 can be regarded as a gateway; in a proxy server shared Internet access mode, the electronic device 100 can be regarded as a proxy server; in a routing shared Internet access mode, the electronic device 100 can be a network device that provides shared Internet access services for the electronic device 200 (or other electronic devices).

[0236] When the electronic device 100 provides a shared Internet access service for the electronic device 200, the electronic device 100 can receive and respond to an Internet access request sent by the electronic device 200, obtain target data from the server, and send the target data to the electronic device 200. In the process of transmitting target data from the electronic device 100 to the electronic device 200, the electronic device 100 can determine whether to switch the link based on whether the link switching condition is met. The link switching condition can refer to the above Figure 5 Link switching conditions in the illustrated embodiment.

[0237] Exemplarily, taking the example of determining whether to switch the transmission link based on the data volume of the target data, if the transmission link between the electronic device 100 and the electronic device 200 includes a P2P link and a Bluetooth link, and the current transmission link is a Bluetooth link, then the electronic device 100 may determine to switch the transmission link from the Bluetooth link to the P2P link when it detects that the data volume of the target data is greater than a preset value. Afterwards, if the electronic device 100 detects that the data volume of the target data is less than the preset value, the electronic device 100 may again switch the transmission link from the P2P link to the Bluetooth link and disconnect the P2P link. The link switching may be achieved by changing the route of the logical interface in the electronic device 100 to point to the logical interface in the electronic device 200. The specific link switching method may refer to the above. Figure 5 The relevant steps in the illustrated embodiment will not be described in detail here.

[0238] By adopting the link switching method provided in the embodiment of the present application, in a shared Internet access scenario, the electronic device 100 can also determine to adopt different transmission links based on the size of the target data requested by the electronic device 200 (i.e., a high-traffic scenario and a low-traffic scenario), which can not only provide a better experience for users, but also save power consumption.

[0239] It can be understood that the above embodiments are merely illustrative of how the link switching method provided in the present application can be applied to screen projection scenarios, multi-device collaboration scenarios, and shared Internet access scenarios. The link switching methods provided in other embodiments of the present application can also be applied to other multi-link transmission scenarios, and the present application does not limit this.

[0240] Figure 6 A schematic diagram of the hardware structure of the electronic device 100 is shown.

[0241] The electronic device 100 may be a mobile phone, a tablet computer, a desktop computer, a laptop computer, a handheld computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a cellular phone, a personal digital assistant (PDA), an augmented reality (AR) device, a virtual reality (VR) device, an artificial intelligence (AI) device, a wearable device, an in-vehicle device, a smart home device and / or a smart city device. The embodiments of the present application do not impose any special restrictions on the specific type of the electronic device.

[0242] The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, 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, a sensor module 180, a display screen 194, etc. Among them, the sensor module 180 may include a touch sensor 180K. In some embodiments, the sensor module 180 may also include any one or more of the following: a pressure sensor, a gyroscope sensor, an air pressure sensor, a magnetic sensor, an acceleration sensor, a distance sensor, a proximity light sensor, a fingerprint sensor, a temperature sensor, an ambient light sensor, a bone conduction sensor, etc.

[0243] In some embodiments, the electronic device 100 may also include any one or more of the following: a universal serial bus (USB) interface, an audio module, a button, a motor, an indicator, a camera, etc.

[0244] It is to be understood that the structure illustrated in the embodiment of the present invention does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, 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.

[0245] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor, a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, 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.

[0246] The controller can generate operation control signals according to the instruction operation code and timing signal to complete the control of instruction fetching and execution.

[0247] 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.

[0248] 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.

[0249] 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 a USB interface. In some wireless charging embodiments, the charging management module 140 may receive wireless charging input through a wireless charging coil of the electronic device 100. While the charging management module 140 is charging the battery 142, it may also power the electronic device through the power management module 141.

[0250] The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, and provides power to the processor 110, the internal memory 121, the display screen 194, 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.

[0251] 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.

[0252] 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.

[0253] 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, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.

[0254] 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 in the audio module (including but not limited to a speaker, a receiver, 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.

[0255] The wireless communication module 160 can provide wireless communication solutions 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 (NFC), infrared (IR), etc., which are applied to the electronic device 100. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, demodulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.

[0256] 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).

[0257] 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.

[0258] 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), and the display panel can also be made of 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), Miniled, MicroLed, Micro-oLed, quantum dot light emitting diodes (QLED), etc. In some embodiments, the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.

[0259] The internal memory 121 may include one or more random access memories (RAM) and one or more non-volatile memories (NVM).

[0260] Random access memory may include static random-access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM, for example, the fifth generation DDR SDRAM is generally referred to as DDR5 SDRAM), etc.; non-volatile memory may include disk storage devices and flash memory.

[0261] The random access memory can be directly read and written by the processor 110, and can be used to store executable programs (such as machine instructions) of the operating system or other running programs, and can also be used to store user and application data.

[0262] The non-volatile memory may also store executable programs and user and application data, etc., and may be loaded into the random access memory in advance for direct reading and writing by the processor 110 .

[0263] The external memory interface 120 can be used to connect to an external non-volatile memory to expand the storage capacity of the electronic device 100. The external non-volatile memory communicates with the processor 110 through the external memory interface 120 to implement a data storage function. For example, files such as music and videos are stored in the external non-volatile memory.

[0264] The touch sensor 180K is also called a "touch control device". The touch sensor 180K can be set on the display screen 194. The touch sensor 180K and the display screen 194 form a touch screen, also called a "touch control screen". The touch sensor 180K is used to detect touch operations acting on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In other embodiments, the touch sensor 180K can also be set on the surface of the electronic device 100, which is different from the position of the display screen 194.

[0265] In some embodiments, the electronic device 100 may further include a key, which may include a power key, a volume key, etc. The key may be a mechanical key or a touch key. The electronic device 100 may receive a key input and generate a key signal input related to the user settings and function control of the electronic device 100.

[0266] Figure 7 The software architecture of an electronic device 100 provided in an embodiment of the present application is shown.

[0267] like Figure 7 As shown, the electronic device 100 includes, from top to bottom, an application layer, a system communication encapsulation layer (also called a soft bus), a framework layer, a hardware abstraction layer (HAL), and a kernel layer.

[0268] The application layer may include a series of application packages, which may include a sender application, which may be a self-developed application or a third-party application. In the screen projection scenario, the sender application may be a screen projection application. In addition, in the screen projection scenario, the application layer may also include a screen projection protocol. The screen projection protocol may include one or more of the screen projection protocols in mirror modes such as miracast, cast+, and airplay. The screen projection protocol may also include one or more of the screen projection protocols in streaming modes such as DLNA and airplay.

[0269] The soft bus may include a communication protocol. The communication protocol may include a communication protocol such as TCP / UDP. The soft bus may provide an interface to the sending end application so that the sending end application can communicate with other layers. The soft bus may also establish a communication connection with a peer device (e.g., electronic device 200).

[0270] The framework layer may include a system server, which may provide an interface to the sending end application and may also configure information such as the address and routing of the logical interface. In some embodiments, the framework layer may also include one or more other modules, such as a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, etc.

[0271] The hardware abstraction layer may include a network daemon (netdaemon, Netd). The network daemon may set the address and route of the logical interface.

[0272] The kernel layer may contain links (routes), which may be used to indicate the routing of transmission links.

[0273] In some embodiments, the kernel layer may further include any one or more of the following: security, drive, tools, etc. The drive may include any one or more of the following: display drive, camera drive, audio drive, sensor drive, etc.

[0274] The following describes the link switching method provided in conjunction with the embodiment of the present application. Figure 8 The functions of each module in the software architecture shown.

[0275] When a link 1 is established between the interface 1 of the electronic device 100 and the interface 2 of the electronic device 200, and the sending application in the electronic device 100 determines to send the target data to the electronic device 200 through the link 1, the sending application can send a setting instruction to the system service through the soft bus, and the setting instruction can be used to indicate the configuration of the logical interface 1, and the logical interface 1 corresponds to multiple physical interfaces (including interface 1 and interface 3) in the electronic device 100. After receiving the setting instruction, the system service can set the route from the logical interface 1 to the logical interface 2 in the route to the address of the interface 2 through Netd. After setting the route from the logical interface 1 to the logical interface 2, the sending application can send the target data to the interface 1 through the connection with the logical interface 1 (such as a socket), and send it to the electronic device 200 through the link 1.

[0276] When the sending application receives the user's operation to switch the link (or detects that other link switching conditions are met), the sending application can send a switching instruction to the system service through the soft bus, instructing to switch the transmission link from link 1 to link 2, where link 2 is the communication connection between interface 3 of electronic device 100 and interface 4 of electronic device 200. After receiving the switching instruction, the system service can set the route from logical interface 1 to logical interface 2 in route to the address of interface 4 through Netd. After setting the route from logical interface 1 to logical interface 2, the sending application can send the target data to interface 3 through the connection with logical interface 1, and send it to electronic device 200 through link 2.

[0277] It should be noted that, when the electronic device 100 transmits target data to the electronic device 200 via link 2, the electronic device 100 may also receive and respond to the user's operation of switching links, and switch the transmission link to link 1 or other links. During the switching process, the operations performed by each module can refer to the operations of each module in the process of switching from link 1 to link 2, the difference being that the route from logical interface 1 to logical interface 2 is different, which will not be repeated here.

[0278] Understandably, Figure 7 The embodiment shown is only an example. In the embodiment of the present application, the software architecture of the electronic device 100 may also include Figure 7 The illustrated embodiments may have more or fewer modules, and this application does not make any limitation thereto.

[0279] In the embodiment of the present application, the hardware structure of the electronic device 200 and the electronic device 300 can also refer to the above Figure 6 The hardware structure of the electronic device 100 is shown in FIG. The software architecture of the electronic device 200 can also refer to the above Figure 7 The software architecture of the electronic device 100 is shown.

[0280] Figure 8 A schematic flow chart of a link switching method performed by a first electronic device provided in an embodiment of the present application is shown.

[0281] like Figure 8 As shown, the specific process of the first electronic device executing the link switching method may include the following steps:

[0282] S801, the first electronic device calls the first logical interface to send data to the second electronic device through the first link, the first link is a physical link between the first physical interface of the first electronic device and the second physical interface of the second electronic device, a logical link is established between the first logical interface of the first electronic device and the second logical interface of the second electronic device, and the route from the first logical interface to the second logical interface is set to the address of the second physical interface.

[0283] The first electronic device may include a first logical interface, a first physical interface, and a third physical interface. The second electronic device may include a second logical interface, a second physical interface, and a fourth physical interface.

[0284] Before the route from the first logical interface to the second logical interface is set to the address of the second physical interface, the first electronic device establishes a first link between the first physical interface and the second physical interface of the second electronic device. Furthermore, the first electronic device and the second electronic device establish a logical link between the first logical interface and the second logical interface.

[0285] The address of the second physical interface may be obtained through the first link. In other embodiments, the address of the second physical interface may also be obtained based on the device capability information of the second electronic device broadcasted by the second electronic device and received by the first electronic device.

[0286] The first electronic device may be the electronic device 100 in the above embodiment, and the second electronic device may be the electronic device 200 in the above embodiment. The first logical interface may be the logical interface 1 in the above embodiment, or the logical interface conInt0 in the above embodiment. The second logical interface may be the logical interface 2 in the above embodiment, or the logical interface conInt1 in the above embodiment. The first physical interface may be the interface 1 in the above embodiment, the second physical interface may be the interface 2 in the above embodiment, the third physical interface may be the interface 3 in the above embodiment, and the fourth physical interface may be the interface 4 in the above embodiment. The first link may be the link 1 in the above embodiment.

[0287] S802: The first electronic device detects that the first condition is met, and establishes a second link between the third physical interface of the first electronic device and the fourth physical interface of the second electronic device.

[0288] Step S802 is an optional step. The second link is a physical link between the third physical interface and the fourth physical interface. The second link may be link 2 in the above embodiment.

[0289] When it is detected that the first condition is met, the first electronic device determines to switch the link for transmitting data to the second link, and the first electronic device can detect whether the second link is established. If the second link has been established, step S803 and subsequent steps are executed; if the second link has not been established, step S802 is executed to establish the second link.

[0290] S803: The first electronic device detects that the first condition is met, and sets the route from the first logical interface to the second logical interface to the address of the fourth physical interface.

[0291] When it is detected that the first condition is met, the first electronic device determines to switch the transmission link to the second link.

[0292] The first condition may include: receiving an operation of a user switching link; and / or, the first link is interfered with; and / or, when the bandwidth of the first link is less than the bandwidth of the second link, the amount of data is greater than a preset value; and / or, the transmission rate of the first link is less than a preset rate; and / or, the transmission quality of the first link is lower than a preset quality.

[0293] In some embodiments, the first condition may also be the link switching condition in the above embodiments.

[0294] The address of the fourth physical interface can be obtained through the first link or the second link. In other embodiments, the address of the fourth physical interface can also be obtained based on the device capability information of the second electronic device broadcasted by the second electronic device and received by the first electronic device. It should be noted that if the second link is a P2P link, the address of the fourth physical interface is generally obtained through the second link after the second link is established.

[0295] S804: The first electronic device calls the first logical interface to send data to the second electronic device through the second link.

[0296] After changing the route from the first logical interface to the second logical interface, the first electronic device can call the first logical interface to send data to the second electronic device through the second link.

[0297] S805: The first electronic device disconnects the first link with the second electronic device.

[0298] Step S805 is an optional step.

[0299] After switching the transmission link to the second link, the first electronic device may disconnect the first link.

[0300] In some embodiments, if it is detected that the second condition is met, the first electronic device can set the route from the first logical interface to the second logical interface to the address of the second physical interface. The second condition may include: receiving an operation of a user switching link; and / or, the second link is interfered; and / or, when the bandwidth of the second link is less than the bandwidth of the first link, the amount of data is greater than a preset value; and / or, the transmission rate of the second link is less than a preset rate; and / or, the transmission quality of the second link is lower than a preset quality. In some embodiments, the second condition may also be the link switching condition in the above embodiment.

[0301] In some embodiments, the first electronic device may further include a fifth physical interface, the second electronic device may further include a sixth physical interface, and a third link may be established between the fifth physical interface and the sixth physical interface. If the first electronic device detects that the third condition is met, the route from the first logical interface to the second logical interface may be set to the address of the sixth physical interface in the second electronic device.

[0302] If the current transmission link is the first link, the third condition may include: receiving an operation of the user switching the link; and / or, the first link is interfered; and / or, when the bandwidth of the first link is less than the bandwidth of the third link, the amount of data is greater than a preset value; and / or, the transmission rate of the first link is less than the preset rate; and / or, the transmission quality of the first link is lower than the preset quality; and / or, the third link has the highest priority or weight. Among them, the priority of the link can be preset, and the priorities of different types of links in different scenarios can be different. The method for calculating the weight of the link can refer to the relevant content in the above embodiment.

[0303] If the current transmission link is the second link, the third condition may include: receiving a user link switching operation; and / or, the second link is interfered; and / or, when the bandwidth of the second link is less than the bandwidth of the third link, the amount of data is greater than a preset value; and / or, the transmission rate of the second link is less than a preset rate; and / or, the transmission quality of the second link is lower than a preset quality; and / or, the third link has the highest priority or weight. In some embodiments, the third condition may also be the link switching condition in the above embodiment.

[0304] The address of the sixth physical interface may be acquired through the first link, the second link, or the third link, and may also be acquired by receiving the device capability information of the second electronic device broadcast by the second electronic device.

[0305] It should be noted that in the screen projection scenario, the first electronic device can use the first screen projection mode to send data to the second electronic device under the circumstances described in step S801. At this time, the first condition may also include: the first screen projection mode is switched to the second screen projection mode. In some embodiments, the first screen projection mode is a streaming mode, the first link is a LAN link, the second screen projection mode is a mirror mode, and the second link is a P2P link. In other embodiments, the first screen projection mode is a mirror mode, the first link is a P2P link, the second screen projection mode is a streaming mode, and the second link is a LAN link.

[0306] It is understandable that the above-mentioned link switching method can also be applied to scenarios including multiple links such as shared Internet access, service synchronization of distributed devices, and multi-device collaboration, and the present application does not limit this.

[0307] The various implementation modes of the present application can be combined arbitrarily to achieve different technical effects.

[0308] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) mode. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state disk (SSD)), etc.

[0309] Those skilled in the art can understand that to implement all or part of the processes in the above-mentioned embodiments, the processes can be completed by computer programs to instruct related hardware, and the programs can be stored in computer-readable storage media. When the programs are executed, they can include the processes of the above-mentioned method embodiments. The aforementioned storage media include: ROM or random access memory RAM, magnetic disk or optical disk and other media that can store program codes.

[0310] In short, the above description is only an embodiment of the technical solution of the present invention, and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made according to the disclosure of the present invention shall be included in the protection scope of the present invention.

Claims

1. A link switching method, It is characterized in that Applied to a first electronic device, the first electronic device includes a first logical interface, a first physical interface and a third physical interface; the method includes: calling the first logical interface to send data to the second electronic device through a first link, where the first link is a physical link between the first physical interface and the second physical interface of the second electronic device, a logical link is established between the first logical interface and the second logical interface of the second electronic device, and a route from the first logical interface to the second logical interface is set to the address of the second physical interface; Upon detecting that a first condition is met, setting a route from the first logical interface to the second logical interface to an address of a fourth physical interface in the second electronic device; The first logical interface is called to send data to the second electronic device through a second link, where the second link is a physical link between the third physical interface and the fourth physical interface.

2. The method according to claim 1, It is characterized in that Before setting the route from the first logical interface to the second logical interface as the address of the fourth physical interface in the second electronic device, the method further includes: The second link is established between the third physical interface and the fourth physical interface.

3. The method according to claim 1 or 2, It is characterized in that After calling the first logical interface to send data to the second electronic device through the second link, the method further includes: The first link with the second electronic device is disconnected.

4. The method according to any one of claims 1 to 3, It is characterized in that Before calling the first logical interface to send data to the second electronic device through the first link, the method further includes: The first link is established between the first physical interface and the second physical interface.

5. The method according to any one of claims 1 to 4, It is characterized in that The calling the first logical interface to send data to the second electronic device through the first link specifically includes: When the first electronic device projects the screen to the second electronic device in the first projection mode, calling the first logical interface to send data to the second electronic device through the first link; The first condition includes: The first screen projection mode is switched to a second screen projection mode, wherein the first screen projection mode is different from the second screen projection mode.

6. The method according to claim 5, It is characterized in that The first screen projection mode is a streaming mode, the second screen projection mode is a mirroring mode, the first link is a local area network link, and the second link is a point-to-point P2P link.

7. The method according to any one of claims 1 to 4, It is characterized in that The first condition includes: Receiving a link switching operation from a user; and / or, The first link is disturbed; and / or, When the bandwidth of the first link is smaller than the bandwidth of the second link, the amount of the data is greater than a preset value; and / or, The transmission rate of the first link is lower than a preset rate; and / or, The transmission quality of the first link is lower than a preset quality.

8. The method according to any one of claims 1 to 7, It is characterized in that The method further comprises: Upon detecting that a second condition is met, setting a route from the first logical interface to the second logical interface to the address of the second physical interface; The first logical interface is called to send data to the second electronic device through the first link.

9. The method according to claim 8, It is characterized in that The second condition includes: Receiving a link switching operation from a user; and / or, The second link is disturbed; and / or, When the bandwidth of the second link is smaller than the bandwidth of the first link, the amount of the data is greater than a preset value; and / or, The transmission rate of the second link is lower than a preset rate; and / or, The transmission quality of the second link is lower than a preset quality.

10. The method according to any one of claims 1 to 9, It is characterized in that The first electronic device further includes a fifth physical interface; and the method further includes: Upon detecting that a third condition is met, setting a route from the first logical interface to the second logical interface to an address of a sixth physical interface in the second electronic device; The first logical interface is called to send data to the second electronic device through a third link, where the third link is a physical link between the fifth physical interface and the sixth physical interface.

11. The method according to claim 10, It is characterized in that The third condition includes: Receiving a link switching operation from a user; and / or, The first link is disturbed; and / or, When the bandwidth of the first link is smaller than the bandwidth of the third link, the amount of the data is greater than a preset value; and / or, The transmission rate of the first link is lower than a preset rate; and / or, The transmission quality of the first link is lower than a preset quality; and / or, The third link has the highest priority or weight.

12. The method according to any one of claims 1 to 11, It is characterized in that Before setting the route from the first logical interface to the second logical interface as the address of the fourth physical interface in the second electronic device, the method further includes: The address of the fourth physical interface is obtained through the first link or the second link.

13. The method according to any one of claims 1 to 12, It is characterized in that Before the route from the first logical interface to the second logical interface is set to the address of the second physical interface in the second electronic device, the method further includes: The address of the second physical interface is obtained through the first link.

14. A multi-link transmission system, It is characterized in that The device comprises a first electronic device and a second electronic device, wherein the first electronic device comprises a first logical interface, a first physical interface and a third physical interface, and the second electronic device comprises a second logical interface, a second physical interface and a fourth physical interface; The first electronic device is used to call the first logical interface to send data to the second electronic device through a first link, the first link is a physical link between the first physical interface and the second physical interface, a logical link is established between the first logical interface and the second logical interface, and a route from the first logical interface to the second logical interface is the address of the second physical interface; The first electronic device is used to detect whether a first condition is met, and if the first condition is met, the first electronic device is used to set the route from the first logical interface to the second logical interface to the address of the fourth physical interface in the second electronic device; The first electronic device is used to call the first logical interface to send data to the second electronic device through a second link, where the second link is a physical link between the third physical interface and the fourth physical interface; The second electronic device is used to receive data sent by the first electronic device.

15. An electronic device, which is a first electronic device, It is characterized in that include: One or more processors, one or more memories, and one or more physical interfaces; the one or more memories are coupled to the one or more processors, and the one or more memories are used to store computer program codes, wherein the computer program codes include computer instructions, and when the one or more processors execute the computer instructions, the first electronic device executes the method described in any one of claims 1 to 13.

16. A computer-readable storage medium comprising computer instructions, It is characterized in that When the computer instructions are executed on the first electronic device, the first electronic device is caused to execute the method described in any one of claims 1 to 13.