Data transmission method and device

By establishing parallel physical links between terminal devices, the connection conflict problem is solved, the disconnected services are restored, and the user experience is improved.

CN120264495APending Publication Date: 2025-07-04HONOR DEVICE CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202311840393.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-12-27
Publication Date
2025-07-04

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 first device needs to establish a physical link with the second device in the second group, the first target device indicates its identification information to the multiple devices in the target group, and establishes a physical link with the multiple devices in the target group in parallel to restore the services in the disbanded group.

Benefits of technology

Reduce connection conflict scenarios, restore disconnected services, and improve user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120264495A_ABST
    Figure CN120264495A_ABST
Patent Text Reader

Abstract

The invention provides a data transmission method and device, and relates to the technical field of terminals. The scene of connection conflict between devices can be reduced, and the user experience is improved. The method comprises: when a first device in a first group sends a first connection request to a second device in a second group, a first target device indicates identification information of the first target device to a plurality of devices in a target group; wherein the first target device is a main device in a third group, the third group is a group obtained by combining the first group and the second group, and the target group is a disintegrated group in the first group and the second group; the first target device receives respective second connection requests from the plurality of devices, wherein the second connection requests are sent after the plurality of devices access the first target device by using the identification information; and in response to the second connection request, the first target device establishes physical links with the plurality of devices in the target group in parallel.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of terminals, and in particular, to a data transmission method and apparatus. Background Art

[0002] Multiple terminal devices can implement various services between terminal devices through the wireless fidelity (WiFi) direct connection technology. For example, multi-screen collaboration, mouse and keyboard sharing, and other services between terminal devices can be achieved through technologies such as peer-to-peer (P2P) direct connection, WiFi wireless access point (AP) and station (STA) connection.

[0003] Among them, multiple terminal devices that establish a WiFi direct connection can be called a group. For example, multiple terminal devices that establish a P2P direct connection can be called a P2P group; a group formed by multiple terminal devices that establish a WiFi AP-STA connection can be called an AP-STA group. However, when a terminal device connects to a terminal device in a group, connection conflicts may occur, such as the disconnection of services between terminal devices in the group, resulting in a poor user experience. Summary of the Invention

[0004] This application provides a data transmission method and apparatus, which can restore the services between devices in a dissolved group, reduce the scenarios of connection conflicts between devices, and thus improve the user experience.

[0005] In a first aspect, a data transmission method is provided. The method includes: when a first device in a first group sends a first connection request to a second device in a second group, a first target device indicates identification information of the first target device to multiple devices in a target group; where the first target device is the master device in a third group, the third group is a group obtained by merging the first group and the second group, and the target group is the dissolved group in the first group and the second group; the first target device receives second connection requests from each of the multiple devices, and the second connection requests are sent by the multiple devices after accessing the first target device using the identification information; in response to the second connection requests, the first target device establishes physical links with multiple devices in the target group in parallel.

[0006] In the data transmission method of this application, when a first device needs to establish a physical link with a second device in a second group and a connection conflict occurs, multiple devices in the dissolved groups in the first group and the second group can all establish physical links with a new master device, facilitating the establishment of services between the first device and the second device. At the same time, it can also restore the disconnected services in the dissolved group, reduce the scenarios of connection conflicts, and improve the user experience.

[0007] It should be understood that the target group can be disbanded after the first target device indicates identification information to multiple devices and before the first target device receives second connection requests from each of the multiple devices. The third group can be established after the first device determines the first target device. At this time, the third group is the group among the first group and the second group that includes the first target device. Subsequently, after multiple devices in the target group establish a physical link with the first target device, the multiple devices join the third group.

[0008] 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. At this time, it can also be said that the first device is the master device in the first group. The number of devices included in the second group can be multiple.

[0009] Among them, the first group can be, for example, the group where the first terminal device in the following text is located, and the first device can be, for example, the first terminal device in the following text. The second group can be, for example, the P2P group formed after the second terminal device and the third terminal device in the following text establish a physical link. The second device can be, for example, the second terminal device in the following text. The first target device can be, for example, the first terminal device in the following text. The first service can be, for example, the multi-screen collaboration service in the following text. The third group can be, for example, the first terminal device in the following text, and the first terminal device is the master device in the third group. After multiple devices establish a physical link with the first target device, if the multiple devices are the second terminal device and the third terminal device, the third group can be the group formed by the first terminal device, the second terminal device, and the third terminal device. The disbanded group among the first group and the second group can be, for example, the P2P group formed by the second terminal device and the third terminal device that is disbanded in the following text. The first connection request can be, for example, request 2 in the following text. The identification information can be, for example, the account number and password of the first terminal device in the following text. Or, the first device and the first target device can also be, for example, device 1 in the following text, the second group can be, for example, group 1 in the following text, the second device can be, for example, device 2 in the following text, and the master device of the target group can be, for example, device 3 in the following text.

[0010] When the number of devices included in the first group is multiple, the first group can be, for example, group 2 in the following text, the second group can be, for example, group 3 in the following text, the first device can be, for example, device 4 in the following text, the second device can be, for example, device 6 in the following text, and the first target device can be, for example, device 7 in the following text. The target group can be, for example, group 2 in the following text. The master device in the target group can be, for example, device 5 in the following text.

[0011] In combination with the first aspect, in certain implementations of the first aspect, after the first target device establishes physical links with multiple devices in the target group in parallel, the method further includes: the first target device separately sends information for instructing to enter a first state to a third device and a fourth device among the multiple devices, where the first state is a state of resuming a disconnected service, and a first service disconnected between the third device and the fourth device is resumed after receiving the information for instructing to enter the first state. In this way, after the first target device establishes physical links with the multiple devices, the multiple devices can resume the disconnected service based on the physical links established between the first target device and the multiple devices, which helps to improve the user experience.

[0012] It should be understood that the third device may be, for example, the second terminal device in the following text, and the fourth device may be, for example, the third terminal device in the following text. The first state may be, for example, the dynamic networking restoration state in the following text. Or, the third device may be, for example, device 4 in the following text, and the fourth device may be, for example, device 5 in the following text.

[0013] In combination with the first aspect, in certain implementations of the first aspect, after the first target device establishes physical links with multiple devices in the target group in parallel, the method further includes: obtaining information for instructing that a first transmission channel is successfully established, where the first transmission channel is a transmission channel between a first device and a second device, and the first transmission channel is used to transmit data generated by the operation of a second service corresponding to a first connection request; the first target device separately sends information for instructing to enter a first state to a third device and a fourth device among the multiple devices, including: in response to the information for instructing that the first transmission channel is successfully established, the first target device separately sends the information for instructing to enter the first state to the third device and the fourth device. In this way, the second service between the first device and the second device can be preferentially established. Since the second service is a service that the user newly triggers and needs to establish, the second service can be established first and then the first service can be resumed, which can meet the user's needs and reduce connection conflict scenarios.

[0014] It should be understood that when the first target device is neither the first device nor the second device, the first transmission channel needs to be established after the first device and the second device both establish physical links with the first target device; when the first target device is the first device or the second device, the first transmission channel needs to be established after a physical link is established between the first device and the second device. That is, the multiple devices include the devices belonging to the target group among the first device and the second device.

[0015] Among them, the first device and the first target device can be, for example, the first terminal device in the following text, the second device and the third device can be, for example, the second terminal device in the following text, and the fourth device can be, for example, the third terminal device in the following text. The first state can be, for example, the dynamic network restoration state in the following text. Or, the first device can be, for example, device 4 in the following text, the second device can be, for example, device 6 in the following text, and the first target device can be, for example, device 7 in the following text. The third device can be, for example, device 4 in the following text, and the fourth device can be, for example, device 5 in the following text.

[0016] In combination with the first aspect, in some implementation manners of the first aspect, obtaining information for indicating the successful establishment of the first transmission channel includes: the first target device sends information for indicating the establishment of the first transmission channel to the first device and receives information for indicating the successful establishment of the first transmission channel from the first device, where the first target device is not the first device; or, the first target device sends information for indicating the establishment of the first transmission channel to the second device and receives information for indicating the successful establishment of the first transmission channel from the second device, where the first target device is the first device. In this way, when the first target device is not the first device, the first device can indicate to the first target device that the first transmission channel is successfully established; when the first target device is the first device, the first target device can determine that the first transmission channel is successfully established, which facilitates the subsequent indication by the first target device to the third device and the fourth device to enter the dynamic network restoration state and restore the first service.

[0017] Among them, when the first target device is not the first device, the information for indicating the successful establishment of the first transmission channel can be sent by the initiating end of the first connection request to the first target device, that is, the first device indicates to the first target device.

[0018] The first device can be, for example, device 4 in the following text, the second device can be, for example, device 6 in the following text, and the first target device can be, for example, device 7 in the following text. The third device can be, for example, device 4 in the following text, and the fourth device can be, for example, device 5 in the following text. Or, the first device and the first target device can be, for example, the first terminal device in the following text, the third device can be, for example, the second terminal device in the following text, and the fourth device can be, for example, the third terminal device in the following text. The first state can be, for example, the dynamic network restoration state in the following text.

[0019] In combination with the first aspect, in some implementation manners of the first aspect, after the first service is disconnected and before the first service is restored, the third device and / or the fourth device display a mask interface of the first service; and / or, after the first service is restored, the third device and / or the fourth device display an interface of the first service. In this way, it is convenient to prompt the user that the first service is in the disconnected stage, but the first service may be restored subsequently.

[0020] Among them, the first device and the first target device may be, for example, the first terminal device in the following text, the third device may be, for example, the second terminal device in the following text, and the fourth device may be, for example, the third terminal device in the following text. The first service may be, for example, the multi-screen collaboration service in the following text.

[0021] In combination with the first aspect, in some implementation manners of the first aspect, the method further includes: after the first service is restored, the first target device respectively receives information from the third device and the fourth device for indicating to exit the first state; in response to the information from the third device and the fourth device for indicating to exit the first state, the first target device exits the first state. In this way, the first target device, the third device, and the fourth device can exit the first state, so that when other devices send connection requests to the first target device, the third device, or the fourth device, the first target device, the third device, or the fourth device can process the connection requests from other devices.

[0022] Among them, the first device and the first target device may be, for example, the first terminal device in the following text, the third device may be, for example, the second terminal device in the following text, and the fourth device may be, for example, the third terminal device in the following text. The first service may be, for example, the multi-screen collaboration service in the following text. The information for indicating to exit the first state may be, for example, the information for indicating to exit the dynamic networking restoration state in the following text.

[0023] In combination with the first aspect, in some implementation manners of the first aspect, after the first target device establishes physical links with multiple devices in the target group in parallel, the method further includes: receiving and saving the information from each of the multiple devices for indicating TCP / IP and ports, where the TCP / IP and ports are used to establish a TCP channel; sending the information for indicating the TCP / IP and ports of the third device to the fourth device; sending the information for indicating the TCP / IP and ports of the fourth device to the third device. The first service is restored by using the first TCP channel between the third device and the fourth device, and the first TCP channel is established by using the TCP / IP and ports of the third device and the TCP / IP and ports of the fourth device. Compared with transmission through Bluetooth, the stability of Bluetooth is poor, and when signaling exchanged between the third device and the fourth device is transmitted through the TCP channel, the phenomenon of signaling transmission failure is less, which can improve the success rate and efficiency of the restoration of the first service.

[0024] Among them, the first device and the first target device can be, for example, the first terminal device in the following text. The third device can be, for example, the second terminal device in the following text. The fourth device can be, for example, the third terminal device in the following text. The first service can be, for example, the multi-screen collaboration service in the following text. The information used to indicate exiting the first state can be, for example, the information used to indicate exiting the dynamic networking recovery state in the following text. The target group can be, for example, the P2P group established by the second terminal device and the third terminal device in the following text.

[0025] Combined with the first aspect, in some implementation manners of the first aspect, 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 first device in the second group.

[0026] Among them, the first device can be, for example, the first terminal device in the following text. The master device in the first group can be, for example, the first terminal device in the following text, and the master device in the second group can be, for example, the second terminal device in the following text. Or, the first device can be, for example, device 4 in the following text. The master device in the first group can be, for example, device 5 in the following text, and the master device in the second group can be, for example, device 7 in the following text.

[0027] Combined with the first aspect, in some implementation manners of the first aspect, the master device in the third group satisfies 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; or, the master device in the third group is the device with the smallest power consumption per unit time; or, the master device in the third group is a plugged-in device.

[0028] Among them, the first device can be, for example, the first terminal device in the following text. When selecting a device with the ability to be the master device in the group as the master device, it is convenient to improve the success rate of forming a new group; selecting the device with the smallest power consumption per unit time and / or selecting a plugged-in device makes the master device less sensitive to power consumption. Since the power consumption of the master device may be large, this can reduce the situation of the group disbanding due to insufficient power of the master device. Selecting the device with the largest MAC address can enable more types of slave devices to connect to this master device.

[0029] Combined with the first aspect, in some implementation manners of the first aspect, the second connection request is sent after the target group is disbanded. The target group is disbanded based on the information for indicating dynamic networking sent by the first device. Dynamic networking means disbanding the target group and joining the third group. The information for indicating dynamic networking carries identification information. In this way, the first device can indicate to multiple devices to disband the target group and access the first target device using the identification information.

[0030] It should be understood that the target group is disbanded based on the information used to indicate dynamic network formation and obtains identification information based on the information used to indicate dynamic network formation.

[0031] Among them, the first device may be, for example, the first terminal device in the following text. The target group may be, for example, a P2P group formed after the second terminal device and the third terminal device establish a physical link in the following text. The information used to indicate dynamic network formation may be, for example, the information used to indicate entering the dynamic network formation state in the following text. The disbanding of the target group may be, for example, the process in which the second terminal device disconnects the physical link and the third terminal device disconnects the physical link in the following text. Alternatively, the first device and the first target device may also be, for example, device 1 in the following text, and the target group may be, for example, group 1 in the following text. Alternatively, the target group may be, for example, group 2 in the following text, the first device may be, for example, device 4 in the following text, and the first target device may be, for example, device 7 in the following text.

[0032] Combined with the first aspect, in some implementation manners of the first aspect, the information used to indicate dynamic network formation is indicated by the first device to the master device in the target group and forwarded by the master device in the target group to the slave devices among multiple devices; the method further includes: the first target device sends identification information to the first device. In this way, when the first device is not the first target device, the first device can also determine the identification information. Forwarding the information used to indicate dynamic network formation by the master device in the target group to the slave devices in the target group helps reduce the power consumption of the first target device.

[0033] Among them, the target group may be, for example, group 2 in the following text, and the master device of the target group may be device 5. The first device may be, for example, device 4 in the following text, and the first target device may be, for example, device 7 in the following text. In group 2, device 5 can forward the information used to indicate dynamic network formation to the slave devices in group 2. The identification information of device 7 in the following text may be carried in the information used to indicate dynamic network formation.

[0034] Combined with the first aspect, in some implementation manners of the first aspect, the method further includes: the first target device receives the information used to indicate initiating network formation preemption from the first device, and the information used to indicate initiating network formation preemption carries the information indicating that the master device of the third group is the first target device; the first target device sends identification information to the first device, including: in response to the information used to indicate initiating network formation preemption, the first target device sends identification information to the first device. In this way, the first target device can determine that itself is the master device of the third group according to the information used to indicate initiating network formation preemption, and then send the identification information to the first device, facilitating subsequent access of multiple devices to the first target device using the identification information.

[0035] Among them, the first device can be, for example, device 4 in the following text, and the first target device can be, for example, device 7 in the following text. The information indicating that the new master device is device 7 in the following text can be carried in the information indicating the initiation of network formation preemption.

[0036] In a second aspect, another data transmission method is provided. The method includes: a first device in a first group sends a first connection request to a second device in a second group; the first device determines, among the master devices of the first group and the second group, that the master device of a third group is the first target device, where the third group is the group obtained by merging the first group and the second group; the first device indicates the identification information of the first target device to multiple devices in the target group, where the target group is the group dissolved from the first group and the second group; in the case where the target group is dissolved, each of the multiple devices accesses the first target device using the identification information and sends a second connection request of each of the multiple devices to the first target device respectively; in response to the second connection request, the first target device establishes physical links with multiple devices in the target group in parallel.

[0037] In combination with the second aspect, in some implementation manners of the second aspect, the method further includes: in response to the first connection request, the second device sends information indicating a connection conflict to the first device; the first device determines, among the master devices of the first group and the second group, that the master device of the third group is the first target device, including: in response to the information indicating a connection conflict, the first device determines the first target device.

[0038] In combination with the second aspect, in some implementation manners of the second aspect, the first target device is not the first device; after the first device determines, among the master devices of the first group and the second group, that the master device of the third group is the first target device, the method further includes: the first device sends information indicating that the master device of the third group is the first target device to the first target device; in response to the information indicating that the master device of the third group is the first target device, the first target device sends identification information to the first device.

[0039] In combination with the second aspect, in some implementation manners of the second aspect, the first device indicates the identification information of the first target device to multiple devices in the target group, including: the first device sends information indicating dynamic network formation to the master device in the target group, where the information indicating dynamic network formation carries the identification information; the master device in the target group forwards the information indicating dynamic network formation to the slave devices in the target group respectively.

