Search

CN-122002639-A - P2P connection method and device

CN122002639ACN 122002639 ACN122002639 ACN 122002639ACN-122002639-A

Abstract

The embodiment of the application provides a P2P connection method and device, and relates to the technical field of communication. The method can realize P2P connection of different types of electronic devices (such as a first type of device using an application module for decision and a second type of device using a link module for decision and old devices) in a multi-device scene. The method may include the second link module of the second electronic device obtaining WI FI capability information of the third electronic device. The WI FI capability information comprises at least one of the identification, the model number and the available channels of at least one network card, and the information of the established WI FI connection of the local terminal equipment. And the second link module determines the connection configuration for establishing P2P connection with the third electronic equipment according to the WI FI capability information of the third electronic equipment and the WI FI capability information of the second electronic equipment. And establishing P2P connection with the third electronic equipment according to the connection configuration of the P2P connection.

Inventors

  • ZHAO SHUAI
  • XIA DENGZHOU
  • KE XIAOFENG

Assignees

  • 荣耀终端股份有限公司

Dates

Publication Date
20260508
Application Date
20241029

Claims (20)

  1. 1. A P2P connection method is characterized in that the method is applied to a second electronic device, The second electronic device and the first electronic device are connected by a first P2P connection, and the method is used for establishing the P2P connection between the second electronic device and the third electronic device; The first electronic device and the second electronic device are both devices of a second type, and a frame layer of the devices of the second type is provided with a link module, wherein the link module is used for deciding P2P connection configuration of the devices of the second type, and the P2P connection configuration comprises at least one of network card information used as role information of GO/GC and frequency information for P2P communication; The third electronic device is a first type device, and an application module is arranged at an application layer of the first type device and is used for deciding P2P connection configuration of the first type device; The method comprises the following steps: the second link module of the second electronic device acquires the WIFI capability information of the third electronic device, wherein the WIFI capability information comprises at least one of the identifier, the model and the available channel of at least one network card, and the information of the WIFI connection established by the local terminal device; The second link module determines connection configuration for establishing P2P connection with the third electronic device according to the WIFI capability information of the third electronic device and the WIFI capability information of the second electronic device; and establishing P2P connection with the third electronic equipment according to the connection configuration of the P2P connection.
  2. 2. The method of claim 1, wherein before the second link module of the second electronic device obtains WIFI capability information of the third electronic device, the method further comprises: and receiving a first operation, wherein the first operation is used for indicating the second electronic equipment to establish P2P connection with the third electronic equipment.
  3. 3. The method of claim 1, wherein the step of determining the position of the substrate comprises, The second link module of the second electronic device obtains WIFI capability information of the third electronic device, including: And receiving a first connection establishment request from third electronic equipment, wherein the first connection establishment request comprises WIFI capability information of the third electronic equipment.
  4. 4. The method of any of claims 1-3, wherein prior to obtaining WIFI capability information for the third electronic device, the method further comprises: The first encryption negotiation channel is used for carrying out data transmission between the application module of the second electronic device and the application module of the third electronic device; The application module of the second electronic device registers a first auxiliary channel with the second link module, the first auxiliary channel is used for data transmission between the second link module and the application module of the second electronic device, and the first auxiliary channel corresponds to the first encryption negotiation channel.
  5. 5. The method of claim 4, wherein prior to the second link module obtaining WIFI capability information for the third electronic device, the method further comprises: the application module of the second electronic device sends a first connection establishment instruction to the second link module, wherein the first connection establishment instruction is used for indicating that the third electronic device is a first type of electronic device, and the first connection establishment instruction also indicates that the second link module establishes P2P connection to the third electronic device; the second link module obtains WIFI capability information of the third electronic device, including: And the second link module acquires the WIFI capability information of the third electronic device from the link module of the third electronic device according to the first connection establishment instruction.
  6. 6. The method according to any one of claims 1-5, wherein the determining, according to the WIFI capability information of the third electronic device and the WIFI capability information of the second electronic device, the connection configuration for establishing a P2P connection with the third electronic device by the second link module includes: The second link module determines that a first preset condition is met according to the WIFI capability information of the third electronic device and the WIFI capability information of the second electronic device; the second link module determining a connection configuration to establish a P2P connection with the third electronic device includes: and establishing P2P direct communication with the third electronic equipment by using the available network card of the second electronic equipment.
  7. 7. The method of claim 6, wherein the step of providing the first layer comprises, The first preset condition includes: the second electronic device includes at least one available network card, and the third electronic device includes an available network card.
  8. 8. The method of claim 5, wherein the determining, according to the WIFI capability information of the third electronic device and the WIFI capability information of the second electronic device, the connection configuration for establishing a P2P connection with the third electronic device by the second link module includes: The second link module determines that a second preset condition is met according to the WIFI capability information of the third electronic device and the WIFI capability information of the second electronic device; the second link module determining a connection configuration to establish a P2P connection with the third electronic device includes: And establishing P2P bridging communication with the third electronic device through the first electronic device by using a second network card of the second electronic device.
  9. 9. The method of claim 8, wherein the second preset condition includes that the second electronic device has no network card available and the third electronic device includes a network card available.
  10. 10. The method according to claim 8 or 9, wherein, The first P2P connection is established between the first electronic device and the second electronic device, and the method comprises the following steps: The first network card of the first electronic device is used as GO, and the first P2P connection is established with the first network card of the second electronic device which is used as GC; The connection configuration of the P2P connection comprises configuration of indication role information; The configuration of the indication role information comprises the steps that a first network card of the second electronic device is used as a GC, a network card of the third electronic device is used as a GC, and the first network card of the first electronic device is used as a GO.
  11. 11. The method according to any of claims 8-10, wherein after determining a connection configuration to establish a P2P connection with the third electronic device, the method further comprises: the second link module sends a first error code to an application module of the second electronic device, where the first error code is used to instruct to establish P2P bridging communication with the third electronic device.
  12. 12. The method of claim 11, wherein the step of determining the position of the probe is performed, Establishing a P2P connection with the third electronic device according to the connection configuration of the P2P connection, including: The application module of the second electronic device sends a first bridging request to the application module of the first electronic device, where the first bridging request is used to request to allocate an equipment IP to the third electronic device.
  13. 13. The method of claim 12, wherein the step of determining the position of the probe is performed, The method further comprises the steps of: The application module of the second electronic device receives a first reply message from the first electronic device, wherein the first reply message comprises at least one of GO connection information of the first electronic device as GO, IP of the third electronic device, IP of the first electronic device and TCP port information; and the application module of the second electronic equipment sends the first reply message to the second link module.
  14. 14. The method of claim 13, wherein the step of determining the position of the probe is performed, The method further comprises the steps of: The second link module generates a second bridging request according to the first reply message, wherein the second bridging request comprises at least one of the following information, namely, the first electronic device is used as GO connection information of GO, the IP of the third electronic device, the IP of the first electronic device and TCP port information, the role information of the second electronic device and the role information of the third electronic device; The role information of the second electronic device indicates that the second electronic device is used as a GC, and the role information of the third electronic device indicates that the third electronic device is used as a GC.
  15. 15. The method of claim 14, wherein the method further comprises: the second link module sends the second bridging request to the application module of the second electronic device, and the application module of the second electronic device sends the second bridging request to the application module of the third electronic device.
  16. 16. The method of claim 15, wherein the P2P connection corresponding to the first operation is for P2P traffic for network sharing; In the case that the third electronic device establishes WIFIP P physical link connection with the first electronic device and a TCP encryption channel, the method further includes: receiving a bridging request success message from an application module of the third electronic device; And according to the IP of the third electronic equipment, the intelligent interconnection application of the second electronic equipment and the intelligent interconnection application of the third electronic equipment carry out intelligent interconnection network sharing negotiation.
  17. 17. A P2P connection method is characterized in that the method is applied to a first electronic device, a first P2P connection is established between the first electronic device and a second electronic device, The first electronic device and the second electronic device are both devices of a second type, and a frame layer of the devices of the second type is provided with a link module, wherein the link module is used for deciding P2P connection configuration of the devices of the second type, and the P2P connection configuration comprises at least one of network card information used as role information of GO/GC and frequency information for P2P communication; The method comprises the following steps: the application module of the first electronic device receives a first bridging request from the second electronic device, wherein the first bridging request is used for requesting to allocate a device IP to a third electronic device; The third electronic device is a first type device, and an application layer of the first type device is provided with an application module, wherein the application module is used for deciding P2P connection configuration of the first type device; The method comprises the steps of sending a first reply message to an application module of first electronic equipment, wherein the first reply message comprises at least one item of GO connection information of the first electronic equipment serving as GO, IP of third electronic equipment, IP of the first electronic equipment and TCP port information, and the GO connection information at least comprises SSID and password corresponding to GO of the first electronic equipment.
  18. 18. The method of claim 17, wherein the step of determining the position of the probe is performed, The first P2P connection is established between the first electronic device and the second electronic device, and the method comprises the following steps: And the first P2P connection is established between the first electronic device and the first network card serving as the GC of the second electronic device through the first network card serving as the GO.
  19. 19. The method according to claim 17 or 18, wherein, Before the sending the first reply message, the method further includes: The application module of the first electronic device sends the first bridging request to the link module of the first electronic device; The link module of the first electronic device generates a first reply packet according to the first bridging request, wherein the first reply packet comprises at least one item of GO connection information of the first electronic device serving as GO, IP of the third electronic device, IP of the first electronic device and TCP port information, and the GO connection information at least comprises SSID and password corresponding to GO of the first electronic device; The link module of the first electronic device sends the first reply message to the application module of the first electronic device, wherein the first reply message comprises the content of the first reply packet.
  20. 20. The method according to any one of claims 17-19, further comprising: establishing WIFIP P physical link connection between the link module of the first electronic device and the link module of the third electronic device, and establishing a TCP encryption channel between the application module of the first electronic device and the application module of the third electronic device; the WIFIP P physical link connection and the TCP encryption channel are used for bridging transmission of first traffic data between the second electronic device and the third electronic device.

