Data transmission method and apparatus

Restoring disconnected services by establishing new physical links between terminal devices, the connection conflict problem is resolved and the user experience is improved.

WO2025138887A1PCT designated stage expired Publication Date: 2025-07-03HONOR DEVICE CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/112188
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-12-27
Filing Date
2024-08-14
Publication Date
2025-07-03

AI Technical Summary

Technical Problem

When connecting to a group, terminal devices may cause connection conflicts, resulting in disconnection of services and poor user experience.

Method used

When the device determines that it is necessary to restore services, it is instructed to establish a physical link with the new master device or directly establish a physical link to restore the disconnected services and reduce connection conflicts.

Benefits of technology

By restoring disconnected services, reduce connection conflicts and improve user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024112188_03072025_PF_FP_ABST
    Figure CN2024112188_03072025_PF_FP_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of terminals, and provides a data transmission method and an apparatus, which can reduce the scenarios of connection conflicts between devices, and improve user experience. The method comprises: when a first device of a first group sends a connection request to a second device of a second group, a first target device determines whether to recover a first service between the first target device and a third device, the first target device being an initiating end of the first service, the first target device being in a disbanded group of the first group and the second group, and the third device and the first target device being in the same group; and when the first target device determines to recover the first service, the first target device sends to the third device information used for instructing to establish a physical link with a second target device, or establishes a physical link with the second target device, the second target device being a master device in a third group, and the third group being obtained by merging the first group and the second group.
Need to check novelty before this filing date? Find Prior Art

Description

Data transmission method and device

[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on December 27, 2023, with application number 202311836155.4 and application name “Data Transmission Method and Device”, the entire contents of which are incorporated by reference into this application. Technical Field

[0002] The present application relates to the field of terminal technology, and in particular to a data transmission method and device. Background Art

[0003] Terminal devices can realize various services between terminal devices through wireless fidelity (WiFi) direct connection technology, such as multi-screen collaboration, keyboard and mouse sharing, etc. between terminal devices through peer-to-peer (P2P) direct connection, WiFi wireless access point (AP) and station (STA) connection and other technologies.

[0004] Multiple terminal devices establishing a WiFi direct connection can be referred to as a group. For example, multiple terminal devices establishing a P2P direct connection can be referred to as a P2P group, and a group formed by multiple terminal devices establishing a WiFi AP-STA connection can be referred to as an AP-STA group. However, when a terminal device connects to a terminal device in a group, connection conflicts may occur, such as disconnecting services between terminal devices in the group, resulting in a poor user experience.

[0005] Summary of the Invention

[0006] The present application provides a data transmission method and apparatus, which can restore services between devices in a disbanded group, thereby improving user experience.

[0007] In a first aspect, a data transmission method is provided, the method comprising: when a first device in a first group sends a connection request to a second device in a second group, the first target device determines whether to restore a first service between the first target device and a third device; wherein the first target device is the initiator of the first service; the first target device is in a disbanded group in the first group and the second group, and the third device is in the same group as the first target device; when the first target device determines to restore the first service, the first target device sends information for indicating establishment of a physical link with the second target device to the third device, or establishes a physical link with the second target device, the second target device is the main device in the third group, and the third group is the group obtained by merging the first group and the second group.

[0008] The data transmission method of the present application, when a first device needs to establish a physical link with a second device in a second group and a connection conflict occurs, can enable the device that needs to restore the service to establish a physical link with a new main device if it is determined that the disconnected service needs to be restored, thereby restoring the disconnected service, reducing connection conflict scenarios, and improving user experience.

[0009] It should be understood that the number of devices included in the first group can be 1, that is, the first group is the first device, and the first device is provided with the ability to be the master device in the group. In this case, the first device can also be referred to as the master device in the first group. The number of devices included in the second group can be multiple. The third group does not necessarily include all devices in the first group and the second group. When the target group is disbanded and before the target group is disbanded, the third group is the group in which the first target device is located in the first group and the second group. Subsequently, after the first device or the second device establishes a physical link with the second target device, the first device or the second device joins the third group. After the third device establishes a physical link with the second target device, the third device joins the third group.

[0010] Among them, the first group can be, for example, the group in which the first terminal device is located below, and the first device can be, for example, the first terminal device below. The second group can be, for example, the P2P group formed after the second terminal device and the third terminal device establish a physical link below. The second device can be, for example, the second terminal device below. The first target device can be, for example, the first terminal device below; the second target device can be, for example, the first terminal device below. The first service can be, for example, the multi-screen collaborative service below. The third group can be, for example, the P2P group formed after the first terminal device and the second terminal device establish a physical link below. The disbanded group in the first group and the second group can be, for example, the P2P group formed by the disbanded second terminal device and the third terminal device below. Alternatively, the first device and the second target device can also be, for example, device 1 below, the second group can be, for example, group 1 below, the second device can be, for example, device 3 below, and the first target device can be, for example, device 3 below. The third device can be, for example, device 2 below.

[0011] When the first group includes multiple devices, the first group may be, for example, Group 2 below, the second group may be, for example, Group 3 below, the first device may be, for example, Device 4 below, the second device may be, for example, Device 6 below, the first target device may be, for example, Device 5 below, the second target device may be, for example, Device 7 below, and the third device may be, for example, Device 6 below. Alternatively, the first group may be, for example, Group 4 below, the second group may be, for example, Group 5 below, the first device may be, for example, Device 8 below, the second device may be, for example, Device 10 below, the first target device may be, for example, Device 11 below, the second target device may be, for example, Device 9 below, and the third device may be, for example, Device 12 below.

[0012] In combination with the first aspect, in certain implementations of the first aspect, the first target device determines that the first service between the first target device and the third device needs to be restored when at least one of the following items is met: the first service belongs to a first preset type of service; the priority of the first service is higher than or equal to the preset priority; after displaying the first interface for determining whether to restore the first service, an operation from the user is received to instruct the restoration of the first service; or, the list to be restored stored in the first target device includes information for indicating the third device, and the information for indicating the third device is bound to the first preset identifier, and the first preset identifier indicates the restoration of the service.

[0013] Among them, the first target device can be, for example, the second terminal device mentioned below, and the third device can be, for example, the third terminal device mentioned below. The first service can be, for example, the multi-screen collaboration service mentioned below. The way in which the first target device determines that the first service between the first target device and the third device needs to be restored is similar to the way in which the second terminal device determines that the multi-screen collaboration between the second terminal device and the third terminal device needs to be restored; the first preset type of service can be understood as the second type of service mentioned below, that is, the service that needs to be restored; the preset level can be understood as the preset priority mentioned below; the list to be restored stored by the first target device can be understood as the list to be restored of the second terminal device mentioned below, the information used to indicate the third device can be understood as the transmission channel information mentioned below, and the first preset identifier can be understood as the first identifier mentioned below.

[0014] It should be understood that the preset priority can be a numerical value, such as 1, 2, 3, etc., or it can be high, medium, low, etc. The representation of the preset priority is the same as the representation of the service priority. This application does not limit the specific form of the service priority and the preset priority.

[0015] In conjunction with the first aspect, in certain implementations of the first aspect, after the first service is disconnected and before the first service is restored, the first target device and / or the third device displays an overlay interface of the first service. This facilitates notifying the user that the first service is disconnected but may be restored later.

[0016] Among them, the first service may be, for example, the multi-screen collaborative service described below, and the mask interface of the first service may be, for example, the interface shown in FIG. 21 described below.

[0017] In conjunction with the first aspect, in certain implementations of the first aspect, the disbanded group among the first and second groups also includes a fourth device, and the second service between the fourth device and the first target device is disconnected. The method further includes: the first target device determining whether to restore the second service; and if the first target device determines not to restore the second service, the first target device sending information to the second target device indicating that the service will not be restored. This facilitates the first target device, the second target device, and the third device to subsequently exit the network restoration state.

[0018] Among them, the fourth device can be, for example, the third terminal device shown in Figure 10, the first target device can be, for example, the second terminal device shown in Figure 10, and the second target device can be, for example, the first terminal device shown in Figure 10. The information for indicating that the service is not to be restored can also be understood as the information sent by the second terminal device shown in Figure 10 to the first terminal device to indicate exit from the dynamic networking recovery state. Alternatively, the fourth device can be understood as the third terminal device below, the first target device can be understood as the second terminal device below, and the second service can be, for example, the multi-screen collaborative service below.

[0019] Optionally, the information for indicating not to resume the service sent by the first target device to the second target device may be sent after the first service is resumed and after it is determined that the second service does not need to be resumed.

[0020] In conjunction with the first aspect, in certain implementations of the first aspect, when the first target device determines that the second service does not need to be restored, the overlay interface of the second service disappears, thereby facilitating determination that the second service will not be restored.

[0021] Among them, the fourth device may be, for example, the third terminal device shown in Figure 10, the first target device may be, for example, the second terminal device shown in Figure 10, and the second target device may be, for example, the first terminal device shown in Figure 10. The mask interface message corresponding to the second business may be, for example, the disappearance of the multi-screen collaborative interface shown in Figure 10. The mask interface corresponding to the second business may be, for example, the interface shown in Figure 21. The mask interface of the second business may be an interface displayed by the first target device and / or the fourth device.

[0022] In conjunction with the first aspect, in certain implementations of the first aspect, the method further includes: after the first service is restored, the first target device sending information indicating exiting the service recovery state to the second target device; and receiving a response from the second target device indicating exiting the service recovery state. This facilitates the first target device and the second target device to exit the network recovery state.

[0023] Among them, the first target device can be, for example, the second terminal device shown in Figure 9, and the second target device can be, for example, the first terminal device shown in Figure 9. The first service recovery process can be, for example, the recovery process of the multi-screen collaborative service shown in Figure 9 below. The information used to indicate the exit from the service recovery state can be, for example, the information sent by the second terminal device shown in Figure 9 to the first terminal device to indicate the exit from the dynamic networking recovery state.

[0024] It should be noted that the first target device can determine whether to resume the first service and the second service simultaneously. If it is determined that the first service needs to be resumed, the first service is resumed, and after resuming the first service, information is sent to the second target device indicating that the service is to be exited from the service resumption state. The implementation of this process can be seen in the processes shown in Figures 9 and 10 below.

[0025] In combination with the first aspect, in some implementations of the first aspect, the master device in the third group is determined by the first device from the master devices in the first group and the master devices in the second group.

[0026] In combination with the first aspect, in certain implementations of the first aspect, the master devices in the third group meet one or more of the following conditions: the master devices in the third group are configured with the capability to serve as the master device in the group; or, the master devices in the third group are devices with the largest media access control MAC addresses; or, the master devices in the third group are devices with the lowest power consumption per unit time; or, the master devices in the third group are plug-in devices.

[0027] The first device may be, for example, the first terminal device described below. Selecting a device capable of acting as a master device in a group as the master device improves the success rate of forming a new group. Selecting a device with the lowest power consumption per unit time and / or a plug-in device reduces the master device's sensitivity to power consumption. Because the master device may consume significant power, this can reduce the likelihood of group disbanding due to insufficient power on the master device. Selecting the device with the largest MAC address allows a wider range of slave devices to connect to the master device.

[0028] In combination with the first aspect, in certain implementations of the first aspect, the first target device determines whether to restore the first service between the first target device and the third device, including: when the first device and the second device have established the third service corresponding to the connection request, the first target device determines whether to restore the first service. In this way, the first service can be restored after the first device and the second device have established the third service corresponding to the connection request. Since the third service is a new service requested by the user, it needs to be established first; then, based on the establishment of the third service, the disconnected first service is restored. The service that was disconnected due to the establishment of the new service can be restored at the same time as the new service is established, which can reduce connection conflict scenarios and improve user experience.

[0029] The first device may be, for example, the first terminal device hereinafter, the second device may be, for example, the second terminal device hereinafter, and the third device may be, for example, the third terminal device hereinafter. The third service may be, for example, the keyboard and mouse sharing service hereinafter, and the first service may be, for example, the multi-screen collaboration service hereinafter.

[0030] In conjunction with the first aspect, in certain implementations of the first aspect, the first target device determines whether to resume the first service, including: when the first device and the second device have established a connection request corresponding to a third service, the first target device receives information from the second target device indicating entry into a first state, where the first state is a state of resuming a disconnected service; and in response to the information from the second target device indicating entry into the first state, the first target device determines whether to resume the first service. In this way, after the third service is established, the second target device can instruct the first target device to begin resuming the third service.

[0031] Among them, the first target device can be, for example, the second terminal device shown in Figure 9; the second target device can be, for example, the first terminal device shown in Figure 9. The third service can be, for example, the keyboard and mouse sharing service described below. The first state can be, for example, the dynamic networking recovery state shown in Figure 9. The information used to indicate entry into the first state can be, for example, the information used to indicate entry into the dynamic networking recovery state shown in Figure 9. The process of the first target device setting the first state and determining whether to restore the first service is similar to the process of the second terminal device shown in Figure 9 entering the dynamic networking recovery state and determining whether to restore the multi-screen collaboration service. Please refer to the description below.

[0032] In combination with the first aspect, in some implementations of the first aspect, data generated by the third service is transmitted using a first transmission channel between the first device and the second device, and the first transmission channel is established based on a physical link between the first device and the second device.

[0033] The first transmission channel can be understood as the transmission channel between the first terminal device and the second terminal device described below. The third service can be understood as the keyboard and mouse sharing service described below. The physical link between the first device and the second device can be understood as the physical link between the first terminal device and the second terminal device described below.

[0034] In combination with the first aspect, in certain implementations of the first aspect, the method also includes: when the third device has established a physical link with the second target device, and the first target device has established a physical link with the second target device, the first target device and the third device establish a second transmission channel, and the second transmission channel is used to transmit data generated by the first service; the first target device and / or the third device displays the interface of the first service.

[0035] The second transmission channel may be understood as the transmission channel between the second terminal device and the third terminal device hereinafter. The first service may be understood as the multi-screen collaboration service hereinafter.

[0036] According to a second aspect, another data transmission method is provided, which includes: a first device in a first group sends a connection request to a second device in a second group; the first device determines a second target device from among the master devices in the first group and the master devices in the second group, the second target device is the master device in a third group, and the third group is a group obtained by merging the first group and the second group; the first device instructs the master device in the target group to disband the target group, the target group is a group that does not include the second target device in the first group and the second group; the first target device in the target group determines whether to restore the first service, the first service is a service between the first target device and the third device in the target group, and the first target device is the initiator of the first service; if so, the first target device sends information to the third device for indicating establishment of a physical link with the second target device, and / or the first target device establishes a physical link with the second target device.

[0037] In combination with the second aspect, in certain implementations of the second aspect, the connection request carries device information of a device in the first group or information indicating that the first device needs to be the master device in the group, and the method also includes: in response to the connection request, the second device sends information indicating a connection conflict to the first device; the first device determines the second target device among the master devices in the first group and the master devices in the second group, including: in response to the information indicating a connection conflict from the second device, the first device determines the second target device.

[0038] In combination with the second aspect, in certain implementations of the second aspect, in response to information from the second device indicating a connection conflict, the first device determines the second target device, including: in response to information from the second device indicating a connection conflict, the first device displays an interface for determining whether to perform network preemption; in response to an input operation indicative of a user performing a network preemption, the first device determines the second target device.

[0039] In combination with the second aspect, in certain implementations of the second aspect, the first device instructs the master device in the target group to disband the target group, including: the first device sends information for instructing the initiation of network preemption to the master device in the target group, and the information for instructing the initiation of network preemption includes information for indicating that the master device of the third group is the second target device; the first device sends information for instructing dynamic networking to the master device in the target group, and the dynamic networking indicates disbanding the target group and joining the third group; in response to the information for instructing dynamic networking from the first device, the master device in the target group disbands the target group.

[0040] In combination with the second aspect, in certain implementations of the second aspect, before the information for indicating dynamic networking, the method also includes: the first device sends information for indicating the initiation of network preemption to the second target device, and the information for indicating the initiation of network preemption also includes: device information of the devices included in the target group and information for indicating the initiator and the initiated end of the connection request.

[0041] In combination with the second aspect, in certain implementations of the second aspect, after the first device sends information for indicating the initiation of network preemption to the second target device, the method also includes: after the second target device receives the information for indicating the initiation of network preemption from the first device, the second target device forwards the information for indicating the initiation of network preemption to a slave device in a non-target group, where the non-target group is a group in the first group and the second group that includes the second target device; in response to the information for indicating the initiation of network preemption, the slave device in the non-target group sends a network preemption response to the second target device; in response to the network preemption response, the second target device sends a network preemption response to the first device; in response to the network preemption response, the first device sends information for indicating dynamic networking to the second target device; in response to the information for indicating dynamic networking, the second target device forwards the information for indicating dynamic networking to the slave devices in the target group.

[0042] In combination with the second aspect, in certain implementations of the second aspect, after the first device sends information for indicating dynamic networking to devices other than the first device in the first group and the second group respectively, the method also includes: the second target device starts a first timer; after the first timer expires, the second target device establishes a physical link with the second device or the first device; the second target device sends information for indicating entering a networking recovery state to the devices in the target group respectively; the first target device in the target group determines whether to restore the first service, including: in response to the information for indicating entering a networking recovery state, the first target device determines whether to restore the first service.

[0043] In combination with the second aspect, in some implementations of the second aspect, the method further includes: in response to the information indicating the establishment of a physical link with the second target device, the third device establishing a physical link with the second target device.

[0044] In combination with the second aspect, in certain implementations of the second aspect, after the third device establishes a physical link with the second target device, the method also includes: the third device sends information to the first target device to indicate that the physical link is successfully established; in response to the information indicating that the physical link is successfully established, the first target device sends information to the third device to indicate the establishment of a second transmission channel, and the second transmission channel is used to transmit data generated by the first service; in response to the information indicating the establishment of the second transmission channel, the third device sends information to the first target device to indicate that the second transmission channel is successfully established.

[0045] In combination with the second aspect, in certain implementations of the second aspect, after the third device sends information to the first target device indicating that the physical link is successfully established, the method also includes: the first target device adds 1 to the reference count, where the reference count represents the number of times the first service references the physical link; and the third device adds 1 to the reference count.

[0046] In a third aspect, a data transmission device is provided for executing the method in any possible implementation of the first aspect or the second aspect. Specifically, the device includes a module for executing the method in any possible implementation of the first aspect or the second aspect.

[0047] In a fourth aspect, embodiments of the present application provide a data transmission device, which may be an electronic device or a chip or chip system within an electronic device. The data transmission device may include a display unit and a processing unit. When the data transmission device is an electronic device, the display unit may be a display screen. The display unit is configured to perform a display step to enable the electronic device to implement a data transmission method described in the first aspect, any possible implementation of the first aspect, the second aspect, or any possible implementation of the second aspect. When the data transmission device is an electronic device, the processing unit may be a processor. The data transmission device may also include a storage unit, which may be a memory. The storage unit is configured to store instructions, and the processing unit executes the instructions stored in the storage unit to enable the electronic device to implement a data transmission method described in the first aspect, any possible implementation of the first aspect, the second aspect, or any possible implementation of the second aspect. When the data transmission device is a chip or chip system within an electronic device, the processing unit may be a processor. The processing unit executes the instructions stored in the storage unit to enable the electronic device to implement a data transmission method described in the first aspect, any possible implementation of the first aspect, the second aspect, or any possible implementation of the second aspect. The storage unit may be a storage unit within the chip (eg, a register, a cache, etc.), or a storage unit within the electronic device that is located outside the chip (eg, a read-only memory, a random access memory, etc.).

[0048] Exemplarily, the display unit is configured to display a mask interface of the first service.

[0049] The processing unit is configured to determine whether to resume the first service.

[0050] In a possible implementation manner, the processing unit is further configured to instruct the third device to establish a physical link with the second target device.

[0051] It should be noted that the device used to perform each step in the first aspect, any possible implementation of the first aspect, the second aspect, or any possible implementation of the second aspect may be a different device. In the first aspect, any possible implementation of the first aspect, the second aspect, or any possible implementation of the second aspect, the step is performed by which device, and for that step or implementation, the corresponding data transmission device may be that device. For example, in the second aspect, if the first device sends a connection request to the second device, the corresponding data transmission device in that step may be the first device; if the first target device determines whether to resume the first service, the corresponding data transmission device in that step may be the first target device. For the sake of brevity, these are not listed one by one.

[0052] In a fifth aspect, an embodiment of the present application provides an electronic device, comprising a processor and a memory, the memory being used to store code instructions, and the processor being used to run the code instructions to execute the method described in the first aspect, any possible implementation of the first aspect, the second aspect, or any possible implementation of the second aspect.

[0053] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium, in which a computer program or instruction is stored. When the computer program or instruction is run on a computer, the computer executes the method described in the first aspect, any possible implementation of the first aspect, the second aspect, or any possible implementation of the second aspect.

[0054] In the seventh aspect, an embodiment of the present application provides a computer program product including a computer program. When the computer program is run on a computer, it enables the computer to execute the method described in the first aspect, any possible implementation of the first aspect, the second aspect, or any possible implementation of the second aspect.

[0055] In an eighth aspect, the present application provides a chip or chip system, comprising at least one processor and a communication interface, wherein the communication interface and the at least one processor are interconnected by a line, and the at least one processor is configured to run a computer program or instruction to execute the method described in the first aspect, any possible implementation of the first aspect, the second aspect, or any possible implementation of the second aspect. The communication interface in the chip may be an input / output interface, a pin, or a circuit, etc.

[0056] In one possible implementation, the chip or chip system described above in this application further includes at least one memory, in which instructions are stored. The memory may be a storage unit within the chip, such as a register, a cache, etc., or a storage unit of the chip (e.g., a read-only memory, a random access memory, etc.).

[0057] It should be understood that the second to eighth aspects of the present application correspond to the technical solutions of the first aspect of the present application, and the beneficial effects achieved by each aspect and the corresponding feasible implementation methods are similar and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0058] FIG1 is a schematic diagram of a physical link and a transmission channel provided in an embodiment of the present application;