[0040] In combination with the second aspect, in some implementations of the second aspect, the method further includes: in response to information from the first device indicating dynamic network formation, the master device of the target group deletes the physical link with the slave devices among the multiple devices; in response to information from the master device in the target group indicating dynamic network formation, the slave devices in the target group delete the physical link with the master device in the target group; the target group is disbanded.

[0041] In combination with the second aspect, in some implementations of the second aspect, the respective second connection requests of the multiple devices carry information indicating the respective multiple devices; the first target device establishes physical links with multiple devices in the target group in parallel, including: the first target device stores in parallel the information indicating the respective multiple devices; the first target device sends information indicating successful establishment of the physical link to the multiple devices respectively.

[0042] Among them, the information indicating the respective multiple devices can be understood as the information indicating the device itself. For example, for the second connection request sent by device A among the multiple devices to the first target device, the second connection request carries the information indicating device A, such as the device ID of device A, etc.

[0043] In combination with the second aspect, in some implementations of the second aspect, after the first target device establishes physical links with multiple devices in the target group in parallel, the method further includes: the first target device obtains information indicating successful establishment of the first transmission channel, where the first transmission channel is the transmission channel between the first device and the second device, and the first transmission channel is used to transmit data generated by the operation of the second service corresponding to the first connection request; in response to the information indicating successful establishment of the first transmission channel, the first target device sends information indicating entry into the first state to the third device and the fourth device among the multiple devices respectively, where the first state is the state of resuming the disconnected service; in response to the information indicating entry into the first state, the third device and the fourth device establish a second transmission channel and resume the first service, where the second transmission channel is used to transmit data generated by the operation of the first service, and the first service is the service that was disconnected between the third device and the fourth device.

[0044] In combination with the second aspect, in some implementations of the second aspect, after resuming the first service, the method further includes: the third device and the fourth device send information indicating exit from the first state to the first target device respectively; in response to the information indicating exit from the first state from the third device and the fourth device, the first target device sends a response to exit the first state to the third device and the fourth device respectively.

[0045] In combination with the second aspect, in some implementations of the second aspect, the third device establishes a second transmission channel with the fourth device, including: the third device sends information for indicating multiplexing a physical link to the fourth device, and the third device is the initiating end of the first service; in response to the information for indicating multiplexing a physical link, the fourth device sends information for indicating successful physical link multiplexing to the third device, and the information for indicating successful physical link multiplexing carries the device Internet Protocol (IP) of the fourth device; in response to the information for indicating successful physical link multiplexing, the third device sends information for indicating establishing a transmission channel to the fourth device, and the information for indicating establishing a transmission channel carries the device IP of the third device; in response to the information for indicating establishing a transmission channel, the fourth device sends information for indicating successful establishment of the transmission channel to the third device.

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

[0047] In a fourth aspect, an embodiment of the present application provides a data transmission device, which may be an electronic device, or a chip or a chip system within the 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 used to perform the display step so that the electronic device implements 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 further include a storage unit, and the storage unit may be a memory. The storage unit is used to store instructions, and the processing unit executes the instructions stored in the storage unit so that the electronic device implements 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 a chip system within the electronic device, the processing unit may be a processor. The processing unit executes the instructions stored in the storage unit so that the electronic device implements 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 (such as a register, a cache, etc.), or a storage unit outside the chip within the electronic device (such as a read-only memory, a random access memory, etc.).

[0048] Exemplarily, assume that the device is a first target device, which includes a display unit and a processing unit. The display unit is used to display a mask interface of a first service. The processing unit is used to establish a physical link with a third device.

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

[0050] It should be noted that the devices for executing each step in the first aspect, any possible implementation manner of the first aspect, the second aspect, or any possible implementation manner of the second aspect may be different devices. In the first aspect, any possible implementation manner of the first aspect, the second aspect, or any possible implementation manner of the second aspect, if a certain step is executed by a certain device, then for that step or implementation manner, the corresponding data transmission device may be that device. Exemplarily, in the second aspect, when a first device sends a connection request to a second device, the corresponding data transmission device for this step may be the first device; when a first target device determines whether to resume a first service, the corresponding data transmission device for this step may be the first target device. For the sake of brevity, these are not listed one by one.

[0051] In a fifth aspect, an embodiment of the present application provides an electronic device, including a processor and a memory. The memory is used to store code instructions, and the processor is used to run the code instructions to execute the methods described in the first aspect, any possible implementation manner of the first aspect, the second aspect, or any possible implementation manner of the second aspect.

[0052] 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 runs on a computer, the computer is caused to execute the methods described in the first aspect, any possible implementation manner of the first aspect, the second aspect, or any possible implementation manner of the second aspect.

[0053] In a seventh aspect, an embodiment of the present application provides a computer program product including a computer program. When the computer program runs on a computer, the computer is caused to execute the methods described in the first aspect, any possible implementation manner of the first aspect, the second aspect, or any possible implementation manner of the second aspect.

[0054] In an eighth aspect, the present application provides a chip or a chip system, which includes at least one processor and a communication interface. The communication interface and the at least one processor are interconnected by a line. 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 manner of the first aspect, the second aspect, or any possible implementation manner of the second aspect. Among them, the communication interface in the chip may be an input / output interface, a pin, a circuit, etc.

[0055] In a possible implementation, the chip or the chip system described above in the present application further includes at least one memory, and instructions are stored in the at least one memory. The memory may be a storage unit inside the chip, such as a register, a cache, etc., or it may be a storage unit of the chip (such as a read-only memory, a random access memory, etc.).

[0056] 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. The beneficial effects obtained by each aspect and the corresponding feasible implementation manners are similar and will not be elaborated herein. BRIEF DESCRIPTION OF THE DRAWINGS

[0057] Figure 1 It is a schematic diagram of a physical link and a transmission channel provided by an embodiment of the present application;

[0058] Figure 2 It is a schematic diagram of a scenario applicable to the method provided by an embodiment of the present application;

[0059] Figure 3 It is a schematic block diagram of the structure of a terminal device provided by an embodiment of the present application;

[0060] Figure 4 It is a schematic software structure diagram of a terminal device provided by an embodiment of the present application;

[0061] Figure 5 It is a schematic software structure diagram of another terminal device provided by an embodiment of the present application;

[0062] Figure 6 It is a schematic flowchart of the device discovery and multi-screen collaboration service establishment process in a data transmission method provided by an embodiment of the present application;

[0063] Figure 7 It is a schematic flowchart of the networking negotiation process in a data transmission method provided by an embodiment of the present application;

[0064] Figure 8 It is a schematic flowchart of the dynamic networking process in a data transmission method provided by an embodiment of the present application;

[0065] Figure 9Schematic flowchart of the dynamic network formation recovery process in a data transmission method provided by an embodiment of the present application;

[0066] Figure 10 Schematic interface diagram of the first notebook computer provided by an embodiment of the present application;

[0067] Figure 11 Schematic interface diagram of the first mobile phone provided by an embodiment of the present application;

[0068] Figure 12 Schematic interface diagram of the second mobile phone provided by an embodiment of the present application;

[0069] Figure 13 Schematic interface diagram of the first tablet computer provided by an embodiment of the present application;

[0070] Figure 14 Schematic interface diagram of the second tablet computer provided by an embodiment of the present application;

[0071] Figure 15 Schematic interface diagram of the third tablet computer provided by an embodiment of the present application;

[0072] Figure 16 Schematic interface diagram of the fourth tablet computer provided by an embodiment of the present application;

[0073] Figure 17 Schematic interface diagram of the third mobile phone provided by an embodiment of the present application;

[0074] Figure 18 Schematic interface diagram of the second notebook computer provided by an embodiment of the present application;

[0075] Figure 19 Schematic interface diagram of the third notebook computer provided by an embodiment of the present application;

[0076] Figure 20 Schematic interface diagram of the fifth tablet computer provided by an embodiment of the present application;

[0077] Figure 21 Schematic interface diagram of the fourth notebook computer provided by an embodiment of the present application;

[0078] Figure 22 Schematic flowchart of another data transmission method provided by an embodiment of the present application;

[0079] Figure 23 Schematic flowchart of yet another data transmission method provided by an embodiment of the present application;

[0080] Figure 24 Schematic flowchart of still another data transmission method provided by an embodiment of the present application;

[0081] Figure 25 Schematic block diagram of the data transmission device provided in the embodiment of the present application. Detailed implementation manners

[0082] The technical solutions in the present application will be described below with reference to the accompanying drawings.

[0083] In the embodiments of the present application, terms such as "first" and "second" are used to distinguish identical or similar items with basically the same functions and effects. For example, the first value and the second value are only used to distinguish different values, and do not limit their sequence. Those skilled in the art can understand that terms such as "first" and "second" do not limit the quantity and execution order, and "first", "second", etc. do not necessarily mean different.

[0084] It should be noted that in the embodiments of the present application, words such as "exemplarily" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design solution described as "exemplarily" or "for example" in the present application should not be construed as being more preferred or having more advantages than other embodiments or design solutions. Rather, the use of words such as "exemplarily" or "for example" is intended to present relevant concepts in a specific manner.

[0085] In the embodiments of the present application, "at least one" means one or more, and "a plurality" means two or more. "And / or" describes the association relationship of associated objects and indicates that three relationships may exist. For example, A and / or B may represent: A exists alone, A and B exist simultaneously, and B exists alone, where A and B may be singular or plural. The character " / " generally indicates that the associated objects before and after are in an "or" relationship. "At least one (item)" or its similar expression refers to any combination of these items, including any combination of single item (item) or plural items (items). For example, at least one (item) of a, b, or c may represent: a, b, c, a - b, a - c, b - c, or a - b - c, where a, b, c may be single or multiple.

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

[0087] 1. A terminal device can be referred to as a terminal, user equipment (UE), mobile station (MS), mobile terminal (MT), etc. For example, the terminal device can be a mobile phone, smart TV, wearable device, tablet computer (Pad), a computer with wireless transceiver function, virtual reality (VR) terminal device, augmented reality (AR) terminal device, wireless terminal in industrial control, wireless terminal in self-driving, wireless terminal in remote medical surgery, wireless terminal in smart grid, wireless terminal in transportation safety, wireless terminal in smart city, wireless terminal in smart home, and so on. Embodiments of the present application do not limit the specific technologies and specific device forms adopted by the terminal device.

[0088] 2. Peer-to-peer (P2P) direct connection, which can also be called wireless fidelity (WiFi) direct connection, is a kind of technology in WiFi direct connection technology. It is 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 the peer device without the intervention of WiFi.

[0089] Establishing a P2P direct connection between terminal devices usually requires the following four processes: WiFi P2P device discovery process, group formation process, WiFi protected setup (WPS) process, and association connection process. Through these four processes, a P2P group is formed among multiple terminal devices that establish P2P direct connection. The P2P group can also be called a WiFi P2P group, etc. The terminal devices in the P2P group are respectively one of the two roles of group owner (GO) and group client (GC). Among them, the number of GOs can be one, and the GCs establish P2P connections with the GO respectively.

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

[0091] 4. Multi-screen collaboration, also known as multi-screen sharing, multi-screen cooperation, etc., refers to the ability to transmit digital multimedia content between different terminal devices through a wireless network connection. It is possible to synchronize the display content of the screen of a peer terminal device on the local terminal device, and it is also possible to control the peer terminal device on the screen of the local terminal device.

[0092] 5. Keyboard and mouse sharing, also known as shared keyboard and mouse, keyboard and mouse sharing, or SYNERGY, etc., is a technology that uses a set of keyboard and mouse to control multiple terminal devices simultaneously. This set of keyboard and mouse can be connected to the local terminal device, and the user can use this set of keyboard and mouse to control both the local terminal device and the peer terminal device. Exemplarily, when the local terminal device initiates a keyboard and mouse sharing service with the peer terminal device, the mouse of the local terminal device can cross over to the display interface of the peer terminal device to control the peer terminal device.

[0093] Currently, information interaction and data transmission between terminal devices can be achieved through technologies such as P2P direct connection and WiFi AP-STA. Exemplarily, a mobile phone and a tablet computer can achieve functions such as multi-screen collaboration and keyboard and mouse sharing through P2P direct connection.

[0094] It should be noted that the realization of functions such as multi-screen collaboration and keyboard and mouse sharing between multiple terminal devices depends on the transmission channels between the multiple terminal devices, and the transmission channels between the multiple terminal devices are established relying on physical links.

[0095] 6. A physical link, also known as a WiFi physical link or a physical channel, etc., 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, etc. Only one physical link can be established between two terminal devices.

[0096] It should be noted that in the embodiments of the present application, when a terminal device establishes a Wi-Fi direct connection, it can also be considered that a physical link is established between terminal devices. Exemplarily, when a P2P direct connection is established between terminal devices, the physical link established between the terminal devices is a Wi-Fi P2P link.

[0097] Therefore, in the embodiments of the present application, the physical link can also be understood as a Wi-Fi direct connection, a P2P connection, a P2P direct connection, or a Wi-Fi AP-STA connection, etc. Exemplarily, 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 Wi-Fi AP-STA connection between the first terminal device and the second terminal device. The present application does not make specific limitations on this.

[0098] Among them, 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, and 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.

[0099] 7. A transmission channel is a channel for transmitting data established 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 other multiple terminal devices, and each transmission channel can be used to transmit a type of service data. The terminal device can establish a transmission channel with the peer device based on the device IP of the peer device. For example, the local device can use the device IP of the peer device to call the protocol stack of the local device to establish a transmission channel with the peer device, so that the data of the local device can be transmitted to the peer device through this transmission channel.

[0100] The following Figure 1 , taking the example of three terminal devices forming a P2P group, further illustrates the physical link and the transmission channel.

[0101] Figure 1 is a schematic diagram of a physical link and a transmission channel provided for the embodiments of the present application. As Figure 1As shown in the figure, a P2P group is formed among the terminal device 110, the terminal device 120, and the terminal device 130. Among them, the terminal device 110 is the GO in this P2P group, and the terminal device 120 and the terminal device 130 are the GCs in this P2P group.

[0102] As Figure 1 shown in (a) of the figure, the terminal device 120 and the terminal device 130 respectively establish P2P direct connections with the terminal device 110, that is, a physical link is established between the terminal device 120 and the terminal device 110 respectively, and between the terminal device 130 and the terminal device 110 respectively.

[0103] As Figure 1 shown in (b) of the figure, in order to enable the multi-screen collaboration 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 keyboard and mouse sharing service data; a transmission channel is established between the terminal device 120 and the terminal device 130 for transmitting multi-screen collaboration service data. Among them, in the process of the terminal device 120 and the terminal device 130 transmitting service data through the transmission channel, the service data can be forwarded by the terminal device 110. For example, when the terminal device 120 sends service data to the terminal device 130, the service data can be forwarded by the terminal device 110 to the terminal device 130.

[0104] It should be understood that when multiple terminal devices realize services between terminal devices through WiFi direct connection other than establishing P2P direct connection, in the group formed by these multiple terminal devices, the relationship between the physical link and the transmission channel between terminal devices is similar to the relationship Figure 1 shown in the figure, and reference can be made to the above description, which will not be elaborated here.

[0105] 8. The group can be disbanded by disconnecting the physical link between the master device and each slave device in the group, or by disconnecting the WiFi direct connection between the master device and each slave device in the group. For example, the disbanding of the P2P group can be understood as the disconnection of the P2P direct connection between the GO and each GC in this group.

[0106] In the case where a first terminal device needs to establish a WiFi direct connection with a terminal device in an already established first group, if the role of the first terminal device can only be the master device, or the first terminal device has already established a WiFi direct connection with other terminal devices, a connection conflict will occur, resulting in the disbanding of the first group, causing 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.

[0107] Exemplarily, due to hardware limitations and / or protocol limitations, a laptop cannot be fully compatible with the P2P direct connection of the Android system, so that the laptop can only be used as a GO to connect to other terminal devices. When the laptop connects to a terminal device in a P2P group, since there is already a GO in the P2P group, a connection conflict will occur. As a result, the laptop cannot establish a P2P direct connection with the terminal device in the P2P group, or, the laptop establishes a P2P direct connection with the terminal device in the P2P group, but the P2P direct connection between the terminal devices in the P2P group is disconnected.

[0108] To solve the above 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 be used as a master device, or the first terminal device belongs to group a. Then, the first terminal device can determine a new master device among the master devices of group a and the master device of group b, and then enable multiple devices in the disconnected group to establish a WiFi direct connection with the new master device. In this way, while enabling the establishment of a new service that needs to be established, the disconnected service can also be restored, which can reduce the scenarios of connection conflicts and improve the user experience.

[0109] The following combines Figure 2 , taking the establishment of a P2P direct connection between terminal devices as an example, to illustrate the scenarios in which the method provided in the embodiments of the present application is used.

[0110] Figure 2 This is a schematic diagram of a scenario provided by the embodiments of the present application. As Figure 2 shown, the scenarios applicable to the method provided by the embodiments of the present application include but are not limited to the following several types.

[0111] Scenario 1: Terminal device 201 has already established a P2P direct connection with terminal device 202, and the role of terminal device 201 is GO, and the role of terminal device 202 is GC. Terminal device 203 initiates a P2P direct connection with terminal device 201. Terminal device 203 can only be used as a GO, so that a connection conflict occurs when terminal device 203 is connected to terminal device 201 as a GO. Therefore, a new P2P group needs to be established.