Description

P2P connection method and device Technical Field The embodiment of the application relates to the technical field of communication, in particular to a P2P connection method and device. Background In order to better serve users, data transmission (information interaction) can be carried out among various electronic devices, so that functions of file sharing, multi-screen collaboration, screen projection and the like are realized. The electronic devices can adopt a WIFI direct connection (WIFI DIRECT, also called peer-to-peer (P2P)) technology for data transmission. Compared with Bluetooth communication, the WIFI P2P communication distance is farther, the bandwidth is larger, and obvious advantages are achieved. However, when the WIFI P2P communication connection is established between the electronic devices, a channel for performing the WIFI P2P connection and a device serving as a group owner/manager (GO) need to be negotiated, and if the negotiation is not reasonable, the communication quality of the WIFI P2P will be degraded. Disclosure of Invention The application provides a P2P connection method and device, which can realize P2P connection of different types of electronic devices (such as a first type of device using an application module for decision and a second type of device using a link module for decision and old devices) under a multi-device scene. In order to achieve the technical purpose, the application adopts the following technical scheme: In a first aspect, a P2P connection method is provided, where the method is applied to a second electronic device, the second electronic device and the first electronic device establish a first P2P connection, and the method is applied to the second electronic device and a third electronic device establish a P2P connection. The first electronic device and the second electronic device are both devices of a second type, and a frame layer of the devices of the second type is provided with a link module, wherein the link module is used for deciding P2P connection configuration of the devices of the second type. The P2P connection configuration includes at least one of the frequency information for P2P communication using network card information as character information of GO/GC. The third electronic device is a first type device, and an application layer of the first type device is provided with an application module, wherein the application module is used for deciding the P2P connection configuration of the first type device. The method comprises the step that a second link module of the second electronic device obtains WIFI capability information of the third electronic device. The WIFI capability information comprises at least one of identification, model number and available channel of at least one network card, and information of established WIFI connection of the local terminal equipment. And the second link module determines the connection configuration for establishing P2P connection with the third electronic equipment according to the WIFI capability information of the third electronic equipment and the WIFI capability information of the second electronic equipment. And establishing P2P connection with the third electronic equipment according to the connection configuration of the P2P connection. Based on the above, the electronic equipment using two different protocol types can realize the establishment of the P2P connection of the two devices according to the WIFI capability information of the double-end device. In some cases, in the case where both ends have available network cards, the P2P connection may be established using the protocol logic of the first type of device in the form of a P2P direct connection. In other cases, where there is one device at both ends that has no network card available, then the P2P bridging connection may be established using the protocol logic of the first type of device. Take an originating terminal (device that receives a user operation) as an example of the second device. The device at the opposite end of the device may be a connectionless first device. In this way, the initiating terminal device can determine to initiate a direct connection flow or a bridging flow between the first device and the second device according to the local WIFI capability information and the version of the opposite terminal device. For example, in the case where the initiator device has a two-way capability (e.g., is configured with two or more network cards), and there is at least one network card that is idle, the initiator device may establish P2P direct communication with the peer device. Wherein, since the opposite device is the first device, the negotiation can be performed using the first protocol. For another example, in the case where the initiator device does not have an available network card (e.g., all network cards are occupied as GCs, or one GO network card exists but the opposite end cannot be used as a GC), the initiat