[0059] FIG2 is a schematic diagram of a scenario to which the method provided in an embodiment of the present application is applicable;

[0060] FIG3 is a schematic block diagram of the structure of a terminal device provided in an embodiment of the present application;

[0061] FIG4 is a schematic diagram of a software structure of a terminal device provided in an embodiment of the present application;

[0062] FIG5 is a schematic diagram of the software structure of another terminal device provided in an embodiment of the present application;

[0063] FIG6 is a flowchart illustrating a process of device discovery and multi-screen collaborative service establishment in a data transmission method provided in an embodiment of the present application;

[0064] FIG7 is a flow chart of a networking negotiation process in a data transmission method according to an embodiment of the present application;

[0065] FIG8 is a schematic diagram of a flow chart of a dynamic networking process in a data transmission method according to an embodiment of the present application;

[0066] FIG9 is a flow chart of a dynamic networking recovery process 1 and a process of exiting a dynamic networking recovery state in a data transmission method provided in an embodiment of the present application;

[0067] FIG10 is a flow chart of a dynamic networking recovery process 2 and a process of exiting a dynamic networking recovery state in a data transmission method according to an embodiment of the present application;

[0068] FIG11 is a schematic diagram of an interface of a first laptop computer provided in an embodiment of the present application;

[0069] FIG12 is a schematic diagram of the interface of the first mobile phone provided in an embodiment of the present application;

[0070] FIG13 is a schematic diagram of an interface of a second mobile phone provided in an embodiment of the present application;

[0071] FIG14 is a schematic diagram of an interface of a first tablet computer provided in an embodiment of the present application;

[0072] FIG15 is a schematic diagram of an interface of a second tablet computer provided in an embodiment of the present application;

[0073] FIG16 is a schematic diagram of an interface of a third tablet computer provided in an embodiment of the present application;

[0074] FIG17 is a schematic diagram of an interface of a fourth tablet computer provided in an embodiment of the present application;

[0075] FIG18 is a schematic diagram of an interface of a third mobile phone provided in an embodiment of the present application;

[0076] FIG19 is a schematic diagram of an interface of a second laptop computer provided in an embodiment of the present application;

[0077] FIG20 is a schematic diagram of an interface of a third laptop computer provided in an embodiment of the present application;

[0078] FIG21 is a schematic diagram of an interface of a fifth tablet computer provided in an embodiment of the present application;

[0079] FIG22 is a schematic diagram of an interface of a fourth laptop computer provided in an embodiment of the present application;

[0080] FIG23 is a schematic diagram of a flow chart of a second data transmission method provided in an embodiment of the present application;

[0081] FIG24 is a schematic diagram of a flow chart of a third data transmission method provided in an embodiment of the present application;

[0082] FIG25 is a schematic diagram of a flow chart of a fourth data transmission method provided in an embodiment of the present application;

[0083] FIG26 is a schematic diagram of a flow chart of a fifth data transmission method provided in an embodiment of the present application;

[0084] Figure 27 is a schematic block diagram of a data transmission device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0085] The technical solution in this application will be described below with reference to the accompanying drawings.

[0086] In the embodiments of the present application, words such as "first" and "second" are used to distinguish between identical or similar items with substantially the same functions and effects. For example, the first and second numerical values ​​are merely used to distinguish different numerical values ​​and do not limit their order. Those skilled in the art will understand that words such as "first" and "second" do not limit the quantity or execution order, and words such as "first" and "second" do not necessarily mean different.

[0087] It should be noted that in the embodiments of this application, words such as "exemplarily" or "for example" are used to indicate examples, illustrations, or explanations. Any embodiment or design described in this application as "exemplary" or "for example" should not be construed as being preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplarily" or "for example" is intended to present the relevant concepts in a concrete manner.

[0088] In the embodiments of the present application, "at least one" refers to one or more, and "more" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: the existence of A alone, the existence of A and B at the same time, and the existence of B alone, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b, or c can represent: a, b, c, ab, a--c, bc, or abc, where a, b, c can be single or multiple.

[0089] To facilitate a clear description of the technical solutions of the embodiments of the present application, some of the terms and technologies involved in the embodiments of the present application are briefly introduced below:

[0090] 1. Terminal devices may be referred to as terminals, user equipment (UE), mobile stations (MS), mobile terminals (MT), etc. For example, terminal devices may be mobile phones, smart TVs, wearable devices, tablet computers, computers with wireless transceiver functions, virtual reality (VR) terminal devices, augmented reality (AR) terminal devices, wireless terminals in industrial control, wireless terminals in self-driving, wireless terminals in remote medical surgery, wireless terminals in smart grids, wireless terminals in transportation safety, wireless terminals in smart cities, wireless terminals in smart homes, etc. The embodiments of the present application do not limit the specific technologies and specific device forms adopted by the terminal devices.

[0091] 2. Peer-to-peer (P2P) direct connection, also known as wireless fidelity (WiFi) direct connection, is a type of WiFi direct connection technology and an important technology under the "WiFi DIRECT" standard protocol launched by the WiFi Alliance. Through WiFi P2P, two WiFi devices can directly connect and communicate with each other without the intervention of a WiFi hotspot.

[0092] Establishing a P2P direct connection between terminal devices typically requires the following four processes: WiFi P2P device discovery, group formation, WiFi protected setup (WPS), and association connection. Through these four processes, a P2P group is formed between multiple terminal devices that establish a P2P direct connection. A P2P group can also be referred to as a WiFi P2P group. Terminal devices in a P2P group can each play one of two roles: a group owner (GO) or a group client (GC). There can be only one GO, and the GC establishes a P2P connection with each GO.

[0093] 3. WiFi wireless access point (AP) and station (STA) technology, also known as WiFi AP-STA technology, is a type of WiFi direct connection technology. Similar to P2P direct connection, it also enables connection and communication between terminal devices. The terminal devices in an AP-STA group play the role of either AP or STA. In WiFi AP-STA technology, a terminal device acting as an STA can connect to a terminal device acting as an AP, forming an AP-STA group.

[0094] 4. Multi-screen collaboration, also known as multi-screen sharing or multi-screen collaboration, refers to the transmission of digital multimedia content between different terminal devices via wireless network connections. This allows users to synchronize the display content on the remote terminal's screen with their local terminal's, and control the remote terminal's screen from their own terminal.

[0095] 5. Keyboard and mouse sharing, also known as shared keyboard and mouse, keyboard and mouse sharing, or SYNERGY, is a technology that uses a single keyboard and mouse to simultaneously control multiple devices. This keyboard and mouse can be connected to a local device, allowing users to control both the local device and the peer device. For example, when a local device initiates a keyboard and mouse sharing service with a peer device, the local device's mouse can be transferred to the peer device's display interface, controlling the peer device.

[0096] Currently, information exchange and data transmission between terminal devices can be achieved through technologies such as P2P direct connection and WiFi AP-STA. For example, mobile phones and tablets can achieve multi-screen collaboration and keyboard and mouse sharing through P2P direct connection.

[0097] It should be noted that the realization of multi-screen collaboration, keyboard and mouse sharing and other functions between multiple terminal devices requires the transmission channels between multiple terminal devices, and the transmission channels between multiple terminal devices are established based on physical links.

[0098] 6. Physical link, also known as a WiFi physical link or physical channel, can be, for example, a WiFi P2P link, a Bluetooth basic rate (BR) link, a Bluetooth socket link, or a Bluetooth enhanced data rate (EDR) link. Only one physical link can be established between two terminal devices.

[0099] It should be noted that in the embodiment of the present application, the terminal devices establishing a WiFi direct connection can also be considered as establishing a physical link between the terminal devices. For example, when a P2P direct connection is established between the terminal devices, the physical link established between the terminal devices is a WiFi P2P link.

[0100] Therefore, in the embodiments of the present application, the physical link can also be understood as a WiFi direct connection, a P2P connection, a P2P direct connection, or a WiFi AP-STA connection. For example, establishing a physical link between a first terminal device and a second terminal device can also be understood as establishing a P2P direct connection or a WiFi AP-STA connection between the first terminal device and the second terminal device. This application does not specifically limit this.

[0101] In a group formed by multiple terminal devices, a physical link is established between each slave device and the master device. The master device can be, for example, a GO in a P2P group or an AP in an AP-STA group. The slave device can be, for example, a GC in a P2P group or an STA in an AP-STA group. For example, in a P2P group formed by multiple terminal devices, a physical link is established between each GC and the GO; in an AP-STA group formed by multiple terminal devices, a physical link is established between each STA and the AP.

[0102] 7. A transmission channel is a channel for transmitting data based on a physical link. The transmission channel can be used to implement user datagram protocol (UDP) communication and / or transmission control protocol / internet protocol (TCP / IP) communication. Each terminal device can establish multiple transmission channels with multiple other terminal devices, and each transmission channel can be used to transmit a type of business data. The terminal device can establish a transmission channel with the opposite device based on the device IP of the opposite device. For example, the local device can use the device IP of the opposite device to call the protocol stack of the local device to establish a transmission channel with the opposite device, so that the data of the local device can be transmitted to the opposite device through the transmission channel.

[0103] 1 , taking three terminal devices forming a P2P group as an example, the physical link and transmission channel will be further described.

[0104] Figure 1 is a schematic diagram of a physical link and transmission channel provided in an embodiment of the present application. As shown in Figure 1 , a P2P group is formed between terminal devices 110, 120, and 130. Terminal device 110 is the GO in the P2P group, and terminal devices 120 and 130 are the GCs in the P2P group.

[0105] As shown in (a) of FIG1 , the terminal device 120 and the terminal device 130 respectively establish a P2P direct connection with the terminal device 110 , that is, a physical link is established between the terminal device 120 and the terminal device 130 and the terminal device 110 .

[0106] As shown in (b) of Figure 1, in order to enable the multi-screen collaborative service between the terminal device 120 and the terminal device 130, and to enable the keyboard and mouse sharing service between the terminal device 110 and the terminal device 120, based on the above physical link, a transmission channel is established between the terminal device 110 and the terminal device 120 for transmitting the keyboard and mouse sharing service data; a transmission channel is established between the terminal device 120 and the terminal device 130 for transmitting the multi-screen collaborative service data. In the process of transmitting service data between the terminal device 120 and the terminal device 130 through the transmission channel, the service data can be forwarded by the terminal device 110. For example, the terminal device 120 sends service data to the terminal device 130, and the service data can be forwarded to the terminal device 130 via the terminal device 110.

[0107] It should be understood that when multiple terminal devices realize services between terminal devices by establishing WiFi direct connection in addition to P2P direct connection, in the group formed by the multiple terminal devices, the relationship between the physical links and transmission channels between the terminal devices is similar to the relationship shown in Figure 1. Please refer to the description above and will not repeat it here.

[0108] 8. Group dissolution can be defined as the disconnection of the physical link between the master device and each slave device in the group, or the disconnection of the Wi-Fi direct connection between the master device and each slave device in the group. For example, the dissolution of a P2P group can be understood as the disconnection of the P2P direct connection between the GO and each GC in the group.

[0109] In the case where a first terminal device needs to establish a WiFi direct connection with a terminal device in an established first group, if the role of the first terminal device can only be that of a master device, or the first terminal device has established a WiFi direct connection with other terminal devices, a connection conflict will occur, causing the first group to be disbanded, and the services between the terminal devices in the first group to be disconnected; or the first terminal device cannot successfully connect to the terminal device in the first group, resulting in a poor user experience.

[0110] For example, due to hardware and / or protocol limitations, a laptop computer is not fully compatible with the Android system's P2P direct connection, forcing it to only connect to other devices as a GO. When the laptop computer connects to a device in a P2P group, a GO already exists in the same P2P group, resulting in a connection conflict. This prevents the laptop computer from establishing a P2P direct connection with the devices in the group. Alternatively, the laptop computer may establish a P2P direct connection with the devices in the group, but disconnect the P2P direct connections between the devices in the group.

[0111] In order to solve the above-mentioned technical problems, the present application provides a data transmission method. When a first terminal device needs to establish a WiFi direct connection with a second terminal device in an established group b, and the first terminal device can only serve as a master device, or the first terminal device belongs to group a. Then, the first terminal device can determine a new master device in group a and group b, and disband the groups in group a and group b that do not include the new master device. Moreover, after the service between the first terminal device and the second terminal device is established, if the initiator of the disconnected service in the disbanded group determines that the service needs to be restored, the initiator and the receiver of the service in the disbanded group can also be connected to the new master device, thereby enabling the service to be restored.

[0112] As can be seen, based on the new group, the first terminal device and the second terminal device can establish a service. Furthermore, the originator of the disconnected service can restore the service if it determines that the service is needed. This facilitates the simultaneous establishment of the service between the first terminal device and the second terminal device while restoring the service between the terminal devices in the disbanded group. This can reduce scenarios caused by connection conflicts between terminal devices, thereby improving the user experience.

[0113] 2 , the following describes an example of establishing a P2P direct connection between terminal devices to illustrate a scenario in which the method provided in the embodiment of the present application is used.

[0114] Figure 2 is a schematic diagram of a scenario provided by an embodiment of the present application. As shown in Figure 2, the scenarios applicable to the method provided by the embodiment of the present application include but are not limited to the following.

[0115] Scenario 1: Terminal device 201 has already established a P2P direct connection with terminal device 202. Terminal device 201 is in the role of the group leader (GO) and terminal device 202 is in the role of the group leader (GC). Terminal device 203 initiates a P2P direct connection with terminal device 201. Since terminal device 203 can only function as a group leader (GO), a connection conflict occurs when connecting to terminal device 201 as a group leader. Therefore, a new P2P group needs to be established.

[0116] The new GO in the new P2P group can be determined by the initiating terminal device 203. Since terminal device 203 can only serve as a GO, while terminal device 201 can serve as both a GO and a GC, in the new P2P group, terminal device 203 is the new GO, and terminal device 201 is connected to terminal device 203 as a GC. Whether terminal device 202 establishes a P2P direct connection with terminal device 203 can be determined by terminal device 201. If terminal device 201 determines that the service between terminal device 201 and terminal device 202 needs to be restored, terminal device 202 establishes a P2P direct connection with terminal device 203; otherwise, terminal device 202 does not establish a P2P direct connection with terminal device 203.

[0117] In scenario 2, terminal device 204 has established a direct P2P connection with terminal device 205, forming the first P2P group. Terminal device 206 has established a direct P2P connection with terminal device 207, forming the second P2P group. Terminal device 207 initiates a direct P2P connection with terminal device 205. Since the GC can only establish a direct P2P connection with the GO, a connection conflict occurs. Therefore, a new P2P group needs to be established.

[0118] The new GO in the new P2P group can be determined by the initiating terminal device 207 from the GO in the first P2P group and the GO in the second P2P group. Since the GO in the second P2P group, that is, the terminal device 206, can only serve as a GO, and the terminal device 204 can serve as both a GO and a GC. Therefore, in the new P2P group, the terminal device 206 is the new GO. Since the new GO is the GO in the second P2P group, the connection relationship in the second P2P group remains unchanged, that is, the terminal device 207 still establishes a P2P direct connection with the terminal device 206. The first P2P group is dissolved, that is, the P2P direct connection between the terminal device 204 and the terminal device 205 is disconnected. The terminal device 205 is connected to the terminal device 206 as a GC.

[0119] In addition, whether terminal device 204 establishes a P2P direct connection with terminal device 206 may be determined by the initiator of the service that was disconnected between terminal device 204 and terminal device 205. If the initiator determines that the service between terminal device 204 and terminal device 205 needs to be restored, terminal device 204 establishes a P2P direct connection with terminal device 206; otherwise, terminal device 204 does not establish a P2P direct connection with terminal device 206.

[0120] In scenario 3, terminal device 208 has already established direct P2P connections with terminal device 209 and terminal device 210, forming a third P2P group. Terminal device 211 initiates a direct P2P connection with terminal device 208. Since the GO can only establish direct P2P connections with the GC, a connection conflict will occur. Therefore, a new P2P group needs to be established.

[0121] The new GO in the new P2P group can be determined by initiating terminal device 211 from among the GOs and terminal device 211 in the third P2P group. Since terminal device 211 can only serve as a GO, while terminal device 208 can serve as both a GO and a GC, terminal device 211 becomes the new GO in the new P2P group. The third P2P group is disbanded, meaning the P2P direct connection between terminal devices 208 and 209 is disconnected, as is the P2P direct connection between terminal devices 208 and 210. Terminal device 208 then connects to terminal device 211 as a GC.

[0122] In addition, whether terminal device 209 and terminal device 210 establish a P2P direct connection with terminal device 211 can be determined by the initiator of the disconnected service involved in terminal device 209 and terminal device 210. For example, if a disconnected service exists between terminal device 209 and terminal device 210, and the initiator of the service is terminal device 209, terminal device 209 makes the determination; if a disconnected service exists between terminal device 209 and terminal device 208, and terminal device 208 is the initiator of the service, terminal device 208 determines whether terminal device 209 establishes a P2P direct connection with terminal device 211. If it is determined that the disconnected service involved in terminal device 209 needs to be restored, terminal device 209 establishes a P2P direct connection with terminal device 211; if it is determined that the disconnected service involved in terminal device 210 needs to be restored, terminal device 210 establishes a P2P direct connection with terminal device 211; otherwise, terminal device 209 and / or terminal device 210 do not establish a P2P direct connection with terminal device 211.

[0123] In scenario 4, terminal device 212 has established direct P2P connections with terminal device 213 and terminal device 214, forming the fourth P2P group. Terminal device 215 has established a direct P2P connection with terminal device 216, forming the fifth P2P group. Terminal device 215 initiates a direct P2P connection with terminal device 212. Since the GC can only establish direct P2P connections with the GO, a connection conflict will occur. Therefore, a new P2P group needs to be established.

[0124] The new GO in the new P2P group can be determined by the initiating terminal device 215 from the GO in the fourth P2P group and the GO in the fifth P2P group. Since the GO in the fourth P2P group, that is, the terminal device 212, can only serve as the GO, while the terminal device 215 can serve as both the GO and the GC. Therefore, in the new P2P group, the terminal device 212 is the new GO. Since the new GO is the GO in the fourth P2P group, the connection relationship in the fourth P2P group remains unchanged. The fifth P2P group is disbanded, that is, the P2P direct connection between the terminal device 215 and the terminal device 216 is disconnected. The terminal device 215 is connected to the terminal device 212 as the GC.

[0125] In addition, whether terminal device 216 establishes a P2P direct connection with terminal device 212 can be determined by the initiator of the disconnected service between terminal device 216 and terminal device 215. The determination method can be found in the description of the above scenarios 2 and 3 and will not be repeated here.

[0126] In scenario 5, terminal device 217 has established direct P2P connections with terminal devices 218 and 219, forming the sixth P2P group. Terminal device 220 has established direct P2P connections with terminal devices 221 and 222, forming the seventh P2P group. Terminal device 220 initiates a direct P2P connection with terminal device 217. Since the GC can only establish direct P2P connections with the GO, a connection conflict will occur. Therefore, a new P2P group needs to be established.

[0127] The new GO in the new P2P group can be determined by the initiating terminal device 220 from the GO in the sixth P2P group and the GO in the seventh P2P group. Since the GO in the sixth P2P group, that is, the terminal device 217, can only serve as a GO, and the terminal device 220 can serve as both a GO and a GC. Therefore, in the new P2P group, the terminal device 217 is the new GO. Since the new GO is the GO in the sixth P2P group, the connection relationship in the sixth P2P group remains unchanged. The seventh P2P group is disbanded, that is, the P2P direct connection between the terminal device 220 and the terminal device 221 is disconnected, and the P2P direct connection between the terminal device 220 and the terminal device 222 is disconnected. The terminal device 220 is connected to the terminal device 217 as a GC.