[0112] The new GO in the new P2P group can be determined by the initiating terminal device 203. Since terminal device 203 can only be used as a GO, while terminal device 201 can be used as both a GO and a GC. Therefore, in the new P2P group, terminal device 203 is the new GO. Terminal device 201 and terminal device 202 are respectively connected to terminal device 203 as GCs.

[0113] Scenario 2: The terminal device 204 has established a P2P direct connection with the terminal device 205, forming the first P2P group. The terminal device 206 has established a P2P direct connection with the terminal device 207, forming the second P2P group. The terminal device 207 initiates a P2P direct connection with the terminal device 205. Since the GC can only establish a P2P direct connection with the GO, a connection conflict will occur. Therefore, a new P2P group needs to be established.

[0114] The new GO in the new P2P group can be determined by the initiating terminal device 207 from the GOs in the first P2P group and the second P2P group. Since the GO in the second P2P group, that is, the terminal device 206, can only be a GO, while the terminal device 204 can be either a GO or 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 disbanded, that is, the P2P direct connection between the terminal device 204 and the terminal device 205 is disconnected. Then, the terminal devices 205 and 204 are connected to the terminal device 206 as GCs.

[0115] Scenario 3: The terminal device 208 has established P2P direct connections with the terminal device 209 and the terminal device 210 respectively, forming the third P2P group. The terminal device 211 initiates a P2P direct connection with the terminal device 208. Since the GO can only establish a P2P direct connection with the GC, a connection conflict will occur. 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 211 from the GO in the third P2P group and the terminal device 211. Since the terminal device 211 can only be a GO, while the terminal device 208 can be either a GO or a GC. Therefore, in the new P2P group, the terminal device 211 is the new GO. The third P2P group needs to be disbanded, that is, the P2P direct connection between the terminal device 208 and the terminal device 209 is disconnected, and the P2P direct connection between the terminal device 208 and the terminal device 210 is disconnected. Then, the terminal devices 208, 209, and 210 are connected to the terminal device 211 as GCs respectively.

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

[0118] The new GO in the new P2P group can be determined by the initiating end terminal device 215 from the GOs in the fourth P2P group and the fifth P2P group. Since the GO in the fourth P2P group, i.e., the terminal device 212, can only act as a GO, while the terminal device 215 can act as both a GO and a 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 GO in the fifth P2P group disconnects all P2Ps with GCs. The fifth P2P group is dissolved, i.e., the P2P direct connection between the terminal device 215 and the terminal device 216 is disconnected. The terminal devices 215 and 216 are respectively connected to the terminal device 212 as GCs.

[0119] Scenario 5: The terminal device 217 has respectively established P2P direct connections with the terminal devices 218 and 219 to form the sixth P2P group. The terminal device 220 has respectively established P2P direct connections with the terminal devices 221 and 222 to form the seventh P2P group. The terminal device 220 initiates a P2P direct connection with the terminal device 217. Since a GC can only establish a P2P direct connection with a GO, a connection conflict will occur. Therefore, a new P2P group needs to be established.

[0120] The new GO in the new P2P group can be determined by the initiating end terminal device 220 from the GOs in the sixth P2P group and the seventh P2P group. Since the GO in the sixth P2P group, i.e., the terminal device 217, can only act as a GO, while the terminal device 220 can act 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 dissolved, i.e., 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 devices 220, 221, and 222 are respectively connected to the terminal device 217 as GCs.

[0121] It should be noted that Figure 2 The scenarios shown are only examples of several scenarios applicable to the method provided in the embodiments of the present application. The method provided in the embodiments of the present application can also be applicable 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. The present application does not make specific limitations in this regard.

[0122] It should also be noted that for scenarios of establishing Wi-Fi direct connections other than P2P direct connections between terminal devices, such as the scenario of establishing an AP-STA connection, it is similar to the scenario of establishing a P2P direct connection between terminal devices shown above. Figure 2 In some possible implementation manners, when establishing an AP-STA connection between terminal devices, Figure 2 the GO in [reference] can be replaced by an AP, and the GC can be replaced by an STA. For the sake of brevity, the scenarios of establishing other Wi-Fi direct connections between terminal devices will not be elaborated here.

[0123] To better understand the terminal device in the embodiments of the present application, the following will Figure 3 describe in detail the hardware structure of the terminal device in the embodiments of the present application.

[0124] Figure 3 FIG. [figure number] is a schematic structural diagram of the terminal device 300 provided in the embodiments of the present application. As Figure 3 shown, 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 key 390, an indicator 392, a camera 393, and a display screen 394, etc.

[0125] It can 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 those shown in the figure, or combine certain components, or split certain components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0126] 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 also be provided in the processor 310 for storing instructions and data. Among them, different processing units may be independent devices or integrated in one or more processors.

[0127] 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, etc.

[0128] 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 general-purpose serial data bus for asynchronous communication; the MIPI interface can be used to connect the processor 310 to peripheral devices such as the display screen 394 and the camera 393; the MIPI interface includes a camera serial interface (CSI), a display serial interface (DSI), etc.; the GPIO interface can be configured by software; the GPIO interface can be configured as a control signal or a data signal.

[0129] The USB interface 330 is an interface that complies with the USB standard specification, and can specifically be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 330 can be used to connect a charger to charge the terminal device 300, can also be used to transfer data between the terminal device 300 and peripheral devices, and can also be used to connect headphones to play audio through the headphones. This interface can also be used to connect other electronic devices, such as AR devices, etc.

[0130] It can be understood that the interface connection relationships between the modules illustrated in the embodiments of this application are only illustrative and do not constitute a structural limitation on the terminal device 300. In other embodiments of this application, the terminal device 300 can also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.

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

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

[0133] Among them, antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals.

[0134] The mobile communication module 350 can provide solutions for wireless communications such as 2G / 3G / 4G / 5G applied to the terminal device 300.

[0135] The modulation and demodulation processor may include a modulator and a demodulator. Among them, 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. Subsequently, the demodulator 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 transmitted to the application processor. The application processor outputs a sound signal through an audio device (not limited to speakers, receivers, etc.), or displays an image or video through the display screen 394. In some embodiments, the modulation and demodulation processor may be an independent device. In other embodiments, the modulation and demodulation processor may be independent of the processor 310 and be provided in the same device as the mobile communication module 350 or other functional modules.

[0136] The wireless communication module 360 may provide solutions for wireless communications applied to the terminal device 300, including wireless local area networks (WLANs) (such as wireless fidelity (WiFi) networks), Bluetooth (BT), global navigation satellite systems (GNSS), frequency modulation (FM), near field communication (NFC), infrared technology (IR), etc.

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

[0138] The terminal device 300 realizes the display function through the GPU, the display screen 394, and the application processor, etc. The GPU is a microprocessor for image processing, connected to 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, which execute program instructions to generate or change the display information.

[0139] The display screen 394 is used to display images, videos, etc. The 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, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the terminal device 300 may include one or N display screens 394, where N is a positive integer greater than 1.

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

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

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

[0143] 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 through the external memory interface 320 to implement the data storage function. For example, files such as music and videos are saved in the external memory card.

[0144] The internal memory 321 can be used to store computer-executable program code, and the executable program code 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.

[0145] The terminal device 300 can implement audio functions through the audio module 370, speaker, receiver, microphone, headphone jack, and application processor, etc. For example, music playback, recording, etc.

[0146] The keys 390 include a power-on key, volume keys, etc. The keys 390 can be mechanical keys or touch keys. The terminal device 300 can receive key inputs and generate key signal inputs related to the user settings and function controls of the terminal device 300.

[0147] The indicator 392 can be an indicator light, which can be used to indicate the charging state, power change, and can also be used to indicate messages, missed calls, notifications, etc.

[0148] The software system of the terminal device can adopt a layered architecture, event-driven architecture, microkernel architecture, microservices architecture, or cloud architecture. The following combines Figure 4 and Figure 5 , taking the Android system and Windows system with a layered architecture as examples, to exemplarily illustrate the process of establishing a WiFi direct connection between the terminal device 401 and the terminal device 402, and the process of establishing a WiFi direct connection between the terminal device 501 and the terminal device 502. The WiFi direct connection can include, but is not limited to, P2P direct connection or AP-STA connection.

[0149] Among them, the hardware structures of the terminal device 401, terminal device 402, terminal device 501, and terminal device 502 can be as Figure 3 shown. The Android system is installed on the terminal device 401, terminal device 501, and terminal device 502 respectively; the Windows system is installed on the terminal device 402. For the convenience of understanding, first combine Figure 4 , and explain the layered architecture of the Android system and the terms involved.

[0150] As Figure 4 shown, the layered architecture divides the software system of the terminal device 401 into several layers, and each layer has a clear role 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 are the application layer, application framework layer, Android runtime, system libraries, kernel layer, and hardware layer.

[0151] 1. The application layer can include a series of application packages that users can directly access, and it is the window for users to interact with the terminal device. Exemplarily, the application packages can include WiFi, Bluetooth, PC Manager, etc.

[0152] Among them, the PC Manager can include a smart connection and device discovery module.

[0153] 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 of 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.

[0154] 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., and the present application does not make specific limitations on this.

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

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

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

[0158] Among them, the transmission module can instruct the WiFi connection module to establish or disconnect the WiFi direct connection between the terminal devices when the terminal device 401 establishes a WiFi direct connection with the terminal device 402 or disconnects the WiFi direct connection with the terminal device 402. It is also possible to establish a transmission channel between the terminal devices 402 based on the WiFi direct connection established by the WiFi connection module. The smart interconnection of the terminal device 401 can use the transmission channel to transmit data with the smart interconnection of the terminal device 402.

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

[0160] The WiFi direct dynamic networking control module may, based on an indication from the transmission module to establish or disconnect a WiFi direct connection between terminal devices, call the WiFi direct connection counting module to increment or decrement the reference count of the physical link with terminal device 402; or, based on an indication from the transmission module to establish or disconnect a WiFi direct connection between terminal devices 402, call the WiFi direct module to instruct the WiFi connection service to establish or disconnect a WiFi direct connection between terminal devices.

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

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

[0163] The core library consists of two parts: one part is the functional functions that need to be called by the Java language, and the other part is the core library of Android.

[0164] The application layer and the application framework layer run in the virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform functions such as object lifecycle management, stack management, thread management, security and exception management, and garbage collection.

[0165] 4. The system library may include multiple functional modules. For example: Function Libraries, graphics processing libraries (such as: OpenGL ES), WiFi connection service, etc.

[0166] The function library provides API interfaces for developers to provide various services, facilitating developers to quickly integrate and implement various functions.

[0167] The graphics processing library is used to implement graphics drawing, image rendering, composition, and layer processing, etc.

[0168] The WiFi connection service can call an interface to control the driver of the kernel layer. For example, the WiFi connection service can call an interface of the WiFi Management (Manager) type. The interfaces of the WiFi Management type include: interfaces such as discoverPeers and connect, which can be directly controlled by the user for WiFi direct connection. Among them, the WiFi connection service can discover devices by calling the discover device interface; calling the connect interface can enable the WiFi driver to drive the WiFi chip to establish or disconnect the WiFi direct connection with the terminal device 402.

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

[0170] 6. The Android system can also include Figure 4 a hardware layer not shown in the figure. The hardware layer can include various hardware, such as a display screen, a GPU, a WiFi chip, etc.

[0171] Then, in combination with Figure 4 , the layered architecture of the Windows system and the related terms will be explained.

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

[0173] Among them, the user mode includes user application processes, system processes, and service processes. The kernel mode includes the kernel layer.

[0174] 1. User application processes can include a series of application program packages that users can directly access, and are the windows for users to interact with the terminal device. Exemplarily, the application program packages can include WiFi, Bluetooth, PC Manager, etc. Among them, the PC Manager can include intelligent interconnection and device discovery modules.

[0175] 2. System processes and service processes provide application programming interfaces (APIs) and programming frameworks for the application programs of user application processes. System processes and service processes include some predefined functions. As Figure 4 shown, system processes and service processes can include a transmission module, a WiFi connection module, a security authentication module, and a WiFi connection service, etc.

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

[0177] It should be understood that the specific functions and terms of each software module involved in the Windows system are similar to those of each software module involved in the above Android system, and reference can be made to the description above, which will not be elaborated here.

[0178] Figure 4 This is a schematic diagram of the process of establishing a service between a terminal device 401 installed with an Android system and a terminal device 402 installed with a Windows system in an embodiment of the present application. The device discovery module of the terminal device 401 can interact with the driver through the application framework layer, so that the driver can drive the hardware in the terminal device 401 to send and receive signals, thereby obtaining the device information of the terminal device 402; the device discovery module of the terminal device 402 can interact with the driver through the system process and the service process, so that the driver can drive the hardware in the terminal device 402 to send and receive signals, thereby obtaining the device information of the terminal device 401. In this way, the terminal device 401 and the terminal device 402 can respectively display the peer device through intelligent interconnection.

[0179] Based on the selection operation of the user instructing the terminal device 401 to establish a service with the terminal device 402, the WiFi connection module of the terminal device 401 and the WiFi connection module of the terminal device 402 can perform signaling interaction, so that the slave device in the two devices can obtain the account and password of the master device. In this way, the WiFi connection module of the slave device can use the account and password of the master device to call the connection interface of the WiFi module through the WiFi connection service, so that the WiFi drives the WiFi chip to connect to the master device, enabling the terminal device 401 to establish a WiFi direct connection with the terminal device 402, or, it can also be said that the terminal device 401 establishes a physical link with the terminal device 402.

[0180] Furthermore, the transmission modules of the terminal device 401 and the terminal device 402 can perform signaling interaction, so that the terminal device 401 and the terminal device 402 can obtain the device IP of the peer device, so as to establish a transmission channel between the terminal device 401 and the terminal device 402. Then, the terminal device 401 and the terminal device 402 can use this transmission channel to transmit the data generated by the service between the terminal device 401 and the terminal device 402, so that the service between the terminal device 401 and the terminal device 402 can run normally.

[0181] Figure 5 This is a schematic diagram of the 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 in an embodiment of the present application.

[0182] It should be understood that the software structures of the terminal devices 501 and 502 are the same as that of the terminal device 401, and reference can be made to the description of the Android system of the terminal device 401 above; the process of establishing a service between the terminal device 501 and the terminal device 502 is similar to the process of establishing a service between the terminal device 401 and the terminal device 402 above, and reference can be made to the description above, which will not be elaborated here.

[0183] It should be noted that in the embodiments of the present application, the Android system and the Windows system are taken as examples for illustration, but the basic principles thereof are equally applicable to terminal devices using other operating systems, and the present application does not limit the operating systems used by the terminal devices.

[0184] It should also be noted that in the embodiments of the present application, the Android system and the Windows system are taken as examples for illustration, but the Android system and the Windows system used by the terminal devices may further include more or fewer layers, or include more or fewer software modules. And, Figure 4 and Figure 5 the names of the software modules shown in are only examples, and each module may also have other names. Figure 4 and Figure 5 the Android system and the Windows system shown do not constitute a limitation to the embodiments of the present application.

[0185] Next, in combination with Figures 6 to 22 the data transmission method of the present application will be introduced in detail. The embodiments shown in the present application can be executed by a terminal device, such as a mobile phone, a tablet computer, a smart bracelet, etc. The specific forms and quantities of the devices shown are only examples and should not constitute any limitation to the implementation of the method provided by the present application. Next, taking the first terminal device, the second terminal device, and the third terminal device as the execution subjects, from the perspective of device interaction among the three terminal devices, the data transmission method of the embodiments of the present application will be described in detail.

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

[0187] First, taking the scenario shown in Scenario 1 above as an example, in combination with Figures 6 to 9The data transmission method 600 of the present application is introduced in detail. 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.

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

[0189] in, Figure 6 The steps in FIG. 1 show the process of device discovery by 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.

[0190] Figure 7 The steps in FIG. 1 show the process of the first terminal device, the second terminal device and the third terminal device performing networking negotiation. The networking negotiation may include the process of the first terminal device, the second terminal device and the third terminal device performing negotiation, determining that a connection conflict occurs, and determining a new GO in a new P2P group.

[0191] Figure 8 The steps in FIG. 1 show 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.

[0192] Figure 9 The steps in 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.

[0193] In addition, for ease of understanding, Figures 10 to 22 , 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, the interfaces of the terminal devices involved in method 600 are exemplarily shown. Figures 10 to 22 It does not constitute a limitation on the embodiments of the present application.

[0194] like Figure 6 As shown, the method 600 includes:

[0195] Among them, S100 to S104 are the processes for the first terminal device to perform device discovery.

[0196] S100. In response to operation 1 by the user, the intelligent interconnection switch of the first terminal device is switched to the on state.

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

[0198] Operation 1 can be an operation where the user clicks or slides the intelligent interconnection switch. In response to operation 1, the intelligent interconnection switch can switch its state. For example, it can be switched from the off state to the on state, or from the on state to the off state, etc. In the embodiments of this application, operation 1 is an operation that switches the intelligent interconnection switch of the first terminal device from the off state to the on state.

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

[0200] Optionally, the intelligent 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 intelligent interconnection of the first terminal device transmits an instruction for instructing the device discovery module to perform device discovery to the device discovery module of the first terminal device.

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

[0202] Device discovery can also be referred to as WiFi P2P discovery. During the device discovery process, the terminal device can switch back and forth between the broadcast (listen) state and the discovery (search) phase. For example, when the first terminal device is in the discovery phase and the second terminal device is in the broadcast phase, the device discovery module in the first terminal device can discover the second terminal device and obtain the device information carried in the information broadcast by the second terminal device. The device information can include one or more of the following: device model, device ID, device name, logged-in account, or the media access control (MAC) address of the device, etc.

[0203] 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 devices can be understood as the devices discovered by the terminal device. For example, for the first terminal device, the online devices include the second terminal device and the third terminal device.

[0204] S103. The device discovery module of the first terminal device transmits the device information of the online devices to the intelligent interconnection of the first terminal device.

[0205] Exemplarily, the device discovery module of the first terminal device can transmit a device list of the online devices to the intelligent interconnection of the first terminal device, and the device list includes the device information of each online device. For example, the device list transmitted by the device discovery module of the first terminal device to the intelligent interconnection of the first terminal device includes device information such as the device names and device models of the second terminal device and the third terminal device.

[0206] Optionally, for the first terminal device, the online devices can be terminal devices with the same account as the account logged in by the first terminal device. For example, the information of the online devices transmitted by the device discovery module of the first terminal device to the intelligent interconnection of the first terminal device can be the 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.

[0207] S104. Based on the device information of the online devices, the intelligent interconnection of the first terminal device instructs to display the online devices.

[0208] Displaying the online devices can be understood as displaying device information such as the device models or device names of the online devices. For example, the online devices 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, etc.

[0209] Exemplarily, the interface for the first terminal device to display the online devices can be as Figure 10 shown. The intelligent interconnection is a module in the PC Manager application installed in the notebook computer. The PC Manager application can also include multiple modules such as multi-screen collaboration and sharing. The multiple modules can refer to the multiple modules shown in Figure 10 and will not be listed one by one here.

[0210] As Figure 10 shown, the online devices include a mobile phone and a tablet computer. The device type, device model, and device sphere 1001 of the mobile phone are displayed in the My Other Devices area of the notebook computer display interface; the device type, device model, and device sphere 1002 of the tablet computer are also displayed.

[0211] S200 to S204 are the processes for the second terminal device to perform device discovery:

[0212] S200. In response to operation 2 of the user, the intelligent interconnection switch of the second terminal device is switched to the on state.

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

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

[0215] S203. The device discovery module of the second terminal device transmits the device information of the online devices to the intelligent interconnection of the second terminal device.

[0216] S204. Based on the device information of the online devices, the intelligent interconnection of the second terminal device instructs to display the online devices.

[0217] Exemplarily, the interface for the second terminal device to display the online devices can be as Figure 11 shown. For a mobile phone, the online devices include a laptop and a tablet computer. In the interface for the mobile phone to display the online devices in the intelligent interconnection, it includes the device balls of each terminal device among the currently online devices: the device ball 1101 of the mobile phone and the information in the device ball 1101 indicating that the mobile phone is the local device; the device ball 1102 of the laptop and the information P10 indicating the model of the laptop in the device ball 1102; the device ball 1103 of the tablet computer and the information V70 indicating the model of the tablet computer in the device ball 1103.

[0218] In addition, the interface also includes information for prompting the user on how to operate to enable the mobile phone to establish a service with other online devices: click on the device ball and select the required service to complete the transfer. Assume the user clicks on the device ball 1103 corresponding to the tablet computer, then the interface displayed on the mobile phone is as Figure 12 shown.

[0219] In the icon 1201 of the tablet computer, multiple device interconnection services are displayed, namely multi-screen collaboration and network sharing. In addition, the interface also includes information for prompting the user on how to operate to enable the mobile phone to establish a service with the tablet computer: drag the service to other devices to complete the transfer.

[0220] S300 to S304 are the processes for the third terminal device to perform device discovery:

[0221] S300. In response to operation 3 of the user, the intelligent interconnection switch of the third terminal device is switched to the on state.

[0222] S301. The intelligent connection of the third terminal device instructs the device discovery module of the third terminal device to perform device discovery.

[0223] S302. In response to the indication of the intelligent connection of the third terminal device in S301, the device discovery module of the third terminal device performs device discovery and discovers the online devices.

[0224] S303. The device discovery module of the third terminal device transmits the device information of the online devices to the intelligent connection of the third terminal device.

[0225] S304. Based on the device information of the online devices, the intelligent connection of the third terminal device instructs to display the online devices.

[0226] Exemplarily, the interface for the second terminal device to display the online devices can be as Figure 13 shown. For a tablet computer, the online devices include a laptop and a mobile phone. In the interface for the intelligent connection of the tablet computer to display the online devices, it includes the device balls of each terminal device among the currently online devices: the device ball 1301 of the tablet computer and the information in the device ball 1301 indicating that the tablet computer is the local device; the device ball 1302 of the mobile phone and the information H90 indicating the model of the mobile phone in the device ball 1302; the device ball 1303 of the laptop and the information P10 indicating the model of the laptop in the device ball 1303.

[0227] In addition, the interface also includes information for prompting the user on how to operate to enable the mobile phone to establish services with other online devices: click on the device ball and select the required service to complete the transfer. Suppose the user clicks on the device ball 1302 corresponding to the mobile phone, then the interface displayed on the tablet computer is as Figure 14 shown.

[0228] Multiple device interconnection services are displayed in the icon 1401 of the mobile phone, namely multi-screen collaboration and network sharing. In addition, the interface also includes information for prompting the user on how to operate to enable the mobile phone to establish services with the tablet computer: drag the service to other devices to complete the transfer.

[0229] It should be noted that the implementation of S200 to S204 and S300 to S304 is similar to that of S100 to S104 respectively, and can all refer to the description of S100 to S104, which will not be elaborated here.

[0230] S205. In response to the operation 4 of the user on the second terminal device, the intelligent connection of the second terminal device obtains a first instruction, and the first instruction is used to instruct the second terminal device to perform multi-screen collaboration with the third terminal device.

[0231] Operation 4 may 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 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 limitations in this regard.

[0232] Exemplarily, when the second terminal device is a mobile phone, in combination with Figure 12 , operation 4 may be an operation in which the user drags the multi-screen collaboration icon in the tablet computer icon 1201 on the mobile phone display interface to the device ball of the mobile phone. When the second terminal device is a tablet computer, in combination with Figure 14 , operation 4 may be an operation in which the user drags the multi-screen collaboration icon in the mobile phone icon 1401 on the tablet computer display interface to the device ball of the tablet computer.

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

[0234] S206. In response to the first instruction, the intelligent 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.

[0235] Optionally, the intelligent interconnection of the second terminal device transmits information 1 to the transmission module of the second terminal device. Information 1 is used to instruct to establish a transmission channel with the third terminal device, and information 1 includes information for instructing the third terminal device. Among them, the information for instructing the third terminal device may be, for example, the device ID, device name, or device model of the third terminal device, etc.

[0236] S207. In response to the instruction of the intelligent interconnection 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.

[0237] 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 in this regard.

[0238] Optionally, the transmission module of the second terminal device may call a function and input information for instructing 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.

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

[0240] Optionally, a first list may be stored in the second terminal device. The first list includes device information of terminal devices that have established a physical link with the second terminal device. The first list may be stored in the WiFi connection module of the second terminal device, or the WiFi connection module of the second terminal device may query from the first list whether a physical link has been established with the third terminal device by calling a function or the like.

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

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

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

[0244] 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 according to the device type of the second terminal device and the device type of the third terminal device. For example, in the case where the second terminal device and / or the third terminal device can only be a GO, the second terminal device determines the terminal device that can only be a GO as the GO; in the case where the second terminal device and the third terminal device can be a GO or a GC, the second terminal device may determine that the local terminal device is the GO because the local terminal device is the initiator of the P2P direct connection.

[0245] In this way, a physical link can be normally established between the second terminal device and the third terminal device; and, in the case where the second terminal device determines that the role of the third terminal device can be a GC, the second terminal device can determine that the role of the second terminal device is GO, which is convenient for the second terminal device to determine whether the transmission channel between the second terminal device and the third terminal device needs to be restored after being disconnected according to the above information 2.

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

[0247] It should be noted that in the embodiments 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 described.

[0248] In some embodiments, the role of the second terminal device can also be a GC. Then, the second terminal device indicates to the third terminal device that the role of the second terminal device is a GC. Correspondingly, subsequently, the third terminal device indicates the account number 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 number and password of the third terminal device. The process of realizing multi-screen collaboration between the second terminal device and the third terminal device when the role of the second terminal device is a GC is similar to the process of realizing multi-screen collaboration between the second terminal device and the third terminal device when the role of the second terminal device is a GO. Reference can be made to the following description, and details are not elaborated here.

[0249] S210. After the creation of the GO is completed, 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 carry 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 determines that the role of the second terminal device is a GO in S209, the role information of the second terminal device is used to indicate that the role of the second terminal device is a GO.

[0250] It should be understood that the account number and password of the second terminal device are the account number and password for the third terminal device to establish a P2P direct connection with the second terminal device. For the sake of simplicity, the account number and password will not be explained further hereinafter.

[0251] Optionally, Request 1 is also used to instruct the WiFi direct connection module of the third terminal device to increment the reference count of the physical link between the second terminal device and the third terminal device by 1.

[0252] The reference count can be understood as the number of times the business between terminal devices references the established physical link between terminal devices. For example, since a multi-screen collaboration service needs to be established between the second terminal device and the third terminal device, and the realization of the multi-screen collaboration service is based on the physical link between the second terminal device and the third terminal device, the reference count of the physical link between the second terminal device and the third terminal device is incremented by 1. For the sake of simplicity, the reference count will not be explained further hereinafter.

[0253] Optionally, the WiFi connection module of the second terminal device can 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 can 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 it includes, it means that a physical link has been established between the second terminal device and the third terminal device; otherwise, it means that a physical link has not been established between the second terminal device and the third terminal device.

[0254] S305. In response to Request 1, the WiFi connection module of the third terminal device connects to the second terminal device via the account and password of the second terminal device, that is, a physical link is established with the second terminal device. And the reference count of the physical link between the second terminal device and the third terminal device is incremented by 1.

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

[0256] 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 has been successfully established.

[0257] 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 for the second terminal device to send data of the multi-screen collaboration service to the third terminal device.

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

[0259] S212. In response to the physical link establishment response, the WiFi connection module of the second terminal device indicates that the data link between the second terminal device and the third terminal device has been successfully established and indicates the device IP of the third terminal device.

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

[0261] 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 established between the second terminal device and the third terminal device to the online devices outside the P2P group. The second list includes the device IDs and roles of each terminal device in the P2P group. Since the online device outside the P2P group established between 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.

[0262] In this way, the online devices outside the P2P group established between 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 an online device outside the P2P group established between the second terminal device and the third terminal device subsequently needs to establish a P2P direct connection with a terminal device in the group, it can determine the roles of the terminal devices in the new P2P group to be established based on the roles and information of the terminal devices in the P2P group.

[0263] Optionally, when the role or connection relationship of the terminal devices in the P2P group established between the second terminal device and the third terminal device changes, the second terminal device can instruct the first terminal device to update the second list.

[0264] S213. The transmission module of the second terminal device sends information for instructing the establishment of a transmission channel to the transmission module of the third terminal device. The information for instructing the establishment of a 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.

[0265] Among them, the information for instructing the establishment of a transmission channel can also be understood as a handshake packet, etc., and the present application does not make specific limitations in this regard.

[0266] S307. In response to the information for instructing the establishment of a 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 is used to indicate consent to establish a transmission channel or successful establishment of a transmission channel.

[0267] S308. The transmission module of the third terminal device instructs the intelligent interconnection of the third terminal device that the transmission channel is successfully established.

[0268] S309. In response to the instruction of the transmission module of the third terminal device in S308, the intelligent interconnection of the third terminal device instructs to display the multi-screen collaboration interface.

[0269] S214. In response to the transmission channel establishment response in S307, the transmission module of the second terminal device instructs the intelligent interconnection of the second terminal device that the transmission channel is successfully established. In this way, a multi-screen collaboration service can be established between the intelligent interconnections of the second terminal device and the third terminal device, and data transmission can be realized.

[0270] Optionally, among the second terminal device and the third terminal device that establish the multi-screen collaboration service, the terminal device for control displays the multi-screen collaboration interface, and the other terminal device does not display the multi-screen collaboration interface. The multi-screen collaboration interface displayed by the terminal device for control may include the corresponding area of the other terminal device. For example, if the second terminal device is a mobile phone and the third terminal device is a tablet computer, and the user can control the mobile phone on the display screen of the tablet computer, the tablet computer can display as Figure 15 shown in the interface. In the display interface of the tablet computer, both the tablet computer and the mobile phone are in the state of using the multi-screen collaboration service. And the device balls of the currently online devices are respectively displayed in the area 1501 corresponding to the tablet computer and the area 1502 corresponding to the mobile phone. Near the device ball of the local device displayed in the area 1501 corresponding to the tablet computer, there is a multi-screen collaboration icon 1503, indicating that the tablet computer is using the multi-screen collaboration service. Near the device ball of the tablet computer displayed in the area 1502 corresponding to the mobile phone, there is a multi-screen collaboration icon 1504, indicating that the mobile phone and the tablet computer are using the multi-screen collaboration service.

[0271] Optionally, based on Figure 15 the interface displayed by the tablet computer, when the user clicks the first return button 1505 in the area 1501 corresponding to the tablet computer, the area 1501 corresponding to the tablet computer can display the main interface of the tablet computer; when the user clicks the second return button 1506 in the area 1502 corresponding to the mobile phone, the area 1502 corresponding to the mobile phone can display the main interface of the mobile phone. Exemplarily, assuming that the user clicks the first return button 1505 and the second return button 1506 based on Figure 15 the picture displayed by the tablet computer, the interface displayed by the tablet computer can be as Figure 16 shown.

[0272] Optionally, among the second terminal device and the third terminal device that establish the multi-screen collaboration service, the terminal device for control displays the multi-screen collaboration interface, and the other terminal device can display the interface of the ongoing multi-screen collaboration service. Exemplarily, the interface of the third terminal device (tablet computer) can be as Figure 15 or Figure 16 shown. The interface displayed by the second terminal device (mobile phone) can be as Figure 17 shown. The interface displayed by the mobile phone includes the device ball 1701 of the mobile phone, the device ball 1702 of the laptop computer, and the device ball 1703 of the tablet computer. There is a multi-screen collaboration identifier 1704 around the device ball 1703 of the tablet computer, indicating that the tablet computer and the mobile phone are performing the multi-screen collaboration service.

[0273] It should be understood that Figure 6Step (S309) shows the situation where the third terminal device displays the multi-screen collaboration interface. In some embodiments, the second terminal device may display the multi-screen collaboration interface, and the third terminal device does not display the multi-screen collaboration interface; or, both the second terminal device and the third terminal device display the multi-screen collaboration interface. This application does not make specific limitations in this regard. In addition, the implementation manner of the second terminal device displaying the multi-screen collaboration interface is similar to that of the third terminal device displaying the multi-screen collaboration interface, which can refer to the above description and will not be elaborated here.

[0274] Further, the intelligent connection of the second terminal device and the intelligent connection of the third terminal device can respectively instruct the transmission module of the local device to transmit the data stream of the multi-screen collaboration service through the transmission channel between the second terminal device and the third terminal device.

[0275] 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 collaboration service, or during the process of the second terminal device and the third terminal device establishing the multi-screen collaboration service through S205 to S309. Based on this, different from 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. And, the first terminal device discovers and obtains the device information of the second terminal device and the third terminal device after going online. The process of discovering and displaying the online device can all refer to S102 to S104 and will not be elaborated here.

[0276] Based on the above embodiments, as Figure 7 shown, if the first terminal device responds to the user's operation 5 and needs to establish a physical link and a transmission channel with the second terminal device to implement the mouse and keyboard 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 the new GO in the new P2P group through the steps shown in the following Figure 7 to establish a physical link between the first terminal device and the second terminal device subsequently.

[0277] As Figure 7 shown, method 600 further includes the following steps.

[0278] S105. In response to the user's operation 5 on the first terminal device, the intelligent connection of the first terminal device obtains a second instruction, and the second instruction is used to instruct the intelligent connection of the first terminal device to perform mouse and keyboard sharing with the second terminal device.

[0279] Operation 5 can be an operation such as the user clicking on the icon of the second terminal device or dragging the icon of the second terminal device into the hot zone on the intelligent connection interface of the first terminal device.

[0280] Exemplarily, as Figure 18 shown, this interface can be the interface switched by the notebook computer after the user clicks on the corresponding area of the keyboard and mouse sharing in Figure 10 . The display interface of the notebook computer includes the device ball 1803 of the tablet computer and the device ball 1804 of the mobile phone. It also includes information for prompting the user on how to implement the keyboard and mouse sharing service between the notebook computer and other devices: drag the device icon to the areas on both sides of the computer to establish a connection. Among them, the device icon can be the device ball 1803 of the tablet computer or the device ball 1804 of the mobile phone, and the areas on both sides of the computer can refer to area 1801 and area 1802. Then operation 5 can be the operation of the user dragging the device ball 1804 to area 1802 or area 1801.