[0128] In addition, whether terminal device 221 establishes a P2P direct connection with terminal device 217 can be determined by the initiator of the disconnected service involved in terminal device 221, and whether terminal device 222 establishes a P2P direct connection with terminal device 217 can be determined by the initiator of the disconnected service involved in terminal device 222. The determination method can be found in the description of the above scenarios 2 and 3, and will not be repeated here.

[0129] It should be noted that the scenarios shown in Figure 2 are only examples of several scenarios to which the method provided in the embodiments of the present application is applicable. The method provided in the embodiments of the present application can also be applied to more scenarios. For example, the number of terminal devices included in the sixth P2P group and / or the seventh P2P group in scenario 5 can be more or less, or the number of terminal devices included in the third P2P group in scenario 3 can be more or less, etc. This application does not make specific limitations on this.

[0130] It should also be noted that scenarios involving Wi-Fi direct connections other than P2P direct connections between terminal devices, such as establishing an AP-STA connection, are similar to the scenario of establishing a P2P direct connection between terminal devices shown in FIG2 above. In some possible implementations, when establishing an AP-STA connection between terminal devices, the GO in FIG2 can be replaced by an AP, and the GC can be replaced by an STA. For the sake of brevity, other scenarios involving Wi-Fi direct connections between terminal devices will not be further described here.

[0131] In order to better understand the terminal device in the embodiment of the present application, the hardware structure of the terminal device in the embodiment of the present application is described in detail below with reference to FIG3 .

[0132] Figure 3 is a schematic diagram of the structure of a terminal device 300 provided in an embodiment of the present application. As shown in Figure 3, the terminal device 300 may include a processor 310, an external memory interface 320, an internal memory 321, a universal serial bus (USB) interface 330, a charging management module 340, a power management module 341, a battery 342, an antenna 1, an antenna 2, a mobile communication module 350, a wireless communication module 360, an audio module 370, a sensor module 380, a button 390, an indicator 392, a camera 393, and a display 394.

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

[0134] The processor 310 may include one or more processing units. For example, the processor 310 may include an application processor (AP), 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), a WiFi chip, etc. Optionally, a memory may be provided in the processor 310 for storing instructions and data. The different processing units may be independent devices or integrated into one or more processors.

[0135] In some embodiments, the processor 310 may include one or more interfaces. The interfaces 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.

[0136] Among them, the I2C interface is a bidirectional synchronous serial bus, including a serial data line (SDA) and a serial clock line (SCL); the I2S interface can be used for audio communication; the PCM interface can also be used for audio communication to sample, quantize and encode analog signals; the UART interface is a universal serial data bus for asynchronous communication; the MIPI interface can be used to connect the processor 310 with peripheral devices such as the display 394 and the camera 393; the MIPI interface includes the camera serial interface (CSI), the display serial interface (DSI), etc.; the GPIO interface can be configured by software; the GPIO interface can be configured as a control signal or as a data signal.

[0137] The USB interface 330 is an interface that complies with USB standards and may be a Mini USB interface, a Micro USB interface, a USB Type-C interface, or the like. The USB interface 330 can be used to connect a charger to charge the terminal device 300, transfer data between the terminal device 300 and peripheral devices, and connect headphones to play audio. This interface can also be used to connect other electronic devices, such as AR devices.

[0138] It is understood that the interface connection relationship between the modules illustrated in the embodiment of the present application is merely an illustrative illustration and does not constitute a structural limitation on the terminal device 300. In other embodiments of the present application, the terminal device 300 may also adopt a different interface connection method from the above embodiment, or a combination of multiple interface connection methods.

[0139] The charging management module 340 is configured to receive charging input from a charger. The charger can be either a wireless charger or a wired charger. While charging the battery 342, the charging management module 340 can also power the electronic device through the power management module 341. The power management module 341 is configured to connect the battery 342, the charging management module 340, and the processor 310.

[0140] The wireless communication function of the terminal device 300 can be implemented through antenna 1, antenna 2, mobile communication module 350, wireless communication module 360, modem processor and baseband processor.

[0141] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals.

[0142] The mobile communication module 350 can provide wireless communication solutions including 2G / 3G / 4G / 5G applied on the terminal device 300.

[0143] The modem processor may include a modulator and a demodulator. The modulator is used to modulate the low-frequency baseband signal to be transmitted 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 being processed by the baseband processor, the low-frequency baseband signal is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to a speaker, a receiver, etc.) or displays an image or video through a display screen 394. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 310 and be set in the same device as the mobile communication module 350 or other functional modules.