[0281] S106. In response to the second instruction, the intelligent 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.

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

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

[0284] It should be understood that the implementation manners of S105 to S108 are similar to those of S205 to S208, and reference can be made to the above description, which will not be elaborated here.

[0285] S109. The WiFi connection module of the first terminal device determines that the first terminal device is set with the ability to act as a GO in the P2P group.

[0286] 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 according to the computer type of the first terminal device and / or the hardware configuration of the first terminal device. For example, in the WiFi connection module, the first preset device type can be queried 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 second preset device type can be queried through function calls and the like in the WiFi connection module. 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 a GC. The first preset device type can include the device types of terminal devices that can only act as GO, such as desktop computers, notebook computers, all-in-one computers, etc.; the second preset device type can include the device types of terminal devices that can act as a GO or a GC, such as mobile phones, tablet computers, etc.

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

[0288] 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 can be the role expected by the first terminal device. At this time, the role of the first terminal device has not been created yet.

[0289] S110. The WiFi connection module of the first terminal device sends Request 2 to the WiFi connection module of the second terminal device. Request 2 is used to request to establish a physical link. Request 2 carries information indicating that the first terminal device needs to act as the GO in the P2P group. Request 2 is used to request to establish a physical link with the second terminal device and is also used to indicate to the second terminal device that the role of the first terminal device is the GO.

[0290] It should be noted that Request 2 is a request different from Request 1. Request 1 is a request used by the second terminal device to request to establish a physical link with the third terminal device, and the account and password of the second terminal device are carried in Request 1. Request 2 is a request for negotiation with the second terminal device, that is, to confirm 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 acts as the GO. Therefore, the account and password of the first terminal device are not carried in Request 2, but the role information of the first terminal device is carried.

[0291] 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 the GO.

[0292] Through S215, since the second terminal device determines that the role to be created by the first terminal device is the GO, and the second terminal device is the 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 the 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.

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

[0294] Based on the information indicating that a physical link cannot be established, the WiFi connection module of the first terminal device can determine that a direct physical link cannot be established between the first terminal device and the second terminal device.

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

[0296] In this way, it is convenient for the first terminal device to determine the roles 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 subsequently, it can determine the roles of each terminal device in the new P2P group to be established based on the roles and information of each terminal device in the P2P group.

[0297] It should be noted that Figure 6 The corresponding signaling interactions in the steps shown can be implemented through a WiFi link or a Bluetooth link. Since 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 can send the second list to the first terminal device again.

[0298] S111. The WiFi connection module of the first terminal device instructs the transmission module of the first terminal device that a physical link cannot be established between the first terminal device and the second terminal device.

[0299] S112. The transmission module of the first terminal device instructs the intelligent interconnection of the first terminal device that a physical link cannot be established between the first terminal device and the second terminal device.

[0300] S113. In response to the indication that a physical link cannot be established between the first terminal device and the second terminal device, the intelligent interconnection of the first terminal device displays a pop-up message 1, and the pop-up message 1 is used to display to the user: The peer P2P is occupied. Whether to initiate a preemption. Preemption can be understood as dissolving the original P2P group and establishing a new group including the first terminal device and the second terminal device.

[0301] Optionally, the pop-up message may further include a button for confirming to initiate a preemption and a button for canceling to initiate a preemption.

[0302] Exemplarily, as Figure 19 shown, this interface may be when the user is in Figure 18The interface shown shows the interface of the laptop computer after dragging the device ball 1804 to area 1802 or area 1801. Pop-up message 1 can be as Figure 19 shown in pop-up message 1901 in it. Pop-up message 1 prompts the user: Continuing to use "mouse and keyboard sharing" will interrupt and reload the services in use. Do you want to continue? This service can also be understood as the business between terminal devices. That is, continuing to use "mouse and keyboard sharing" will interrupt the multi-screen collaboration service between the mobile phone and the tablet computer.

[0303] As Figure 19 shown, pop-up message 1 also includes a button for confirming to initiate preemption, that is, the "Continue" button; and a button for canceling the initiation of preemption, that is, the "Cancel" button. Based on the user's selection operation on the "Continue" button, the laptop computer can initiate preemption; based on the user's selection operation on the "Cancel" button, the laptop computer can cancel preemption.

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

[0305] S114. The intelligent connection of the first terminal device obtains a third instruction, and the third instruction is used to instruct to perform dynamic networking preemption with the second terminal device.

[0306] The third instruction can be an instruction generated based on the user's operation 6. Operation 6 is an input operation for the user to indicate to initiate preemption based on pop-up message 1. For example, pop-up message 1 can include a first button and a second button. The first button is used to determine to initiate preemption; the second button is used to cancel the initiation of preemption. Operation 6 can be the operation of the user clicking the first button in pop-up message 1. Exemplarily, in combination with Figure 19 , operation 6 can be the operation of the user clicking the "Continue" button.

[0307] Optionally, the third instruction carries information for instructing the second terminal device. The information for instructing the second terminal device can be, for example, the device ID of the second terminal device.

[0308] Among them, the intelligent connection 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 in the intelligent connection interface of the first terminal device. The intelligent connection of the first terminal device can convert the "second terminal device" clicked by the user into the device ID of the second terminal device.

[0309] S115. In response to the third instruction, the intelligent connection of the first terminal device instructs the transmission module of the first terminal device to initiate dynamic networking preemption.

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

[0311] Optionally, the intelligent connection of the first terminal device also instructs the transmission module of the first terminal device about information for instructing the second terminal device. The information for instructing the second terminal device can be, for example, the device ID of the second terminal device.

[0312] S116. In response to the instruction of the intelligent connection 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.

[0313] Optionally, the transmission module of the first terminal device also instructs the WiFi connection module of the first terminal device about information for instructing the second terminal device. The information for instructing the second terminal device can be, for example, the device ID of the second terminal device.

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

[0315] Optionally, the WiFi connection module of the first terminal device can determine a new GO among the terminal devices included in the second list and the first terminal device according to the second list. The new GO can be a device that can only act as a GO. For example, since the WiFi connection module of the first terminal device can determine that the first terminal device can only act as a GO, the WiFi connection module of the first terminal device determines the new GO to be the first terminal device.

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

[0317] After S118, on the one hand, the first terminal device triggers the execution of S119 to S51; on the other hand, the first terminal device executes S52, that is, after the WiFi connection module of the first terminal device determines that the GO is successfully created, it obtains the device IP of the first terminal device and initiates listening on the transmission control protocol (TCP) port. That is, S52 and S44 to S51 can be executed in parallel, or S52 can also be executed before or after S44 to S51. This application does not make specific limitations on this.

[0318] Optionally, the WiFi connection module of the first terminal device also selects the channel of the physical link. The channel of the physical link can also be understood as the P2P channel, which can refer to the 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, but establishes a physical link based on this P2P channel, which can improve the efficiency of physical link establishment.

[0319] 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 networking preemption. Request 3 can also be understood as a request for 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.

[0320] Optionally, Request 3 carries information for indicating the new GO and information for indicating the destination device. For example, the device ID of the new GO and the device ID of the destination device, etc. The new GO is the first terminal device, and the destination device is the device that the second terminal device wants to connect to, that is, the second terminal device.

[0321] 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 a normal physical link establishment process; Request 3 is used to request the second terminal device to disconnect the current physical link, that is, to disconnect the physical link with the third terminal device to facilitate the subsequent establishment of the physical link between the new GO indicated in Request 3 and the destination device.

[0322] 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 the signaling, etc. Through the command ID, the receiving terminal device can determine the function or type of different signaling. For example, when the second terminal device receives Request 1, it can determine based on the command ID of Request 1 that Request 1 is used to request to initiate the 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 to initiate dynamic networking preemption.

[0323] 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 listening.

[0324] 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 the GO.

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

[0326] It should be understood that when the WiFi connection module of the second terminal device determines that the role of the second terminal device 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 current first terminal device needs to establish a physical link with the second terminal device, and the third terminal device needs to disconnect the physical link with the second terminal device.

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

[0328] It should be understood that the judgment logics of S217 and S310 can be the same. That is, after the terminal device receives Request 3, it will determine whether the role of the terminal device in the current P2P group is GO or GC. When the role of the terminal device is GO, the terminal device forwards Request 3 to all GCs in the P2P group where the terminal device is located; when the role of the terminal device is GC, the terminal device sends Response 1 to the GO in the P2P group where the terminal device is located.

[0329] S311. The WiFi connection module of the third terminal device sends Response 1 to the WiFi connection module of the second terminal device.

[0330] It should be understood that Response 1 is a response message to Request 3, and can be, for example, an acknowledgement (ACK), etc.

[0331] S219. The WiFi connection module of the second terminal device determines that it has received Response 1 from all GCs in the current P2P group. All GCs here are the GCs that have established P2P direct connection with the second terminal device.

[0332] S220. Based on the judgment result of S219, the WiFi connection module of the second terminal device sends 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.

[0333] Optionally, if the WiFi connection module of the second terminal device determines that it has not received Response 1 from all GCs in the current P2P group, it continues to wait until it receives Response 1 from all GCs.

[0334] S121. The WiFi connection module of the first terminal device sends information indicating entry into the dynamic networking state to the WiFi connection module of the second terminal device. The information indicating entry into the dynamic networking state carries information indicating the account, password, TCP IP, and port of the first terminal device. The TCP IP and port of the first terminal device can be obtained by listening to the TCP port in S120.

[0335] S221. The WiFi connection module of the second terminal device forwards the information indicating entry into the dynamic networking state to the WiFi connection module of the third terminal device. The information indicating entry into the dynamic networking state carries information indicating the account, password, TCP IP, and port of the first terminal device.

[0336] Optionally, the information indicating entry into the dynamic networking state may also carry information indicating the channel of the physical link of the first terminal device. The channel of the physical link can also be understood as the P2P channel and can refer to the WiFi frequency. In this way, when the WiFi connection module of the second terminal device or the third terminal device establishes a physical link with the WiFi connection module of the first terminal device, it does not need to traverse all P2P channels, but establishes a physical link based on this P2P channel, which can improve the efficiency of physical link establishment.

[0337] S222. The WiFi connection module of the second terminal device saves the account, password, TCP IP, and port of the first terminal device.

[0338] S312. The WiFi connection module of the third terminal device saves the account, password, TCP IP, and port of the first terminal device.

[0339] The WiFi connection module of the second terminal device and the WiFi connection module of the third terminal device can respectively use the account and password of the first terminal device to connect to the first terminal device.

[0340] The TCP IP and port can be used to implement TCP IP communication between terminal devices. The TCP IP and port of the first terminal device can implement TCP IP communication between the first terminal device and the second terminal device, and / or implement TCP IP communication between the first terminal device and the third terminal device. The second terminal device and / or the third terminal device can call the interface of the TCP protocol stack to establish a transmission channel for TCP communication with the first terminal device through the TCP IP and port of the first terminal device, so as to implement TCP communication based on this transmission channel for TCP communication.

[0341] The dynamic networking state can be understood as the state when physical links and transmission channels are established between terminal devices.

[0342] Based on the above embodiments, the first terminal device and the second terminal device can establish a physical link and a transmission channel, enabling the first terminal device and the second terminal device to share the keyboard and mouse.

[0343] As Figure 8 shown, method 600 may further include the following steps.

[0344] It should be noted that after the first terminal device executes S121, it starts to execute S122; after the second terminal device executes S222, it starts to execute S223; after the third terminal device executes S312, it starts to execute S313.

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

[0346] S123. The WiFi connection module of the first terminal device instructs the transmission module of the first terminal device to enter the dynamic networking state.

[0347] Through S122 and S123, both the WiFi connection module and the transmission module of the first terminal device can enter the dynamic networking state. When the first terminal device receives a request to establish a physical link from other terminal devices, it does not respond to the request to establish a physical link from other terminal devices. In this way, it is convenient to improve the establishment efficiency and success rate of a new P2P group.

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

[0349] S224. The WiFi connection module of the second terminal device instructs the transmission module of the second terminal device to enter the dynamic networking state.

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

[0351] S314. The WiFi connection module of the third terminal device instructs the transmission module of the third terminal device to enter the dynamic networking state.

[0352] It should be understood that the implementation manners of the WiFi connection module of the second terminal device and the third terminal device to set to enter the dynamic networking state and instruct the transmission module to enter the dynamic networking state are similar to S122 and S123, and can refer to the above description, which will not be elaborated here.

[0353] 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 a new P2P group; if so, further determine the role of the local device in the new P2P group.

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

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

[0356] Optionally, the second terminal device and the third terminal device can respectively determine the terminal devices included in the new P2P group through the above-mentioned request 3. That is, the above-mentioned request 3 can 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.

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

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

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

[0360] S227. The WiFi connection module of the second terminal device instructs the transmission module of the second terminal device that the physical link has been disconnected and indicates the reason for the disconnection of the physical link. The reason for the disconnection of the physical link is that the second terminal device and the third terminal device enter the dynamic networking state.

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

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

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

[0364] S317. The WiFi connection module of the third terminal device indicates that the physical link of the transmission module of the third terminal device has been disconnected and indicates the reason for the disconnection of the physical link. The reason for the disconnection of the physical link is that the second terminal device and the third terminal device enter the dynamic networking state.

[0365] S318. The transmission module of the third terminal device indicates that the intelligent interconnection of the third terminal device disconnects the multi-screen collaboration with the second terminal device.

[0366] S319. The intelligent interconnection of the third terminal device indicates that the display interface displays a mask layer.

[0367] Among them, the display interface displaying the mask layer can be understood as the disconnection of multi-screen collaboration and the interface displayed by the terminal device during the period to be restored.

[0368] Exemplarily, as Figure 20 shown, the interface displayed on the laptop includes the area 2001 corresponding to the laptop and the area 2002 corresponding to the mobile phone. In the area 2001 corresponding to the laptop, device balls of the local machine, the laptop, and the mobile phone are displayed. And near the device ball of the mobile phone, an icon 2003 for multi-screen collaboration is displayed, indicating the disconnection of multi-screen collaboration between the tablet computer and the mobile phone. Optionally, the user can click the first return button 2004 to return to the main interface of the tablet computer.

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

[0370] S228. The transmission module of the second terminal device indicates that the intelligent interconnection of the second terminal device disconnects the multi-screen collaboration with the third terminal device.

[0371] Based on S228 and S318, the multi-screen collaboration service between the second terminal device and the third terminal device is disconnected.

[0372] S320. 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 can be, for example, information for indicating the second terminal device. Through the information for indicating the second terminal device, the third terminal device can determine that it has disconnected the transmission channel with the second terminal device and may need to restore the transmission channel subsequently.

[0373] Optionally, the transmission module of the third terminal device can save the information for indicating the second terminal device in the list to be restored of the third terminal device. The list to be restored is a list for storing the transmission channels to be restored. The third terminal device can determine that there is a transmission channel to be restored between the second terminal device and the third terminal device through the information for indicating the second terminal device stored in the list to be restored. The information for indicating the second terminal device can be, for example, the device ID of the second terminal device.

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

[0375] It should be understood that the implementation manners of S229 and S320 are similar and can refer to the above description, which will not be elaborated here.

[0376] S125. The WiFi connection module of the first terminal device enters the concurrent connection state. That is, the WiFi connection module of the first terminal device waits for the second terminal device and the third terminal device to connect to the first terminal device. The concurrent connection state can be understood as the state of waiting for the devices in the group to be dissolved to connect to the local device.

[0377] Optionally, S125 can be executed after the first time period after the WiFi connection module of the first terminal device executes S124. 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. For example, after S214, the first terminal device can start a timer with a timing length of the first time period and execute S215 after the timer times out.

[0378] S230. The WiFi connection module of the second terminal device accesses the first terminal device through the account of the first terminal device and the password of the first terminal device. The account of the first terminal device is saved by the WiFi connection module of the second terminal device in S222.

[0379] It should be noted that in the embodiments of the present application, accessing a certain device does not mean establishing a physical link with the device. For example, in S230, accessing the first terminal device means that the second terminal device unilaterally joins the hotspot or other network of the first terminal device using the account and password of the first terminal device. At this time, the physical link between the first terminal device and the second terminal device is not successfully established.

[0380] S321. The WiFi connection module of the third terminal device accesses the first terminal device through the account of the first terminal device and the password of the first terminal device. The account of the first terminal device is saved by the WiFi connection module of the third terminal device in S312.

[0381] It should be understood that the implementation manner of S321 is similar to that of S230, and reference can be made to the above description, which will not be elaborated here.

[0382] S231. The WiFi connection module of the second terminal device sends information for instructing to establish a physical link to the WiFi connection module of the first terminal device. The information for instructing to establish a physical link carries information for instructing the second terminal device, such as the device ID of the second terminal device. And the information for instructing to establish a physical link is used to instruct the first terminal device that the second terminal device has connected to the first terminal device through the account and password of the first terminal device.

[0383] S322. The WiFi connection module of the third terminal device sends information for instructing to establish a physical link to the WiFi connection module of the first terminal device. The information for instructing to establish a physical link carries information for instructing the third terminal device, such as the device ID of the third terminal device. And the information for instructing to establish a physical link is used to instruct the first terminal device that the third terminal device has connected to the first terminal device through the account and password of the first terminal device.

[0384] S126. The WiFi connection module of the first terminal device concurrently processes the connection tasks of the second terminal device and the third terminal device. The connection task can be understood as the task of establishing a P2P direct connection.

[0385] It should be understood that after the second terminal device and the third terminal device connect to the first terminal device through the account and password of the first terminal device, the first terminal device can determine that two devices have newly connected to the first terminal device. Based on S231 and S322, the first terminal device can save the information for instructing the second terminal device and the information for instructing the third terminal device, and can associate the information for instructing the second terminal device with the information of the second terminal device connecting to the first terminal device; it can also associate the information for instructing the third terminal device with the information of the third terminal device connecting to the first terminal device.

[0386] S127. The WiFi connection module of the first terminal device increments the reference count by 2. Since both the second terminal device and the third terminal device establish P2P direct connections with the first terminal device, the WiFi connection module of the first terminal device increments the reference count by 2.

[0387] S128. The WiFi connection module of the first terminal device sends information indicating the successful establishment of the physical link to the WiFi connection module of the second terminal device.

[0388] S129. The WiFi connection module of the first terminal device sends information indicating the successful establishment of the physical link to the WiFi connection module of the third terminal device.

[0389] It should be understood that S127 can be executed in parallel with S128 and S129, or can be executed before or after S128 and S129. The present application does not make specific limitations on this.

[0390] S232. The WiFi connection module of the second terminal device increments the reference count by 1.

[0391] S323. The WiFi connection module of the third terminal device increments the reference count by 1.

[0392] S233. The WiFi connection module of the second terminal device determines that the local device is the GC in the new P2P group, enables TCP service (TCP server) listening, and obtains the TCP IP and port of the second terminal device.

[0393] S234. The WiFi connection module of the second terminal device sends information indicating the TCP IP and port of the second terminal device to the WiFi connection module of the first terminal device. The information indicating the TCP IP and port of the second terminal device may carry the device ID of the second terminal device.

[0394] S323. The WiFi connection module of the third terminal device determines that the local device is the GC in the new P2P group, enables TCP service (TCP server) listening, and obtains the TCP IP and port of the third terminal device.

[0395] S324. The WiFi connection module of the third terminal device sends information indicating the TCP IP and port of the third terminal device to the WiFi connection module of the first terminal device. The information indicating the TCP IP and port of the third terminal device may carry the device ID of the third terminal device.

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

[0397] S130. The WiFi connection module of the first terminal device sends information for indicating the reuse of the physical link to the WiFi connection module of the second terminal device. According to the information for indicating the reuse of the physical link, the WiFi connection module of the second terminal device can determine that it is necessary to utilize the existing physical link between the first terminal device and the second terminal device to establish a transmission channel between the second terminal device and the first terminal device.

[0398] Optionally, before S130, the WiFi connection module of the first terminal device determines whether a physical link has been established between the first terminal device and the second terminal device. For example, the WiFi connection module of the first terminal device can call a function to obtain information for indicating whether a physical link has been established between the first terminal device and the second terminal device.

[0399] If so, the WiFi connection module of the first terminal device executes S130.

[0400] If not, the WiFi connection module of the first terminal device executes S125.

[0401] S235. In response to the information for indicating the reuse of the physical link, the WiFi connection module of the second terminal device increments the reference count by 1.

[0402] S236. The WiFi connection module of the second terminal device sends a physical link reuse response to the WiFi connection module of the first terminal device. The physical link reuse response is used to indicate that the second terminal device determines to establish a transmission channel between the second terminal device and the first terminal device by using the existing physical link. The physical link establishment response carries the device IP of the second terminal device.

[0403] S131. The WiFi connection module of the first terminal device increments the reference count by 1.

[0404] It should be understood that S131 can be executed in parallel with S130, or S131 can be executed before or after S130. This application does not make specific limitations on this.

[0405] S132. The WiFi connection module of the first terminal device indicates that the physical link reuse of the first terminal device is successful. And it indicates the device IP of the second terminal device.

[0406] S237. The WiFi connection module of the second terminal device indicates that the physical link reuse of the second terminal device is successful.

[0407] Based on the indication of the successful physical link reuse, the transmission module of the first terminal device can further establish a transmission channel with the transmission module of the second terminal device.

[0408] S133. The transmission module of the first terminal device sends information for indicating the establishment of a transmission channel to the transmission module of the second terminal device. The information for indicating the establishment of a transmission channel carries the device IP of the first terminal device.

[0409] S238. In response to the information for indicating the establishment of a 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 is used to indicate consent to establish the transmission channel or successful establishment of the transmission channel.

[0410] It should be understood that the implementation manners of S133 and S238 are similar to those of S213 and 307, and reference can be made to the above description, which will not be elaborated here.

[0411] Optionally, the information for indicating the establishment of a transmission channel in S133 and the transmission channel establishment response in S238 can be transmitted through the TCP channel between the first terminal device and the second terminal device. Compared with Bluetooth transmission, Bluetooth has poor stability, so that when these two signaling are transmitted through the TCP channel, the phenomenon of transmission failure of these two signaling is less.

[0412] The TCP channel transmission between the first terminal device and the second terminal device can be established by using the TCP IP and port of the first terminal device and the TCP IP and port of the second terminal device. For example, the first terminal device calls the TCP protocol stack and uses the TCP IP and port of the second terminal device, so that the first terminal device can transmit data to the second terminal device; the second terminal device calls the TCP protocol stack and uses the TCP IP and port of the first terminal device, so that the second terminal device can transmit data to the first terminal device. Thus, the establishment of the TCP channel between the first terminal device and the second terminal device is completed.

[0413] S239. The transmission module of the second terminal device indicates to the intelligent connection of the second terminal device that the transmission channel is successfully established.

[0414] S134. The transmission module of the first terminal device indicates to the intelligent connection of the first terminal device that the transmission channel is successfully established.

[0415] S135. The intelligent connection of the first terminal device indicates to display the keyboard and mouse sharing interface.

[0416] Exemplarily, the first terminal device is a notebook computer, and the keyboard and mouse sharing interface displayed on the notebook computer can be as Figure 21 shown. The keyboard and mouse sharing interface displayed on the notebook computer may include a prompt card 2101, and the prompt card includes information for indicating how the user can operate to realize controlling the mobile phone with the keyboard and mouse of the notebook.

[0417] Based on the above embodiments, the second terminal device and the third terminal device 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. The first terminal device, the second terminal device, and the third terminal device can execute Figure 9 the steps shown. As Figure 9 shown, method 600 may further include the following steps.

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

[0419] Among them, the dynamic networking recovery state can be understood as the state when the terminal device restores the disconnected transmission channel.

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

[0421] Through S136 and S137, both the WiFi connection module and the transmission module of the first terminal device can enter the dynamic networking recovery state. When the first terminal device receives a request to establish a physical link from other terminal devices, it does not respond to the request to establish a physical link from other terminal devices. In this way, it is convenient to improve the recovery efficiency and success rate of the transmission channel.

[0422] S138. The WiFi connection module of the first terminal device sends information for instructing to enter the dynamic networking recovery state to the WiFi connection module of the second terminal device.

[0423] S240. In response to the information for instructing to enter 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] S241. The WiFi connection module of the second terminal device instructs the transmission module of the second terminal device to enter the dynamic networking recovery state. Or, it can also be understood that the WiFi connection module of the second terminal device instructs the transmission module of the second terminal device to restore the transmission channel to be restored. The dynamic networking recovery state can also be understood as the state of restoring the transmission channel to be restored.

[0425] S139. The WiFi connection module of the first terminal device sends information for instructing to enter the dynamic networking recovery state to the WiFi connection module of the third terminal device.

[0426] S326. In response to the information for instructing to enter 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] S327. The WiFi connection module of the third terminal device instructs the transmission module of the third terminal device to enter the dynamic networking recovery state.

[0428] It should be understood that S240 and S241, S326 and S327 are similar to the implementation manners of S136 and S137, and reference may be made to the above description, which will not be elaborated here.

[0429] S242. The transmission module of the second terminal device instructs the WiFi connection module of the second terminal device to restore the transmission channel indicated by the transmission channel information saved in S229, that is, the transmission channel between the second terminal device and the third terminal device. For example, the instruction includes the device ID of the third terminal device. According to this instruction, the WiFi connection module of the second terminal device can start to restore the transmission channel between the second terminal device and the third terminal device.

[0430] S328. The transmission module of the third terminal device instructs the WiFi connection module of the third terminal device to restore the transmission channel indicated by the transmission channel information saved in S320, that is, the transmission channel between the second terminal device and the third terminal device. For example, the instruction includes the device ID of the second terminal device. According to this instruction, the WiFi connection module of the third terminal device can start to restore the transmission channel between the second terminal device and the third terminal device.

[0431] S243. In response to the instruction of the transmission module of the second terminal device in S242, the WiFi connection module of the second terminal device sends information for instructing the reuse of the physical link to the WiFi connection module of the third terminal device. According to the information for instructing the reuse of the physical link, the WiFi connection module of the third terminal device can determine that the existing physical link needs to be utilized between the second terminal device and the third terminal device to establish the transmission channel between the second terminal device and the third terminal device.

[0432] S329. In response to the information for instructing the reuse of the physical link from the WiFi connection module of the second terminal device, the WiFi connection module of the third terminal device increments the reference count by 1.

[0433] S329-1. In response to the information for instructing the reuse of the physical link from the WiFi connection module of the second terminal device, the WiFi connection module of the third terminal device sends a physical link reuse request to the WiFi connection module of the first terminal device.

[0434] S140-1. In response to the physical link reuse request, the WiFi connection module of the first terminal device increments the reference count by 1.

[0435] S330. The WiFi connection module of the third terminal device sends a physical link multiplexing response to the WiFi connection module of the second terminal device. The physical link multiplexing response is used to instruct the third terminal device to determine to establish a transmission channel between the third terminal device and the second terminal device by using the existing physical link. The device IP of the third terminal device is carried in the physical link establishment response.

[0436] S244. The WiFi connection module of the second terminal device increments the reference count by 1.

[0437] It should be understood that S244 can be executed in parallel with S243, or S244 can be executed before or after S243. This application does not make specific limitations on this.

[0438] It should be noted that the physical link multiplexing process, that is, S243 and S330, is to perform a virtual physical link establishment process between the WiFi connection module of the second terminal device and the WiFi connection module of the third terminal device. That is, the physical link is not actually established, but the reference counts of both the WiFi connection module of the second terminal device and the WiFi connection module of the third terminal device are incremented by 1. Through this process, the third terminal device and the second terminal device can add the reference counts reduced due to the disconnection of the multi-screen collaboration service.

[0439] S245. The WiFi connection module of the second terminal device indicates that the physical link multiplexing of the second terminal device's transmission module is successful. And it indicates the device IP of the third terminal device.

[0440] S331. The WiFi connection module of the third terminal device indicates that the physical link multiplexing of the third terminal device's transmission module is successful.

[0441] S246. The transmission module of the second terminal device sends information for instructing the establishment of a transmission channel to the transmission module of the third terminal device. The information for instructing the establishment of a transmission channel carries the device IP of the second terminal device.

[0442] S332. In response to the information for instructing the establishment of a transmission channel from the transmission module of the second terminal device, 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 is used to indicate consent to establish a transmission channel or successful establishment of a transmission channel.

[0443] It should be understood that the implementation manners of S246 and S332 are similar to the implementation manners of S213 and S307, and can refer to the above description, and will not be elaborated here.

[0444] Optionally, the information for indicating the establishment of the transmission channel in S246 and the transmission channel establishment response in S332 can be transmitted through the TCP channel between the third terminal device and the second terminal device. Compared with Bluetooth transmission, the stability of Bluetooth is relatively poor, so that when these two signaling are transmitted through the TCP channel, the phenomenon of transmission failure of these two signaling is less.

[0445] The TCP channel transmission between the third terminal device and the second terminal device can be established by using the TCP IP and port of the third terminal device and the TCP IP and port of the second terminal device. For example, the third terminal device calls the TCP protocol stack and uses the TCP IP and port of the second terminal device, so that the third terminal device can transmit data to the second terminal device; the second terminal device calls the TCP protocol stack and uses the TCP IP and port of the third terminal device, so that the second terminal device can transmit data to the third terminal device. Thus, the establishment of the TCP channel between the third terminal device and the second terminal device is completed.

[0446] S333. The transmission module of the third terminal device indicates to the intelligent interconnection of the third terminal device that the transmission channel is successfully established.

[0447] S334. In response to the indication of the successful establishment of the transmission channel, the intelligent interconnection of the third terminal device indicates to display the multi-screen collaboration interface.

[0448] S247. The transmission module of the second terminal device indicates to the intelligent interconnection of the second terminal device that the transmission channel is successfully established.

[0449] S248. The transmission module of the second terminal device instructs the WiFi connection module of the second terminal device that the transmission channel is successfully restored.

[0450] S335. The transmission module of the third terminal device instructs the WiFi connection module of the third terminal device that the transmission channel is successfully restored.

[0451] S249. The WiFi connection module of the second terminal device sends information for indicating the exit from the dynamic networking restoration state to the WiFi connection module of the first terminal device. Exiting the dynamic networking restoration state can also be understood as that the second terminal device has no transmission channel to be restored or the transmission channel has been restored, and there is no need to be in the dynamic networking state anymore.

[0452] S140. The WiFi connection module of the first terminal device sends Response 2 to the WiFi connection module of the second terminal device. Response 2 is a response to the information for indicating the exit from the dynamic networking restoration state. Response 2 can be an ACK message.

[0453] S141. The WiFi connection module of the second terminal device sends a disconnection request to the WiFi connection module of the first terminal device. The disconnection request is used to request the disconnection of a transmission channel once. That is, the first terminal device and the second terminal device execute the disconnection logic of a physical link once.

[0454] S250. The WiFi connection module of the first terminal device sends a disconnection response to the WiFi connection module of the second terminal device. The disconnection response indicates that the second terminal device determines to execute the disconnection logic of a physical link once.

[0455] S251. The WiFi connection module of the second terminal device decrements the reference count by 1.

[0456] S142. The WiFi connection module of the first terminal device decrements the reference count by 1.

[0457] By executing the disconnection logic of a physical link once by the first terminal device and the second terminal device. The first terminal device and the second terminal device respectively decrement the reference count by 1, so that the extra reference count added when the first terminal device and the second terminal device establish a physical link (S127 and S232) is subtracted.

[0458] S336. The WiFi connection module of the third terminal device sends information for indicating to exit the dynamic networking recovery state to the WiFi connection module of the first terminal device. Exiting the dynamic networking recovery state can also be understood as that the third terminal device has no transmission channel to be recovered or the transmission channel has been recovered, and there is no need to be in the dynamic networking state anymore.

[0459] S143. The WiFi connection module of the first terminal device sends a response 2 to the WiFi connection module of the third terminal device. The response 2 is a response to the information for indicating to exit the dynamic networking recovery state. The response 2 can be an ACK message.

[0460] S144. The WiFi connection module of the third terminal device sends a disconnection request to the WiFi connection module of the first terminal device. The disconnection request is used to request the disconnection of a transmission channel once. That is, the first terminal device and the third terminal device execute the disconnection logic of a physical link once.

[0461] S337. The WiFi connection module of the first terminal device sends a disconnection response to the WiFi connection module of the third terminal device. The disconnection response indicates that the third terminal device determines to execute the disconnection logic of a physical link once.

[0462] S338. The WiFi connection module of the third terminal device decrements the reference count by 1.

[0463] S145. The WiFi connection module of the first terminal device decrements the reference count by 1.

[0464] Execute the disconnection logic of the physical link once through the first terminal device and the third terminal device. The first terminal device and the third terminal device each subtract 1 from the reference count, so as to subtract the extra reference count added when the first terminal device and the third terminal device establish the physical link (S127 and S323).

[0465] 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. In this way, when the first terminal device, the second terminal device, or the third terminal device receives a connection request from another device, it can process the connection request from another device.

[0466] It should be understood that in the case where the second terminal device and the third terminal device establish a multi-screen collaboration 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 both a GC and a GO, 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 2200. As Figure 22 shown, the method 2200 includes the following steps:

[0467] S2201, Device discovery.

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

[0469] S2202, The second terminal device and the third terminal device establish a multi-screen collaboration service.

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

[0471] S2203, The intelligent connection of the first terminal device obtains an instruction to perform call sharing with the third terminal device.

[0472] S2204, The intelligent connection of the first terminal device instructs the transmission module of the first terminal device to establish a transmission channel with the third terminal device.

[0473] S2205. 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.

[0474] S2206. The WiFi connection module of the first terminal device determines that the first terminal device and the third terminal device have not established a physical link.

[0475] S2207. The WiFi connection module of the first terminal device determines that the first terminal device has the ability to act as a GO or a GC. That is, the first terminal device can act as both a GO and a GC.

[0476] S2208. 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 for indicating that the first terminal device can act as a GO or a GC.

[0477] S2209. The WiFi connection module of the third terminal device determines that the third terminal device has already 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 the GO.

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