[0144] The wireless communication module 360 ​​can provide wireless communication solutions applied to the terminal device 300, including wireless local area networks (WLAN) (such as wireless fidelity (WiFi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication technology (NFC), infrared technology (IR), etc.

[0145] The sensor module 380 may include, for example, a pressure sensor, a gyroscope sensor, etc.

[0146] The terminal device 300 implements display functions through a GPU, display screen 394, and an application processor. The GPU is a microprocessor for image processing that connects the display screen 394 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 310 may include one or more GPUs that execute program instructions to generate or modify display information.

[0147] Display screen 394 is used to display images, videos, etc. Display screen 394 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a MiniLED, a MicroLED, a Micro-oLed, or a quantum dot light-emitting diode (QLED). In some embodiments, terminal device 300 may include one or N display screens 394, where N is a positive integer greater than one.

[0148] The terminal device 300 can realize the shooting function through the ISP, camera 393, video codec, GPU, display screen 394 and application processor.

[0149] The ISP is used to process data fed back by the camera 393. For example, when taking a photo, the shutter is opened, light is transmitted through the lens to the camera's photosensitive element, and the light signal is converted into an electrical signal. The camera's photosensitive element transmits the electrical signal to the ISP for processing and converting it into an image visible to the naked eye.

[0150] The camera 393 is used to capture static images or videos. In some embodiments, the terminal device 300 may include 1 or N cameras 393, where N is a positive integer greater than 1.

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

[0152] The internal memory 321 can be used to store computer executable program code, which includes instructions. The internal memory 321 can include a program storage area and a data storage area. The processor 310 executes various functional applications and data processing of the terminal device 300 by running the instructions stored in the internal memory 321 and / or the instructions stored in the memory provided in the processor.

[0153] The terminal device 300 can implement audio functions such as music playback and recording through the audio module 370, speakers, receivers, microphones, headphone jacks, and application processors.

[0154] The buttons 390 include a power button, a volume button, and the like. The buttons 390 may be mechanical buttons or touch buttons. The terminal device 300 may receive key inputs and generate key signal inputs related to user settings and function control of the terminal device 300.

[0155] Indicator 392 can be an indicator light, which can be used to indicate charging status, power changes, messages, missed calls, notifications, etc.

[0156] The software system of the terminal device can adopt a layered architecture, an event-driven architecture, a microkernel architecture, a microservice architecture, or a cloud architecture. Below, with reference to FIG4 and FIG5 , the process of establishing a WiFi direct connection between terminal devices 401 and 402, and the process of establishing a WiFi direct connection between terminal devices 501 and 502 are exemplified, using the layered architecture of the Android system and the Windows system as examples. WiFi direct connections can include, but are not limited to, P2P direct connections or AP-STA connections.

[0157] The hardware structures of terminal devices 401, 402, 501, and 502 can be shown in Figure 3. Terminal devices 401, 501, and 502 are each installed with the Android system; terminal device 402 is installed with the Windows system. To facilitate understanding, the layered architecture of the Android system and the associated terminology are first explained in conjunction with Figure 4.

[0158] As shown in Figure 4, the layered architecture divides the software system of terminal device 401 into several layers, each with clear roles and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into six layers: from top to bottom, the application layer, the application framework layer, the Android runtime layer, the system library layer, the kernel layer, and the hardware layer.

[0159] 1. The application layer includes a series of application packages that users can directly access and is the window for users to interact with terminal devices. For example, the application packages may include WiFi, Bluetooth, PC Manager, etc.

[0160] Among them, PC Manager can include smart interconnection and device discovery modules.

[0161] Smart interconnection can include multiple services such as multi-screen collaboration, keyboard and mouse sharing, and call sharing. In response to the user's selection operation for the service, Smart Interconnection can obtain the corresponding instruction and call the lower-level module to establish or disconnect the WiFi direct connection between the terminal devices, thereby establishing or disconnecting the service between the terminal devices. For example, in response to the user's instruction to establish a multi-screen collaboration with the terminal device 402, the Smart Interconnection of the terminal device 401 can call the lower-level module to establish a WiFi direct connection with the terminal device 402, thereby realizing multi-screen collaboration with the terminal device 402.

[0162] It should be understood that in the embodiments of the present application, the business may refer to the business established between terminal devices through intelligent interconnection, such as multi-screen collaboration, keyboard and mouse sharing, call sharing or global collection, etc. The business may also be called service, device interconnection business, etc. This application does not make specific limitations on this.

[0163] The device discovery module can be used to discover other devices and can indicate the device information of discovered online devices to the smart interconnection, so that the smart interconnection can indicate and display online devices. For example, when terminal device 402 comes online, the device discovery module of terminal device 401 can discover terminal device 402 and indicate the device information of terminal device 402, such as device ID and model, to the smart interconnection of terminal device 401.

[0164] It should be understood that the smart interconnection and device discovery modules can be two modules in the PC manager, or they can be two independent applications that exist in the application layer. This application does not make specific limitations on this.

[0165] 2. The application framework layer provides an application programming interface (API) and programming framework for applications in the application layer. The application framework layer includes some predefined functions. As shown in Figure 4, the application framework layer may include a transmission module, a WiFi connection module, and a security authentication module.

[0166] The transmission module may instruct the WiFi connection module to establish or disconnect the WiFi direct connection between the terminal devices during the process of the terminal device 401 establishing or disconnecting the WiFi direct connection with the terminal device 402. Alternatively, a transmission channel may be established between the terminal devices 402 based on the WiFi direct connection established by the WiFi connection module, and data may be transmitted to the terminal device 402 using the transmission channel.

[0167] The WiFi connection module may include a WiFi direct dynamic networking control module, a WiFi direct module, and a WiFi direct connection counting module.

[0168] The WiFi direct dynamic networking control module can call the WiFi direct connection counting module to add or subtract the number of references to the physical link between the terminal device 402 based on the instruction of the transmission module to establish or disconnect the WiFi direct connection between the terminal devices; or, based on the instruction of the transmission module to establish or disconnect the WiFi direct connection between the terminal devices 402, call the WiFi direct connection module to instruct the WiFi connection service to establish or disconnect the WiFi direct connection between the terminal devices.

[0169] The security authentication module is used to perform security authentication on the terminal device 402 when the WiFi direct dynamic networking control module receives an instruction from the transmission module to establish or disconnect the WiFi direct connection between the terminal devices, and to indicate to the WiFi direct dynamic networking control module the key and / or secret key for signaling interaction with the terminal device 402.

[0170] 3. The Android runtime includes the core library and the virtual machine. The Android runtime is responsible for scheduling and management of the Android system.

[0171] The core library consists of two parts: one is the function that needs to be called by the Java language, and the other is the Android core library.

[0172] The application layer and application framework layer run in a virtual machine. The virtual machine executes Java files in the application layer and application framework layer as binary files. The virtual machine manages object lifecycles, stack management, thread management, security and exception management, and garbage collection.

[0173] 4. The system library can include multiple functional modules, such as function libraries, graphics processing libraries (such as OpenGL ES), and WiFi connection services.

[0174] The function library provides developers with API interfaces for multiple services, making it easy for developers to quickly integrate and implement various functions.

[0175] The graphics processing library is used to implement graphics drawing, image rendering, compositing, and layer processing.

[0176] The WiFi connection service can call interfaces to control the kernel-layer driver. For example, the WiFi connection service can call WiFi manager interfaces. WiFi manager interfaces include discover peers and connect interfaces, which allow users to directly control WiFi direct connections. The WiFi connection service can call the discover peer interface to implement device discovery; calling the connect interface enables the WiFi driver to drive the WiFi chip to establish or disconnect a WiFi direct connection with terminal device 402.

[0177] 5. The kernel layer is a layer between hardware and software. In an exemplary embodiment, the kernel layer includes a WiFi driver, a display driver, etc.

[0178] 6. The Android system may also include a hardware layer not shown in Figure 4. The hardware layer may include a variety of hardware, such as a display screen, a GPU, a WiFi chip, and the like.

[0179] Then, combined with Figure 4, the layered architecture of the Windows system and the terms involved are explained.

[0180] As shown in Figure 4, the layered architecture divides the software system of terminal device 402 into several layers, each with clear roles and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Windows system is divided into user mode and kernel mode.

[0181] The user state includes user application processes, system processes, and service processes, while the kernel state includes the kernel layer.

[0182] 1. User application processes include a series of application packages that users can directly access and serve as a window for users to interact with terminal devices. For example, application packages may include WiFi, Bluetooth, and PC Manager. PC Manager may include smart interconnection and device discovery modules.

[0183] 2. System processes and service processes provide application programming interfaces (APIs) and programming frameworks for user application processes. System processes and service processes include predefined functions. As shown in Figure 4, system processes and service processes may include a transmission module, a Wi-Fi connection module, a security authentication module, and a Wi-Fi connection service.

[0184] 3. The kernel layer is a layer between hardware and software. In an exemplary embodiment, the kernel layer includes a WiFi driver, a display driver, etc.

[0185] It should be understood that the specific functions and terminology of each software module involved in the Windows system are similar to the specific functions of each software module involved in the above-mentioned Android system. Please refer to the above description and will not be repeated here.

[0186] FIG4 is a schematic diagram of a process for establishing a service between a terminal device 401 installed with an Android system and a terminal device 402 installed with a Windows system, provided by an embodiment of the present application. The device discovery module of terminal device 401 can interact with the driver through the application framework layer, allowing the driver to drive the hardware in terminal device 401 to send and receive signals, thereby obtaining device information of terminal device 402; the device discovery module of terminal device 402 can interact with the driver through the system process and service process, allowing the driver to drive the hardware in terminal device 402 to send and receive signals, thereby obtaining device information of terminal device 401. In this way, terminal device 401 and terminal device 402 can each display the other device through smart interconnection.

[0187] Based on the user's selection operation to instruct terminal device 401 to establish a service with terminal device 402, the WiFi connection module of terminal device 401 and the WiFi connection module of terminal device 402 can perform signaling interaction, allowing the slave device in the two devices to obtain the account number and password of the master device. In this way, the WiFi connection module of the slave device can use the account number and password of the master device to call the connection interface of the WiFi module through the WiFi connection service, so that the WiFi driver WiFi chip connects to the master device, thereby establishing a WiFi direct connection between terminal device 401 and terminal device 402, or it can also be said that terminal device 401 and terminal device 402 establish a physical link.

[0188] Furthermore, the transmission modules of terminal device 401 and terminal device 402 can perform signaling interaction, so that terminal device 401 and terminal device 402 can obtain the device IP of the other terminal device, thereby establishing a transmission channel between terminal device 401 and terminal device 402. Terminal device 401 and terminal device 402 can then use this transmission channel to transmit data generated by the service between terminal device 401 and terminal device 402, so that the service between terminal device 401 and terminal device 402 can operate normally.

[0189] FIG5 is a schematic diagram of a process of establishing a service between a terminal device 501 installed with an Android system and a terminal device 502 installed with an Android system, provided in an embodiment of the present application.

[0190] It should be understood that the software structure of terminal device 501 and terminal device 502 is the same as the software structure of terminal device 401, and reference can be made to the above description of the Android system of terminal device 401; the process of establishing business between terminal device 501 and terminal device 502 is similar to the process of establishing business between the above-mentioned terminal device 401 and terminal device 402, and reference can be made to the above description, which will not be repeated here.

[0191] It should be noted that the embodiments of this application are described using the Android system and the Windows system as examples, but its basic principles are also applicable to terminal devices using other operating systems. This application does not limit the operating system used by the terminal device.

[0192] It should also be noted that the embodiments of this application are described using the Android system and the Windows system as examples, but the Android system and the Windows system used by the terminal device may also include more or fewer layers, or include more or fewer software modules. In addition, the names of the software modules shown in Figures 4 and 5 are only examples, and the modules may also use other names. The Android system and the Windows system shown in Figures 4 and 5 do not constitute a limitation on the embodiments of this application.

[0193] The data transmission method of the present application is described in detail below with reference to Figures 6 to 22. The embodiments shown in this application can be executed by terminal devices, such as mobile phones, tablet computers, smart bracelets, etc. The specific forms and quantities of the devices shown therein are only examples and should not constitute any limitation on the implementation of the method provided in this application. Below, taking the first terminal device, the second terminal device and the third terminal device as the execution subjects as an example, the data transmission method of the embodiment of the present application is described in detail from the perspective of device interaction between the three terminal devices.

[0194] It should be understood that the terminal device can be the terminal device itself, or it can be a chip, chip system or processor that supports the terminal device to implement the data transmission method, or it can be a logic module or software that can implement all or part of the terminal device functions. The hardware structure of the terminal device can be as shown in Figure 3, and the software structure can be as shown in Figure 4 or Figure 5. This application does not make specific limitations on this.

[0195] First, taking the scenario shown in the above scenario 1 as an example, the data transmission method 600 of the present application is described in detail in conjunction with Figures 6 to 10. Among them, the first terminal device can be understood as the terminal device 203 in scenario 1, the second terminal device can be understood as the terminal device 201 in scenario 1, and the third terminal device can be understood as the terminal device 202 in scenario 1.

[0196] It should be noted that, for ease of understanding, in method 600, the steps starting with S100 and numbered beginning with S1 are steps executed by the first terminal device or steps triggered by the first terminal device; the steps starting with S200 and numbered beginning with S2 are steps executed by the second terminal device or steps triggered by the second terminal device; the steps starting with S300 and numbered beginning with S3 are steps executed by the third terminal device or steps triggered by the third terminal device.

[0197] Among them, the steps in Figure 6 show the process of device discovery of the first terminal device, the second terminal device and the third terminal device, and the process of establishing multi-screen collaboration between the second terminal device and the third terminal device.

[0198] The steps in Figure 7 illustrate a process of networking negotiation among the first, second, and third terminal devices. The networking negotiation may include a process of the first, second, and third terminal devices negotiating, determining a connection conflict, and determining a new GO in a new P2P group.

[0199] The steps in FIG8 illustrate a process in which the first terminal device, the second terminal device, and the third terminal device enter a dynamic networking state, and the first terminal device and the second terminal device establish a keyboard and mouse sharing service.

[0200] The steps in Figure 9 show the process of the second terminal device and the third terminal device restoring the multi-screen collaborative service between the second terminal device and the third terminal device, and the process of the first terminal device, the second terminal device and the third terminal device exiting the dynamic networking recovery state after the multi-screen collaborative service is restored.

[0201] The steps in Figure 10 show the process in which the second terminal device and the third terminal device do not need to restore the multi-screen collaborative service between the second terminal device and the third terminal device, and the first terminal device, the second terminal device and the third terminal device exit the dynamic networking recovery state.

[0202] In addition, for ease of understanding, Figures 11 to 23 illustrate the interfaces of the terminal devices involved in method 600, taking the first terminal device as a laptop, the second terminal device as a mobile phone, and the third terminal device as a tablet computer as an example. Figures 11 to 23 do not constitute a limitation on the embodiments of the present application.

[0203] As shown in FIG6 , method 600 includes:

[0204] Among them, S100 to S104 are the process of the first terminal device performing device discovery.

[0205] S100: In response to user operation 1, the smart interconnection switch of the first terminal device is switched to the on state.

[0206] The smart interconnection switch can be a button on the system settings interface of the terminal device, or a button on the settings interface of an application such as PC Manager in the terminal device. The state of the smart interconnection switch can control whether the terminal device can perform device discovery, and then establish interconnection with other terminal devices to perform services such as multi-screen collaboration and keyboard and mouse sharing. For example, when the smart interconnection switch of the first terminal device is in the on state, the first terminal device can discover other terminal devices, and the smart interconnection switches of the other terminal devices are also in the on state.

[0207] Operation 1 can be an operation in which a user clicks or slides the smart interconnection switch. In response to Operation 1, the smart interconnection switch can switch its state, for example, from an off state to an on state, or from an on state to an off state. In this embodiment of the present application, Operation 1 is an operation in which the smart interconnection switch of the first terminal device is switched from an off state to an on state.

[0208] S101. The smart interconnection of the first terminal device instructs the device discovery module of the first terminal device to perform device discovery.

[0209] Optionally, the smart interconnection of the first terminal device calls a function to instruct the device discovery module of the first terminal device to perform device discovery, or the smart interconnection of the first terminal device transmits an instruction to the device discovery module of the first terminal device to instruct the device discovery module to perform device discovery.

[0210] S102. In response to the instruction of the smart interconnection of the first terminal device in S101, the device discovery module of the first terminal device performs device discovery and discovers the online device.

[0211] Device discovery, also known as WiFi P2P discovery, involves switching between the listen and search phases. For example, when a first device is in the discovery phase and a second device is in the broadcast phase, the device discovery module in the first device can discover the second device and retrieve the device information contained in the information broadcast by the second device. This device information can include one or more of the following: device model, device ID, device name, logged-in account, or the device's media access control (MAC) address.

[0212] In this way, the device discovery module of the first terminal device can discover the second terminal device and the third terminal device and obtain the device information of the second terminal device and the third terminal device. The online device can be understood as the device discovered by the terminal device. For example, for the first terminal device, the online device includes the second terminal device and the third terminal device.

[0213] S103. The device discovery module of the first terminal device transmits the device information of the online device to the smart interconnection of the first terminal device.

[0214] For example, the device discovery module of the first terminal device may transmit a list of online devices to the first terminal device's smart interconnection. The list includes device information for each online device. For example, the device discovery module of the first terminal device transmits the list of online devices to the first terminal device's smart interconnection, including device information such as the device name and model of the second and third terminal devices.

[0215] Optionally, for the first terminal device, the online device may be a terminal device with the same account as the one logged in by the first terminal device. For example, the online device information transmitted by the device discovery module of the first terminal device to the smart interconnection of the first terminal device may be information of the second terminal device and the third terminal device, the account logged in by the second terminal device is the same as the account logged in by the first terminal device, and the account logged in by the third terminal device is the same as the account logged in by the first terminal device.

[0216] S104. Based on the device information of the online device, the smart interconnection indication of the first terminal device displays the online device.

[0217] Displaying the online device can be understood as displaying the device model or device name of the online device. For example, the online device displayed by the first terminal device can be the device name or device model of the second terminal device, and the device name or device model of the third terminal device.

[0218] For example, the interface of the first terminal device displaying the online device may be as shown in Figure 11. Smart Interconnect is a module in the PC Manager application installed on the laptop. The PC Manager application may also include multiple modules such as multi-screen collaboration and hotspot sharing. For more modules, please refer to the multiple modules shown in Figure 11, which are not listed here one by one.

[0219] As shown in FIG11 , online devices include mobile phones and tablet computers. The device type, device model, and device ball 1101 of the mobile phone are displayed in the My Other Devices area of ​​the laptop display interface; the device type, device model, and device ball 1102 of the tablet computer are also displayed.

[0220] S200 to S204 are the process of the second terminal device performing device discovery:

[0221] S200: In response to the user's operation 2, the smart interconnection switch of the second terminal device is switched to the on state.

[0222] S201. The smart interconnection of the second terminal device instructs the device discovery module of the second terminal device to perform device discovery.

[0223] S202. In response to the smart interconnection instruction of the second terminal device in S201, the device discovery module of the second terminal device performs device discovery and discovers the online device.

[0224] S203. The device discovery module of the second terminal device transmits the device information of the online device to the smart interconnection of the second terminal device.

[0225] S204. Based on the device information of the online device, the smart interconnection indication of the second terminal device displays the online device.

[0226] For example, the interface for displaying online devices on the second terminal device may be as shown in Figure 12. For mobile phones, online devices include laptops and tablets. The interface for displaying online devices in the mobile phone's smart interconnection includes a device ball for each of the currently online devices: device ball 1201 for the mobile phone and information indicating that the mobile phone is the local device within device ball 1201; device ball 1202 for the laptop and information P10 indicating the laptop model within device ball 1202; and device ball 1203 for the tablet and information V70 indicating the tablet model within device ball 1203.

[0227] In addition, the interface also includes information for prompting the user on how to establish a service between the mobile phone and other online devices: click the device ball and select the required service to complete the flow. Assuming that the user clicks the device ball 1203 corresponding to the tablet computer, the interface displayed on the mobile phone is as shown in Figure 13.

[0228] The tablet icon 1301 displays multiple inter-device interconnection services, namely multi-screen collaboration and network sharing. In addition, the interface also includes information for prompting the user how to establish a service between the mobile phone and the tablet: drag and drop the service to other devices to complete the flow.

[0229] S300 to S304 are the process of device discovery by the third terminal device:

[0230] S300: In response to the user's operation 3, the smart interconnection switch of the smart interconnection of the third terminal device is switched to the on state.

[0231] S301. The smart interconnection of the third terminal device instructs the device discovery module of the third terminal device to perform device discovery.

[0232] S302. In response to the smart interconnection instruction of the third terminal device in S301, the device discovery module of the third terminal device performs device discovery and discovers the online device.

[0233] S303. The device discovery module of the third terminal device transmits the device information of the online device to the smart interconnection of the third terminal device.

[0234] S304. Based on the device information of the online device, the smart interconnection indication of the third terminal device displays the online device.

[0235] For example, the interface for displaying online devices on the second terminal device may be as shown in Figure 14. For tablets, online devices include laptops and mobile phones. The interface for displaying online devices in the tablet's smart interconnection includes a device ball for each of the currently online devices: device ball 1401 for the tablet and information indicating that the tablet is the local device within device ball 1401; device ball 1402 for the mobile phone and information H90 indicating the phone's model within device ball 1402; and device ball 1403 for the laptop and information P10 indicating the laptop's model within device ball 1403.

[0236] In addition, the interface also includes information for prompting the user on how to establish a service between the mobile phone and other online devices: click the device ball and select the required service to complete the flow. Assuming that the user clicks the device ball 1402 corresponding to the mobile phone, the interface displayed on the tablet computer is as shown in Figure 15.

[0237] The mobile phone icon 1501 displays multiple inter-device interconnection services, namely multi-screen collaboration and network sharing. In addition, the interface also includes information for prompting the user how to establish a service between the mobile phone and the tablet: drag and drop the service to other devices to complete the flow.

[0238] It should be noted that the implementation of S200 to S204 and S300 to S304 are similar to that of S100 to S104, and reference may be made to the description of S100 to S104, which will not be repeated here.

[0239] S205. In response to the user's operation 4 on the second terminal device, the smart interconnection of the second terminal device obtains a first instruction, where the first instruction is used to instruct the second terminal device to perform multi-screen collaboration with the third terminal device.

[0240] Operation 4 can be an operation in which the user clicks on the device name or device model of the third terminal device displayed on the display screen of the second terminal device, or it can be an operation in which the user drags the device name or device model of the third terminal device displayed on the display screen of the second terminal device into the hot zone. This application does not make specific restrictions on this.

[0241] For example, when the second terminal device is a mobile phone, in conjunction with Figure 13, operation 4 may be an operation in which the user drags the multi-screen collaboration icon 1301 of the tablet computer on the mobile phone display interface to the device ball of the mobile phone. When the second terminal device is a tablet computer, in conjunction with Figure 15, operation 4 may be an operation in which the user drags the multi-screen collaboration icon 1501 of the mobile phone on the tablet computer display interface to the device ball of the tablet computer.

[0242] Based on the user's operation 4, the second terminal device generates a first instruction, and the first instruction can be transmitted to the smart interconnection of the second terminal device.

[0243] S206. In response to the first instruction, the smart interconnection of the second terminal device instructs the transmission module of the second terminal device to establish a transmission channel with the third terminal device, and indicates whether the transmission channel needs to be restored after being subsequently disconnected.

[0244] Optionally, the smart interconnection of the second terminal device transmits information 1 to the transmission module of the second terminal device. Information 1 is used to instruct the establishment of a transmission channel with the third terminal device. Information 1 includes information indicating the third terminal device. The information indicating the third terminal device may be, for example, a device ID, device name, or device model of the third terminal device.

[0245] Optionally, the smart interconnection of the second terminal device further transmits information 2 to the transmission module of the second terminal device, where information 2 is used to indicate whether the transmission channel established between the second terminal device and the third terminal device needs to be restored if it is subsequently disconnected. Exemplarily, information 2 can be a first identifier or a second identifier. When information 2 is the first identifier, for example, true, it indicates that the transmission channel established between the second terminal device and the third terminal device needs to be restored if it is subsequently disconnected; when information 2 is the second identifier, for example, false, it indicates that the transmission channel established between the second terminal device and the third terminal device does not need to be restored if it is subsequently disconnected.

[0246] The smart interconnection of the second terminal device can determine information 2 in the following two ways.

[0247] In a first possible implementation, the smart interconnection of the second terminal device may determine information 2 according to a service type of a service to be established between the second terminal device and the third terminal device.

[0248] Exemplarily, the second terminal device may be pre-installed with first-type services and second-type services. The first-type services are services that do not need to be restored after disconnection, such as call sharing; the second-type services are services that need to be restored after disconnection, such as multi-screen collaboration, keyboard and mouse sharing, etc.

[0249] In the case where the service to be established between the second terminal device and the third terminal device belongs to the first type of service, the transmission channel between the second terminal device and the third terminal device does not need to be restored after being subsequently disconnected, and the smart interconnection of the second terminal device can determine that information 2 is the second identifier; in the case where the service to be established between the second terminal device and the third terminal device belongs to the second type of service, the transmission channel between the second terminal device and the third terminal device needs to be restored after being subsequently disconnected, and the smart interconnection of the second terminal device can determine that information 2 is the first identifier. Since the service to be established between the second terminal device and the third terminal device is a multi-screen collaborative service, it belongs to the second type of service. Therefore, the smart interconnection of the second terminal device can determine that information 2 is the first identifier.

[0250] In a second possible implementation, the smart interconnection of the second terminal device can determine information 2 based on the priority of the multi-screen collaborative service to be established between the second terminal device and the third terminal device.

[0251] For example, the second terminal device may be pre-installed with preset information, including each of the multiple services and their priority. For example, assuming that the priority is represented by a positive integer, with a larger positive integer indicating a higher priority, the preset information may include: multi-screen collaboration with a priority of 2, keyboard and mouse sharing with a priority of 3, call sharing with a priority of 0, and so on. Thus, the smart interconnection of the second terminal device can obtain the preset information by calling a function, etc., and determine the priority of the service to be established between the second terminal device and the third terminal device based on the preset information, and then determine information 2 based on the priority. For example, the smart interconnection of the second terminal device may determine information 2 based on the preset priority and the priority of the service to be established between the second terminal device and the third terminal device. Assuming the preset priority is 2, if the priority of the service to be established between the second terminal device and the third terminal device is greater than or equal to 2, the smart interconnection of the second terminal device may determine information 2 as the first identifier; if the priority of the service to be established between the second terminal device and the third terminal device is less than 2, the smart interconnection of the second terminal device may determine information 2 as the second identifier. Since the service to be established between the second terminal device and the third terminal device is a multi-screen collaboration service, its priority is equal to 2. Therefore, the smart interconnection of the second terminal device can determine that information 2 is the first identifier.

[0252] It should be understood that information 2 and information 1 can be carried in one instruction or different instructions, and this application does not make any specific limitations on this.

[0253] S207. In response to the smart interconnection instruction of the second terminal device in S206, the transmission module of the second terminal device instructs the WiFi connection module of the second terminal device to establish a physical link with the third terminal device.

[0254] It should be understood that establishing a physical link may also be replaced by establishing a P2P connection, establishing a P2P direct connection, or establishing a P2P link, etc. This application does not make specific limitations on this.

[0255] Optionally, the transmission module of the second terminal device can call a function and input information used to indicate the third terminal device, such as the device ID of the third terminal device, to instruct the WiFi connection module of the second terminal device to establish a physical link with the third terminal device.

[0256] S208. In response to the instruction of the transmission module of the second terminal device in S207, the WiFi connection module of the second terminal device determines whether a physical link has been established between the second terminal device and the third terminal device.

[0257] Optionally, the second terminal device may store a first list including device information of terminal devices with which the second terminal device has established a physical link. The first list may be stored in a WiFi connection module of the second terminal device, or the WiFi connection module of the second terminal device may query the first list, for example, by calling a function, to determine whether a physical link has been established with the third terminal device.

[0258] If not, the second terminal device executes S209 to S214.

[0259] If so, the second terminal device executes S212 to S214.

[0260] S209. The WiFi connection module of the second terminal device determines that the role of the second terminal device is GO, and creates a GO role.

[0261] Optionally, the WiFi connection module of the second terminal device may determine the GO in the P2P group to be established between the second terminal device and the third terminal device based on the device type of the second terminal device and the device type of the third terminal device. For example, if the second terminal device and / or the third terminal device can only function as a GO, the second terminal device may determine the terminal device that can only function as a GO as the GO; if the second terminal device and the third terminal device can function as either a GO or a GC, the second terminal device may determine the terminal device on its own end as the GO because the terminal device on its own end is the initiator of the P2P direct connection.

[0262] In this way, a physical link can be established normally between the second terminal device and the third terminal device; and, when the second terminal device determines that the role of the third terminal device can be GC, the second terminal device can determine that the role of the second terminal device is GO, so that the second terminal device can determine whether the transmission channel between the second terminal device and the third terminal device needs to be restored after being disconnected based on the above information 2.

[0263] Optionally, the WiFi connection module of the second terminal device can call a function or a first interface to create a GO role. The first interface can be a WiFi standard interface or an Android P2P module GO creation interface.

[0264] It should be noted that, in the embodiment of the present application, taking the role of the second terminal device as GO as an example, the process of realizing multi-screen collaboration between the second terminal device and the third terminal device is explained.

[0265] In some embodiments, the role of the second terminal device can also be GC, then the second terminal device indicates to the third terminal device that the role of the second terminal device is GC; correspondingly, the third terminal device subsequently indicates the account and password of the third terminal device to the second terminal device; the second terminal device connects to the third terminal device through the account and password of the third terminal device. The process of achieving multi-screen collaboration between the second terminal device and the third terminal device when the role of the second terminal device is GC is similar to the process of achieving multi-screen collaboration between the second terminal device and the third terminal device when the role of the second terminal device is GO. Please refer to the description below and will not be repeated here.

[0266] S210: After the GO is created, the WiFi connection module of the second terminal device sends Request 1 to the WiFi connection module of the third terminal device. Request 1 is used to request the establishment of a physical link. Request 1 may include the account number of the second terminal device, the password of the second terminal device, and the role information of the second terminal device. Since the WiFi connection module of the second terminal device determined that the role of the second terminal device is GO in S209, the role information of the second terminal device is used to indicate that the role of the second terminal device is GO.

[0267] It should be understood that the account number and password of the second terminal device are the account number and password used to establish a P2P direct connection between the third terminal device and the second terminal device. For the sake of brevity, the account number and password will not be explained in the following text.

[0268] Optionally, request 1 is further used to instruct the WiFi direct connection module of the third terminal device to increase the reference count of the physical link between the second terminal device and the third terminal device by 1.

[0269] The reference count can be understood as the number of times a service between terminal devices references the physical link established by the terminal devices. For example, since a multi-screen collaboration service needs to be established between the second terminal device and the third terminal device, the implementation of the multi-screen collaboration service needs to be based on the physical link between the second terminal device and the third terminal device. Therefore, the reference count of the physical link between the second terminal device and the third terminal device is increased by 1. For the sake of brevity, the reference count will not be explained in the following text.

[0270] Optionally, the WiFi connection module of the second terminal device may call a function to obtain information indicating whether a physical link has been established between the second terminal device and the third terminal device. For example, the WiFi connection module of the second terminal device may call a function to check whether the list of established physical links of the second terminal device includes information indicating the third terminal device; if so, it indicates that a physical link has been established between the second terminal device and the third terminal device; otherwise, it indicates that a physical link has not been established between the second terminal device and the third terminal device.

[0271] S305. In response to request 1, the WiFi connection module of the third terminal device connects to the second terminal device using the second terminal device's account and password, i.e., establishes a physical link with the second terminal device. The reference count of the physical link between the second and third terminal devices is incremented by 1.

[0272] Optionally, the WiFi connection module of the third terminal device can call a function to connect to the second terminal device using the account number and password of the second terminal device.

[0273] S306: The WiFi connection module of the third terminal device sends a physical link establishment response to the WiFi connection module of the second terminal device. The physical link establishment response is used to indicate that the physical link is successfully established.

[0274] Optionally, the physical link establishment response carries the device IP of the third terminal device. The device IP of the third terminal device can be used by the second terminal device to send data of the multi-screen collaboration service to the third terminal device.

[0275] S211 . In response to the physical link establishment response, the WiFi connection module of the second terminal device increases the reference count of the physical link between the second terminal device and the third terminal device by 1.

[0276] S212. In response to the physical link establishment response, the WiFi connection module of the second terminal device indicates to the transmission module of the second terminal device that the data link is successfully established, and indicates the device IP of the third terminal device.

[0277] Optionally, the WiFi connection module of the second terminal device transmits information 3 to the transmission module of the second terminal device, where information 3 is used to indicate that the data link is successfully established and indicates the device IP of the third terminal device.

[0278] Optionally, when a physical link is successfully established between the second terminal device and the third terminal device, the second terminal device sends a second list of the P2P group to online devices outside the P2P group established by the second terminal device and the third terminal device, where the second list includes the device ID and role of each terminal device in the P2P group. Since the online device outside the P2P group established by the second terminal device and the third terminal device is the first terminal device, the second terminal device sends the second list to the first terminal device.

[0279] In this way, online devices outside the P2P group established by the second terminal device and the third terminal device can obtain the P2P direct connection status between the second terminal device and the third terminal device, the role of the second terminal device, and the role of the third terminal device. When online devices outside the P2P group established by the second terminal device and the third terminal device need to establish a P2P direct connection with the terminal devices in the group, the role of each terminal device in the new P2P group to be established can be determined based on the role and information of each terminal device in the P2P group.

[0280] Optionally, when the roles of the terminal devices in the P2P group established by the second terminal device and the third terminal device change or the connection relationship changes, the second terminal device may instruct the first terminal device to update the second list.

[0281] S213. The transmission module of the second terminal device sends information indicating the establishment of a transmission channel to the transmission module of the third terminal device. The information indicating the establishment of the transmission channel includes the device IP of the second terminal device. The device IP of the second terminal device can be used by the third terminal device to send data for the multi-screen collaboration service to the second terminal device.

[0282] The information for indicating the establishment of a transmission channel may also be understood as a handshake packet, etc., and this application does not make any specific limitation on this.

[0283] S307: In response to the information indicating the establishment of the transmission channel, the transmission module of the third terminal device sends a transmission channel establishment response to the transmission module of the second terminal device. The transmission channel establishment response indicates that the transmission channel is agreed to be established or that the transmission channel is successfully established.

[0284] S308. The transmission module of the third terminal device indicates to the smart interconnection of the third terminal device that the transmission channel is successfully established.

[0285] S309. In response to the instruction of the transmission module of the third terminal device in S308, the smart interconnection instruction of the third terminal device displays the multi-screen collaboration interface.

[0286] In response to the transmission channel establishment response in S307, the transmission module of the second terminal device indicates that the smart interconnection transmission channel of the second terminal device is successfully established. In this way, a multi-screen collaborative service is established between the smart interconnection between the second terminal device and the third terminal device, and data transmission can be achieved.

[0287] Optionally, the terminal device used for control in the second terminal device and the third terminal device for establishing a multi-screen collaborative service displays a multi-screen collaborative interface, and the other terminal device does not display the multi-screen collaborative interface. The terminal device used for control may include the corresponding area of ​​another terminal device in the multi-screen collaborative interface displayed. For example, the second terminal device is a mobile phone, and the third terminal device is a tablet computer. The user can control the mobile phone on the display screen of the tablet computer, and the tablet computer can display the interface as shown in Figure 16. The tablet computer and the mobile phone displayed in the display interface of the tablet computer are both in a state of using the multi-screen collaborative service. And the area 1601 corresponding to the tablet computer and the area 1602 corresponding to the mobile phone respectively display the device ball of the currently online device. The area 1601 corresponding to the tablet computer displays a multi-screen collaborative icon 1603 near the device ball of the local device, indicating that the tablet computer is using the multi-screen collaborative service. The area 1602 corresponding to the mobile phone displays a multi-screen collaborative icon 1604 near the device ball of the tablet computer, indicating that the mobile phone and the tablet computer are using the multi-screen collaborative service.

[0288] Alternatively, based on the interface displayed on the tablet computer in FIG16 , if the user clicks first return button 1605 in area 1601 corresponding to the tablet computer, area 1601 corresponding to the tablet computer may display the tablet computer's home interface; and if the user clicks second return button 1606 in area 1602 corresponding to the mobile phone, area 1602 corresponding to the mobile phone may display the mobile phone's home interface. For example, assuming that the user clicks first return button 1605 and second return button 1606 based on the screen displayed on the tablet computer in FIG16 , the interface displayed on the tablet computer may be as shown in FIG17 .

[0289] Optionally, the terminal device used for control in the second terminal device and the third terminal device for establishing a multi-screen collaborative service displays a multi-screen collaborative interface, and the other terminal device may also display an interface for the ongoing multi-screen collaborative service. Exemplarily, the interface of the third terminal device (tablet computer) may be as shown in Figure 16 or Figure 17. The interface displayed by the second terminal device (mobile phone) may be as shown in Figure 18. The interface displayed by the mobile phone includes a device ball 1801 for the mobile phone, a device ball 1802 for the laptop computer, and a device ball 1803 for the tablet computer. The device ball 1803 of the tablet computer is surrounded by a multi-screen collaborative logo 1804, indicating that the tablet computer and the mobile phone are performing a multi-screen collaborative service.

[0290] It should be understood that step (S309) in Figure 6 shows the situation where the third terminal device displays the multi-screen collaborative interface. In some embodiments, the second terminal device can display the multi-screen collaborative interface, and the third terminal device does not display the multi-screen collaborative interface; or, the second terminal device and the third terminal device both display the multi-screen collaborative interface. This application does not make specific limitations on this. In addition, the implementation method of the second terminal device displaying the multi-screen collaborative interface is similar to the implementation method of the third terminal device displaying the multi-screen collaborative interface. Please refer to the description above and will not be repeated here.

[0291] Furthermore, the smart interconnection of the second terminal device and the smart interconnection of the third terminal device can respectively instruct the local transmission module to use the transmission channel between the second terminal device and the third terminal device to transmit the data stream of the multi-screen collaborative service.

[0292] It should be noted that the process of the first terminal device going online and performing device discovery can also be after the second terminal device and the third terminal device realize the multi-screen collaborative service, or the second terminal device and the third terminal device establish the multi-screen collaborative service through S205 to S309. Based on this, unlike the above process, the second terminal device and the third terminal device may not be able to discover the first terminal device during the device discovery stage, but discover the first terminal device after the first terminal device goes online. In addition, the first terminal device obtains the device information of the second terminal device and the third terminal device after going online. The process of discovering and displaying online devices can refer to S102 to S104 and will not be repeated here.

[0293] On the basis of the above embodiment, as shown in FIG7 , if the first terminal device needs to establish a physical link and a transmission channel with the second terminal device in response to the user's operation 5, thereby realizing the keyboard and mouse sharing service between the second terminal device and the first terminal device, the first terminal device, the second terminal device and the third terminal device can determine a new GO in the new P2P group through the steps shown in FIG7 below, so as to subsequently establish a physical link between the first terminal device and the second terminal device.

[0294] As shown in FIG7 , the method 600 further includes the following steps.

[0295] S105. In response to the user's operation 5 on the first terminal device, the smart interconnection of the first terminal device obtains a second instruction, where the second instruction is used to instruct the smart interconnection of the first terminal device to share the keyboard and mouse with the second terminal device.

[0296] Operation 5 may be an operation in which the user clicks on the icon of the second terminal device or drags the icon of the second terminal device into the hot zone on the smart interconnection interface of the first terminal device.

[0297] For example, as shown in FIG19 , the interface may be the interface that the laptop switches to after the user clicks on the area corresponding to the keyboard and mouse sharing in FIG11 . The display interface of the laptop includes a device ball 1903 for a tablet computer and a device ball 1904 for a mobile phone. It also includes information for prompting the user on how to implement the keyboard and mouse sharing service between the laptop and other devices: drag the device icon to the area on both sides of the computer to establish a connection. Among them, the device icon may be the device ball 1903 for a tablet computer or the device ball 1904 for a mobile phone, and the areas on both sides of the computer may refer to area 1901 and area 1902. Operation 5 may be the operation of the user dragging the device ball 1904 to area 1902 or area 1901.

[0298] S106. In response to the second instruction, the smart interconnection of the first terminal device instructs the transmission module of the first terminal device to establish a transmission channel with the second terminal device.

[0299] S107. The transmission module of the first terminal device instructs the WiFi connection module of the first terminal device to establish a physical link with the second terminal device.

[0300] S108. The WiFi connection module of the first terminal device determines that no physical link is established between the first terminal device and the second terminal device.

[0301] It should be understood that the implementation of S105 to S108 is similar to the implementation of S205 to S208, and reference may be made to the above description, which will not be repeated here.

[0302] S109: The WiFi connection module of the first terminal device determines that the first terminal device is provided with a capability of performing GO in the P2P group.

[0303] Optionally, the WiFi connection module of the first terminal device can determine that the first terminal device needs to act as a GO in the P2P group based on the computer type of the first terminal device and / or the hardware configuration of the first terminal device. For example, the WiFi connection module can query the first preset device type through function calls and the like. When the device type of the first terminal device belongs to the first preset device type, it is determined that the first terminal device needs to act as a GO in the P2P group; and / or, the WiFi connection module can query the second preset device type through function calls and the like, and when the device type of the first terminal device belongs to the second preset device type, it is determined that the first terminal device can act as a GO or GC in the P2P group. The first preset device type may include device types of terminal devices that can only act as GOs, such as desktop computers, laptops, all-in-one computers, etc.; the second preset device type may include device types of terminal devices that can act as GOs or GCs, such as mobile phones, tablet computers, etc.

[0304] Optionally, the hardware configuration of the first terminal device may be, for example, a chip model, etc. When the chip model of the first terminal device belongs to a preset chip model, the first terminal device needs to act as a GO in the P2P group; when the chip model of the first terminal device does not belong to the preset chip model, the role of the first terminal device may be a GO or a GC.

[0305] It should be understood that in S109 , the WiFi connection module of the first terminal device determines that the role of the first terminal device may be the role expected by the first terminal device, and at this time the role of the first terminal device has not yet been created.

[0306] S110: The WiFi connection module of the first terminal device sends Request 2 to the WiFi connection module of the second terminal device, requesting the establishment of a physical link. Request 2 carries information indicating that the first terminal device needs to serve as a GO in the P2P group. Request 2 requests the establishment of a physical link with the second terminal device and also indicates to the second terminal device that the first terminal device's role is a GO.

[0307] It should be noted that Request 2 is different from Request 1. Request 1 is a request from the second terminal device to request the third terminal device to establish a physical link. Request 1 carries the second terminal device's account number and password. Request 2 is a request for negotiation with the second terminal device, confirming with the second terminal device whether the first terminal device can establish a physical link with the second terminal device when the first terminal device is acting as the GO. Therefore, Request 2 does not carry the first terminal device's account number and password, but rather carries the first terminal device's role information.

[0308] S215. In response to request 2, the WiFi connection module of the second terminal device determines that a physical link has been established between the second terminal device and the third terminal device, and the role of the second terminal device is GO.

[0309] Through S215, since the second terminal device determines that the role to be created by the first terminal device is GO, and the second terminal device is GO in the P2P group formed by the second terminal device and the third terminal device, the WiFi connection module of the second terminal device can determine that there is a conflict between the role of the first terminal device and the role of the second terminal device. The second terminal device can determine that the first terminal device cannot join the P2P group formed by the second terminal device and the third terminal device as a GO, that is, the first terminal device cannot establish a physical link with the second terminal device, that is, the first terminal device cannot directly establish a P2P direct connection with the second terminal device. Based on this, the second terminal device executes S216.

[0310] S216. The WiFi connection module of the second terminal device sends information indicating that the physical link cannot be established to the WiFi connection module of the first terminal device.

[0311] According to the information indicating that the physical link cannot be established, the WiFi connection module of the first terminal device can determine that a physical link cannot be directly established between the first terminal device and the second terminal device.

[0312] Optionally, the information indicating that the physical link cannot be established further carries a second list, where the second list includes the ID and role of each terminal device in the P2P group established between the second terminal device and the third terminal device.

[0313] In this way, it is convenient for the first terminal device to determine the role of each terminal device in the P2P group. When the first terminal device needs to establish a P2P direct connection with the terminal devices in the group later, it can determine the role of each terminal device in the new P2P group to be established based on the role and information of each terminal device in the P2P group.

[0314] It should be noted that the corresponding signaling interactions in the steps shown in Figure 6 can be implemented via a WiFi link or a Bluetooth link. Because the WiFi link or the Bluetooth link may be unstable, the second terminal device may fail to send the second list to the first terminal device in S212. Therefore, in S216, the second terminal device may send the second list to the first terminal device again.

[0315] S111. The WiFi connection module of the first terminal device instructs the transmission module of the first terminal device that the first terminal device cannot establish a physical link with the second terminal device.

[0316] S112. The transmission module of the first terminal device indicates that the first terminal device and the second terminal device cannot establish a physical link.

[0317] S113. In response to an indication that a physical link cannot be established between the first terminal device and the second terminal device, the smart interconnection of the first terminal device displays a pop-up message 1. The pop-up message 1 is used to indicate to the user that the peer P2P group is occupied and whether to initiate a preemption. Preemption can be understood as disbanding the existing P2P group and establishing a new group including the first terminal device and the second terminal device.

[0318] Optionally, the pop-up message may further include a button for confirming the initiation of preemption and a button for canceling the initiation of preemption.

[0319] Exemplarily, as shown in Figure 20, the interface may be the interface to which the laptop switches after the user drags the device ball 1904 to area 1902 or area 1901 in the interface shown in Figure 19. Pop-up message 1 may be shown as pop-up message 2001 in Figure 20. Pop-up message 1 prompts the user: Continuing to use "keyboard and mouse sharing" will interrupt and reload the service in use, do you want to continue? This service can also be understood as a service between terminal devices. That is, continuing to use "keyboard and mouse sharing" will interrupt the multi-screen collaborative service between the mobile phone and the tablet computer.

[0320] As shown in Figure 20, the pop-up message 1 also includes a button for confirming the initiation of preemption, namely the "Continue" button; and a button for canceling the initiation of preemption, namely the "Cancel" button. Based on the user's selection of the "Continue" button, the laptop can initiate preemption; based on the user's selection of the "Cancel" button, the laptop can cancel the preemption.

[0321] It should be understood that pop-up message 1 is a message used to ask the user whether to continue the keyboard and mouse sharing service initiated between the first terminal device and the second terminal device. The content shown in the pop-up message of Figure 20 is only an example and does not constitute a limitation on the embodiments of the present application.

[0322] S114. The smart interconnection of the first terminal device obtains a third instruction, and the third instruction is used to instruct dynamic networking preemption with the second terminal device.

[0323] The third instruction may be generated based on user operation 6. Operation 6 is the user's input operation indicating the initiation of preemption based on pop-up message 1. For example, pop-up message 1 may include a first button and a second button, with the first button used to confirm the initiation of preemption and the second button used to cancel the initiation of preemption. Operation 6 may be the user clicking the first button in pop-up message 1. For example, in conjunction with Figure 20, operation 6 may be the user clicking the "Continue" button.

[0324] Optionally, the third instruction carries information for indicating the second terminal device, and the information for indicating the second terminal device may be, for example, a device ID of the second terminal device.

[0325] The smart interconnection of the first terminal device can obtain the device ID of the second terminal device based on the user's operation 5. For example, the user's operation 5 is the operation of the user clicking on the second terminal device on the smart interconnection interface of the first terminal device. The smart interconnection of the first terminal device can convert the "second terminal device" clicked by the user into the device ID of the second terminal device.

[0326] S115. In response to the third instruction, the smart interconnection of the first terminal device instructs the transmission module of the first terminal device to initiate dynamic networking preemption.

[0327] It should be understood that dynamic networking preemption can be understood as a process in which the first terminal device instructs the second terminal device to disconnect the physical link between the second terminal device and the third terminal device and establish a physical link with the first terminal device.

[0328] Optionally, the smart interconnection of the first terminal device further indicates information used to indicate the second terminal device to the transmission module of the first terminal device. The information used to indicate the second terminal device may be, for example, a device ID of the second terminal device.

[0329] S116. In response to the instruction of the smart interconnection of the first terminal device in S115, the transmission module of the first terminal device instructs the WiFi connection module of the first terminal device to initiate dynamic networking preemption.

[0330] Optionally, the transmission module of the first terminal device further indicates information used to indicate the second terminal device to the WiFi connection module of the first terminal device. The information used to indicate the second terminal device may be, for example, a device ID of the second terminal device.

[0331] S117: The WiFi connection module determines a new GO from the current online devices, which are the first terminal device, the second terminal device, and the third terminal device.

[0332] Optionally, the WiFi connection module of the first terminal device may determine a new GO from among the terminal devices included in the second list and the first terminal device based on the second list. The new GO may be a device that can only function as a GO. For example, because the WiFi connection module of the first terminal device may determine that the first terminal device can only function as a GO, the WiFi connection module of the first terminal device determines that the new GO is the first terminal device.

[0333] S118. The WiFi connection module of the first terminal device sets the account and password of the first terminal device and creates a GO.

[0334] After S118, the first terminal device triggers execution of S119 to S51. Furthermore, the first terminal device executes S52. After determining that the GO has been successfully created, the WiFi connection module of the first terminal device obtains the device IP address of the first terminal device and initiates monitoring of the Transmission Control Protocol (TCP) port. S52 and S44 to S51 can be executed in parallel, or before or after S44 to S51. This is not specifically limited in this application.

[0335] Optionally, the WiFi connection module of the first terminal device also selects a channel for the physical link. The physical link channel can also be understood as a P2P channel, which can refer to a WiFi frequency. In this way, when the WiFi connection module of the first terminal device establishes a physical link with the WiFi connection module of the second terminal device, it does not need to traverse all P2P channels. Instead, the physical link is established based on the P2P channel, which can improve the efficiency of physical link establishment.

[0336] S119: The WiFi connection module of the first terminal device sends Request 3 to the WiFi connection module of the second terminal device. Request 3 is used to initiate dynamic network preemption. Request 3 can also be understood as a request from the first terminal device to instruct the second terminal device to disconnect the physical link between the second terminal device and the third terminal device.

[0337] Optionally, Request 3 carries information indicating a new GO and information indicating a destination device, such as the device ID of the new GO and the device ID of the destination device. The new GO is the first terminal device, and the destination device is the device to which the second terminal device is to connect, i.e., the second terminal device.

[0338] It should be noted that Request 3 is different from Request 2 (or Request 1). Request 2 (or Request 1) is used to request the peer terminal device to initiate the normal physical link establishment process; Request 3 is used to request the second terminal device to disconnect the current physical link, that is, disconnect the physical link with the third terminal device in order to subsequently establish a physical link between the new GO indicated in Request 3 and the destination device.

[0339] Optionally, the command ID of request 3 is different from that of request 2 (or request 1). The command ID is used to indicate the function or type of signaling, etc. Through the command ID, the terminal device receiving the information can determine the function or type of different signaling. For example, when the second terminal device makes request 1, it can determine, based on the command ID of request 1, that request 1 is used to request initiation of a physical link establishment process between the second terminal device and the third terminal device; when the second terminal device receives request 3, it can determine, based on the command ID of request 3, that request 3 is used to request initiation of dynamic networking preemption.

[0340] S120. After the GO is successfully created, the WiFi connection module of the first terminal device obtains the device IP of the first terminal device and initiates TCP port monitoring.

[0341] S217. In response to request 3, the WiFi connection module of the second terminal device determines that the role of the second terminal device is GO.

[0342] S218. The WiFi connection module of the second terminal device forwards request 3 to the WiFi connection module of the third terminal device.

[0343] It should be understood that if the WiFi connection module of the second terminal device determines that the second terminal device's role is GO, the WiFi connection module of the second terminal device will forward Request 3 to all GCs connected to the second terminal device. Therefore, the WiFi connection module of the second terminal device forwards Request 3 to the WiFi connection module of the third terminal device. In this way, all GCs connected to the second terminal device can determine that the first terminal device currently needs to establish a physical link with the second terminal device and that the third terminal device needs to disconnect the physical link with the second terminal device.

[0344] S310. The WiFi connection module of the third terminal device determines that the role of the third terminal device is GC.

[0345] It should be understood that the judgment logic of S217 and S310 can be the same. That is, after receiving Request 3, the terminal device determines whether its role in the current P2P group is a GO or a GC. If the terminal device's role is a GO, the terminal device forwards Request 3 to all GCs in the P2P group to which the terminal device belongs. If the terminal device's role is a GC, the terminal device sends Response 1 to the GO in the P2P group to which the terminal device belongs.

[0346] S311. The WiFi connection module of the third terminal device sends a response 1 to the WiFi connection module of the second terminal device.

[0347] It should be understood that response 1 is a response message to request 3, for example, it can be confirmation information (Acknowledgement, ACK) and the like.

[0348] S219: The WiFi connection module of the second terminal device determines that it has received responses 1 from all GCs in the current P2P group, wherein all GCs are GCs that have established P2P direct connections with the second terminal device.

[0349] S220. Based on the judgment result of S219, the WiFi connection module of the second terminal device sends a response 1 to the WiFi connection module of the first terminal device, indicating that all devices in the P2P group where the second terminal device is located have confirmed to perform dynamic networking preemption.

[0350] Optionally, if the WiFi connection module of the second terminal device determines that the responses 1 of all GCs in the current P2P group have not been received, it continues to wait until the responses 1 of all GCs are received.

[0351] S121. The WiFi connection module of the first terminal device sends information indicating entering a dynamic networking state to the WiFi connection module of the second terminal device.

[0352] S220 - 1 . The WiFi connection module of the second terminal device forwards information indicating entering a dynamic networking state to the WiFi connection module of the third terminal device.

[0353] Optionally, the information indicating the entry into the dynamic networking state may also carry the TCP IP and port of the first terminal device. The TCP IP and port of the first terminal device may be obtained by monitoring the TCP port in S120.

[0354] It should be understood that TCP IP and ports can be used to implement TCP IP communication between terminal devices. The TCP IP and port of a first terminal device can implement TCP IP communication between the first terminal device and a second terminal device, and / or implement TCP IP communication between the first terminal device and a third terminal device. The second terminal device and / or the third terminal device can call an interface of the TCP protocol stack to establish a TCP communication transmission channel with the first terminal device via the TCP IP and port of the first terminal device, thereby implementing TCP communication based on the TCP communication transmission channel.

[0355] The dynamic networking status can be understood as the status when the physical link and transmission channel are established between terminal devices.

[0356] Optionally, based on the information indicating the entry into the dynamic networking state, the WiFi connection module of the second terminal device saves the TCP IP and port of the new GO, that is, the TCP IP and port of the first terminal device.

[0357] Optionally, based on the information indicating the entry into the dynamic networking state, the WiFi connection module of the third terminal device saves the TCP IP and port of the new GO, that is, the TCP IP and port of the first terminal device.

[0358] On the basis of the above embodiment, the first terminal device and the second terminal device may establish a physical link and a transmission channel, so that the first terminal device and the second terminal device can share a keyboard and a mouse.

[0359] As shown in FIG8 , the method 600 may further include the following steps.

[0360] It should be noted that, after executing S121, the first terminal device starts executing S123; after receiving the information in S121, the second terminal device starts executing S221; and after receiving the information in S220-1, the third terminal device starts executing S312.

[0361] S123. The WiFi connection module of the first terminal device calls a function to set the first terminal device to a dynamic networking state.

[0362] S124. The WiFi connection module of the first terminal device instructs the transmission module of the first terminal device to enter a dynamic networking state.

[0363] Through S123 and S124, the WiFi connection module and transmission module of the first terminal device can enter the dynamic networking state. When the first terminal device receives a request from another terminal device to establish a physical link, it does not respond to the request from the other terminal device to establish a physical link. This helps improve the efficiency and success rate of establishing new P2P groups.

[0364] S221. The WiFi connection module of the second terminal device calls a function to set the second terminal device to a dynamic networking state.

[0365] S222. The WiFi connection module of the second terminal device instructs the transmission module of the second terminal device to enter a dynamic networking state.

[0366] S312: The WiFi connection module of the third terminal device calls a function to set the third terminal device to a dynamic networking state.

[0367] S313: The WiFi connection module of the third terminal device instructs the transmission module of the third terminal device to enter a dynamic networking state.

[0368] It should be understood that the implementation of setting the WiFi connection module of the second terminal device and the third terminal device to enter the dynamic networking state and instructing the transmission module to enter the dynamic networking state is similar to S123 and S124. Please refer to the above description and will not be repeated here.

[0369] After entering the dynamic networking state, the WiFi connection modules of the first terminal device, the second terminal device and the third terminal device respectively execute the following judgment logic: whether the local device belongs to the new P2P group; if so, further determine the role of the local device in the new P2P group.

[0370] The new P2P group is a P2P group that needs to be established based on the user's operation 5, that is, a P2P group including the first terminal device and the second terminal device.

[0371] S125. The WiFi connection module of the first terminal device determines that the first terminal device is a GO in the new P2P group.

[0372] Optionally, the second terminal device and the third terminal device may respectively determine the terminal devices included in the new P2P group through the above-mentioned request 3 (S119 and S218). That is, the above-mentioned request 3 may carry a third list of the new P2P group, and the third list includes information for indicating the new GO and information for indicating the destination device.

[0373] S223: The WiFi connection module of the second terminal device determines that the second terminal device does not belong to the new P2P group.

[0374] S224: The WiFi connection module of the second terminal device disconnects the physical link. The physical link may refer to all physical links currently established by the second terminal device, such as the physical link between the second terminal device and the third terminal device.

[0375] Optionally, the WiFi connection module of the second terminal device may call an interface for disconnecting the physical link to disconnect the physical link.

[0376] S225: The WiFi connection module of the second terminal device indicates to the transmission module of the second terminal device that the physical link is disconnected, and indicates the reason for the physical link disconnection. The reason for the physical link disconnection is that the second terminal device and the third terminal device enter a dynamic networking state.

[0377] S314: The WiFi connection module of the third terminal device determines that the third terminal device does not belong to the new P2P group.

[0378] S315: The WiFi connection module of the third terminal device disconnects the physical link. The physical link may refer to all physical links currently established by the third terminal device, such as the physical link between the second terminal device and the third terminal device.

[0379] Optionally, the WiFi connection module of the third terminal device may call an interface for disconnecting the physical link to disconnect the physical link.

[0380] S316: The WiFi connection module of the third terminal device indicates to the transmission module of the third terminal device that the physical link is disconnected, and indicates the reason for the physical link disconnection. The reason for the physical link disconnection is that the second terminal device and the third terminal device enter a dynamic networking state.

[0381] S317. The transmission module of the third terminal device instructs the smart interconnection of the third terminal device to disconnect the multi-screen collaboration between the third terminal device and the second terminal device.

[0382] S318. The smart interconnection indication display interface of the third terminal device displays a mask.

[0383] Among them, the display interface display mask can be understood as the interface displayed by the terminal device when multi-screen collaboration is disconnected and waiting to be restored.

[0384] For example, as shown in Figure 21, the interface displayed by the laptop includes an area 2101 corresponding to the laptop and an area 2102 corresponding to the mobile phone. The device balls for the laptop, the laptop, and the mobile phone are displayed in area 2101 corresponding to the laptop. A multi-screen collaboration icon 2103 is displayed near the device ball of the mobile phone, indicating that the multi-screen collaboration between the tablet and the mobile phone is disconnected. Optionally, the user can click the first return button 2104 to return to the main interface of the tablet.

[0385] The area 2102 corresponding to the mobile phone displays information that the multi-screen collaboration has been disconnected. There is also a prompt message for prompting the user to keep the Bluetooth and WLAN switches of the mobile phone and tablet computer on during the multi-screen collaboration, and to keep the mobile phone and tablet computer within the effective connection distance. The area 2102 corresponding to the mobile phone also includes a button for restoring multi-screen collaboration, that is, a button corresponding to "Reconnect", and a button for canceling the restoration of multi-screen collaboration, that is, a button corresponding to "Cancel". By the user clicking the button corresponding to "Reconnect", the mobile phone can initiate the restoration of the multi-screen collaboration service between the mobile phone and the tablet computer. By the user clicking the button corresponding to "Cancel", the mobile phone can cancel the restoration of the multi-screen collaboration service between the mobile phone and the tablet computer.

[0386] S226. The transmission module of the second terminal device instructs the smart interconnection of the second terminal device to disconnect the multi-screen collaboration between the second terminal device and the third terminal device.

[0387] Based on S226 and S317, the multi-screen collaborative service between the second terminal device and the third terminal device is disconnected.

[0388] S319: The transmission module of the third terminal device saves the transmission channel information between the second terminal device and the third terminal device. For the third terminal device, the transmission channel information between the second terminal device and the third terminal device may be, for example, information indicating the second terminal device. Using the information indicating the second terminal device, the third terminal device can determine that the transmission channel with the second terminal device is disconnected and may need to restore the transmission channel later.

[0389] Optionally, the transmission module of the third terminal device may store information indicating the second terminal device in a to-be-restored list of the third terminal device. The to-be-restored list is a list of transmission channels to be restored. The third terminal device can determine the existence of a to-be-restored transmission channel between the second terminal device and the third terminal device based on the information indicating the second terminal device stored in the to-be-restored list. The information indicating the second terminal device may be, for example, the device ID of the second terminal device.

[0390] S227. The transmission module of the second terminal device saves the transmission channel information between the second terminal device and the third terminal device.

[0391] It should be understood that the implementation of S227 is similar to that of S319, and reference can be made to the above description, which will not be repeated here.

[0392] S228. The transmission module of the second terminal device binds the transmission channel information between the second terminal device and the third terminal device and information 2, where information 2 is used to indicate whether the transmission channel information between the second terminal device and the third terminal device needs to be restored after being disconnected.

[0393] It should be understood that when the smart interconnection of the second terminal device indicates information 2 to the transmission module of the second terminal device in S206, the transmission module of the second terminal device can associate or bind the transmission channel information between the second terminal device and the third terminal device saved in S227 with information 2. In this way, the transmission module of the second terminal device can subsequently determine whether the transmission channel between the second terminal device and the third terminal device needs to be restored based on information 2.

[0394] S126: The WiFi connection module of the first terminal device determines that no physical link has been established between the first terminal device and the second terminal device, and executes S127 based on the determination result.

[0395] Optionally, the WiFi connection module of the first terminal device may call a function to obtain information indicating whether a physical link has been established between the first terminal device and the second terminal device.

[0396] Optionally, S126 may be executed by the WiFi connection module of the first terminal device after a first time period has passed since S125 was executed. In this way, the WiFi connection module of the first terminal device can establish a physical link with the second terminal device after the physical link between the second terminal device and the third terminal device is disconnected.

[0397] S127: The WiFi connection module of the first terminal device sends a request 4 to the WiFi connection module of the second terminal device, requesting to establish a physical link. Request 4 may carry the account number of the first terminal device, the password of the first terminal device, and the role information of the first terminal device.

[0398] S229. In response to request 4, the WiFi connection module of the second terminal device connects to the first terminal device through the account and password of the first terminal device, that is, establishes a physical link with the first terminal device; and increases the reference count by 1.

[0399] S230: The WiFi connection module of the second terminal device sends a physical link establishment response to the WiFi connection module of the first terminal device. The physical link establishment response is used to indicate that the physical link is successfully established.

[0400] Optionally, the physical link establishment response carries the device IP of the second terminal device.

[0401] S128. The WiFi connection module of the first terminal device increases the reference count by 1.

[0402] Here, S128 may be executed after S230.

[0403] It should be understood that the implementation of S127 to S128 is similar to the implementation of S210 to S211. Please refer to the above description and will not be repeated here.

[0404] S231. The WiFi connection module of the second terminal device determines that the device is a GC in the new P2P group, starts TCP service (TCP server) monitoring, and obtains the TCP IP and port of the second terminal device.

[0405] S232. The WiFi connection module of the second terminal device sends information indicating the device ID, TCP IP, and port of the second terminal device to the WiFi connection module of the first terminal device.

[0406] S129. The WiFi connection module of the first terminal device saves the TCP IP and port of the second terminal device.

[0407] S130: The WiFi connection module of the first terminal device indicates to the transmission module of the first terminal device that the physical link is successfully established, and indicates the device IP of the second terminal device. Based on the indication of successful physical link multiplexing, the transmission module of the first terminal device may further establish a transmission channel with the transmission module of the second terminal device.

[0408] S131: The transmission module of the first terminal device sends information for instructing the transmission channel to be established to the transmission module of the second terminal device. The information for instructing the transmission channel to be established carries the device IP of the first terminal device.

[0409] S233: In response to the information indicating the establishment of the transmission channel, the transmission module of the second terminal device sends a transmission channel establishment response to the transmission module of the first terminal device. The transmission channel establishment response indicates that the transmission channel is agreed to be established or that the transmission channel is successfully established.

[0410] It should be understood that the implementation of S131 to S233 is similar to the implementation of S213 and 307, and reference may be made to the above description, which will not be repeated here.

[0411] Optionally, the information indicating the establishment of the transmission channel in S131 and the transmission channel establishment response in S233 may be transmitted via a TCP channel between the first terminal device and the second terminal device. Compared to transmission via Bluetooth, Bluetooth has poor stability, so that the two signaling messages transmitted via the TCP channel are less likely to fail.

[0412] The TCP channel transmission between the first terminal device and the second terminal device can be established using the TCP IP address and port number of the first terminal device and the TCP IP address and port number of the second terminal device. For example, the first terminal device invokes the TCP protocol stack and uses the TCP IP address and port number of the second terminal device to transmit data to the second terminal device; the second terminal device then invokes the TCP protocol stack and uses the TCP IP address and port number of the first terminal device to transmit data to the first terminal device. This completes the establishment of the TCP channel between the first and second terminal devices.

[0413] S234. The transmission module of the second terminal device indicates to the smart interconnection of the second terminal device that the transmission channel is successfully established.

[0414] S132. The transmission module of the first terminal device indicates to the smart interconnection of the first terminal device that the transmission channel is successfully established.

[0415] S133. The smart interconnection indication of the first terminal device displays a keyboard and mouse sharing interface.

[0416] For example, the first terminal device is a laptop computer, and the keyboard and mouse sharing interface displayed on the laptop computer may be as shown in Figure 22. The keyboard and mouse sharing interface displayed on the laptop computer may include a prompt card 2201, which includes information for instructing the user on how to control the mobile phone using the laptop keyboard and mouse.

[0417] Based on the above embodiment, the second terminal device and the third terminal device can determine whether it is necessary to restore the transmission channel between the second terminal device and the third terminal device, and then restore the multi-screen collaboration service between the second terminal device and the third terminal device. If necessary, the first terminal device, the second terminal device, and the third terminal device can perform the steps shown in Figure 9. As shown in Figure 9, method 600 can also include the following steps.

[0418] S134. The WiFi connection module of the first terminal device calls a function to reset the state of the first terminal device to a dynamic networking recovery state.

[0419] The dynamic networking recovery state can be understood as the state when the terminal device recovers the disconnected transmission channel.

[0420] S135. The WiFi connection module of the first terminal device instructs the transmission module of the first terminal device to enter a dynamic networking recovery state.

[0421] Through S134 and S135, the WiFi connection module and transmission module of the first terminal device can both enter the dynamic networking recovery state. When the first terminal device receives a request from another terminal device to establish a physical link, it does not respond to the request from the other terminal device to establish a physical link. This helps improve the recovery efficiency and success rate of the transmission channel.

[0422] S136. The WiFi connection module of the first terminal device sends information indicating entry into a dynamic networking recovery state to the WiFi connection module of the second terminal device.

[0423] S235. In response to the information indicating the entry into the dynamic networking recovery state, the WiFi connection module of the second terminal device calls a function to reset the state of the second terminal device to the dynamic networking recovery state.

[0424] S236: The WiFi connection module of the second terminal device instructs the transmission module of the second terminal device to enter a dynamic network recovery state. Alternatively, this can be understood as the WiFi connection module of the second terminal device instructing the transmission module of the second terminal device to restore the transmission channel to be restored. The dynamic network recovery state can also be understood as the state of restoring the transmission channel to be restored.

[0425] S137. The WiFi connection module of the first terminal device sends information indicating entry into a dynamic networking recovery state to the WiFi connection module of the third terminal device.

[0426] S320. In response to the information indicating the entry into the dynamic networking recovery state, the WiFi connection module of the third terminal device calls a function to reset the state of the third terminal device to the dynamic networking recovery state.

[0427] S321. The WiFi connection module of the third terminal device instructs the transmission module of the third terminal device to enter a dynamic networking recovery state.

[0428] It should be understood that the implementation of S235 and S236, S320 and S321 are similar to that of S134 and S135, and reference can be made to the above description, which will not be repeated here.

[0429] After the transmission module of the terminal device determines that it has entered the dynamic networking recovery state, the transmission module of the terminal device can determine whether there is a transmission channel to be recovered. That is, the transmission modules of the second terminal device and the third terminal device can execute S237 and S322 respectively.

[0430] S237. The transmission module of the second terminal device determines whether there is a transmission channel to be restored.

[0431] Optionally, the transmission module of the second terminal device can determine whether there is a transmission channel to be restored in the list to be restored. The list to be restored of the second terminal device stores the transmission channel information between the second terminal device and the third terminal device, that is, the information used to indicate the third terminal device; the information used to indicate the third terminal device is bound or associated with information 2; when information 2 is used to indicate the first identifier, the transmission module of the second terminal device can determine that the transmission channel between the second terminal device and the third terminal device needs to be restored, that is, there is a transmission channel to be restored in the list to be restored of the second terminal device; when information 2 is used to indicate the second identifier, the transmission module of the second terminal device can determine that there is no need to restore the transmission channel between the second terminal device and the third terminal device, that is, there is no transmission channel to be restored in the list to be restored of the second terminal device.

[0432] Optionally, the transmission module of the second terminal device can also determine the transmission channel information in the to-be-restored list of the second terminal device by means of the smart interconnection determination information 2 of the second terminal device in S206, and judge the transmission channel that needs to be restored in the transmission channel information.

[0433] Exemplarily, the transmission channel information in the list to be restored includes the transmission channel information between the second terminal device and the third terminal device, and the transmission channel information between the second terminal device and the smart bracelet. The transmission module of the second terminal device can determine whether it is necessary to restore the transmission channel between the second terminal device and the third terminal device based on the service type or service priority of the service disconnected between the second terminal device and the third terminal device; the transmission module of the second terminal device can determine whether it is necessary to restore the transmission channel between the second terminal device and the smart bracelet based on the service type or service priority of the service disconnected between the second terminal device and the smart bracelet. The specific determination method can be found in the description at S206 above, which will not be repeated here.

[0434] It should be understood that the way in which the third terminal device determines whether there is a transmission channel to be restored is similar to the way in which the second terminal device determines whether there is a transmission channel to be restored. Since the multi-screen collaborative service between the second terminal device and the third terminal device is initiated by the second terminal device, the transmission channel information between the second terminal device and the third terminal device in the to-be-restored list of the second terminal device is bound to information 2, while the transmission channel information between the second terminal device and the third terminal device in the to-be-restored list of the third terminal device is not bound to information 2. Therefore, the judgment result of the third terminal device is that there is no transmission channel to be restored in the third terminal device. The rest of the judgment process is similar to the above-mentioned implementation method of S237. Please refer to the above description and will not be repeated here.

[0435] Optionally, the transmission module of the second terminal device can instruct the smart interconnection of the second terminal device whether to restore the transmission channel between the second terminal device and the third terminal device. Based on the instruction, the smart interconnection of the second terminal device instructs the display of pop-up message 2, which is used to confirm with the user whether to restore the multi-screen collaboration service between the second terminal device and the third terminal device.

[0436] For example, pop-up message 2 may include a button for confirming restoration, such as the button corresponding to "Reconnect" in FIG21; and a button for canceling restoration, such as the button corresponding to "Cancel" in FIG21; thus, based on the user's selection of one of the two buttons, the smart interconnection of the second terminal device may determine whether to restore the multi-screen collaboration service between the second terminal device and the third terminal device. However, the smart interconnection of the second terminal device may indicate the result of the determination to the transmission module of the second terminal device.

[0437] S238. Based on the second information and the transmission channel information bound in the to-be-restored list, the transmission module of the second terminal device determines that the transmission channel between the second terminal device and the third terminal device needs to be restored. The transmission module of the second terminal device instructs the WiFi connection module of the second terminal device to instruct the restoration of the transmission channel between the second terminal device and the third terminal device.

[0438] S322: The transmission module of the third terminal device determines whether there is a transmission channel to be restored. Because the transmission channel information in the to-be-restored list of the third terminal device is not associated with information indicating the restoration of the transmission channel, the transmission module of the third terminal device may determine that there is no transmission channel to be restored. Therefore, the transmission module of the third terminal device does not instruct the WiFi connection module of the third terminal device to restore the transmission channel.

[0439] S239: The WiFi connection module of the second terminal device sends information for instructing the WiFi connection module of the third terminal device to establish a physical link with the first terminal device. The information for instructing the establishment of a physical link with the first terminal device may carry information for indicating the first terminal device, such as the device ID of the first terminal device.

[0440] S323: In response to the information indicating the establishment of a physical link with the first terminal device, the WiFi connection module of the third terminal device sends a physical link establishment request to the WiFi connection module of the first terminal device. The physical link establishment request is used to request the third terminal device to establish a physical link with the first terminal device.

[0441] S138. In response to the physical link establishment request, the WiFi connection module of the first terminal device sends information indicating the account number and password of the first terminal device to the WiFi connection module of the third terminal device. Based on the information indicating the account number and password of the first terminal device, the WiFi connection module of the third terminal device may determine the account number and password of the first terminal device.

[0442] S139. The WiFi connection module of the first terminal device increases the reference count by 1.

[0443] S324. In response to the information indicating the account number of the first terminal device and the password of the first terminal device, the WiFi connection module of the third terminal device connects to the first terminal device through the account number of the first terminal device and the password of the first terminal device, that is, establishes a physical link with the first terminal device.

[0444] S325. The WiFi connection module of the third terminal device sends information indicating that the physical link is successfully established to the WiFi connection module of the second terminal device.

[0445] S326. The WiFi connection module of the third terminal device increases the reference count by 1.

[0446] S327: The WiFi connection module of the third terminal device instructs the transmission module of the third terminal device to restore the transmission channel. Instructing the transmission module of the third terminal device to restore the transmission channel can also be understood as instructing the transmission module of the third terminal device to restore a transmission channel to be restored in the to-be-restored list, i.e., the transmission channel between the second terminal device and the third terminal device.

[0447] S240: The WiFi connection module of the second terminal device increases the reference count by 1.

[0448] S241: The WiFi connection module of the second terminal device instructs the transmission module of the second terminal device to restore the transmission channel. Instructing the transmission module of the second terminal device to restore the transmission channel can also be understood as instructing the transmission module of the second terminal device to restore a transmission channel to be restored in a to-be-restored list, i.e., a transmission channel between the second terminal device and the third terminal device.

[0449] S242: The transmission module of the second terminal device sends information for instructing the transmission channel to be established to the transmission module of the third terminal device. The information for instructing the transmission channel to be established carries the device IP of the second terminal device.

[0450] S328: In response to the information indicating the establishment of the transmission channel, the transmission module of the third terminal device sends a transmission channel establishment response to the transmission module of the second terminal device. The transmission channel establishment response indicates that the transmission channel is agreed to be established or that the transmission channel is successfully established.

[0451] It should be understood that the implementation of S242 and S328 is similar to that of S213 and S307 , and reference may be made to the above description, which will not be repeated here.

[0452] S329. The transmission module of the third terminal device indicates to the smart interconnection of the third terminal device that the transmission channel is successfully established.

[0453] S330. In response to the indication that the transmission channel is successfully established, the smart interconnection indication of the third terminal device displays a multi-screen collaboration interface.

[0454] S243. The transmission module of the second terminal device indicates to the smart interconnection of the second terminal device that the transmission channel is successfully established.

[0455] S244: The transmission module of the second terminal device indicates to the WiFi connection module of the second terminal device that the transmission channel has been successfully restored, or may indicate that there is no transmission channel to be restored.

[0456] S331: The transmission module of the third terminal device indicates to the WiFi connection module of the third terminal device that the transmission channel has been successfully restored, or may indicate that there is no transmission channel to be restored.

[0457] S245: The WiFi connection module of the second terminal device sends information to the WiFi connection module of the first terminal device indicating exiting the dynamic networking recovery state. Exiting the dynamic networking recovery state can also be understood as the second terminal device having no transmission channels to be recovered or having already recovered its transmission channels and no longer needing to be in the dynamic networking state.

[0458] S140: The WiFi connection module of the first terminal device sends a response 2 to the WiFi connection module of the second terminal device. The response 2 is a response to the information indicating the exit from the dynamic networking recovery state. The response 2 may be an ACK message.

[0459] S332: The WiFi connection module of the third terminal device sends information indicating exiting the dynamic networking recovery state to the WiFi connection module of the first terminal device. S332 may be triggered based on S331.

[0460] S141. The WiFi connection module of the first terminal device sends a response 2 to the WiFi connection module of the third terminal device.

[0461] Optionally, the WiFi connection module of the second terminal device can exit the dynamic networking recovery state based on response 2; and / or, the WiFi connection module of the third terminal device can exit the dynamic networking recovery state based on response 2; and / or, the first terminal device can exit the dynamic networking recovery state when sending response 2 to all GCs connected to it.

[0462] Based on the above embodiment, if the transmission module of the second terminal device determines in S237 that there is no transmission channel to be restored, the transmission module of the second terminal device may, for example, determine that information 2 bound to the transmission channel information of the second terminal device and the third terminal device is the second identifier, i.e., the transmission channel between the second terminal device and the third terminal device is not restored. The first terminal device, the second terminal device, and the third terminal device may execute the steps shown in Figure 10.

[0463] As shown in FIG10 , the method 600 further includes the following steps.

[0464] S246. The transmission module of the second terminal device instructs the WiFi connection module of the second terminal device that there is no transmission channel to be restored.

[0465] S247. In response to the indication that there is no transmission channel to be restored, the WiFi connection module of the second terminal device instructs the smart interconnection of the second terminal device not to restore the transmission channel.

[0466] S332. The transmission module of the third terminal device instructs the WiFi connection module of the third terminal device that there is no transmission channel to be restored.

[0467] S333. In response to an indication that there is no transmission channel to be restored, the WiFi connection module of the third terminal device instructs the smart interconnection of the third terminal device not to restore the transmission channel.

[0468] S334. In response to the instruction not to restore the transmission channel, the multi-screen collaborative interface displayed by the smart interconnection of the third terminal device disappears, that is, the third terminal device no longer displays the masked interface.

[0469] Furthermore, the second terminal device may exit the dynamic networking recovery state through S245 and S140; the third terminal device may exit the dynamic networking recovery state through S332 and S141; and the first terminal device may exit the dynamic networking recovery state after executing S140 and S141. This part can be found in the above description and will not be repeated here.

[0470] It should be understood that when the second terminal device and the third terminal device establish a multi-screen collaborative service, if the first terminal device needs to establish a call sharing service with the third terminal device, and the first terminal device can act as either a GC or a GO, then the first terminal device can join the group of the second terminal device and the third terminal device, that is, no connection conflict will occur. Based on this, the embodiment of the present application also provides a data transmission method 2300. As shown in Figure 23, the method 2300 includes the following steps:

[0471] S2301. Device discovery.

[0472] It should be understood that the process of discovering the first terminal device can refer to the implementation methods of S100 to S104 in method 600; the process of discovering the second terminal device can refer to the implementation methods of S200 to S204 in method 600; the process of discovering the third terminal device can refer to the implementation methods of S300 to S304 in method 600, which will not be repeated here.

[0473] S2302. The second terminal device and the third terminal device establish a multi-screen collaborative service.

[0474] It should be understood that the process of establishing a multi-screen collaborative service between the second terminal device and the third terminal device can refer to the process of the second terminal device S205 to S214 and the third terminal device executing S305 to S309 in method 600, which will not be repeated here.

[0475] S2303. The smart interconnection of the first terminal device obtains an instruction to share a call with the third terminal device.

[0476] S2304. The smart interconnection of the first terminal device instructs the transmission module of the first terminal device to establish a transmission channel with the third terminal device.

[0477] S2305. The transmission module of the first terminal device instructs the WiFi connection module of the first terminal device to establish a physical link with the third terminal device.

[0478] S2306. The WiFi connection module of the first terminal device determines that no physical link is established between the first terminal device and the third terminal device.

[0479] S2307: The WiFi connection module of the first terminal device determines that the first terminal device has the capability of serving as a GO or a GC, that is, the first terminal device can serve as both a GO and a GC.

[0480] S2308: The WiFi connection module of the first terminal device sends a request 5 for requesting to establish a physical link to the WiFi connection module of the third terminal device. The request 5 carries information indicating that the first terminal device can act as a GO or a GC.

[0481] S2309. The WiFi connection module of the third terminal device determines that the third terminal device has established a physical link with the second terminal device, and in the P2P group formed by the third terminal device and the second terminal device, the second terminal device is a GO.

[0482] It should be understood that based on S2309 and the information included in Request 5 indicating that the first terminal device can act as both a GO and a GC, the WiFi connection module of the third terminal device can determine that the first terminal device can join the P2P group formed by the third terminal device and the second terminal device as a GC. Therefore, the WiFi connection module of the third terminal device executes S2310.

[0483] It should be understood that the implementation of S2303 to S2308 is similar to that of S105 to S110, and the implementation of S2309 is similar to that of S215. Please refer to the above description and no further details will be given here.

[0484] S2310: The WiFi connection module of the third terminal device sends information indicating the establishment of a physical link with the second terminal device to the WiFi connection module of the first terminal device.

[0485] S2311. In response to the information in S2310, the WiFi connection module of the first terminal device sends a request for establishing a physical link to the WiFi connection module of the second terminal device.

[0486] S2312. In response to the request in S2311, the WiFi connection module of the second terminal device sends information indicating the account and password of the second terminal device to the WiFi connection module of the first terminal device.

[0487] S2313. The WiFi connection module of the first terminal device connects to the second terminal device using the account and password of the second terminal device.

[0488] S2314. After S2312, the WiFi connection module of the second terminal device adds 1 to the reference count of the physical link between the second terminal device and the first terminal device.

[0489] S2315. Based on S2313, the WiFi connection module of the first terminal device sends information indicating that the physical link is successfully established to the WiFi connection module of the third terminal device.

[0490] S2316. The WiFi connection module of the first terminal device increases the reference count by 1.

[0491] S2317. The WiFi connection module of the third terminal device increases the reference count by 1.

[0492] It should be understood that since the physical link between the first terminal device and the second terminal device is established to implement the service between the first terminal device and the third terminal device, the WiFi connection module of the third terminal device also increases the reference count by 1.

[0493] S2318. The WiFi connection module of the third terminal device instructs the transmission module of the third terminal device that the physical link is successfully established.

[0494] S2319. The WiFi connection module of the first terminal device indicates to the transmission module of the first terminal device that the physical link is successfully established.

[0495] S2320: The transmission module of the third terminal device sends information for instructing the transmission channel to be established to the transmission module of the first terminal device. The information for instructing the transmission channel to be established carries information for indicating the device IP of the third terminal device.

[0496] S2321: The transmission module of the first terminal device sends a transmission channel establishment response to the transmission module of the third terminal device. The transmission channel establishment response carries information indicating the device IP of the first terminal device.

[0497] S2322. The transmission module of the third terminal device indicates to the smart interconnection of the third terminal device that the transmission channel is successfully established.

[0498] S2323. The smart interconnection indicator of the third terminal device displays a call sharing interface.

[0499] Optionally, S2324 , the transmission module of the third terminal device indicates to the WiFi connection module of the third terminal device that the transmission channel is successfully established.

[0500] It should be understood that S2324 can be executed in parallel with S2322 and S2323, or can be executed before or after S2322 and S2323. This application does not make any specific limitations on this.

[0501] S2325. The transmission module of the first terminal device indicates to the smart interconnection of the first terminal device that the transmission channel is successfully established.

[0502] S2326. The smart interconnection indication of the first terminal device displays a call sharing interface.

[0503] Optionally, in S2327, the transmission module of the first terminal device indicates to the WiFi connection module of the first terminal device that the transmission channel is successfully established.

[0504] It should be understood that S2327 can be executed in parallel with S2325 and S2326, or before or after S2325 and S2326. This application does not make any specific limitations on this.

[0505] It should be noted that S2323 and S2326 are optional. That is, when there is an incoming call on the remote device, the local device can display the incoming call interface of the remote device, allowing the user to answer the call on the local device. If there is no incoming call on the remote device, the local device does not need to display the call sharing interface.

[0506] It should also be understood that the implementation of S2310 to S2327 is similar to S239 to S244 executed by the second terminal device, S138 to S139 executed by the first terminal device, and S324 to S331 executed by the third terminal device in method 600. Please refer to the above description and no further details will be given here.

[0507] It should also be noted that the above description of the method of the embodiment of the present application uses the example of establishing a P2P direct connection between the first terminal device, the second terminal device, and the third terminal device. In some implementations, the above-mentioned P2P direct connection can also be replaced by a WiFi AP+STA connection, the above-mentioned GO can be replaced by an AP, and the above-mentioned GC can be replaced by an STA. This application does not specifically limit this.

[0508] The data transmission method of the present application is described below from the perspective of interaction between multiple devices. The device involved below can be a terminal device, a chip, a chip system or a processor in a terminal device, or a logic module or software that can realize all or part of the functions of the terminal device. The hardware structure of the terminal device can be as shown in Figure 3, and the software structure can be as shown in Figure 4 or Figure 5. This application does not make specific restrictions on this.

[0509] The present application also provides a data transmission method 700, which can be applied to the above-mentioned scenarios 1 to 5. The hardware structure of the device involved can be shown in Figure 3, and the software structure can be shown in Figure 4 or Figure 5. The method 700 includes the following steps:

[0510] S701: A first device in a first group sends a connection request to a second device in a second group.

[0511] The second group includes multiple devices. The first group may include only the first device, and the first device may be configured to be the master device in the group. For example, the first device may be the first terminal device in method 600. Alternatively, both the first and second groups may include multiple devices, for example, the first group includes three devices and the second group includes three devices.

[0512] The connection request may be understood as a request for requesting to establish a physical link, such as request 2 in S110 in method 600 .

[0513] S702: The first device determines a second target device from the master devices in the first group and the master devices in the second group. The second target device is the master device in the third group. The third group is a group obtained by merging the first group and the second group.

[0514] When the first group includes only the first device, the second target device is the first device, such as the above scenario 1. When the first group includes multiple devices, the second target device is one of the master device in the first group and the master device in the second group.

[0515] In the case where the first group includes a plurality of devices, the master device in the first group may or may not be the first device, and the master device in the second group may or may not be the second device.

[0516] The fact that the third group is the result of merging the first and second groups does not necessarily mean that the third group includes all devices in the first and second groups. For example, if the first or second device is not connected to the second target device, the third group does not include the first or second device. Subsequently, after the first or second device connects to the second target device, the first or second device joins the third group. If the third device is not connected to the second target device, the third device does not belong to the third group. After the third device connects to the second target device, the third device joins the third group.

[0517] The first device may use one or more of the following rules to determine the master device of the third group: select a device that is configured with the capability to be the master device in the group; or select a device with the largest MAC address between the master device of the first group and the master device of the second group; or select a device with the lowest power consumption per unit time between the master device of the first group and the master device of the second group; or select a plug-in device.

[0518] Among them, if there is a device that is capable of being a master device in a group, the device that is capable of being a master device in a group is preferably selected as the master device, such as S117 in method 600. Otherwise, the first device can be selected according to one or more of the remaining rules. In this way, when selecting a device that is capable of being a master device in a group as the master device, it is convenient to improve the success rate of forming a new group; select the device with the lowest power consumption per unit time and / or select a plug-in device, so that the master device is less sensitive to power consumption. Because the power consumption of the master device may be large, this can reduce the situation where the group is disbanded due to insufficient power of the master device. Selecting the device with the largest MAC address allows more types of slave devices to connect to the master device.

[0519] S703: The first device instructs a master device in the target group to disband the target group, where the target group is a group between the first group and the second group that does not include the second target device.

[0520] The target group is the group to be disbanded in the first group and the second group. Disbanding the target group can be understood as disconnecting the physical link between the master device and the slave device in the target group.

[0521] S704: The first target device in the target group determines whether to restore a first service, where the first service is a service between the first target device and a third device in the target group.

[0522] The first service may be, for example, the multi-screen collaboration service in method 600. The manner in which the first target device determines whether to resume the first service may be referred to the implementation of S237 in method 600 and will not be described in detail here. The third device may be the first device or the second device. Alternatively, the third device may not be the first device and not the second device, such as the third device in method 600.

[0523] The first target device and the third device are different devices. The first target device can be the first device or the second device, for example, the second terminal device in method 600. The first target device can also be neither the first device nor the second device.

[0524] The first target device may be an initiator of the first service, and the third device may be an initiated end of the first service.

[0525] S705: If yes, the first target device sends information for instructing the third device to establish a physical link with the second target device, and / or the first target device establishes a physical link with the second target device.

[0526] In the first case, the third device is neither the first device nor the second device. That is, when the first target device executes S705, the third device has not established a physical link with the second target device. Therefore, the first target device sends information to the third device indicating that a physical link has been established with the second target device. This is, for example, S239 in method 600.

[0527] Optionally, the method 700 further includes: S706 , in response to the information indicating to establish a physical link with the second target device, the third device establishes a physical link with the second target device.

[0528] In the second case, the third device is the first device or the second device. That is, when the first target device executes S705, the third device has already established a physical link with the second target device. Furthermore, the first target device is neither the first device nor the second device. That is, when the first target device executes S705, the first target device has not established a physical link with the second target device. Therefore, the first target device establishes a physical link with the second target device.

[0529] In the third scenario, the third device is neither the first device nor the second device. That is, when the first target device executes S705, the third device has not established a physical link with the second target device; and the first target device is neither the first device nor the second device. That is, when the first target device executes S705, the first target device has not established a physical link with the second target device. The first target device then sends information instructing the third device to establish a physical link with the second target device, and the first target device establishes a physical link with the second target device. Furthermore, the third device may further establish a physical link with the second target device.

[0530] It should be understood that the process of establishing a physical link between the first target device and / or the third device and the second target device can refer to the implementation of S323 to S326, S138 and S139, and S240 in method 600, which will not be repeated here.

[0531] The data transmission method of the present application can enable both the first device and the second device to establish a physical link with the new master device when a first device needs to establish a physical link with the second device in the second group and a connection conflict occurs, thereby facilitating the establishment of services between the first device and the second device; at the same time, when it is determined that a disconnected service needs to be restored, the device that needs to restore the service can establish a physical link with the new master device, thereby restoring the disconnected service, which can improve the user experience.

[0532] Several situations involved in method 700 are exemplarily described below with reference to FIG. 24 to FIG. 26 .

[0533] As shown in FIG. 24 , method 2400 includes the following steps:

[0534] S2401: Device 1 sends a connection request to device 3 in group 1. Group 1 includes device 2 and device 3. Device 2 is the master device in group 1, and device 3 is the slave device in group 1.

[0535] S2402: Device 1 determines that the new master device is device 1. Device 1 is configured in the group to have the capability to function as a master device.

[0536] S2403: Device 1 instructs device 2 to disband group 1.

[0537] S2404: After group 1 is dissolved, device 1 and device 3 establish a physical link.

[0538] S2405 : Device 3 determines that the first service between it and device 2 needs to be restored.

[0539] S2406 : Device 3 instructs device 2 to establish a physical link with device 1 .

[0540] S2407: Device 2 establishes a physical link with device 1.

[0541] Among them, group 2 can be understood as the second group in method 700. The new master device can be understood as the master device of the third group in method 700, that is, the second target device. Device 1 can be understood as the first device and the second target device in method 700, that is, the first device and the second target device in method 700 can be the same device, and device 1 can be understood as the master device in the first group. Device 2 can be understood as the master device and the third device of the target group in method 700, that is, the master device and the third device of the target group in method 700 can be the same device. Device 3 can be understood as the first target device and the second device in method 700, that is, the first target device and the second device in method 700 can be the same device. In addition, method 2400 can correspond to the first case in method 700.

[0542] It should be understood that in some possible implementations, device 2 may be a slave device in group 1, and device 3 may be a master device in group 1, in which case device 1 instructs device 3 to disband group 1; and / or device 2 may be the initiator of the first service, and if device 2 determines that the first service needs to be restored, device 2 establishes a physical link with device 1. In such cases, the implementation methods are similar to method 2400 and are not listed here for brevity.

[0543] As shown in FIG. 25 , method 2500 includes the following steps:

[0544] S2501: Device 4 in group 2 sends a connection request to device 6 in group 3. Group 2 includes device 4 and device 5, where device 4 is a slave device and device 5 is a master device. Group 3 includes device 6 and device 7, where device 6 is a slave device and device 7 is a master device.

[0545] S2502 : Device 4 determines that the new master device is device 7 .

[0546] S2503 : Device 4 instructs device 5 to disband group 2 .

[0547] S2504: Device 4 establishes a physical link with device 7.

[0548] S2505 : Device 5 determines that the first service between it and device 4 needs to be restored.

[0549] S2506 : Device 5 establishes a physical link with device 7 .

[0550] Group 2 can be understood as the first group in method 700. Group 3 can be understood as the second group in method 700. The new master device can be understood as the master device of the third group in method 700, that is, the second target device. Device 4 can be understood as the first and third devices in method 700, that is, the first and third devices in method 700 can be the same device. Device 5 can be understood as the master device and the first target device of the target group in method 700, that is, the master device and the first target device of the target group in method 700 can be the same device. Device 6 can be understood as the second device in method 700, and device 7 can be understood as the second target device in method 700. In addition, method 2500 can correspond to the second case in method 700.

[0551] It should be understood that in some possible implementations, device 4 may be the master device in group 2, and device 5 may be the slave device in group 1, in which case device 4 disbands group 2; and / or device 6 may be the master device in group 3, and device 7 may be the slave device in group 3; and / or device 4 may be the initiator of the first service, and if device 4 determines that the first service needs to be restored, device 4 instructs device 5 to establish a physical link with device 7, and device 5 and device 7 establish a physical link. In these cases, the implementation methods are similar to method 2500 and are not listed here for brevity.

[0552] As shown in FIG. 26 , method 2600 includes the following steps:

[0553] S2601: Device 8 in group 4 sends a connection request to device 10 in group 5. Group 4 includes devices 8 and 9, with device 8 being a slave device in group 4 and device 9 being the master device in group 4. Group 5 includes devices 10, 11, and 12, with devices 10 and 12 being slave devices in group 5 and device 11 being the master device in group 5.

[0554] S2602 : Device 8 determines that the new master device is device 9 .

[0555] S2603 : Device 8 instructs device 11 to disband group 5 .

[0556] S2604: Device 9 establishes a physical link with device 10.

[0557] S2605 : Device 11 determines that the first service between it and device 12 needs to be restored.

[0558] S2606 : Device 11 instructs device 12 to establish a physical link with device 9 .

[0559] S2607 : Device 12 establishes a physical link with device 9 .

[0560] S2608 : Device 11 establishes a physical link with device 9 .

[0561] It should be understood that S2608 can be executed in parallel with S2606 to S2607, or can be executed before or after S2606 to S2607. This application does not make any specific limitations on this.

[0562] Group 4 can be understood as the first group in method 700. Group 5 can be understood as the second group in method 700. The new master device can be understood as the master device of the third group in method 700, that is, the second target device. Device 8 can be understood as the first device in method 700. Device 9 can be understood as the second target device in method 700. Device 10 can be understood as the second device in method 700. Device 11 can be understood as the master device and the first target device of the target group in method 700, that is, the master device and the first target device of the target group in method 700 can be the same device. Device 12 can be understood as the third device in method 700. In addition, method 2600 can correspond to the second and third in method 700.

[0563] It should be understood that in some possible implementations, device 8 may be the master device in group 4, and device 9 may be the slave device in group 4; and / or, device 10 or device 12 may be the master device in group 5, and device 11 may be the slave device in group 5, in which case device 8 instructs device 10 or device 12 to disband group 5; and / or, device 12 is the initiator of the first service, and if device 12 determines that the first service needs to be restored, device 12 instructs device 11 to establish a physical link with device 9, and device 12 establishes a physical link with device 9. In such cases, the implementation methods are similar to method 2600 and are not listed here for brevity.

[0564] It should be noted that methods 2400 through 2600 are exemplary illustrations of method 700. The implementation of each step in methods 2400 through 2600 can be found in the description of method 700 and will not be repeated here. In the scenarios illustrated in methods 2400 through 2600, the group may include more devices, and their implementations are similar to those of methods 2400 through 2600, and will not be listed here one by one.

[0565] As an optional embodiment, in S701, the connection request carries device information of the device in the first group or information indicating that the first device needs to be the main device in the group; method 700 also includes: in response to the connection request, the second device sends information indicating a connection conflict to the first device; S702 can be implemented in the following manner: in response to the information indicating a connection conflict from the second device, the first device determines the second target device.

[0566] It should be understood that device information can be information used to identify a device. For example, the device information of the first device in the first group can be information such as the device ID and / or device model of the first device. Alternatively, the device information can also be understood as a list of devices in the first group. The device information can also include information such as the device ID and / or device model of each device in the first group, as well as information about the role of each device in the first group, such as the first device being the GO in the first group.

[0567] In the case that the first group includes only the first device, and the first device is configured with the capability of being a master device in the group, the connection request carries information indicating that the first device is required to be a master device in the group.

[0568] Based on this, the second device can determine, based on the connection request, that the first device needs to establish a connection with the second device as the master device. This allows the second device to determine that the role desired by the first device conflicts with that of the master device in the second group, i.e., the group can only include one master device. Therefore, the second device can determine that a connection conflict has occurred. Alternatively, the first device is already in the first group. In this case, the first device can determine that the first group includes a master device, and the master device in the first group cannot directly join the second group as the master device, i.e., a connection conflict has occurred. Therefore, the second device can determine that a connection conflict has occurred.

[0569] Based on this, the second device sends information indicating a connection conflict to the first device. It should be noted that this process is similar to the implementation of S110, S215, and S216 in method 600. For example, the information indicating a connection conflict can also be understood as the information indicating that a physical link cannot be established in S216. Please refer to the above description and will not be repeated here.

[0570] The implementation of the first device determining the second target device is similar to the implementation of S117 in method 600, and reference may be made to the above description, which will not be repeated here.

[0571] In one possible embodiment, in response to information from the second device indicating a connection conflict, the first device determines the second target device, which can be implemented in the following manner: in response to information from the second device indicating a connection conflict, the first device displays an interface for determining whether to perform network preemption; in response to an input operation indicative of network preemption by a user, the first device determines the second target device.

[0572] It should be understood that the interface for determining whether to initiate network preemption may include a pop-up message, such as pop-up message 1 in S113 of method 600. For this interface, see the interface shown in FIG20 and will not be described in detail here. The user's input operation for instructing network preemption may be, for example, clicking the "Continue" button in the interface shown in FIG20. In this way, whether to initiate network preemption can be determined based on the user's instruction, which facilitates meeting the user's service needs and improves the user experience.

[0573] As an optional embodiment, S703 can be implemented in the following manner: the first device sends information to the master device in the target group for instructing the initiation of network preemption, and the information for instructing the initiation of network preemption includes information for indicating that the master device of the third group is the second target device; the first device sends information to the master device in the target group for instructing dynamic networking, and dynamic networking means disbanding the target group and joining the third group; in response to the information from the first device for instructing dynamic networking for indicating that the master device of the third group is the second target device, the master device in the target group disbands the target group. In this way, the master device in the target group can determine that the machine is in the group to be disbanded and that the machine is the master device in the group. The master device in the target group can further disband the target group.

[0574] Optionally, the master device in the target group can respectively forward the information for indicating that dynamic networking is to be performed and the information for indicating that the master device of the third group is the second target device to the slave devices in the target group, so that the slave devices in the target group can determine that the physical link with the master device in the target group needs to be disconnected. That is, S703 can be implemented in the following manner: the first device sends information for indicating the initiation of network preemption to the master device in the target group, and the information for indicating the initiation of network preemption includes information for indicating that the master device of the third group is the second target device; the master device in the target group forwards the information for indicating the initiation of network preemption to the slave devices in the target group; in response to the information for indicating the initiation of network preemption from the master device in the target group, the slave devices in the target group send a network preemption response to the master device in the target group; in response to the network preemption response from the slave devices in the target group, the master device in the target group sends a network preemption response to the first device; In response to a networking preemption response from a master device in a target group, the first device sends information for instructing dynamic networking to the master device in the target group; in response to the information for instructing dynamic networking from the first device, the master device in the target group forwards the information for instructing dynamic networking to the slave devices in the target group; in response to the information for instructing dynamic networking from the first device, the master device in the target group deletes the physical link between itself and the slave devices in the target group; in response to the information for instructing dynamic networking from the master device in the target group, the slave devices in the target group delete the physical link between itself and the master device in the target group.

[0575] It should be understood that the implementation of this embodiment is similar to the implementation of S119 to S121, S217 to S224, and S310 to S315 in method 600. For example, the information indicating the initiation of network preemption can be understood as request 3 in S119. Based on the information indicating the second target device, the master device in the target group can determine that the master device of the third group is not the master device of the current group and, therefore, can determine that the current group needs to be disbanded. The master device of the target group forwarding the information indicating the initiation of network preemption can be understood as S218. The network preemption response can be understood as response 1 in S311 and S220. The information indicating the implementation of dynamic networking can be understood as the information indicating the entry into the dynamic networking state in S121 and S220-1. The deletion of the physical link by the master device and the slave device in the target group can be understood as disconnecting the physical link in S224 and S315, respectively. Please refer to the above description and will not be repeated here.

[0576] In a possible implementation, before the first device sends information for instructing the master device of the target group to perform dynamic networking, the method further includes:

[0577] The first device sends information for instructing to initiate network preemption to the second target device, where the information for instructing to initiate network preemption also includes: device information of devices included in the target group and information for indicating an initiator and an initiated end of the connection request.

[0578] It should be understood that the second target device determines that the local device is the main device in the third group based on the device information of the devices included in the target group and the information used to indicate the initiator and the initiated end of the connection request, and can determine the information of the devices in the target group, and can also determine the initiator and the initiated end of the connection request, thereby facilitating the second target device to subsequently establish a physical link with the devices in the initiator and the initiated end of the connection request that are not in the third group.

[0579] Optionally, the information indicating the initiation of network preemption may include device information for the first group's devices, device information for the second group's devices, information indicating that the master device of the third group is the second target device, and information indicating the initiator and recipient of the connection request. The device information can be found in the description above. In this way, devices in both the first and second groups can determine the master device of the third group and, therefore, whether they belong to the newly established third group, thereby facilitating the subsequent determination of whether to disconnect the physical link. For example, S223 and S314 in method 600 are provided.

[0580] In one possible embodiment, after the first device sends information indicating initiation of network preemption to the second target device, the method 700 further includes: after the second target device receives the information indicating initiation of network preemption from the first device, the second target device forwards the information indicating initiation of network preemption to a slave device in a non-target group, the non-target group being a group in the first group and the second group that includes the second target device; in response to the information indicating initiation of network preemption from the second target device, the slave device in the non-target group sends a network preemption response to the second target device; in response to the network preemption response from the slave device in the non-target group, the second target device sends a network preemption response to the first device; in response to the network preemption response from the second target device, the first device sends information indicating initiation of dynamic networking to the second target device; in response to the information indicating initiation of dynamic networking from the first device, the second target device forwards the information indicating initiation of dynamic networking to a slave device in the target group. In this way, the slave device in the non-target group can determine that the device is in the newly established third group and can determine the role of the device in the third group, so that the slave device in the non-target group can maintain a physical link with the second target device.

[0581] It should be understood that after receiving the networking preemption responses from the second target device and the master device in the target group, the first device may send information instructing the master device in the target group of the second target device to perform dynamic networking. The implementation of this embodiment is similar to the implementation of S119 to S121, S217 to S220-1, and S310 to S311 in method 600. Please refer to the above description and will not be repeated here.

[0582] In one possible embodiment, after the first device sends information for indicating dynamic networking to the second target device, method 700 further includes: the second target device starts a first timer; after the first timer expires, the second target device establishes a physical link with the second device or the first device; the second target device sends information for indicating entry into a networking recovery state to the devices in the target group respectively; S704 can be implemented in the following manner: in response to the information for indicating entry into a networking recovery state, the first target device determines whether to restore the first service.

[0583] It should be understood that the second target device can determine the device to which the second target device is connected based on the information indicating the initiator (first device) and the initiated end (second device) of the connection request included in the information indicating the initiation of network preemption. When the second target device is the master device in the second group, the second target device establishes a physical link with the first device; when the second target device is the master device in the first group, the second target device establishes a physical link with the second device. This embodiment is similar to the implementation of S121 to S129 and S221 to S232 in method 600. Please refer to the description above and will not be repeated here.

[0584] As an optional embodiment, assume that S705 includes the first target device sending information to the third device indicating establishment of a physical link with the second target device; and after S705, the third device establishes a physical link with the second target device. Then, after the third device establishes the physical link with the second target device, method 700 further includes: the third device sending information to the first target device indicating successful establishment of the physical link; in response to the information indicating successful establishment of the physical link between the third device and the second target device, the first target device sending information to the third device indicating establishment of a second transmission channel, the second transmission channel being used to transmit data generated by the first service; and in response to the information indicating establishment of the second transmission channel, the third device sending information to the first target device indicating successful establishment of the second transmission channel.

[0585] The implementation of this embodiment is similar to the implementation of S325 to S328 and S240 to S242 in method 600. For example, the information indicating the successful establishment of the physical link can be understood as the information indicating the successful establishment of the physical link in S325. The physical link here can be the physical link between the third device and the second target device. The information indicating the establishment of the second transmission channel can be understood as the information indicating the establishment of the transmission channel in S242. The information indicating the successful establishment of the second transmission channel can be understood as the transmission channel response in S328. Please refer to the above description and will not repeat it here.

[0586] In one possible implementation, after the third device sends information indicating that the physical link is successfully established to the first target device, method 700 further includes: the first target device adds 1 to the reference count, where the reference count represents the number of times the first service references the physical link; and the third device adds 1 to the reference count.

[0587] It should be understood that the implementation of this embodiment is similar to the implementation of S240 and S326 in method 600. Please refer to the above description and will not be repeated here.

[0588] The physical link in the number of references to the physical link by the first service. After the first target device determines to resume the first service, the third device establishes a physical link with the second target device. The reference count is the number of references to the physical link established between the third device and the second target device.

[0589] It should be understood that if S705 includes the first target device establishing a physical link with the second target device, the first target device and the second target device can also respectively increase the reference count by 1, indicating that the first service increases the number of references to the physical link between the first target device and the second target device by 1.

[0590] It should also be understood that the order of execution of the above methods does not necessarily mean the order in which they are executed. The order in which the methods are executed should be determined by their functions and internal logic.

[0591] It should be noted that in the embodiments of this application, states such as the first state, the dynamic networking state, and the dynamic networking recovery state refer to states in which the terminal device enters a specific processing strategy. For example, when the terminal device enters the dynamic networking recovery state, service recovery will be performed. Entering one of the above states can also be understood as the terminal device entering a certain mode, etc., which is not specifically limited in this application.

[0592] It should also be noted that in the embodiments of the present application, the multiple devices that discover each other can be devices with their Bluetooth and / or WiFi switches turned on and logged into the same user account. Different from the device account used to establish a WiFi direct connection, the user account here refers to the account logged into the device by the user to identify the device as belonging to that user.

[0593] The above describes in detail the data transmission method of an embodiment of the present application in combination with Figures 1 to 26. The following describes in detail the data transmission device of an embodiment of the present application in combination with Figure 27.

[0594] Figure 27 is a schematic block diagram of a data transmission device 2700 provided in an embodiment of the present application. The device 2700 includes a processor 2701, a communication interface 2702 and a memory 2703. Among them, the processor 2701, the communication interface 2702 and the memory 2703 communicate with each other through an internal connection path, the memory 2703 is used to store instructions, and the processor 2701 is used to execute the instructions stored in the memory 2703. The communication interface 2702 can be used to send signals to other devices (such as the processor 2701 or the touch screen of the terminal device), and can also be used to receive signals from other devices (such as the memory 2703). Exemplarily, the communication interface 2702 reads the instructions stored in the memory 2703 and sends the instructions to the processor 2701.

[0595] It should be understood that the device 2700 can be specifically a terminal device or device in the above-mentioned embodiment, and can be used to execute the various steps and / or processes corresponding to the terminal device or device in the above-mentioned method embodiment. Optionally, the memory 2703 may include a read-only memory and a random access memory, and provide instructions and data to the processor. A portion of the memory may also include a non-volatile random access memory. For example, the memory may also store information about the device type. The processor 2701 can be used to execute instructions stored in the memory, and when the processor 2701 executes the instructions stored in the memory, the processor 2701 is used to execute the various steps and / or processes of the above-mentioned method embodiment.

[0596] It should be understood that in the embodiments of the present application, the processor may be a central processing unit (CPU), or may be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

[0597] During implementation, each step of the above method can be completed by an integrated logic circuit of hardware in a processor or by instructions in the form of software. The steps of the method disclosed in conjunction with the embodiments of the present application can be directly embodied as being executed by a hardware processor, or can be executed by a combination of hardware and software modules in the processor. The software module can be located in a storage medium mature in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in a memory, and the processor executes the instructions in the memory, and completes the steps of the above method in conjunction with its hardware. To avoid repetition, it will not be described in detail here.

[0598] The present application also provides a computer-readable storage medium, which is used to store a computer program, and the computer program is used to implement the method shown in the above method embodiment.

[0599] The present application also provides a computer program product, which includes a computer program (also referred to as code or instructions). When the computer program runs on a computer, the computer can execute the method shown in the above method embodiment.

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

[0601] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and modules described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

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

[0603] The modules described as separate components may or may not be physically separate, and the components shown as modules may or may not be physical modules, that is, they may be located in one place or distributed across multiple network modules. Some or all of the modules may be selected to achieve the purpose of the present embodiment according to actual needs.

[0604] In addition, each functional module in each embodiment of the present application may be integrated into one processing module, or each module may exist physically separately, or two or more modules may be integrated into one module.

[0605] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0606] The above description is merely a specific embodiment of the present application, but the scope of protection of the embodiments of the present application is not limited thereto. Any person skilled in the art can easily conceive of changes or substitutions within the technical scope disclosed in the embodiments of the present application, and such changes or substitutions should be included in the scope of protection of the embodiments of the present application. Therefore, the scope of protection of the embodiments of the present application should be based on the scope of protection of the claims.

Claims

1. A data transmission method, characterized in that, The method includes: When a first device in a first group sends a connection request to a second device in a second group, a first target device determines whether to resume a first service between the first target device and a third device; wherein, the first target device is the initiator of the first service; the first target device is in a dissolved group among the first group and the second group, and the third device is in the same group as the first target device; When the first target device determines to resume the first service, the first target device sends information for instructing to establish a physical link with a second target device to the third device, or the first target device establishes a physical link with the second target device; wherein, the second target device is the master device in a third group, and the third group is obtained by merging the first group and the second group.

2. The method according to claim 1, wherein When at least one of the following conditions is met, the first target device determines that it is necessary to resume the first service between the first target device and the third device: The first service belongs to a first preset type of service; The priority of the first service is higher than or equal to a preset priority; After displaying a first interface for determining whether to resume the first service, receiving an operation from the user for instructing to resume the first service; or, The information for instructing the third device is included in the list of services to be resumed stored by the first target device, and the information for instructing the third device is bound to a first identifier, and the first identifier indicates resuming the service.

3. The method according to claim 1 or 2, characterized in that, After the first service is disconnected and before the first service is resumed, the first target device and / or the third device display a masking interface of the first service.

4. The method according to claim 1 or 2, characterized in that, A fourth device is further included in the dissolved group among the first group and the second group, and a second service between the fourth device and the first target device is disconnected; The method further includes: The first target device determines whether to resume the second service; When the first target device determines not to resume the second service, the first target device sends information for instructing not to resume the service to the second target device.

5. The method according to claim 4, characterized in that, When the first target device determines that it is not necessary to resume the second service, the masking interface of the second service disappears.

6. The method according to any one of claims 1 to 5, characterized in that, The method further includes: After the first service is resumed, the first target device sends information for instructing to exit the service resuming state to the second target device; Receiving a response to exit the service resuming state from the second target device.

7. The method according to any one of claims 1 to 6, characterized in that The master device in the third group is determined from the master device of the first device in the first group and the master device of the second device in the second group.

8. The method according to claim 7, wherein The master device in the third group meets one or more of the following conditions: The master device in the third group is set with the ability to be the master device in the group; or, The master device in the third group is the device with the largest Media Access Control (MAC) address among the master device of the first group and the master device of the second group; Or, The master device in the third group is the device with the lowest power consumption per unit time among the master devices in the first group and the master devices in the second group; or, The master device in the third group is a plugged-in device.

9. The method according to any one of claims 1 to 8, characterized in that, The first target device determines whether to resume the first service between the first target device and the third device, including: When the first device and the second device have established the third service corresponding to the connection request, the first target device determines whether to resume the first service.

10. The method according to claim 9, wherein The first target device determines whether to resume the first service, including: When the first device and the second device have established the third service corresponding to the connection request, the first target device receives information from the second target device for indicating entry into the first state, and the first state is the state of resuming the disconnected service; In response to the information from the second target device for indicating entry into the first state, the first target device determines whether to resume the first service.

11. The method according to claim 10, wherein The data generated by the third service is transmitted using the first transmission channel between the first device and the second device, and the first transmission channel is established based on the physical link between the first device and the second device.

12. The method according to any one of claims 1 to 11, characterized in that, The method further includes: When the third device has established a physical link with the second target device and the first target device has established a physical link with the second target device, the first target device establishes a second transmission channel with the third device, and the second transmission channel is used to transmit the data generated by the first service; The first target device and / or the third device displays the interface of the first service.

13. A data transmission method, characterized in that, The method includes: The first device in the first group sends a connection request to the second device in the second group; The first device determines a second target device among the master devices in the first group and the master devices in the second group, and the second target device is the master device in the third group, and the third group is the group obtained by merging the first group and the second group; The first device instructs the master device in the target group to dissolve the target group, and the target group is the group that does not include the second target device in the first group and the second group; The first target device in the target group determines whether to resume the first service, and the first service is the service between the first target device and the third device in the target group, and the first target device is the initiator of the first service; If so, the first target device sends information for instructing to establish a physical link with the second target device to the third device, and / or, the first target device establishes a physical link with the second target device.

14. The method according to claim 13, wherein The connection request carries the device information of the devices in the first group or the information for indicating that the first device needs to be the master device in the group, and the method further includes: In response to the connection request, the second device sends information for indicating a connection conflict to the first device; The first device determines a second target device among the master device in the first group and the master device in the second group, including: In response to the information for indicating a connection conflict from the second device, the first device determines the second target device.

15. The method according to claim 14, characterized in that, The step that in response to the information for indicating a connection conflict from the second device, the first device determines the second target device, includes: In response to the information for indicating a connection conflict from the second device, the first device displays an interface for determining whether to perform network formation preemption; In response to an input operation by the user indicating network formation preemption, the first device determines the second target device.

16. The method according to any one of claims 13 to 15, characterized in that, The first device instructs the master device in the target group to dissolve the target group, including: The first device sends information for indicating initiating network formation preemption to the master device in the target group, and the information for indicating initiating network formation preemption includes information indicating that the master device of the third group is the second target device; The first device sends information for indicating dynamic network formation to the master device in the target group, and the dynamic network formation means dissolving the target group and joining the third group; In response to the information for indicating dynamic network formation and the information indicating that the master device of the third group is the second target device from the first device, the master device in the target group dissolves the target group.

17. The method according to any one of claims 13 to 16, characterized in that The method further includes: The first device sends information for indicating initiating network formation preemption to the second target device, and the information for indicating initiating network formation preemption includes: device information of the devices included in the target group and information indicating the initiator and the recipient of the connection request.

18. The method according to claim 17, characterized in that, After the first device sends the information for indicating initiating network formation preemption to the second target device, the method further includes: The second target device forwards the information for indicating initiating network formation preemption to the slave devices in the non-target group, and the non-target group is the group among the first group and the second group that includes the second target device; In response to the information for indicating initiating network formation preemption from the second target device, the slave devices in the non-target group send network formation preemption responses to the second target device; In response to the network formation preemption responses from the slave devices in the non-target group, the second target device sends the network formation preemption responses to the first device; In response to the network formation preemption responses from the second target device, the first device sends information for indicating dynamic network formation to the second target device; In response to the information for indicating dynamic network formation from the first device, the second target device forwards the information for indicating dynamic network formation to the slave devices in the non-target group.

19. The method according to claim 18, characterized in that After the first device sends the information for indicating dynamic network formation to the second target device, the method further includes: The second target device starts a first timer with a first duration. After the first timer times out, the second target device establishes a physical link with the second device or the first device; The second target device sends information for indicating entering the network recovery state to each device in the target group; The first target device in the target group determines whether to resume the first service, including: In response to the information for indicating entering the network recovery state, the first target device determines whether to resume the first service.

20. The method according to any one of claims 13 to 19, characterized in that, The method further includes: In response to the information for indicating establishing a physical link with the second target device, the third device establishes a physical link with the second target device.

21. The method according to claim 20, wherein After the third device establishes a physical link with the second target device, the method further includes: The third device sends information for indicating successful establishment of the physical link to the first target device; In response to the information for indicating successful establishment of the physical link, the first target device sends information for indicating establishing a second transmission channel to the third device, and the second transmission channel is used for transmitting data generated by the first service; In response to the information for indicating establishing the second transmission channel, the third device sends information for indicating successful establishment of the second transmission channel to the first target device.

22. The method according to claim 21, wherein After the third device sends the information for indicating successful establishment of the physical link to the first target device, the method further includes: The first target device increments a reference count by 1, and the reference count represents the number of times the first service references the physical link; The third device increments the reference count by 1.

23. An electronic device, characterized in that, Includes a module for executing the method according to any one of claims 1 to 22.

24. An electronic device, characterized in that, Includes: A processor, the processor is coupled with a memory, the memory is used for storing a computer program, and when the processor calls the computer program, the electronic device executes the method according to any one of claims 1 to 22.

25. A computer-readable storage medium, characterized in that, For storing a computer program, the computer program includes instructions for implementing the method according to any one of claims 1 to 22.

26. A chip system, characterized in that, Includes at least one processor and a communication interface, the communication interface and the at least one processor are interconnected by a line, and the at least one processor is used for running a computer program or instruction to execute the method according to any one of claims 1 to 22.

27. A computer program product, characterized in that, The computer program product includes computer program code, and when the computer program code runs on a computer, the computer implements the method according to any one of claims 1 to 22.

Citation Information

Patent Citations

  • Method and apparatus for handling topology in wireless communication system

    CN104429155A

  • Data transmission method under Wi-Fi direct connection and electronic equipment

    CN114679732A

  • Physical link establishment method and electronic equipment

    CN114928899A

  • Wi-Fi direct communication method and device

    CN115802516A

  • Changing topology of wireless peer-to-peer group

    US20150264123A1