[0479] It should be understood that the implementation manners of S2203 to S2208 are similar to those of S105 to S110, and the implementation manner of S2209 is similar to that of S215. Reference can be made to the above description and will not be elaborated here.

[0480] S2210. The WiFi connection module of the third terminal device sends information for indicating to establish a physical link with the second terminal device to the WiFi connection module of the first terminal device.

[0481] S2211. In response to the information in S2210, the WiFi connection module of the first terminal device sends a request for requesting to establish a physical link to the WiFi connection module of the second terminal device.

[0482] S2212. In response to the request in S2211, the WiFi connection module of the second terminal device sends information for indicating the account and password of the second terminal device to the WiFi connection module of the first terminal device.

[0483] S2213. 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. S2214. After S2212, the WiFi connection module of the second terminal device increments the reference count of the physical link between the second terminal device and the first terminal device by 1.

[0484] S2215. Based on S2213, the WiFi connection module of the first terminal device sends information indicating the completion of the establishment of the physical link to the WiFi connection module of the third terminal device.

[0485] S2216. The WiFi connection module of the first terminal device increments the reference count by 1.

[0486] S2217. The WiFi connection module of the third terminal device increments the reference count by 1.

[0487] It should be understood that since the establishment of the physical link between the first terminal device and the second terminal device is for the purpose of implementing the service between the first terminal device and the third terminal device, the WiFi connection module of the third terminal device also increments the reference count by 1.

[0488] S2218. The WiFi connection module of the third terminal device indicates to the transmission module of the third terminal device that the physical link has been successfully established.

[0489] S2219. The WiFi connection module of the first terminal device indicates to the transmission module of the first terminal device that the physical link has been successfully established.

[0490] S2220. The transmission module of the third terminal device sends information indicating the establishment of the transmission channel to the transmission module of the first terminal device. The information indicating the establishment of the transmission channel carries information indicating the device IP of the third terminal device.

[0491] S2221. 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.

[0492] S2222. The transmission module of the third terminal device indicates to the intelligent interconnection of the third terminal device that the transmission channel has been successfully established.

[0493] S2223. The intelligent interconnection of the third terminal device indicates to display the call sharing interface.

[0494] Optionally, S2224. 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 established.

[0495] It should be understood that S2224 can be executed in parallel with S2222 and S2223, or can be executed before or after S2222 and S2223. This application does not make specific limitations in this regard.

[0496] S2225. The transmission module of the first terminal device indicates to the intelligent connection of the first terminal device that the transmission channel is successfully established.

[0497] S2226. The intelligent connection indication of the first terminal device displays a call sharing interface.

[0498] Optionally, S2227. 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.

[0499] It should be understood that S2227 can be executed in parallel with S2225 and S2226, or can be executed before or after S2225 and S2226. This application does not make specific limitations in this regard.

[0500] It should be noted that S2223 and S2226 are optional contents. That is, in the case of an incoming call from the peer device, the local device can display the interface of the incoming call of the peer device, so that the user can answer the incoming call of the peer device on the local device. In the case of no incoming call from the peer device, the local device can not display the call sharing interface.

[0501] It should also be noted that the above takes the establishment of P2P direct connection between the first terminal device, the second terminal device and the third terminal device as an example to illustrate the method of the embodiment of this application. In some implementations, the above P2P direct connection can also be replaced by a WiFi AP+STA connection, the above GO can be replaced by an AP, and the above GC can be replaced by an STA. This application does not make specific limitations in this regard.

[0502] The data transmission method of this application will be described below from the perspective of interactions between multiple devices. The devices involved below can be terminal devices, chips in terminal devices, chip systems or processors, and can also be logic modules or software that can implement all or part of the functions of terminal devices. The hardware structure of the terminal device can be as Figure 3 shown, and the software structure can be as Figure 4 or Figure 5 shown. This application does not make specific limitations in this regard.

[0503] The embodiment of this application also provides a data transmission method 700. The method 700 can be applicable to the above scenarios 1 to 5. The hardware structure of the devices involved can be as Figure 3 shown, and the software structure can be as Figure 4 or Figure 5 shown. The method 700 includes the following steps:

[0504] S701. The first device in the first group sends a first connection request to the second device in the second group.

[0505] It should be understood that the second group includes multiple devices. The first group may only include the first device, and the first device is configured with the ability to be the master device in the group. For example, the first device may be the first terminal device in the above method 600. Or, both the first group and the second group include multiple devices. For example, the first group includes 3 devices and the second group includes three devices, etc. Or, both the first group and the second group include multiple devices.

[0506] The first connection request can be understood as a request for establishing a physical link, such as request 2 in S110 of method 600.

[0507] S702. The first device determines the master device of the third group as the first target device among the master devices of the first group and the second group. The third group is the group obtained by combining the first group and the second group.

[0508] In the case where the first group only includes the first device, the first target device is the first device, such as the above scenario 1. In the case where the first group includes multiple devices, the first target device is one of the master device in the first group and the master device in the second group. When the first device is in the first group, the first target device may also be the first device; when the second device is in the second group, the first target device may also be the second device.

[0509] In the case where the first group includes multiple devices, the master device in the first group may or may not be the first device. The master device in the second group may or may not be the second device.

[0510] That the third group is the group obtained by combining the first group and the second group does not necessarily mean that the third group includes all the devices in the first group and the second group. For example, when multiple devices establish a physical link with the first target device, the third group does not include the multiple devices; subsequently, after the multiple devices establish a physical link with the second target device, the multiple devices join the third group.

[0511] The first device can determine the master device of the third group by using one or more of the following rules: select the device configured with the ability to be the master device in the group; or, select the device with the largest media access control (MAC) address; or, select the device with the smallest power consumption per unit time; or, select the plugged-in device.

[0512] Among them, if there is a device with the ability to be the master device in the group, the device with the ability to be the master device in the group is preferentially 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 with the ability to be the master device in the group as the master device, it is convenient to improve the success rate of forming a new group; selecting the device with the smallest power consumption per unit time and / or selecting a plugged-in device makes the master device less sensitive to power consumption. Since 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 can enable more types of slave devices to connect to this master device.

[0513] S703. The first device indicates the identification information of the first target device to multiple devices in the target group, where the target group is the group disbanded among the first group and the second group.

[0514] Among them, the identification information can be, for example, the account and password of the first target device for connecting to the first target device. Exemplarily, the first target device can be the first terminal device in method 600, and the identification information can be the account and password of the first terminal device.

[0515] The multiple devices can be all or part of the devices in the target group.

[0516] S704. In the case where the target group is disbanded, each of the multiple devices accesses the first target device by using the identification information and respectively sends a second connection request of each of the multiple devices to the first target device.

[0517] It should be understood that each of the multiple devices accessing the first target device by using the identification information can be, for example, the process in which the second terminal device and the third terminal device in method 600 access the first terminal device, that is, S230 and S321 in method 600. Refer to the above description, and details are not described herein again.

[0518] The second connection request is used to request the first target device to process the task of establishing a physical link, that is, to complete the establishment of a physical link with each of the multiple devices. For example, the information for indicating the establishment of a physical link in S231 and S322 in method 600. Each of the multiple devices respectively sending a second connection request to the first target device can be understood as that each of the multiple devices sends its own second connection request to the first target device. For example, the second terminal device and the third terminal device in method 600 respectively send information for indicating the establishment of a physical link (S231 and S322) to the first terminal device. Refer to the above description, and details are not described herein again.

[0519] S705. In response to the second connection request, the first target device establishes physical links with multiple devices in the target group in parallel.

[0520] It should be understood that the first target device establishing physical links with multiple devices in the target group in parallel can be understood as the first target device processing the second connection requests of multiple devices in parallel and completing the establishment of physical links with each device among the multiple devices.

[0521] It should be understood that the process of multiple devices establishing physical links with the first target device (S704 and S705) can refer to the implementation manners of S230, S126 to S129, and S321 and S322 in method 600, which will not be elaborated here.

[0522] In the data transmission method of this application, when the first device needs to establish a physical link with a second device in the second group and a connection conflict occurs, it can enable the devices in the dissolved groups in the first group and the second group to establish physical links with the new master device, thereby facilitating the establishment of the service between the first device and the second device; at the same time, it can also restore the interrupted services in the dissolved groups, reduce connection conflict scenarios, and improve the user experience.

[0523] As an optional embodiment, method 700 further includes: in response to the first 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, the first device determines the first target device.

[0524] It should be understood that after the first device determines a connection conflict, it then determines the master device of the third group. The first device can determine a connection conflict based on the information indicating a connection conflict from the second device. The information indicating a connection conflict can be, for example, the information indicating that a physical link cannot be established in S216 of method 600. This process is similar to the implementation manners of S216 and S111 to S117 in method 600, and can refer to the above description, which will not be elaborated here.

[0525] It should be noted that in method 700, in the first case, the first target device can be the first device. For example, the first device is the master device in the first group, and the first device determines the first device as the master device of the third group among the first device and the master device of the second group, or the first group only includes the first device, and the first device is set with the ability to be the master device in the group. Then the first device can directly indicate the identification information to multiple devices.

[0526] Exemplarily, as Figure 23 shown, the data transmission method 2300 provided in the embodiment of this application includes the following steps:

[0527] S2301. Device 1 sends a first connection request to Device 2 in Group 1.

[0528] Among them, Device 1 is set with the ability to be the master device in the group. Device 2 and Device 3 are in Group 1. Device 2 is the slave device in Group 1, and Device 3 is the master device in Group 1.

[0529] S2302. Device 1 determines that the new master device is Device 1.

[0530] Optionally, S2302 can be the new master device determined after Device 2 sends information indicating a connection conflict to Device 1.

[0531] S2303. Device 1 sends the identification information of Device 1 to Device 3.

[0532] S2304. Device 3 forwards the identification information of Device 1 to the slave device in Group 1, that is, Device 2.

[0533] S2305. Device 2 accesses Device 1 using the identification information.

[0534] S2306. Device 3 accesses Device 1 using the identification information.

[0535] S2307. Device 2 sends a second connection request to Device 1.

[0536] S2308. Device 3 sends a second connection request to Device 1.

[0537] S2309. Device 1 establishes a physical link with Device 2 and Device 3 in parallel.

[0538] Among them, Group 1 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 first target device. Device 1 can be understood as the first device and the first target device in Method 700, that is, the first device and the first target device in Method 700 can be the same device. Device 2 can be understood as the second device in Method 700. Device 3 can be understood as the master device of the target group in Method 700.

[0539] It should be understood that in some possible implementation manners, if Device 2 is the slave device in Group 1 and Device 3 is the master device in Group 1, then Device 1 instructs Device 2 of the identification information, and Device 2 forwards the identification information to Device 3, etc. In such cases, the implementation manners are all similar to Method 2300. For the sake of brevity, they are not listed one by one here.

[0540] In the second case, the first target device is not the first device. For example, the first device determines that the master device in the second group is the master device of the third group. Then the first device needs to obtain the identification information of the first target device from the first target device, and then indicate the identification information to multiple devices.

[0541] Optionally, the first device may obtain the identification information of the first target device in the following manner: After S702, method 700 further includes: The first device sends information indicating that the master device of the third group is the first target device to the first target device; in response to the information indicating that the master device of the third group is the first target device, the first target device sends the identification information to the first device.

[0542] It should be understood that in the case where the first target device determines that the master device of the third group is the first target device, the first target device may send the identification information to the first device, facilitating the subsequent indication of the identification information to multiple devices by the first device, so that multiple devices can access the first target device.

[0543] Exemplarily, as Figure 24 shown, the data transmission method 2400 provided by the embodiment of the present application includes the following steps:

[0544] S2401. The device 4 in group 2 sends a first connection request to the device 6 in group 3. Device 4 and device 5 are in group 2. Device 4 is a slave device in group 2, and device 5 is the master device in group 2. Device 6 and device 7 are in group 3. Device 6 is a slave device in group 3, and device 7 is the master device in group 3.

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

[0546] Optionally, S2402 may be determined as the new master device after the device 6 sends information indicating a connection conflict to the device 4.

[0547] S2403. Device 4 sends information indicating that the new device is device 7 to device 7.

[0548] S2404. Device 7 sends the identification information of device 7 to device 4.

[0549] S2405. Device 4 sends the identification information to device 5.

[0550] Since the slave devices in group 2 only include device 4, device 5 may not forward the identification information to the slave devices in group 2. In some embodiments, device 5 may also forward the identification information to the slave devices in group 2, and the present application does not make specific limitations thereon.

[0551] S2406. Device 4 accesses device 7 using the identification information.

[0552] S2407. The device 5 accesses the device 7 using the identification information.

[0553] S2408. The device 4 sends a second connection request to the device 7.

[0554] S2409. The device 5 sends a second connection request to the device 7.

[0555] S2410. The device 7 establishes physical links with the device 4 and the device 5 in parallel.

[0556] Among them, 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 first target device. The device 4 can be understood as the first device in Method 700. The device 5 can be understood as the master device of the target group in Method 700. That is, Group 2 can be understood as the target group in Method 700. The device 6 can be understood as the second device in Method 700. The device 7 can be understood as the first target device in Method 700.

[0557] It should be understood that in some possible implementation manners, if the device 4 is the master device in Group 2 and the device 5 is the slave device in Group 2, then the device 4 instructs the device 5 of the identification information, and the device 5 will no longer forward the identification information; and / or, if the device 6 is the master device in Group 3 and the device 7 is the slave device in Group 3, then the device 6 can be the new master device. In such cases, their implementation manners are similar to those of Method 2400. For the sake of brevity, they are not listed one by one here.

[0558] It should be noted that Method 2300 and Method 2400 are exemplary descriptions of Method 700. The implementation manners of each step in Method 2300 and Method 2400 can be respectively referred to the descriptions in Method 700, which will not be elaborated here. In the scenarios shown in Method 2300 and Method 2400, the group may further include more devices, and their implementation manners are similar to those of Method 2300 or Method 2400, which are not listed one by one here.

[0559] Optionally, in Method 700, the information for indicating that the master device of the third group is the first target device may be carried in the information for initiating network formation preemption. Among them, network formation preemption can be understood as the process of dissolving the target group and establishing physical links between multiple devices and the first target device.

[0560] Exemplarily, the first device may send information for initiating network formation preemption to the first target device; the first target device forwards the information for initiating network formation preemption to the slave devices of the non-target group, where the non-target group is the group including the first target device among the first group and the second group; the slave devices of the non-target group respectively send network formation preemption responses to the first target device; the first target device sends a network formation preemption response to the first device. And / or,

[0561] The first device may send information for initiating network formation preemption to the master device of the target group; the master device of the target group forwards the information for initiating network formation preemption to the slave devices of the target group; the slave devices of the target group respectively send network formation preemption responses to the master device of the target group; the master device of the target group sends a network formation preemption response to the first device.

[0562] In this way, the devices in the first group and the second group can determine that the master device of the third group is the first target device. This facilitates subsequent connection to the first target device, or includes a physical link with the first target device.

[0563] It should be understood that the information for initiating network formation preemption may be, for example, request 3 in S119 and S218 in method 600; the network formation preemption response may be, for example, response 1 in S311 and S220 in method 600. Similar to the implementation manners of S119, S217 to S220, and S310 and S311, reference may be made to the above description and will not be elaborated here.

[0564] Optionally, the information for indicating the initiation of network formation preemption may include device information of the devices in the first group, device information of the devices in the second group, information for indicating that the master device of the third group is the second target device, and information for indicating the initiator and the recipient of the first connection request. In this way, the devices in the first group and the second group can both determine the master device of the third group, and then determine whether the local device belongs to the newly established third group, thereby facilitating subsequent determination of whether to disconnect the physical link. For example, S124, S225, and S315 in method 600.

[0565] It should be understood that the device information may be information for indicating a device. For example, the device information of the first device in the first group may be the device ID and / or device model of the first device, etc. Or, the device information may also be understood as a device list of the first group. The device information may also include the device ID and / or device model of each device in the first group, etc., and information about the role of each device in the first group in the first group. For example, the first device is the GO in the first group.

[0566] In addition, the above identification information may be carried in the information for indicating dynamic network formation. Specifically as follows.

[0567] As an optional embodiment, S703 may be implemented in the following manner: The first device sends information for indicating dynamic network formation to the master device in the target group, and the information for indicating dynamic network formation carries identification information; The master device in the target group forwards the information for indicating dynamic network formation to the slave devices in the target group respectively.

[0568] It should be understood that the information for indicating dynamic network formation may be, for example, the information for indicating entering the dynamic network formation state in S121 and S221 of method 600. The implementation manner of this embodiment is similar to that of S121 and S221, and reference may be made to the above description, which will not be elaborated here.

[0569] Based on the above embodiment, method 700 may further include the following steps: In response to the information for indicating dynamic network formation from the first device, the master device of the target group deletes the physical link with the slave devices among the multiple devices; In response to the information for indicating dynamic network formation from the master device in the target group, the slave devices in the target group delete the physical link with the master device in the target group; The target group is disbanded.

[0570] It should be understood that this embodiment is the process of disbanding the target group. The implementation manner of this embodiment is similar to that of S226 and S316 in method 600, and reference may be made to the above description, which will not be elaborated here.

[0571] As an optional embodiment, the respective second connection requests of the multiple devices carry information for indicating each of the multiple devices; S705 may be implemented in the following manner: The first target device saves the information for indicating each of the multiple devices in parallel; The first target device sends information for indicating successful establishment of the physical link to the multiple devices respectively.

[0572] It should be understood that the implementation manner of this embodiment is similar to that of S126 to S129 in method 600, and reference may be made to the above description, which will not be elaborated here.

[0573] Optionally, after the physical link between the first target device and the multiple devices is established, the reference count of the first target device may be incremented by N, and the reference count of each device among the multiple devices may be incremented by 1, where N is the number of the multiple devices. The implementation manner of this process is similar to that of S127, S232, and S323 in method 600, and reference may be made to the above description, which will not be elaborated here.

[0574] As an optional embodiment, after S705, method 700 further includes: a first target device obtains information indicating that a first transmission channel is successfully established, where the first transmission channel is a transmission channel between a first device and a second device, and the first transmission channel is used to transmit data generated by the operation of a second service corresponding to a first connection request; in response to the information indicating that the first transmission channel is successfully established, the first target device respectively sends information indicating entry into a first state to a third device and a fourth device among a plurality of devices, where the first state is a state of resuming a disconnected service; in response to the information indicating entry into the first state, the third device and the fourth device establish a second transmission channel and resume a first service, where the second transmission channel is used to transmit data generated by the operation of the first service, and the first service is a service that was disconnected between the third device and the fourth device.

[0575] In Case 1, if the first target device is the first device, then the first target device can determine that the first transmission channel is successfully created. For example, if the first device is the first terminal device described above and the second device is the second terminal device described above. If the first device and the second device establish the first transmission channel in the manner shown in S133 and S238 of method 600, then the first target device (the first device) can determine that the first transmission channel is successfully established based on the transmission channel establishment response.

[0576] In Case 2, if the first target device is not the first device. Then the first target device can obtain the information indicating that the first transmission channel is successfully established through the following method: the first target device sends information indicating the establishment of the first transmission channel to the first device; the first device and the second device establish the first transmission channel; the first device sends information indicating that the first transmission channel is successfully established to the first target device.

[0577] For example, in method 2400, after device 4 and device 6 establish a transmission channel, device 4 can indicate that the transmission channel establishment is completed to device 7.

[0578] In Case 3, if the first target device is neither the first device nor the second device. Then the first target device can obtain the information indicating that the first transmission channel is successfully established through the following method: the first target device sends information indicating the establishment of the first transmission channel to the second device; the first device and the second device establish the first transmission channel; the second device sends information indicating that the first transmission channel is successfully established to the first target device.

[0579] It should be understood that the process of establishing a transmission channel between the first device and the second device is similar to the implementation manners of S130 to S134 and S235 to S239 in method 600, and reference can be made to the above description; in addition, the first state can be understood as the dynamic networking recovery state in method 600. The information used to indicate exiting the first state can also be understood as the information used to indicate entering the dynamic networking recovery state in S138 and S139 of method 600. The third device can be, for example, the second terminal device described above, the fourth device can be, for example, the third terminal device above, the first service can be, for example, the multi-screen collaboration service above, and the implementation manner of this embodiment is similar to the implementation manners of S138 and S139, S240 to S248, and S326 to S335, and reference can be made to the above description, which will not be elaborated here.

[0580] Optionally, during the process of establishing a transmission channel between the first device and the second device, the first device and the second device can also increment the reference count by 1 respectively.

[0581] Based on the above embodiment, after restoring the first service, method 700 further includes: the third device and the fourth device respectively send information used to indicate exiting the first state to the first target device; in response to the information used to indicate exiting the first state from the third device and the fourth device, the first target device respectively sends a response to exit the first state to the third device and the fourth device.

[0582] It should be understood that the implementation manner of this embodiment is similar to the implementation manners of S140 to S145, S249 to S251, and S336 to S338 in method 600, and reference can be made to the above description, which will not be elaborated here.

[0583] Optionally, when the first target device and the third device exit the first state, they can respectively decrement the reference count by 1, such as S142 and S251; when the first target device and the fourth device exit the first state, they can also respectively decrement the reference count by 1, such as S145 and S338. Reference can be made to the above description, which will not be elaborated here.

[0584] Optionally, the third device and the fourth device establish a second transmission channel, which can be implemented in the following manner: the third device sends information for indicating multiplexing of a physical link to the fourth device, and the third device is the initiating end of the first service; in response to the information for indicating multiplexing of the physical link, the fourth device sends information for indicating successful multiplexing of the physical link to the third device, and the information for indicating successful multiplexing of the physical link carries the device Internet Protocol (IP) of the fourth device; in response to the information for indicating successful multiplexing of the physical link, the third device sends information for indicating establishment of a transmission channel to the fourth device, and the information for indicating establishment of a transmission channel carries the device IP of the third device; in response to the information for indicating establishment of a transmission channel, the fourth device sends information for indicating successful establishment of the transmission channel to the third device.

[0585] It should be understood that the implementation manner of this embodiment is similar to the implementation manners of S243 to S248 and S329 to S335 in method 600, and reference can be made to the above description, which will not be elaborated here.

[0586] Optionally, during the process of the third device and the fourth device establishing a transmission channel, the third device and the fourth device can also increment the reference count by 1 respectively. For example, S329 and S224. Reference can be made to the above description, which will not be elaborated here.

[0587] It should be understood that in some implementation manners, the first device in method 700 can be understood as the first terminal device in the above text, the second device can be understood as the second terminal device in the above text, the target group can be understood as the P2P group established by the second terminal device and the third terminal device in the above text, and the first target device can be understood as the first terminal device in the above text. Then, method 700 is similar to the implementation of method 600, and reference can be made to the above description, which will not be elaborated here.

[0588] It should also be understood that the magnitudes of the sequence numbers of the above methods do not mean the order of execution. The order of execution of each method should be determined according to its function and internal logic.

[0589] It should be noted that in the embodiments of the present application, states such as the first state, the dynamic networking state, and the dynamic networking recovery state are states in which the terminal device enters a state of executing a specific processing strategy. For example, when the terminal device enters the dynamic networking recovery state, service recovery will be performed. Entering a certain state above can also be understood as the terminal device entering a certain mode, etc., and the present application does not make specific limitations on this.

[0590] It should also be noted that in the embodiments of the present application, multiple devices that discover each other can be devices with the Bluetooth switch and / or the WiFi switch turned on and logged in to the same user account. Different from the accounts of the devices used to establish WiFi direct connection, the user account here refers to the account that the user logs in to on the device to identify which user the device belongs to.

[0591] In combination with the above Figures 1 to 24 , the data transmission method of the embodiment of the present application has been described in detail. Next, in combination with Figure 25 , the data transmission device of the embodiment of the present application will be described in detail.

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

[0593] It should be understood that the device 2500 can specifically be the terminal device or equipment in the above embodiment, and can be used to execute each step and / or process corresponding to the terminal device or equipment in the above method embodiment. Optionally, the memory 2503 may include a read-only memory and a random access memory, and provide instructions and data to the processor. A part 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 2501 can be used to execute the instructions stored in the memory, and when the processor 2501 executes the instructions stored in the memory, the processor 2501 is used to execute each step and / or process of the above method embodiment.

[0594] It should be understood that in the embodiment of the present application, the processor may be a central processing unit (CPU), and the processor may also 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. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

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

[0596] The present application also provides a computer-readable storage medium, which is used to store a computer program for implementing the method shown in the above method embodiments.

[0597] The present application also provides a computer program product, which includes a computer program (which can also be 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 embodiments.

[0598] Those of ordinary skill in the art can realize that the modules and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, or by the combination of computer software and electronic hardware. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present application.

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

[0600] In several embodiments provided by the present 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 illustrative. For example, the division of the modules is only a logical function division, and there can be other division methods in actual implementation. For example, 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 displayed or discussed couplings or direct couplings or communication connections to each other can be through some interfaces, and the indirect couplings or communication connections of the devices or modules can be in electrical, mechanical, or other forms.

[0601] The module described as a separation component may or may not be physically separated. The component shown as a module may or may not be a physical module, that is, it may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0602] In addition, in each embodiment of the present application, each functional module can be integrated into a processing module, or each module can exist physically alone, or two or more modules can be integrated into one module.

[0603] If the above function is implemented in the form of a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing 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 methods described in each embodiment of the present application. The foregoing storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical discs that can store program codes.

[0604] The above is only the specific implementation manner of the present application, but the protection scope of the embodiments of the present application is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed in the embodiments of the present application, and all of them should be covered by the protection scope of the embodiments of the present application. Therefore, the protection scope of the embodiments of the present application should be subject to the protection scope 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 first connection request to a second device in a second group, a first target device indicates identification information of the first target device to multiple devices in a target group; wherein, the first target device is a master device in a third group, and the third group is a group obtained by merging the first group and the second group, and the target group is a group dissolved from the first group and the second group; The first target device receives respective second connection requests from the multiple devices, and the second connection requests are sent after the multiple devices access the first target device by using the identification information; In response to the second connection requests, the first target device establishes physical links with the multiple devices in parallel.

2. The method according to claim 1, wherein After the first target device establishes physical links with the multiple devices in parallel, the method further includes: The first target device respectively sends information for indicating entering a first state to a third device and a fourth device among the multiple devices, the first state is a state of resuming a disconnected service, and a first service disconnected between the third device and the fourth device is resumed after receiving the information for indicating entering the first state.

3. The method according to claim 2, wherein After the first target device establishes physical links with the multiple devices in parallel, the method further includes: Obtaining information for indicating successful establishment of a first transmission channel, where the first transmission channel is a transmission channel between the first device and the second device, and the first transmission channel is used to transmit data generated by running a second service corresponding to the first connection request; The first target device respectively sending the information for indicating entering the first state to the third device and the fourth device among the multiple devices includes: In response to the information for indicating successful establishment of the first transmission channel, the first target device respectively sends the information for indicating entering the first state to the third device and the fourth device.

4. The method according to claim 3, characterized in that, The obtaining the information for indicating successful establishment of the first transmission channel includes: The first target device sends information for indicating establishment of the first transmission channel to the first device and receives the information for indicating successful establishment of the first transmission channel from the first device, and the first target device is not the first device; or, The first target device sends the information for indicating establishment of the first transmission channel to the second device and receives the information for indicating successful establishment of the first transmission channel from the second device, and the first target device is the first device.

5. The method according to any one of claims 2 to 4, characterized in that After the first service is disconnected and before the first service is resumed, the third device and / or the fourth device displays a masking interface of the first service; and / or After the first service is resumed, the third device and / or the fourth device displays an interface of the first service.

6. The method according to any one of claims 2 to 5, characterized in that The method further includes: After the first service is resumed, the first target device respectively receives information for indicating exiting the first state from the third device and the fourth device; In response to the information for indicating exiting the first state from the third device and the fourth device, the first target device exits the first state.

7. The method according to any one of claims 2 to 6, characterized in that After the first target device establishes physical links with the multiple devices in the target group in parallel, the method further includes: Receiving and saving the information for indicating Transmission Control Protocol / Internet Protocol (TCP / IP) and ports from each of the multiple devices, where the TCP / IP and the ports are used to establish a Transmission Control Protocol (TCP) channel; Sending the information for indicating the TCP / IP and ports of the third device to the fourth device; Sending the information for indicating the TCP / IP and ports of the fourth device to the third device, where the first service is restored using a first TCP channel between the third device and the fourth device, and the first TCP channel is established using the TCP / IP and ports of the third device and the TCP / IP and ports of the fourth device.

8. The method according to any one of claims 1 to 7, 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 first device in the second group.

9. The method according to claim 8, wherein The master device in the third group satisfies 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 minimum power consumption per unit time 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 a plugged-in device.

10. The method according to any one of claims 1 to 9, characterized in that, The second connection request is sent after the target group is disbanded, and the target group is disbanded based on the information for indicating dynamic network formation sent by the first device. The dynamic network formation means disbanding the target group and joining the third group, and the information for indicating dynamic network formation carries the identification information.

11. The method according to claim 10, characterized in that, The information for indicating dynamic network formation is indicated by the first device to the master device in the target group and forwarded by the master device in the target group to the slave devices among the multiple devices; The method further includes: The first target device sends the identification information to the first device, where the first device is not the first target device.

12. The method according to claim 11, wherein The method further includes: The first target device receives the information for indicating initiating network formation preemption from the first device, and the information for indicating initiating network formation preemption carries the information for indicating that the master device of the third group is the first target device; The first target device sending the identification information to the first device includes: In response to the information for indicating initiating network formation preemption, the first target device sends the identification information to the first device.

13. A data transmission method, characterized in that, The method includes: The first device in the first group sends a first connection request to the second device in the second group; The first device determines the master device of a third group as the first target device among the master devices of the first group and the master devices of the second group, where the third group is a group obtained by combining the first group and the second group; The first device indicates the identification information of the first target device to multiple devices in the target group, where the target group is the group among the first group and the second group that has been disbanded; When the target group is disbanded, each of the multiple devices accesses the first target device by using the identification information and respectively sends a second connection request of each of the multiple devices to the first target device; In response to the second connection request, the first target device establishes physical links with the multiple devices in the target group in parallel.

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

15. The method according to claim 13 or 14, characterized in that, The first target device is not the first device; After the first device determines the master device of a third group as the first target device among the master devices of the first group and the master devices of the second group, the method further includes: The first device sends information for indicating that the master device of the third group is the first target device to the first target device; In response to the information for indicating that the master device of the third group is the first target device, the first target device sends the identification information to the first device.

16. The method according to any one of claims 13 to 15, characterized in that The first device indicates the identification information of the first target device to multiple devices in the target group, including: The first device sends information for indicating dynamic network formation to the master device in the target group, and the information for indicating dynamic network formation carries the identification information; The master device in the target group forwards the information for indicating dynamic network formation to the slave devices in the target group respectively.

17. The method according to claim 16, wherein The dynamic network formation means disbanding the target group and joining the third group; The method further includes: In response to the information for indicating dynamic network formation from the first device, the master device of the target group deletes the physical link with the slave devices among the multiple devices; In response to the information for indicating dynamic network formation from the master device in the target group, the slave devices in the target group deletes the physical link with the master device in the target group; The target group is disbanded.

18. The method according to claim 17, wherein The second connection request of each of the multiple devices carries information for indicating each of the multiple devices; The first target device establishes physical links with the multiple devices in the target group in parallel, including: The first target device saves the information for indicating each of the multiple devices in parallel. The first target device sends information indicating successful establishment of a physical link to the multiple devices respectively.

19. The method according to any one of claims 13 to 18, characterized in that, After the first target device establishes physical links with the multiple devices in the target group in parallel, the method further includes: The first target device obtains information indicating successful establishment of a first transmission channel, where the first transmission channel is a transmission channel between the first device and the second device, and the first transmission channel is used to transmit data generated by the operation of a second service corresponding to the first connection request; In response to the information indicating successful establishment of the first transmission channel, the first target device sends information indicating entry into a first state to a third device and a fourth device among the multiple devices respectively, where the first state is a state of resuming a disconnected service; In response to the information indicating entry into the first state, the third device and the fourth device establish a second transmission channel and resume a first service, where the second transmission channel is used to transmit data generated by the operation of the first service, and the first service is a service that was disconnected between the third device and the fourth device.

20. The method according to claim 19, wherein After resuming the first service, the method further includes: The third device and the fourth device send information indicating exit from the first state to the first target device respectively; In response to the information indicating exit from the first state received from the third device and the fourth device, the first target device sends a response indicating exit from the first state to the third device and the fourth device respectively.

21. The method according to claim 19 or 20, characterized in that, The third device and the fourth device establishing a second transmission channel includes: The third device, which is the initiator of the first service, sends information indicating reuse of a physical link to the fourth device; In response to the information indicating reuse of the physical link, the fourth device sends information indicating successful reuse of the physical link to the third device, and the information indicating successful reuse of the physical link carries the device Internet Protocol (IP) of the fourth device; In response to the information indicating successful reuse of the physical link, the third device sends information indicating establishment of a transmission channel to the fourth device, and the information indicating establishment of a transmission channel carries the device IP of the third device; In response to the information indicating establishment of the transmission channel, the fourth device sends information indicating successful establishment of the transmission channel to the third device.

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

23. An electronic device, characterized in that, It includes: A processor, where the processor is coupled to a memory, and the memory is used to store a computer program. When the processor calls the computer program, the electronic device executes the method according to any one of claims 1 to 21.

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

25. A chip system, characterized in that, Comprising 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 configured to run a computer program or instructions to perform the method according to any one of claims 1 to 21.

26. A computer program product, characterized in that, The computer program product includes computer program code, which, when running on a computer, causes the computer to implement the method according to any one of claims 1 to 21.

Citation Information

Patent Citations

  • Wi-Fi (wireless fidelity)-based group establishing method and WiFi directly-connecting equipment

    CN103702291A

  • Wi-Fi direct communication method and device

    CN115802516A

  • Improved discovery of P2P groups using assistance of aps in infrastructure networks

    GB202311357D0

  • Changing topology of wireless peer-to-peer group

    US20150264123A1