Method and electronic device for establishing a wi-fi p2p connection
By exchanging device information before the user initiates a Wi-Fi P2P connection, the problem of long Wi-Fi P2P connection time is solved, resulting in a faster connection process and a better user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HUAWEI TECH CO LTD
- Filing Date
- 2021-04-28
- Publication Date
- 2026-06-16
AI Technical Summary
In existing technologies, establishing a connection using the standard Wi-Fi P2P protocol takes a long time, which cannot meet users' needs for rapid transmission of business data, resulting in a poor user experience.
Before a user initiates a Wi-Fi P2P connection, connection information between electronic devices is exchanged in advance, including inherent and variable information. Multiple discovery methods are used for device discovery and information exchange to improve exchange efficiency and shorten connection time.
By exchanging information in advance, the time required for Wi-Fi P2P connections is reduced, improving the user experience and making it suitable for different platforms and upper-layer applications.
Smart Images

Figure CN122227207A_ABST
Abstract
Description
[0001] This application is a divisional application. The original application has the application number 202110469588.5 and the original application date is April 28, 2021. The entire contents of the original application are incorporated herein by reference. Technical Field
[0002] This application relates to the field of communications, and more specifically, to a method and electronic device for establishing a Wi-Fi P2P connection. Background Technology
[0003] Wi-Fi Direct (Wi-Fi P2P) technology is an important technology under the "Wi-Fi DIRECT" standard protocol launched by the Wireless Fidelity (Wi-Fi®) Alliance. Wi-Fi P2P enables two Wi-Fi devices to connect and communicate directly with each other without the intervention of a Wi-Fi hotspot.
[0004] A complete Wi-Fi P2P service includes three stages: Wi-Fi P2P device discovery, Wi-Fi P2P device connection, and Wi-Fi P2P device data transmission. After the Wi-Fi P2P device connection is established, a P2P group (or Wi-Fi P2P cluster) is formed.
[0005] Establishing a Wi-Fi P2P device connection using the standard Wi-Fi DIRECT protocol takes a long time and cannot meet users' requirements for quickly using the Wi-Fi P2P link to transmit business data, resulting in a poor user experience. Summary of the Invention
[0006] This application provides a method and electronic device for establishing a Wi-Fi P2P connection. The information required for establishing a Wi-Fi P2P connection is exchanged in advance before the electronic device actually initiates the Wi-Fi P2P connection. This allows most of the information to be exchanged by the time the user actually initiates the Wi-Fi P2P connection using the electronic device, thereby further shortening the time required for the Wi-Fi P2P connection and improving the user experience.
[0007] In a first aspect, a method for discovering and connecting electronic devices is provided, the method comprising: a first electronic device acquiring first connection information of a second electronic device, the first connection information being used to establish a Wi-Fi P2P connection, a first operation being used to instruct the establishment of a Wi-Fi P2P connection with the second electronic device, the first electronic device receiving the first operation; and the first electronic device, in response to the first operation, establishing a Wi-Fi P2P connection with the second electronic device according to the first connection information.
[0008] The method for establishing a Wi-Fi P2P connection provided in the first aspect exchanges the first connection information required for the second electronic device to establish a Wi-Fi P2P connection in advance before the user triggers the first operation of establishing a Wi-Fi P2P connection between the first and second electronic devices. This allows most of the information to be exchanged before the user actually initiates the Wi-Fi P2P connection using the electronic device, and only some simple signaling needs to be sent to complete the Wi-Fi P2P connection, thereby further shortening the time required for the Wi-Fi P2P connection and improving the user experience.
[0009] In one possible implementation of the first aspect, the first connection information includes: inherent information of the second electronic device for establishing a Wi-Fi P2P connection and / or variable information of the second electronic device for establishing a Wi-Fi P2P connection.
[0010] For example, the inherent information of the second electronic device for establishing a Wi-Fi P2P connection includes at least one of the following: a list of channels supported by the second electronic device, the SSID of the Wi-Fi P2P group when the second electronic device creates the Wi-Fi P2P group, the PWD of the Wi-Fi P2P group when the second electronic device creates the Wi-Fi P2P group, whether the second electronic device supports Wi-Fi P2P connection, whether the second electronic device supports broadband, and device information of the second electronic device.
[0011] For example, the variable information used by the second electronic device to establish a Wi-Fi P2P connection includes: the Wi-Fi P2P connection status of the second electronic device and / or the frequency of the Wi-Fi hotspot to which the second electronic device is connected.
[0012] In one possible implementation of the first aspect, the method further includes: a first electronic device and a second electronic device establishing a first connection; the first electronic device obtaining first connection information in the Wi-Fi P2P connection of the second electronic device, including: the first electronic device receiving the first connection information sent by the second electronic device through the first connection.
[0013] For example, the first connection includes any one of the following: Bluetooth connection, Wi-Fi connection, NFC connection, Zigbee connection, USB connection, etc. In this implementation, when discovering Wi-Fi P2P devices, various discovery methods (such as BLE discovery, LAN discovery, Wi-Fi P2P discovery, broadcast discovery, etc.) can be used. It supports multiple discovery methods and allows for information exchange using different connection types or broadcast methods, improving the efficiency of information exchange and enhancing versatility and scalability.
[0014] In one possible implementation of the first aspect, the first electronic device obtaining the first connection information of the second electronic device includes: the first electronic device receiving the first connection information sent by the second electronic device via a first broadcast message. For example, the first broadcast message may include a message broadcast via BLE, BR, Wi-Fi, etc.
[0015] For example, the variable information used by the second electronic device to establish a Wi-Fi P2P connection and the inherent information used by the second electronic device to establish a Wi-Fi P2P connection can be sent to the first electronic device using different signaling, or they can be sent to the first electronic device using the same signaling.
[0016] In one possible implementation of the first aspect, the timing of the second electronic device sending variable information for establishing a Wi-Fi P2P connection can be periodic, or it can be sent during the actual establishment of the Wi-Fi P2P connection between the second electronic device and the first electronic device, or it can be sent before the actual establishment of the Wi-Fi P2P connection between the second electronic device and the first electronic device, or it can be sent after a period of time following a change in the variable information for establishing the Wi-Fi P2P connection, or it can be sent immediately after a change in the variable information for establishing the Wi-Fi P2P connection.
[0017] In one possible implementation of the first aspect, the timing of the second electronic device sending variable information for establishing a Wi-Fi P2P connection to the first electronic device can be before sending inherent information for establishing a Wi-Fi P2P connection to the first electronic device, after sending inherent information for establishing a Wi-Fi P2P connection, or simultaneously with sending inherent information for establishing a Wi-Fi P2P connection.
[0018] In one possible implementation of the first aspect, the method further includes: a first electronic device sending second connection information of the first electronic device to a second electronic device; the second connection information is used to establish a Wi-Fi P2P connection, and the second connection information includes: inherent information of the first electronic device for establishing the Wi-Fi P2P connection and / or variable information of the first electronic device for establishing the Wi-Fi P2P connection. In this implementation, the information required by the first electronic device to establish a Wi-Fi P2P connection is sent to the second electronic device in advance, thereby achieving the exchange of information required for establishing a Wi-Fi P2P connection before the electronic device actually initiates the Wi-Fi P2P connection, thus shortening the time required for the Wi-Fi P2P connection and improving the user experience.
[0019] In one possible implementation of the first aspect, sending second connection information of the first electronic device to the second electronic device includes: the first electronic device sending the second connection information of the first electronic device to the second electronic device via a first broadcast message. For example, the first broadcast message may include a message broadcast via BLE, BR, Wi-Fi, etc.
[0020] In one possible implementation of the first aspect, the first electronic device sending second connection information of the first electronic device to the second electronic device includes: the first electronic device sending the second connection information of the first electronic device to the second electronic device through a first connection.
[0021] For example, the variable information used by the first electronic device to establish a Wi-Fi P2P connection and the inherent information used by the first electronic device to establish a Wi-Fi P2P connection can be sent to the second electronic device using different signaling, or they can be sent to the second electronic device using the same signaling.
[0022] In one possible implementation of the first aspect, the timing of the first electronic device sending variable information for establishing a Wi-Fi P2P connection to the second electronic device can be periodic, or it can be sent during the process of establishing a Wi-Fi P2P connection between the first and second electronic devices, or it can be sent after a period of time after the variable information for establishing a Wi-Fi P2P connection changes, or it can be sent immediately after the variable information for establishing a Wi-Fi P2P connection changes.
[0023] For example, the timing of the variable information in the Wi-Fi P2P connection sent by the first electronic device to the second electronic device may be before the first electronic device sends the inherent information of the first electronic device for establishing the Wi-Fi P2P connection to the second electronic device, or after the first electronic device sends the inherent information of the first electronic device for establishing the Wi-Fi P2P connection to the second electronic device, or simultaneously with the first electronic device sending the inherent information in the Wi-Fi P2P connection to the second electronic device.
[0024] For example, the inherent information of the first electronic device for establishing a Wi-Fi P2P connection includes at least one of the following: a list of channels supported by the first electronic device, the SSID of the Wi-Fi P2P group when the first electronic device creates the Wi-Fi P2P group, the PWD of the Wi-Fi P2P group when the first electronic device creates the Wi-Fi P2P group, whether the first electronic device supports Wi-Fi P2P connection, whether the first electronic device supports broadband, and device information of the second electronic device.
[0025] For example, the variable information used by the first electronic device to establish a Wi-Fi P2P connection includes: the Wi-Fi P2P connection status of the first electronic device and / or the frequency of the Wi-Fi hotspot to which the first electronic device is connected.
[0026] In one possible implementation of the first aspect, after the first electronic device and the second electronic device establish a first connection and before the first electronic device receives the first connection information through the first connection, the method further includes: the first electronic device and the second electronic device performing security authentication through the first connection; after the security authentication is successful, the first electronic device adds the second electronic device to a trusted device list. In this implementation, the first electronic device and the second electronic device performing device security authentication through the first connection enables the first electronic device and the second electronic device to mutually determine trusted devices. After determining the trusted device, the exchange of inherent and variable information in the Wi-Fi P2P connection is performed, ensuring the security of information exchange and avoiding the risk of information leakage.
[0027] In one possible implementation of the first aspect, if the first electronic device receives inherent and variable information from the Wi-Fi P2P connection sent by the second electronic device through the first connection, the sender can first encrypt the information using an encryption key before sending it, and the receiver can decrypt the information using a decryption key after receiving it, thus ensuring the security of information transmission.
[0028] In one possible implementation of the first aspect, before the first electronic device sends the inherent information for establishing a Wi-Fi P2P connection to the second electronic device, if the first electronic device has not yet determined that the second electronic device is a trusted device, the first electronic device may send a portion of the inherent information for the Wi-Fi P2P connection to the second electronic device. For example, the device information of the first electronic device may be sent to the second electronic device. Other information in the inherent information for the Wi-Fi P2P connection (e.g., the list of channels supported by the first electronic device, the SSID of the P2P group when the first electronic device creates the P2P group, the PWD of the P2P group when the first electronic device creates the P2P group, whether the first electronic device itself supports Wi-Fi P2P connection, whether the first electronic device supports broadband, etc.) will not be sent to the second electronic device. Only after the first electronic device determines that the second electronic device is a trusted device will it send the other information in the inherent information for the Wi-Fi P2P connection to the second electronic device.
[0029] For example, if the first electronic device has not yet determined that the second electronic device is a trusted device, the user can also choose in the settings which information(s) of the inherent information in the Wi-Fi P2P connection of the first electronic device will be sent to the second electronic device.
[0030] For example, if the first electronic device has determined that the second electronic device is a trusted device, it can send all the information in the inherent information of the first electronic device's Wi-Fi P2P connection to the second electronic device.
[0031] For the second electronic device, if the first electronic device has not yet been determined to be a trusted device, a similar approach can be used to share or send different inherent information in the Wi-Fi P2P connection of the second electronic device to trusted and untrusted devices respectively.
[0032] In one possible implementation of the first aspect, before the first electronic device sends variable information for establishing a Wi-Fi P2P connection to the second electronic device, if the first electronic device has not yet determined that the second electronic device is a trusted device, the first electronic device may send a portion of the variable information for the Wi-Fi P2P connection to the second electronic device. Other information in the variable information for the Wi-Fi P2P connection will not be sent to the second electronic device. Only after the first electronic device determines that the second electronic device is a trusted device will the remaining information in the variable information for the Wi-Fi P2P connection be sent to the second electronic device.
[0033] For example, if the first electronic device has not yet determined that the second electronic device is a trusted device, the user can also choose in the settings which or some of the variable information in the Wi-Fi P2P connection of the first electronic device will be sent to the second electronic device.
[0034] If the first electronic device has determined that the second electronic device is a trusted device, it can send all the information in the variable information of the first electronic device's Wi-Fi P2P connection to the second electronic device.
[0035] For the second electronic device, if the first electronic device has not yet been determined to be a trusted device, a similar approach can be used to share or send different variable information in the Wi-Fi P2P connection of the second electronic device to trusted and untrusted devices respectively.
[0036] In one possible implementation of the first aspect, the method further includes: after the first electronic device receives the first operation, the first electronic device obtains third connection information of the second electronic device, the third connection information including: information used by the second electronic device to establish a Wi-Fi P2P connection, in addition to the first connection information.
[0037] For example, if the first connection information does not include the inherent information of the second electronic device for establishing a Wi-Fi P2P connection, then the third connection information includes the inherent information of the second electronic device for establishing a Wi-Fi P2P connection.
[0038] For example, if the first connection information does not include variable information used by the second electronic device to establish a Wi-Fi P2P connection, then the third connection information includes variable information used by the second electronic device to establish a Wi-Fi P2P connection.
[0039] For example, if the first connection information includes a portion of the inherent information of the second electronic device for establishing a Wi-Fi P2P connection, then the third connection information includes: information other than that portion of the inherent information of the second electronic device for establishing a Wi-Fi P2P connection.
[0040] For example, if the first connection information includes a portion of the variable information used by the second electronic device to establish a Wi-Fi P2P connection, then the third connection information includes: the variable information used by the second electronic device to establish a Wi-Fi P2P connection, excluding that portion of the variable information.
[0041] In one possible implementation of the first aspect, the first electronic device, in response to a first operation, establishes a Wi-Fi P2P connection with the second electronic device based on first connection information, including: the first electronic device determining the frequency of Wi-Fi P2P group establishment, the role assignment of GC devices and GO devices, the SSID and PWD of the Wi-Fi P2P group based on inherent information of the first electronic device for establishing the Wi-Fi P2P connection, the inherent information of the first electronic device for establishing the Wi-Fi P2P connection, the first connection information and the third connection information; the first electronic device sending a second broadcast message to the second electronic device to establish the Wi-Fi P2P group with the second electronic device; the second broadcast message including: the MAC address, IP address and port number of the first electronic device, the frequency of Wi-Fi P2P group establishment, the role assignment of GC devices and GO devices, the SSID and PWD of the Wi-Fi P2P group. In this implementation, after discovering the device, the first and second electronic devices exchange the information required for a Wi-Fi P2P connection in advance. This ensures that by the time the Wi-Fi P2P connection is actually initiated, some or all of the necessary information has already been exchanged. Therefore, only simple signaling (such as broadcast messages or Bluetooth messages) needs to be sent to complete the connection, further shortening the connection time and improving user experience. Furthermore, it can be used on different product platforms to meet the needs of various upper-layer applications.
[0042] For example, the second broadcast message may include a message broadcast via BLE, BR, Wi-Fi, etc.
[0043] In one possible implementation of the first aspect, if the first electronic device is a GO device and the second electronic device is a GC device in the Wi-Fi P2P group, then the first electronic device establishes the Wi-Fi P2P group, and the second electronic device joins the Wi-Fi P2P group according to the Wi-Fi P2P group information (the frequency of the Wi-Fi P2P group establishment, the role assignment of GC devices and GO devices, the SSID and PWD of the Wi-Fi P2P group).
[0044] In one possible implementation of the first aspect, if the second electronic device is a GO device and the first electronic device is a GC device in the Wi-Fi P2P group, then the second electronic device establishes the Wi-Fi P2P group, and the first electronic device joins the Wi-Fi P2P group according to the Wi-Fi P2P group information (the frequency of the Wi-Fi P2P group establishment, the role assignment of GC devices and GO devices, the SSID and PWD of the Wi-Fi P2P group).
[0045] In one possible implementation of the first aspect, the method further includes: the first electronic device sending service data to the second electronic device via the Wi-Fi P2P connection.
[0046] In a second aspect, a method for establishing a communication connection is provided, the method comprising: before a first electronic device receives a first operation from a user, the first electronic device acquires fourth connection information of a second electronic device, the fourth connection information being used to establish a communication connection, the first operation being used to instruct the establishment of the communication connection with the second electronic device, the fourth connection information including: operating frequency information and / or communication channel information of the second electronic device; the first electronic device receives the first operation; and in response to the first operation, the first electronic device establishes the communication connection with the second electronic device according to the fourth connection information.
[0047] The second method involves the two devices exchanging information necessary for establishing the wireless communication connection (including device operating frequency information and / or communication channel information) before the two devices actually establish the wireless communication connection. This ensures that most of the information has already been exchanged when the two devices actually initiate the communication connection, and the two devices only need to send some simple signaling to complete the communication connection, thereby further shortening the time required to establish the communication connection and improving the user experience.
[0048] For example, the first electronic device can be a terminal device, and the second electronic device can be an access point (AP) device or a soft AP device. For instance, the second electronic device can be a router or another terminal device.
[0049] For example, the communication connection includes a Wi-Fi connection.
[0050] For example, the necessary information for the second electronic device to establish the communication connection also includes at least one of the following: SSID, PWD, MAC address, IP address and port number of the second electronic device.
[0051] In one possible implementation of the second aspect, the method further includes: the first electronic device acquiring fourth connection information of the second electronic device, including: the first electronic device receiving the fourth connection information through a first connection. For example, the first connection includes: Bluetooth connection, NFC connection, Zigbee connection, USB connection, etc. In this implementation, when discovering dual-end devices, multiple discovery methods (such as BLE discovery, LAN discovery, broadcast discovery, etc.) can be used for device discovery, supporting multiple discovery methods and simultaneously supporting information exchange using different types of connection methods or broadcast methods, improving the efficiency of necessary information exchange, and enhancing versatility and scalability.
[0052] In one possible implementation of the second aspect, the first electronic device obtains the fourth connection information of the second electronic device, including: the first electronic device receives the fourth connection information through a third broadcast message.
[0053] For example, third broadcast messages include messages broadcast via BLE, BR, Wi-Fi, etc.
[0054] In one possible implementation of the second aspect, the method further includes: the first electronic device sending fifth connection information to the second electronic device, the fifth connection information including the operating frequency information and / or communication channel information of the first electronic device.
[0055] For example, the fifth connection information can be sent via the first connection and / or broadcast messages.
[0056] For example, the fifth connection information may also include at least one of the following: the SSID, PWD, MAC address, IP address, and port number of the first electronic device that established the communication connection.
[0057] Thirdly, an electronic device is provided, comprising: a unit for performing the steps of the first aspect or any possible implementation of the first aspect, or a unit for performing the steps of the second aspect or any possible implementation of the second aspect.
[0058] Fourthly, an electronic device is provided, comprising at least one processor and a memory, wherein the at least one processor is configured to execute: the method of the first aspect or any possible implementation thereof, or the method of the second aspect or any possible implementation thereof.
[0059] Fifthly, an electronic device is provided, comprising at least one processor and interface circuitry, wherein the at least one processor is configured to execute: the method of the first aspect or any possible implementation thereof, or the method of the second aspect or any possible implementation thereof.
[0060] Sixthly, a communication device is provided, which includes any of the electronic devices provided in the third, fourth, or fifth aspects described above.
[0061] In a seventh aspect, a computer program product is provided, comprising a computer program that, when executed by a processor, performs a method of either the first aspect or the second aspect, or performs a method of any possible implementation of either the first aspect or the second aspect.
[0062] Eighthly, a computer-readable storage medium is provided, which stores a computer program that, when executed, performs the method of either the first or the second aspect, or performs the method of any possible implementation of either the first or the second aspect.
[0063] Ninth aspect, a chip is provided, the chip comprising: a processor for calling and running a computer program from a memory, causing a communication device on which the chip is installed to perform a method of either the first aspect or the second aspect, or for performing a method of any possible implementation of either the first aspect or the second aspect.
[0064] The method for establishing a Wi-Fi P2P connection provided in this application can utilize multiple discovery methods (such as BLE discovery, LAN discovery, Wi-Fi P2P discovery, broadcast discovery, etc.) for device discovery. It supports multiple discovery methods and allows for information exchange using different connection types or broadcast methods, improving versatility and scalability. This can be provided as a platform-level capability for various applications. After device discovery, the information required for Wi-Fi P2P connection is exchanged in stages. The inherent information required for Wi-Fi P2P connection (e.g., list of supported channels, P2P group SSID, PWD, whether broadband is supported (e.g., whether 160MHz is supported), device information, etc.) is exchanged in advance before the Wi-Fi P2P service is initiated. Variable information required for Wi-Fi P2P connection (such as the device's Wi-Fi P2P connection status, role, and the frequency of the connected AP) is exchanged before the Wi-Fi P2P service is initiated, or during the actual Wi-Fi P2P connection process, if this variable information changes. This ensures that some or all of the necessary information for the Wi-Fi P2P connection has already been exchanged by the time the connection is actually initiated. Therefore, only simple signaling (such as broadcast messages or Bluetooth messages) is needed to complete the connection, further reducing connection time and improving user experience. Furthermore, this method can be used on different product platforms to meet the needs of various upper-layer applications. Attached Figure Description
[0065] Figure 1 This is an example of a Wi-Fi P2P service system architecture diagram on an electronic device provided in an embodiment of this application.
[0066] Figure 2 This is a schematic diagram of an example of a Wi-Fi P2P device connection and networking structure provided in an embodiment of this application.
[0067] Figure 3 This is a schematic diagram illustrating an application scenario applicable to the embodiments of this application.
[0068] Figure 4 This is a schematic flowchart illustrating a method for establishing a Wi-Fi P2P connection provided in an embodiment of this application.
[0069] Figure 5 This is a schematic flowchart illustrating another method for establishing a Wi-Fi P2P connection provided in the embodiments of this application.
[0070] Figure 6 This is a schematic user interface diagram illustrating a user triggering a Wi-Fi P2P connection between a smartphone and a large-screen device, provided in an embodiment of this application.
[0071] Figure 7 This is another example of a user interface diagram illustrating how a user triggers a Wi-Fi P2P connection between a smartphone and a large-screen device, as provided in this application embodiment.
[0072] Figure 8 This is a schematic flowchart illustrating an example of a smartphone establishing a first connection with a large-screen device, provided in an embodiment of this application.
[0073] Figure 9 This is another schematic flowchart illustrating the establishment of a first connection between a smartphone and a large-screen device, as provided in the embodiments of this application.
[0074] Figure 10 This is a schematic block diagram of an example electronic device structure provided in the embodiments of this application. Detailed Implementation
[0075] The technical solutions in this application will now be described with reference to the accompanying drawings.
[0076] In the description of the embodiments of this application, unless otherwise stated, " / " means "or", for example, A / B can mean A or B; "and / or" in this document is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. In addition, in the description of the embodiments of this application, "multiple" means two or more.
[0077] Hereinafter, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this embodiment, unless otherwise stated, "a plurality of" means two or more.
[0078] Furthermore, various aspects or features of this application can be implemented as methods, apparatus, or articles of manufacture using standard programming and / or engineering techniques. The term "article of manufacture" as used herein encompasses a computer program accessible from any computer-readable device, carrier, or medium. For example, computer-readable media may include, but are not limited to: magnetic storage devices (e.g., hard disks, floppy disks, or magnetic tapes), optical discs (e.g., compact discs (CDs), digital versatile discs (DVDs), etc.), smart cards, and flash memory devices (e.g., erasable programmable read-only memory (EPROMs), cards, sticks, or key drives, etc.). Additionally, the various storage media described herein may represent one or more devices and / or other machine-readable media for storing information. The term "machine-readable medium" may include, but is not limited to, wireless channels and various other media capable of storing, containing, and / or carrying instructions and / or data.
[0079] The technical solutions of this application embodiment can be applied to various communication systems, such as: Global System of Mobile communication (GSM) system, Code Division Multiple Access (CDMA) system, Wideband Code Division Multiple Access (WCDMA) system, General Packet Radio Service (GPRS), Long Term Evolution (LTE) system, LTE Frequency Division Duplex (FDD) system, LTE Time Division Duplex (TDD) system, Universal Mobile Telecommunication System (UMTS), Worldwide Interoperability for Microwave Access (WiMAX) system, 5th Generation (5G) system, or New Radio (NR), etc.
[0080] Furthermore, various aspects or features of this application can be implemented as methods, apparatus, or articles of manufacture using standard programming and / or engineering techniques. The term "article of manufacture" as used herein encompasses a computer program accessible from any computer-readable device, carrier, or medium. For example, computer-readable media may include, but are not limited to: magnetic storage devices (e.g., hard disks, floppy disks, or magnetic tapes), optical discs (e.g., compact discs (CDs), digital versatile discs (DVDs), etc.), smart cards, and flash memory devices (e.g., erasable programmable read-only memory (EPROMs), cards, sticks, or key drives, etc.). Additionally, the various storage media described herein may represent one or more devices and / or other machine-readable media for storing information. The term "machine-readable medium" may include, but is not limited to, wireless channels and various other media capable of storing, containing, and / or carrying instructions and / or data.
[0081] Wi-Fi P2P technology is an important technology under the "Wi-Fi DIRECT" standard protocol launched by the Wi-Fi Alliance. Wi-Fi P2P enables two Wi-Fi devices to connect and communicate directly with each other without the intervention of a Wi-Fi hotspot.
[0082] Figure 1 The diagram shown is an example of a Wi-Fi P2P service system architecture on an electronic device applicable to the solution of this application, as follows: Figure 1 As shown, the system architecture mainly includes: a Wi-Fi chip, a Wi-Fi driver, middleware, an application framework layer, and an upper-layer application (APP). The Wi-Fi driver is responsible for connecting the Wi-Fi chip to the terminal device's operating system, while the middleware acts as a relay for all messages between kernel mode and user mode during terminal device operation. One of the most widely used middlewares is wpa_supplicant. wpa_supplicant is an open-source project, later modified by Google and introduced into the Android platform. It is a daemon process that runs independently within the device and is used for message relay.
[0083] FRAMEWORK refers to system capabilities that run on top of the operating system of a terminal device. Taking the Android Open Source Project (AOSP) as an example, AOSP provides some interfaces and services for operating Wi-Fi P2P. For example, Wi-Fi P2P related services can include Wi-Fi P2P Service. The interface type corresponding to Wi-Fi P2P Service is Wi-Fi P2P Manager. The interfaces of the Wi-Fi P2P Manager type include providing interfaces such as discovering devices (discoverPeers) and connecting (connect). These interfaces allow users to directly control Wi-Fi P2P.
[0084] Upper-layer applications are applications that users can directly interact with using the FRAMEWORK interface. They run on the terminal device and serve as the window for users to interact with the terminal device.
[0085] Wi-Fi P2P connection protocols are typically implemented within the Wi-Fi chip, with the framework layer in the terminal device interacting with the chip through a driver. For example, taking AOSP as an example, the framework layer uses `wpa_supplicant` to interact with the driver and support encryption authentication. The application layer provides several interface functions that developers / businesses can directly call. After calling these functions, the driver can instruct the chip to perform corresponding Wi-Fi P2P-related operations. The framework layer itself is responsible for message relay and coordination between upper-layer applications and lower-layer hardware (including `wpa_supplicant`, Wi-Fi Driver, and Chipset), as well as connection management. Currently, user operations on Wi-Fi P2P are implemented by the application layer through calling the Wi-Fi P2P-related interfaces and services within the framework.
[0086] A complete Wi-Fi P2P service includes three stages: Wi-Fi P2P device discovery, Wi-Fi P2P device connection, and Wi-Fi P2P device data transmission. After the Wi-Fi P2P device connection is established, a P2P group (or Wi-Fi P2P cluster) is formed. Within the P2P group, devices have two distinct roles: group owner (GO) and group client (GC). The protocol specification also outlines and restricts the methods of Wi-Fi P2P connection, primarily focusing on the following three points: (1) GO devices can only connect to GC and cannot establish connections with other GO devices; (2) GC devices can only connect to GO devices and cannot establish connections with other GO devices or GC devices; (3) There is an upper limit to the number of GC devices that can be connected to a GO device; Besides the limitations of the Wi-Fi DIRECT protocol itself, different chip manufacturers and operating systems (such as Android and Windows) also have other limitations on Wi-Fi P2P connections. For example, chip platforms like HiSilicon do not support multiple P2P roles on the same device. This lack of support for multiple P2P roles on the same device can be understood as follows: a single device cannot simultaneously act as both a GO (Go) and a GC (GC); or, while a device is acting as a GO, it cannot act as a GO in another P2P group; or, while a device is acting as a GC, it cannot act as a GC in another P2P group. Furthermore, AOSP also does not support the coexistence of multiple P2P roles on the same device. Therefore, as... Figure 2 As shown, the current Wi-Fi P2P device connection and networking methods are limited to star networks centered on GO devices.
[0087] In the standard Wi-Fi DIRECT protocol specification, establishing a Wi-Fi P2P device connection requires four steps: Wi-Fi P2P device discovery, group formation, Wi-Fi protected setup (WPS) process, and association connection.
[0088] Wi-Fi P2P device discovery is a key capability in Wi-Fi DIRECT, comprising two phases: scanning and finding. The scanning phase is for discovering existing GO devices, while the finding phase is further divided into a listen state and a search state, with P2P devices switching back and forth between these phases. In the search phase, the P2P device sends a probe request frame, while in the listen phase, it receives probe requests from other devices and responds with probe responses. For the search and listen phases to occur, P2P devices can only discover each other and proceed with subsequent processes if they are in different phases. Therefore, the protocol specifies that the duration of these two phases is randomized to ensure that there is a window of overlap between the two phases; that is, there must be a time interval between them.
[0089] Group negotiation is the next stage after Wi-Fi P2P device discovery. Due to protocol provisions, on a Wi-Fi P2P connection, both devices have the roles of GO and GC, so their respective roles need to be negotiated before connecting.
[0090] The WPS process is the next step after group negotiation, used to ensure the security and reliability of the established connection and avoid security vulnerabilities such as identity spoofing.
[0091] The final connection involves a four-step handshake, which establishes a trusted Wi-Fi P2P connection between the two devices.
[0092] Establishing a Wi-Fi P2P device connection using the standard Wi-Fi DIRECT protocol simply requires triggering Wi-Fi P2P discovery on both ends, waiting for the discovery result, initiating a connection when the desired device is detected, and then waiting for the connection result. However, using this technology results in a relatively long Wi-Fi P2P device connection process. As described above, it requires that the Search and Listen phases of both devices be staggered (i.e., one device is in the Search phase while the other is in the Listen phase, or vice versa). For either device, it will switch back and forth between the Search and Listen phases. When one device is in the Search phase, it doesn't guarantee that the other device is in the Listen phase. Furthermore, if one device is in the Search phase but the other is not, device discovery cannot occur. In this situation, if one device switches from the Search phase to the Listen phase, and the other device also switches to the Search phase, then both devices can discover the device. If the other device is still in the Listen phase, then device discovery cannot occur. In other words, during this process, both devices switch between the Search and Listen phases. Device discovery is only possible if one device is in the Listen phase and the other is simultaneously in the Search phase. However, this process may require both devices to switch between the Search and Listen phases multiple times to meet the conditions for device discovery: either one device must be in the Search phase and the other in the Listen phase, or both must be in the Listen phase and the other in the Search phase. The process of meeting the device discovery conditions takes a relatively long time, typically ranging from 1 to 3 seconds. The connection time is also relatively long, typically ranging from 2 to 3 seconds. Overall, a complete Wi-Fi P2P connection process takes 3 to 6 seconds, resulting in a poor user experience.
[0093] To accelerate the establishment of Wi-Fi P2P connections, related technologies have modified and optimized the standard Wi-Fi P2P connection establishment process. Bluetooth Low Energy (BLE) discovery is used instead of Wi-Fi P2P device discovery to speed up the discovery process. After BLE discovers a device, the service directly assigns the GO / GC role to simplify the group negotiation process. By establishing a BLE / Bluetooth basic rate (BR) connection, security authentication and P2P group information exchange are performed based on the BLE / BR connection, ultimately allowing the GC device to directly access the P2P group on the designated channel, thus realizing the Wi-Fi P2P connection. While this technology can accelerate the Wi-Fi P2P connection establishment process, it heavily relies on the BLE / BR connection, and the process is largely customized by the service, lacking universality and scalability.
[0094] In view of this, this application provides a method for establishing a Wi-Fi P2P connection. When discovering Wi-Fi P2P devices, various discovery methods (such as BLE discovery, LAN discovery, Wi-Fi P2P discovery, broadcast discovery, etc.) can be used. It supports multiple discovery methods and allows for information exchange using different connection types or broadcast methods, improving versatility and scalability. Furthermore, the information required for establishing a Wi-Fi P2P connection is exchanged in stages. The inherent information required for Wi-Fi P2P connection (e.g., the list of channels supported by the device, the service set identifier (SSID) of the P2P group, the password (PWD), whether broadband is supported (e.g., whether 160MHz is supported), device information, etc.) is exchanged in advance before the Wi-Fi P2P service is initiated. The variable information required for Wi-Fi P2P connection (such as the device's Wi-Fi P2P connection status, role, and frequency of the AP (i.e., Wi-Fi hotspot) connected to the device) is synchronized between devices after changes in the variable information. This ensures that when the user actually initiates a Wi-Fi P2P connection using the device, most of the information has already been exchanged, and only some simple signaling (such as broadcast messages, Bluetooth messages, etc.) is needed to complete the Wi-Fi P2P connection, thereby further reducing the time required for Wi-Fi P2P connection and improving the user experience.
[0095] The following examples illustrate the method for establishing a Wi-Fi P2P connection provided in this application.
[0096] It should be understood that the method provided in this application is mainly aimed at Wi-Fi P2P connection and networking scenarios in the Wi-Fi DIRECT standard protocol. It can be applied to devices using Android and Windows operating systems that use Wi-Fi P2P technology based on the Wi-Fi DIRECT standard protocol, as well as devices using iOS and HarmonyOS operating systems. The embodiments in this application are not limited herein.
[0097] Figure 3 The diagram illustrates a communication system applicable to an embodiment of this application. For example... Figure 3 As shown, the system includes: a first electronic device 110 and a second electronic device 120. Figure 3 In the example shown, the first electronic device 110 is a smartphone used by a user in a home, and the second electronic device 120 is a large-screen device in the home (such as a smart TV or smart screen). The user uses a smartphone and wants to share files with the large-screen device using a Wi-Fi P2P link.
[0098] It should be understood that Figure 3 The examples shown should not impose any limitations on the electronic devices described in the embodiments of this application.
[0099] In the embodiments of this application, the first electronic device or the second electronic device may include: smartphones, smart TVs, large-screen devices, tablet computers, netbooks, PDAs, handheld computer communication devices, handheld computing devices, smart bracelets, smart wristbands, wearable devices, user equipment, access terminals, user units, user stations, mobile stations, mobile stations, remote stations, remote terminals, mobile devices, user terminals, terminals, wireless communication devices, user agents, or user devices. Terminal devices may also be cellular phones, cordless phones, Session Initiation Protocol (SIP) phones, Wireless Local Loop (WLL) stations, Personal Digital Assistants (PDAs), handheld devices with wireless communication capabilities, computing devices or other processing devices connected to a wireless modem, in-vehicle devices, terminal devices in 5G networks, or terminal devices in future evolved public land mobile networks (PLMNs), etc., and the embodiments of this application do not limit this to these categories.
[0100] Figure 4 The image shown is in Figure 3The illustrated scenario is a schematic flowchart of a Wi-Fi P2P connection method 200 provided in this application. Method 200 includes steps S205 to S250.
[0101] S205, the communication module in the smartphone and the communication module in the large-screen device establish the first connection.
[0102] In S205, the communication module in the smartphone and the communication module in the large-screen device can establish a first connection through interactive broadcast messages. For example, the first connection can be a BLE connection, a universal serial bus (USB) connection, a BR connection, a near field communication (NFC) connection, a Zigbee connection, a Wi-Fi connection, or a socket connection based on a local area network, etc. This application embodiment is not limited to these methods.
[0103] In this embodiment, a Wi-Fi connection can be understood as a communication connection established between a smartphone and a large-screen device through an access point device. Information transmission between the smartphone and the large-screen device needs to be relayed through an access point device (such as a router); the smartphone and the large-screen device cannot communicate directly.
[0104] S210, the communication module in the smartphone sends the inherent information required for the smartphone's Wi-Fi P2P connection to the communication module of the large-screen device via a first connection or broadcast method.
[0105] Optionally, as a possible implementation, in S210, the communication module in the smartphone can send the inherent information in the information required for the smartphone's Wi-Fi P2P connection to the communication module of the large-screen device through the first connection.
[0106] In this embodiment, the inherent information in a Wi-Fi P2P connection (i.e., the inherent information used to establish a Wi-Fi P2P connection) can be understood as information that remains unchanged for a period of time when a smartphone establishes a Wi-Fi P2P connection with other devices. For example, the list of channels supported by the smartphone refers to the list of channels supported by the smartphone in the 5GHz band, which is an inherent attribute of the smartphone. SSID and PWD refer to the network ID and key used by the smartphone when creating a P2P group. These two items are randomly generated when the smartphone is powered on and remain unchanged for a certain period of time (i.e., the lifespan). After the lifespan expires, they are regenerated randomly to ensure the security of the Wi-Fi P2P connection.
[0107] In this embodiment of the application, the inherent information in the Wi-Fi P2P connection of the smartphone (i.e., the inherent information of the smartphone used to establish a Wi-Fi P2P connection) includes: a list of channels supported by the smartphone (e.g., supporting 36 channels, corresponding to 5180MHz), the SSID of the P2P group when the smartphone creates a P2P group, the PWD of the P2P group when the smartphone creates a P2P group, whether the smartphone itself supports Wi-Fi P2P connection, whether the smartphone supports broadband (e.g., whether it supports 160MHz, which can be indicated by true if it supports it and false if it does not), and the device information of the smartphone, etc.
[0108] Optionally, in this embodiment of the application, the device information of the smartphone includes: the smartphone's device name, the smartphone's account information, the status of the smartphone's Bluetooth and Wi-Fi switches, and the smartphone's battery level, etc.
[0109] Alternatively, as another possible implementation, in S210, the communication module in the smartphone can also send the inherent information of the smartphone's Wi-Fi P2P connection to the communication module of the large-screen device via broadcast (e.g., BLE broadcast, BR broadcast, Wi-Fi broadcast, etc.).
[0110] Alternatively, as another possible implementation, in S210, the communication module in the smartphone can also send the inherent information of the smartphone's Wi-Fi P2P connection to the communication module of the large-screen device through either broadcasting or the first connection.
[0111] After the communication module of the large-screen device receives the inherent information in the information required for the Wi-Fi P2P connection of the smartphone through the first connection and / or broadcast, it can store the inherent information in the information required for the Wi-Fi P2P connection of the smartphone.
[0112] S215, the communication module in the large-screen device sends the inherent information (i.e., the inherent information used by the large-screen device to establish a Wi-Fi P2P connection) required for the Wi-Fi P2P connection of the large-screen device to the communication module in the smartphone through the first connection or broadcast method.
[0113] Optionally, in S215, as a possible implementation, the communication module in the large-screen device can send the inherent information required for the Wi-Fi P2P connection of the large-screen device to the communication module in the smartphone via the first connection. In this embodiment, the inherent information in the Wi-Fi P2P connection of the large-screen device includes: a list of channels supported by the large-screen device, the SSID of the P2P group when the large-screen device creates the P2P group, the PWD of the P2P group when the large-screen device creates the P2P group, whether the large-screen device itself supports Wi-Fi P2P connection, whether the large-screen device supports broadband, and device information of the large-screen device, etc.
[0114] Device information for large-screen devices may include: device name, account information, Bluetooth and Wi-Fi status, and battery level.
[0115] Optionally, in S215, the communication module of the large-screen device can also send the inherent information of the Wi-Fi P2P connection of the large-screen device to the communication module of the smartphone via broadcast (e.g., BLE broadcast, BR broadcast, Wi-Fi broadcast, etc.).
[0116] Alternatively, in S215, as another possible implementation, the communication module in the large-screen device can also send the inherent information of the Wi-Fi P2P connection of the large-screen device to the communication module of the smartphone through either broadcasting or the first connection.
[0117] After the smartphone's communication module receives the inherent information from the Wi-Fi P2P connection information required by the large-screen device through a first connection and / or broadcast, it can store the inherent information from the Wi-Fi P2P connection information required by the large-screen device.
[0118] The above-mentioned S210 and S215 are the process by which large-screen devices and smartphones exchange inherent information in the Wi-Fi P2P connection.
[0119] The following will describe in detail the specific process of exchanging (or synchronizing) variable information (i.e., variable information used to establish a Wi-Fi P2P connection) between large-screen devices and smartphones, which includes S220 to S245.
[0120] S220, when the smartphone's driver and chip module change the smartphone's Wi-Fi P2P connection state and / or the frequency of the AP (i.e., Wi-Fi hotspot) connected to the smartphone changes, the message sent to the smartphone's FRAMEWORK module includes at least one of the smartphone's Wi-Fi P2P connection state and the frequency of the AP connected to the smartphone. In this embodiment, the smartphone's Wi-Fi P2P connection state includes: the smartphone currently has no Wi-Fi P2P connection with any device; the smartphone currently has a Wi-Fi P2P connection with other devices and its role is GO; the smartphone currently has a Wi-Fi P2P connection with other devices and its role is GC.
[0121] S225, the smartphone's FRAMEWORK module sends a message to the smartphone's communication module, the message including at least one of the smartphone's Wi-Fi P2P connection status and the frequency of the AP to which the smartphone is connected.
[0122] S230, the smartphone's communication module sends a message to the communication module of the large-screen device. This message includes: variable information in the smartphone's Wi-Fi P2P connection (i.e., variable information used by the smartphone to establish a Wi-Fi P2P connection).
[0123] For example, variable information in a smartphone's Wi-Fi P2P connection includes at least one of the smartphone's Wi-Fi P2P connection status and the frequency of the AP to which the smartphone is connected.
[0124] Specifically, since the Wi-Fi chips of terminal devices (such as smartphones or large-screen devices) generally support the simultaneous existence of Wi-Fi Station and Wi-Fi P2P roles, the Wi-Fi Station role can be understood as the terminal device establishing a Wi-Fi connection by connecting to a router (Wi-Fi hotspot / AP), while the Wi-Fi P2P role can be understood as the terminal device directly connecting to another device without going through a router. When a terminal device's Wi-Fi Station connection and Wi-Fi P2P connection are on the same frequency band but different channels, a situation of same frequency but different channels occurs, thus affecting the performance of both the Wi-Fi Station connection and Wi-Fi P2P. Therefore, the state of the terminal device's Wi-Fi Station also affects the Wi-Fi P2P connection, and the state of the Wi-Fi Station can be reflected by the frequency of the AP to which the terminal device is connected. Therefore, in this embodiment, when the frequency of the AP connected to the smartphone or large-screen device changes, the smartphone or large-screen device can synchronize the frequency of the connected AP to the devices in the trusted device list.
[0125] Furthermore, due to the limitations of the "Wi-Fi DIRECT" standard protocol, Wi-Fi P2P connections can only occur between GO devices and GC devices, and there are restrictions on a maximum number of GC devices that one GO device can connect to, and a maximum of one GO device that one GC device can connect to. Therefore, the Wi-Fi P2P connection status of both devices (large-screen device and smartphone) before initiating a Wi-Fi P2P connection will also affect the current Wi-Fi P2P connection. Therefore, in this embodiment, when the Wi-Fi P2P connection status of the smartphone or large-screen device changes, the smartphone and large-screen device will synchronously notify all devices in the trusted device list of their own Wi-Fi P2P status.
[0126] The device's Wi-Fi P2P connection status includes: the device currently has no Wi-Fi P2P connection with any other device; the device currently has a Wi-Fi P2P connection with other devices and the device's role is GO; and the device currently has a Wi-Fi P2P connection with other devices and the device's role is GC.
[0127] It should be understood that, in the embodiments of this application, the variable information in the Wi-Fi P2P connection of the smartphone may also include other information that may change at any time and affect the Wi-Fi P2P connection during the process of the smartphone in the Wi-Fi P2P connection. The embodiments of this application do not limit this.
[0128] Optionally, in S230, the message can be sent via broadcast (e.g., BLE broadcast, BR broadcast, Wi-Fi broadcast, etc.), or via the first connection, or via both broadcast and the first connection.
[0129] After receiving variable information from the smartphone's Wi-Fi P2P connection via a first connection and / or broadcast, the communication module of the large-screen device can store the variable information from the smartphone's Wi-Fi P2P connection.
[0130] It should be understood that in S230, the timing for the smartphone's communication module to send variable information about the smartphone's Wi-Fi P2P connection to the large-screen device's communication module can be periodic, or it can be sent during the actual initiation of a Wi-Fi P2P connection between the smartphone and the large-screen device, or it can be sent after a period of time following the variable information in the smartphone's Wi-Fi P2P connection, or some sending rules can be set: For example, after a smartphone's Wi-Fi P2P connection status changes, the changed Wi-Fi P2P connection status is immediately sent to the communication module of the large-screen device. If the frequency of the access point (AP) to which the smartphone is connected also changes while sending the smartphone's Wi-Fi P2P connection status, the changed AP frequency is also sent to the large-screen device. In other words, if only the frequency of the AP to which the smartphone is connected changes, it will not trigger the sending of the changed AP frequency to the large-screen device's communication module.
[0131] For example, after the frequency of the access point (AP) connected to the smartphone changes, the changed AP frequency is immediately sent to the communication module of the large-screen device. If the smartphone's Wi-Fi P2P connection status also changes while sending the AP frequency, the changed smartphone Wi-Fi P2P connection status is also sent to the large-screen device. In other words, if only the smartphone's Wi-Fi P2P connection status changes, it will not trigger the sending of the changed smartphone Wi-Fi P2P connection status to the large-screen device's communication module.
[0132] For example, if any of the variable information in a smartphone's Wi-Fi P2P connection changes, the smartphone will immediately send the changed variable information to the communication module of the large-screen device. That is, any one of the variable information in a smartphone's Wi-Fi P2P connection can be sent independently, unaffected by other information.
[0133] It should be understood that, in the embodiments of this application, the execution order of S230 and S210 is not limited. S230 can be executed before S210, after S210, or simultaneously with S210. In other words, the smartphone sending variable information in its Wi-Fi P2P connection to the large-screen device can be performed before, after, or simultaneously with the smartphone sending its inherent information in the Wi-Fi P2P connection to the large-screen device. This embodiment of the application does not impose any limitations.
[0134] S235, when the Wi-Fi P2P connection state of the large-screen device changes, or the frequency of the AP (i.e., Wi-Fi hotspot) connected to the large-screen device changes, the driver and chip module of the large-screen device send a message to the FRAMEWORK module of the large-screen device. This message includes at least one of the following: the Wi-Fi P2P connection state of the large-screen device and the frequency of the AP connected to the large-screen device. In this embodiment, the Wi-Fi P2P connection state of the large-screen device includes: the large-screen device currently has no Wi-Fi P2P connection with any device; the large-screen device currently has a Wi-Fi P2P connection with other devices, and the role of the large-screen device is GO; the large-screen device currently has a Wi-Fi P2P connection with other devices, and the role of the large-screen device is GC.
[0135] S240, the FRAMEWORK module of the large screen device sends a message to the communication module of the large screen device. The message includes at least one of the following: the Wi-Fi P2P connection status of the large screen device and the frequency of the AP to which the large screen device is connected.
[0136] S245, the communication module of the large-screen device sends a message to the communication module of the smartphone. The message includes: variable information in the Wi-Fi P2P connection of the large-screen device (i.e., variable information used by the large-screen device to establish a Wi-Fi P2P connection).
[0137] For example, variable information in the Wi-Fi P2P connection of a large-screen device includes at least one of the Wi-Fi P2P connection status and the frequency of the AP to which the large-screen device is connected.
[0138] It should be understood that, in the embodiments of this application, the variable information in the Wi-Fi P2P connection of the large-screen device may also include other information that may change at any time and affect the Wi-Fi P2P connection process of the large-screen device, which is not limited in the embodiments of this application.
[0139] Optionally, in S245, the message can be sent via broadcast (e.g., BLE broadcast, BR broadcast, Wi-Fi broadcast, etc.), or via the first connection, or via both broadcast and the first connection.
[0140] It should be understood that, in this embodiment, the execution order of S245 and S215 is not limited. S245 can be executed before S215, after S215, or simultaneously with S215. In other words, the large-screen device sending variable information from its Wi-Fi P2P connection to the smartphone can occur before, after, or simultaneously with the large-screen device sending its inherent information from its Wi-Fi P2P connection to the smartphone. This embodiment does not impose any limitations.
[0141] Optionally, in S245, the timing for the communication module of the large-screen device to send variable information about the Wi-Fi P2P connection of the large-screen device to the communication module of the smartphone can be periodic, or some sending rules can be set. These rules are similar to those in S230, and for the sake of brevity, will not be elaborated here.
[0142] The above-mentioned S220 to S245 are the process of exchanging (or synchronizing) variable information in the Wi-Fi P2P connection between the large-screen device and the smartphone.
[0143] S250, the communication module of a smartphone and the communication module of a large-screen device, establishes a Wi-Fi P2P connection based on the variable and fixed information in the exchanged Wi-Fi P2P connection.
[0144] For example, when a smartphone and a large-screen device actually initiate a Wi-Fi P2P connection, the smartphone can complete the Wi-Fi P2P connection simply by sending some simple signaling (such as broadcast messages, Bluetooth messages, etc.) to the large-screen device.
[0145] It should also be understood that, in the embodiments of this application, the order of execution of S230 and S250 is not limited. S230 can be executed before S250, or it can be executed simultaneously with S250. In other words, the smartphone sending variable information in its Wi-Fi P2P connection to the large-screen device can be done before the smartphone and the large-screen device establish a Wi-Fi P2P connection, or it can be done during the process of establishing a Wi-Fi P2P connection. The embodiments of this application do not impose any limitations.
[0146] Similarly, in this embodiment, the order of execution of S245 and S250 is not limited. S245 can be executed before S250, or it can be executed simultaneously with S250. In other words, the large-screen device sending variable information in its Wi-Fi P2P connection to the smartphone can be done before the large-screen device and the smartphone establish a Wi-Fi P2P connection, or it can be done during the process of establishing a Wi-Fi P2P connection. This embodiment does not impose any limitations.
[0147] The method for establishing a Wi-Fi P2P connection provided in this application exchanges the necessary information for the Wi-Fi P2P connection in stages after the Wi-Fi P2P device is discovered and the first connection is established. The inherent information required for the Wi-Fi P2P connection is exchanged in advance before the Wi-Fi P2P service is initiated. Variable information required for the Wi-Fi P2P connection is exchanged in advance before the Wi-Fi P2P service is initiated, or during the actual Wi-Fi P2P connection initiation process, if the variable information changes. This ensures that by the time the Wi-Fi P2P connection is actually initiated, some or all of the necessary information has already been exchanged. Therefore, only simple signaling needs to be sent to complete the Wi-Fi P2P connection, further shortening the connection time and improving the user experience.
[0148] Optionally, in this application embodiment, as another possible implementation, such as Figure 5 As shown, in Figure 4 Based on the steps shown, prior to S210, the method further includes: a process in which a smartphone and a large-screen device establish a connection through scanning and perform inter-device security authentication based on the first connection, namely the steps described in S204, S206 to S208 below.
[0149] S204: Both the smartphone and the large-screen device are connected to the home router's hotspot. The drivers and chip modules of the smartphone and the large-screen device automatically start background scanning to discover devices. In this embodiment, the smartphone and the large-screen device can discover devices using one or more of the following methods: BLE scanning, classic Bluetooth scanning, wireless local area network (WLAN) scanning, or Wi-Fi P2P scanning. Classic Bluetooth includes at least one of two types: BR and Bluetooth enhanced data rate (EDR).
[0150] It should be understood that in the embodiments of this application, smartphones and large-screen devices perform periodic background scans.
[0151] After S204, S205 can be executed.
[0152] After S205, S206 to S208 can be executed.
[0153] S206, the communication module in the smartphone and the communication module in the large-screen device negotiate keys based on the first connection to obtain an encryption key and a decryption key, thereby completing device security authentication based on the first connection.
[0154] After S206, smartphones can add large-screen devices to the list of trusted devices, and large-screen devices can also add smartphones to the list of trusted devices.
[0155] S207, the communication module in the smartphone stores the encryption key and decryption key.
[0156] S208, the communication module in the large-screen device stores the encryption key and decryption key.
[0157] After S208, S210 to S250 can be executed. The specific steps corresponding to S210 to S250 can be referred to the description of the corresponding steps above, and will not be repeated here for the sake of brevity.
[0158] It should be understood that in the embodiments of this application, if the smartphone and the large-screen device have been verified as trusted devices, then after S205, S206 to S208 can be skipped and S210 can be executed directly.
[0159] Optionally, as another possible implementation, even if the smartphone and the large-screen device are not verified as trusted devices, after S205, S206 to S208 can be skipped, and S210 can be executed directly. In this case, the smartphone will not add the large-screen device to the trusted device list, and the large-screen device will not add the smartphone to the trusted device list; that is, the smartphone and the large-screen device are not trusted devices to each other.
[0160] Optionally, in this embodiment, for example, the smartphone and the large-screen device are logged into the same account; or, the smartphone and the large-screen device have previously been verified as trusted devices; or, after being bound together through various means (such as QR code scanning), the smartphone and the large-screen device can be confirmed as trusted devices. The smartphone can then add the large-screen device to the trusted device list, and the large-screen device can also add the smartphone to the trusted device list.
[0161] In S204, when discovering Wi-Fi P2P devices, various discovery methods (such as BLE discovery, LAN discovery, Wi-Fi P2P discovery, broadcast discovery, etc.) can be used. It supports multiple discovery methods and different types of connection methods or broadcast methods for information exchange, which improves versatility and scalability. It can be provided as a platform-level capability for various applications and can be used on different product platforms to meet the needs of different upper-layer applications.
[0162] In S206 to S208, the smartphone and the large-screen device perform secure authentication through the first connection, which enables the smartphone and the large-screen device to determine each other's trusted devices. After determining the trusted device, they exchange inherent and variable information in the Wi-Fi P2P connection, ensuring the security of information exchange and avoiding the risk of information leakage.
[0163] Optionally, in S210 to S245, if the smartphone and the large-screen device exchange inherent and variable information in the Wi-Fi P2P connection through the first connection, the sender can first encrypt the information using an encryption key before sending it, and the receiver can decrypt the information using a decryption key after receiving it, thus ensuring the security of information transmission.
[0164] Optionally, as a possible implementation, during the exchange of inherent information in the Wi-Fi P2P connection between the smartphone and the large-screen device described in S210 and S215, if the smartphone has not yet determined that the large-screen device is a trusted device, the smartphone can send some information from the inherent information of the smartphone's Wi-Fi P2P connection to the large-screen device. For example, the smartphone's device information can be sent to the large-screen device. Other information from the inherent information of the smartphone's Wi-Fi P2P connection (e.g., the list of channels supported by the smartphone, the SSID of the P2P group when the smartphone creates the P2P group, the PWD of the P2P group when the smartphone creates the P2P group, whether the smartphone itself supports Wi-Fi P2P connection, whether the smartphone supports broadband, etc.) will not be sent to the large-screen device. Only after the smartphone determines that the large-screen device is a trusted device will it send the other information from the inherent information of the smartphone's Wi-Fi P2P connection to the large-screen device.
[0165] Alternatively, if the smartphone has not yet identified the large-screen device as a trusted device, the user can also choose in the settings which information(s) from the inherent information of the smartphone's Wi-Fi P2P connection should be sent to the large-screen device.
[0166] For large-screen devices, if the smartphone has not yet been identified as a trusted device, a similar approach can be used to share or send different inherent information in the Wi-Fi P2P connection of the large-screen device to trusted and untrusted devices respectively.
[0167] If the smartphone has already identified the large-screen device as a trusted device, it can send all the inherent information from the smartphone's Wi-Fi P2P connection to the large-screen device. Alternatively, users can choose in their settings which specific pieces of the inherent information from the smartphone's Wi-Fi P2P connection should be sent to the large-screen device.
[0168] For large-screen devices, if the smartphone has been identified as a trusted device, the inherent information of the large-screen device's Wi-Fi P2P connection can be sent to the smartphone in a similar manner.
[0169] Optionally, as a possible implementation, during the exchange of variable information in the Wi-Fi P2P connection between the smartphone and the large-screen device described in S230 and S245, if the smartphone has not yet determined that the large-screen device is a trusted device, the smartphone may send some information from the variable information of the smartphone's Wi-Fi P2P connection to the large-screen device. Other information from the variable information of the smartphone's Wi-Fi P2P connection will not be sent to the large-screen device. Only after the smartphone determines that the large-screen device is a trusted device will the other information from the variable information of the smartphone's Wi-Fi P2P connection be sent to the large-screen device.
[0170] Alternatively, if the smartphone has not yet identified the large-screen device as a trusted device, the user can also choose in the settings which information(s) of the variable information in the smartphone's Wi-Fi P2P connection should be sent to the large-screen device.
[0171] For large-screen devices, if the smartphone has not yet been identified as a trusted device, a similar approach can be used to share or send different variable information in the Wi-Fi P2P connection of the large-screen device separately for trusted and untrusted devices.
[0172] If the smartphone has already identified the large-screen device as a trusted device, it can send all variable information from the smartphone's Wi-Fi P2P connection to the large-screen device. Alternatively, users can choose in their settings which specific variable information from the smartphone's Wi-Fi P2P connection should be sent to the large-screen device.
[0173] For large-screen devices, if the smartphone has been identified as a trusted device, variable information from the large-screen device's Wi-Fi P2P connection can be sent to the smartphone in a similar manner.
[0174] Alternatively, as one possible implementation, such as Figure 5 As shown, in S250: the specific process by which the smartphone and the large-screen device establish a Wi-Fi P2P connection based on the variable and fixed information in the exchanged Wi-Fi P2P connection may include: S2511 to S2525.
[0175] In step S2511, the smartphone's communication module sends information about the list of available devices to an application within the smartphone. For example, the application could be a file-sharing application. In this embodiment, the list of available devices may include trusted devices (those that have already performed the steps described in steps S206 to S208), and further, it may include untrusted devices. An untrusted device is one that, although the smartphone has established a first connection with a certain device, has not yet performed device security authentication based on the first connection, i.e., has not performed the steps described in steps S206 to S208. The list of available devices includes large-screen devices.
[0176] Optionally, in this embodiment, after the large-screen device discovers a smartphone and establishes a first connection with it, the communication module of the large-screen device can also send information about the list of available devices to the applications on the large-screen device. For example, the application on the large-screen device could be a file-sharing application. The list of available devices includes smartphones.
[0177] S2512, the user triggers the smartphone to establish a Wi-Fi P2P connection with the large-screen device. In this embodiment, the user can trigger the smartphone to establish a Wi-Fi P2P connection with the large-screen device through the following two operation methods: The first method: Suppose a user needs to share files from their smartphone to a large-screen device, such as... Figure 6 As shown in 'a', when a user opens the "File Manager" application on their smartphone, the interface displayed is as follows: Figure 6 As shown in b, the user selects the file they want to share (e.g., file 1), clicks "Share," and chooses the sharing method. The displayed interface is as follows. Figure 6 As shown in 'c', when the user selects the "Wi-Fi Direct" sharing method, the smartphone app will display a previously stored list of available devices. This list contains device identifiers for one or more devices. For example, the displayed list of available devices could be as follows: Figure 6 As shown by 'd' in the diagram. Users can select a device from the list of available devices (e.g., a large-screen device) as needed. For example, a user can select a large-screen device by clicking its device icon in the device list.
[0178] Optional, such as Figure 6As shown in 'd', the smartphone can also display to the user whether each device in the list of available devices is a trusted device. If a device is an untrusted device, it can also display an icon indicating whether authentication is required. If the user confirms that authentication is needed, they can click "Authenticate," and the smartphone will automatically perform security authentication with the device (i.e., execute S206 to S208). If the security authentication is successful, the device will be displayed as a trusted device. If the security authentication fails, the device will still be displayed as an untrusted device.
[0179] The second method: Assume the user's sole purpose is to establish a Wi-Fi P2P connection between their smartphone and a large-screen device for quick file transfer when data or files need to be shared. The user's smartphone would display something like... Figure 7 Click "Settings" on the interface shown in Figure 'a'. The displayed interface is as follows: Figure 7 As shown in b, clicking the "WLAN Direct" menu will trigger a Wi-Fi P2P connection. The interface displayed after clicking "WLAN Direct" is as follows. Figure 7 As shown in 'c', the smartphone app displays a previously stored list of available devices to the user. This list contains device identifiers for one or more devices. For example, the displayed list of available devices could be as follows: Figure 7 As shown in 'c', users can select a device from the list of available devices (e.g., a large-screen device) as needed. For example, a user can select a large-screen device by clicking its device icon in the list of available devices.
[0180] Optional, such as Figure 7 As shown in 'c', the smartphone can also display whether each device in the list of available devices is a trusted device to the user. If a device is untrusted, it can also display an icon indicating whether authentication is required. If the user confirms that authentication is needed, they can click "Authenticate," and the smartphone will automatically perform a security authentication with the device. If the security authentication is successful, the device will be displayed as a trusted device. If the security authentication fails, the device will still be displayed as an untrusted device.
[0181] It should be understood that, in addition to the two operation methods described above, users can also trigger the establishment of a Wi-Fi P2P connection between the smartphone and other devices through other operation methods in this application embodiment, and this application embodiment does not impose any restrictions on this.
[0182] It should also be understood that, in the embodiments of this application, Figure 6 and Figure 7The interface diagrams shown are merely illustrative and should not impose any limitations on the interface displayed when a user triggers the process of establishing a Wi-Fi P2P connection between a smartphone and other devices in the embodiments of this application. For example, in other embodiments of this application, the icons on the smartphone interface may include those that are larger than those on the other side. Figure 6 or Figure 7 The interface shown may display more or fewer icons, or combine some icons, or split some icons, or use different icons, etc. This application does not impose any limitations on the embodiments described herein.
[0183] It should also be understood that, in the embodiments of this application, the execution order of S230 and S2512 is not limited. S230 can be executed before S2512, after S2512, or simultaneously with S2512. In other words, the exchange of variable information in the Wi-Fi P2P connection between the smartphone and the large-screen device can occur before the smartphone and the large-screen device actually establish a Wi-Fi P2P connection, or it can occur during the process of the smartphone and the large-screen device actually establishing a Wi-Fi P2P connection. The embodiments of this application do not impose any limitations.
[0184] Similarly, there is no restriction on the order in which S245 and S2512 are executed. S245 can be executed before S2512, after S2512, or simultaneously with S2512. This embodiment of the application does not impose any restrictions.
[0185] S2513, after the user clicks on the device identifier of the large-screen device in the list of available devices, the application on the smartphone calls the Wi-Fi P2P connection interface to send a Wi-Fi P2P connection request to the communication module in the smartphone. The Wi-Fi P2P connection request includes the identifier of the large-screen device.
[0186] The following describes the specific process of establishing a Wi-Fi P2P connection between a smartphone and a large-screen device after the smartphone and the large-screen device obtain the information required to establish a Wi-Fi P2P connection. This process includes steps S2514 to S2524.
[0187] S2514, after receiving the Wi-Fi P2P connection request, the communication module in the smartphone determines the Wi-Fi P2P connection method based on the inherent and variable information stored in the Wi-Fi P2P connection of the large-screen device.
[0188] Specifically, in S2514, when the user actually needs to initiate a Wi-Fi P2P connection to the large-screen device using their smartphone, since most of the information required for establishing the Wi-Fi P2P connection (both inherent and variable information in the Wi-Fi P2P connection) has already been exchanged with the large-screen device, the smartphone determines its GO and GC roles based on the inherent and variable information in its Wi-Fi P2P connection with the large-screen device. For example, the smartphone determines its GO and GC roles based on its own device type and device status (battery level, etc.) and Wi-Fi P2P connection status. For example, the smartphone is the GO device, and the large-screen device is the GC device. The smartphone determines the frequency on which the GO device will ultimately establish the connection, as well as the SSID and PWD of the Wi-Fi P2P group, based on the large-screen device's Wi-Fi STATION channel, supported 5G channel list, and whether broadband is supported. In other words, the Wi-Fi P2P connection method is determined.
[0189] S2515, the communication module in the smartphone sends a Wi-Fi P2P group establishment request to the communication module of the large-screen device via broadcast or first connection. This Wi-Fi P2P group establishment request includes: the frequency of Wi-Fi P2P group establishment, the role assignment of GC and GO devices, the SSID and PWD of the Wi-Fi P2P group, the MAC address or IP address of the smartphone, and the port number, etc.
[0190] For example, in S2515, the communication module in a smartphone can send a Wi-Fi P2P group establishment request to the communication module of a large-screen device via BLE broadcast, BR broadcast, Wi-Fi broadcast, etc.
[0191] S2516 After receiving the Wi-Fi P2P group establishment request, the communication module of the large screen device sends the Wi-Fi P2P group establishment request to the driver and chip module of the large screen device.
[0192] S2517, the driver and chip module of the large screen device establishes a Wi-Fi P2P group according to the Wi-Fi P2P group establishment request.
[0193] S2518, the driver and chip module of the large screen device sends a notification message that the Wi-Fi P2P group has been successfully established to the communication module of the large screen device.
[0194] S2519, the communication module of the large-screen device sends a notification message of successful Wi-Fi P2P group establishment to the communication module in the smartphone via broadcast or first connection. The notification message includes: the frequency of Wi-Fi P2P group establishment, the role assignment of GC device and GO device, the SSID and PWD of the Wi-Fi P2P group, the MAC address or IP address of the large-screen device, and the port number, etc.
[0195] S2520: The communication module in the smartphone sends a notification message to the smartphone's driver and chip indicating successful Wi-Fi P2P group establishment. This notification message includes: the frequency of Wi-Fi P2P group establishment, the role assignment of GC and GO devices, the SSID and PWD of the Wi-Fi P2P group, the MAC address or IP address of the large-screen device, and the port number, etc.
[0196] S2521, the smartphone's driver and chip module joins the Wi-Fi P2P group based on the notification message indicating successful Wi-Fi P2P group establishment.
[0197] S2522, the smartphone's driver and chip module notifies the smartphone's communication module of a message that the user has successfully joined a Wi-Fi P2P group.
[0198] S2523 After receiving the message, the communication module in the smartphone sends a message to the application on the smartphone that the user has successfully joined the Wi-Fi P2P group.
[0199] S2524, after receiving the message that the application on the smartphone has successfully joined the Wi-Fi P2P group, it establishes a transmission channel based on the Wi-Fi P2P connection with the application on the large screen device (such as a file sharing application).
[0200] After S2524, a Wi-Fi P2P connection was established between smartphones and large-screen devices.
[0201] The S2525 enables smartphone apps to share files with apps on large-screen devices via a Wi-Fi P2P connection.
[0202] The method for establishing a Wi-Fi P2P connection provided in this application can utilize multiple discovery methods (such as BLE discovery, LAN discovery, Wi-Fi P2P discovery, broadcast discovery, etc.) for device discovery. It supports multiple discovery methods and allows for information exchange using different connection types or broadcast methods, improving versatility and scalability. This can be provided as a platform-level capability for various applications. After device discovery, the information required for Wi-Fi P2P connection is exchanged in stages. The inherent information required for Wi-Fi P2P connection (e.g., list of supported channels, P2P group SSID, PWD, whether broadband is supported (e.g., whether 160MHz is supported), device information, etc.) is exchanged in advance before the Wi-Fi P2P service is initiated. The variable information required for Wi-Fi P2P connection (such as the device's Wi-Fi P2P connection status, role, and frequency of the connected AP (i.e., Wi-Fi hotspot)) is exchanged before the Wi-Fi P2P service is initiated, or during the actual Wi-Fi P2P connection process, if this variable information changes. This ensures that some or all of the necessary information for the Wi-Fi P2P connection has already been exchanged by the time the connection is actually initiated. Only simple signaling (such as broadcast messages or Bluetooth messages) needs to be sent to complete the connection, further reducing connection time and improving user experience. Furthermore, it can be used on different product platforms to meet the needs of various upper-layer applications.
[0203] Optionally, in this embodiment, after S204, regarding S205: the communication module in the smartphone and the communication module in the large-screen device establish a first connection through interactive broadcast messages, there are two different implementation methods: The first implementation method: for example, Figure 8 As shown: S205 may include: In S2051a, after the smartphone driver and chip module initiate background scanning to discover devices, the communication module in the smartphone sends a first broadcast message. This first broadcast message can be a BLE broadcast message, a BR broadcast message, or a Wi-Fi broadcast message, etc. The first broadcast message carries: the smartphone's device identifier (deviceId), device type, connection address, version number, etc. For example, the connection address may include: the smartphone's MAC address, the smartphone's IP address, and the port number, etc.
[0204] S2052a, after the driver and chip module of the large screen device starts background scanning to discover the device, the communication module of the large screen device receives the first broadcast message.
[0205] S2053a, the communication module of the large-screen device replies with a second broadcast message. This second broadcast message can be a BLE broadcast message, a BR broadcast message, or a Wi-Fi broadcast message, etc. The second broadcast message includes the large-screen device's device identifier (deviceId), device type, connection address, and version number. For example, the connection address may include the large-screen device's MAC address, IP address, and port number.
[0206] S2054a: After receiving the second broadcast message, the communication module in the smartphone establishes a first connection with the large-screen device based on the connection address included in the second broadcast message. For example, if it is based on the MAC address, the established first connection is a BLE connection or a BR connection; if it is based on the MAC address, IP address, and port number, the established first connection is a local area network-based socket connection.
[0207] After S2054a, S206 can be executed.
[0208] The second implementation method: for example, Figure 9 As shown: S205 may include: In S2051b, after the smartphone driver and chip module initiate background scanning to discover devices, the communication module in the smartphone sends a first broadcast message. This first broadcast message can be a BLE broadcast message, a BR broadcast message, or a Wi-Fi broadcast message, etc. The first broadcast message carries: the smartphone's device identifier (deviceId), device type, connection address, version number, etc. For example, the connection address may include: the smartphone's MAC address, the smartphone's IP address, and the port number, etc.
[0209] S2052b: After the driver and chip module of the large screen device starts background scanning to discover the device, the communication module of the large screen device receives the first broadcast message.
[0210] S2053b, the communication module of the large-screen device establishes a first connection with the smartphone based on the connection address included in the first broadcast message. For example, if it is based on the smartphone's MAC address, the first connection established is a BLE connection or a BR connection; if it is based on the smartphone's IP address and port number, the first connection established is a local area network-based socket connection.
[0211] After S2053b, S206 can be executed.
[0212] The method for establishing a Wi-Fi P2P connection provided in this application can utilize various discovery methods (such as BLE discovery, LAN discovery, Wi-Fi P2P discovery, broadcast discovery, etc.) to discover Wi-Fi P2P devices. It can support multiple discovery methods and also supports the use of different types of connection methods or broadcast methods for information exchange, improving versatility and scalability. It can be provided as a platform-level capability for various applications. After device discovery, the information required for Wi-Fi P2P connection is exchanged in stages. The inherent information required for Wi-Fi P2P connection (e.g., list of supported channels, P2P group SSID, PWD, broadband support (e.g., 160MHz), device information, etc.) is exchanged before the Wi-Fi P2P service is initiated. The variable information required for Wi-Fi P2P connection (e.g., device Wi-Fi P2P connection status, role, frequency of the connected AP (i.e., Wi-Fi hotspot), etc.) is exchanged either before the Wi-Fi P2P service is initiated or during the actual Wi-Fi P2P connection process, if the variable information changes. This ensures that by the time the Wi-Fi P2P connection is actually initiated, some or all of the necessary information has already been exchanged. When actually initiating a Wi-Fi P2P connection, only a few simple signaling messages (such as broadcast messages, Bluetooth messages, etc.) are needed to complete the connection, thereby further reducing the time required for Wi-Fi P2P connection and improving user experience. Furthermore, it can be used on different product platforms to meet the needs of different upper-layer applications.
[0213] It should be understood that the above description uses the establishment of a Wi-Fi P2P connection as an example to illustrate the method provided in this application. In other possible implementations of this application, such as in the scenario of establishing a Wi-Fi connection between a first electronic device and a second electronic device, the concepts provided in this application can also be utilized, which will be described in detail below.
[0214] In this embodiment, as one possible implementation, it is assumed that the first electronic device is a terminal device and the second electronic device is an access point (AP), for example, the second electronic device can be a router. In this case, before the user triggers the establishment of a Wi-Fi connection between the terminal device and the router, since the router already exists, the terminal device can obtain the router's SSID and PWD (inherent Wi-Fi connection information, i.e., information that remains unchanged for a period of time during the Wi-Fi connection process) through background network discovery. In addition, since the router supports frequency hopping, the router's operating frequency or channel may change at any time. Therefore, after the router's operating frequency or channel changes, the router can send the changed operating frequency, channel, and other information to the terminal device (e.g., via Bluetooth messages, Wi-Fi messages, etc.), or the terminal device can actively request the router's operating frequency, channel, and other information from the router. After the terminal device obtains the router's operating frequency, channel, and other variable information about the Wi-Fi connection (i.e., information that may change at any time during the Wi-Fi connection process and affect the connection), when the user actually triggers the terminal device to establish a Wi-Fi connection with the router, since the terminal device has already obtained the inherent information for establishing a Wi-Fi connection with the router (including the router's SSID and PWD, etc.) and the variable information (including the router's operating frequency, channel, etc.), most of the information has already been exchanged when the user actually initiates the Wi-Fi connection. The terminal device directly scans the router's operating frequency and channel, and only needs to send some simple signaling (such as sending signaling through broadcast messages, Bluetooth messages, etc.) to complete the Wi-Fi connection, thereby further shortening the Wi-Fi connection time and improving the user experience.
[0215] In this embodiment, as another possible implementation, it is assumed that the first electronic device is a terminal device and the second electronic device is a soft AP. A soft AP can be understood as a terminal device connected to a wired or wireless network, providing Wi-Fi access to other terminal devices as a Wi-Fi hotspot. For example, a soft AP may include a smartphone, tablet, netbook, PDA, or other handheld communication device used by the user. In this case, it is assumed that the first electronic device is the first terminal device used by the user, and the second electronic device is the second terminal device used by the user. Before the user triggers the establishment of a Wi-Fi connection between the first and second terminal devices, the first and second terminal devices can exchange their respective SSID and PWD (inherent Wi-Fi connection information, i.e., information that remains unchanged for a period of time during the Wi-Fi connection process) through various broadcast messages (e.g., Bluetooth messages, Wi-Fi messages). In addition, the first and second terminal devices can exchange their respective operating frequencies, channels, and other variable Wi-Fi connection information (information that may change at any time during the Wi-Fi connection process and affect the Wi-Fi connection) through broadcast messages (e.g., Bluetooth messages). When the user actually triggers the establishment of a Wi-Fi connection between the first terminal device and the second terminal device, since the first terminal device has already obtained the inherent information (including the second terminal device's SSID and PWD, etc.) and variable information (including the second terminal device's operating frequency and channel, etc.) for establishing a Wi-Fi connection with the second terminal device, most of the information has already been exchanged when the user actually initiates the Wi-Fi connection using the first terminal device. The first terminal device only needs to send some simple signaling (such as broadcast messages and Bluetooth messages) to complete the Wi-Fi connection, thereby further shortening the Wi-Fi connection time and improving the user experience.
[0216] For example, in S205 of the above method 200, when the first connection between the smartphone and the large-screen device is a Wi-Fi connection, the smartphone and the large-screen device can establish a Wi-Fi connection using the two methods described above.
[0217] Optionally, before establishing a Wi-Fi connection, the first and second electronic devices can establish other communication connections, such as a Bluetooth connection. After establishing the communication connection, but before the user actually triggers the first and second electronic devices to establish a Wi-Fi connection, the first and second electronic devices can exchange inherent and variable information in the Wi-Fi connection through this communication connection, which can improve the information exchange rate and further shorten the Wi-Fi connection time.
[0218] Optionally, the first electronic device and the second electronic device may also exchange inherent and variable information in the Wi-Fi connection via broadcast messages (e.g., Bluetooth messages, Wi-Fi messages, etc.). This application does not impose limitations on the embodiments described herein.
[0219] It should be understood that the method provided in this application, which allows two devices to exchange information necessary for establishing a wireless communication connection before actually establishing such a connection, so that when the two devices actually initiate the communication connection, most of the information has already been exchanged and only requires the two devices to send some simple signaling to complete the communication connection, can be applied not only to scenarios including establishing Wi-Fi connections and Wi-Fi P2P connections, but also to scenarios including establishing other communication connections (such as Bluetooth and Zigbee). The embodiments of this application are not limited here.
[0220] It should be understood that the above description is only intended to help those skilled in the art better understand the embodiments of this application, and is not intended to limit the scope of the embodiments of this application. Based on the examples given above, those skilled in the art can obviously make various equivalent modifications or changes. For example, some steps in the above method 200 may be unnecessary, or new steps may be added, etc. Alternatively, any combination of two or more of the above embodiments may be used. Such modifications, changes, or combinations also fall within the scope of the embodiments of this application.
[0221] It should also be understood that the methods, situations, categories, and classifications of embodiments in this application are for the convenience of description only and should not constitute a special limitation. Various methods, categories, situations, and features in embodiments can be combined without contradiction.
[0222] It should also be understood that the various numerical designations used in the embodiments of this application are merely for descriptive convenience and are not intended to limit the scope of the embodiments of this application. The order of the process numbers described above does not imply the order of execution; the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0223] It should also be understood that the above description of the embodiments of this application focuses on highlighting the differences between the various embodiments. Any similarities or differences not mentioned can be referred to each other. For the sake of brevity, they will not be repeated here.
[0224] The above combination Figures 1-9 An embodiment of the method for establishing a Wi-Fi P2P connection provided in this application has been described. The electronic device provided in this application is described below.
[0225] This embodiment can divide the electronic device (including the first electronic device and the second electronic device mentioned above) into functional modules according to the above method. For example, each function can be divided into different functional modules, or two or more functions can be integrated into one processing module. The integrated modules can be implemented in hardware. It should be noted that the module division in this embodiment is illustrative and only represents one logical functional division; other division methods may be used in actual implementation.
[0226] It should be noted that the relevant content of each step involved in the above method embodiments can be referenced from the functional description of the corresponding functional module, and will not be repeated here.
[0227] The electronic device provided in this application embodiment is used to execute any of the methods for establishing a Wi-Fi P2P connection provided in the above-described method embodiments, thus achieving the same effect as the above-described implementation method. When using integrated units, the electronic device may include a processing module, a storage module, and a communication module. The processing module can be used to control and manage the actions of the electronic device. For example, it can be used to support the electronic device in executing the steps executed by the processing unit. The storage module can be used to support the storage of program code and data, etc. The communication module can be used to support communication between the electronic device and other devices.
[0228] The processing module can be a processor or a controller. It can implement or execute various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. The processor can also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of digital signal processing (DSP) and a microprocessor, etc. The storage module can be a memory. The communication module can specifically be a radio frequency circuit, a Bluetooth chip, a Wi-Fi chip, or other devices that interact with other electronic devices.
[0229] For example, Figure 10 A schematic diagram of the hardware structure of an example electronic device 300 provided in this application is shown. This electronic device 300 can be a smartphone or a large-screen device as described in the above method embodiments. Figure 10 As shown, the electronic 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 wireless communication module 350, etc.
[0230] It is understood that the structures illustrated in the embodiments of this application do not constitute a specific limitation on the electronic device 300. In other embodiments of this application, the electronic device 300 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0231] Processor 310 may include one or more processing units. For example, 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). Different processing units may be independent components or integrated into one or more processors. In some embodiments, electronic device 300 may also include one or more processors 310. The controller can generate operation control signals based on instruction opcodes and timing signals to control instruction fetching and execution.
[0232] In some embodiments, the processor 310 may include one or more interfaces. These interfaces may include an inter-integrated circuit (I2C) interface, an 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 SIM card interface, and / or a USB interface, etc. The USB interface 330 is a USB standard-compliant interface, specifically 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 electronic device 300, and can also be used for data transfer between the electronic device 300 and peripheral devices.
[0233] It is understood that the interface connection relationships between the modules illustrated in the embodiments of this application are merely illustrative and do not constitute a structural limitation on the electronic device 500. In other embodiments of this application, the electronic device 300 may also employ different interface connection methods or combinations of multiple interface connection methods as described in the above embodiments.
[0234] The wireless communication function of electronic device 300 can be realized through antenna 1, antenna 2 and wireless communication module 350, etc.
[0235] The wireless communication module 350 can provide solutions for wireless communication applications on the electronic device 300, including Wi-Fi (including Wi-Fi sensing and Wi-Fi AP), Bluetooth (BT), mobile networks, and wireless data transmission modules (e.g., 433MHz, 868MHz, 515MHz). The wireless communication module 350 can be one or more devices integrating at least one communication processing module. The wireless communication module 350 receives electromagnetic waves via antenna 1 or antenna 2 (or antenna 1 and antenna 2), filters and frequency-modulates the electromagnetic wave signals, and sends the processed signal to the processor 310. The wireless communication module 350 can also receive signals to be transmitted from the processor 310, frequency-modulate and amplify them, and then convert them into electromagnetic waves for radiation via antenna 1 or antenna 2.
[0236] The external storage interface 320 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 300. The external memory card communicates with the processor 310 through the external storage interface 320 to perform data storage functions. For example, music, video, and other files can be saved on the external memory card.
[0237] Internal memory 321 can be used to store one or more computer programs, which include instructions. Processor 310 can execute the instructions stored in internal memory 321, thereby causing electronic device 300 to perform the Wi-Fi Direct data transmission method provided in some embodiments of this application, as well as various applications and data processing. Internal memory 321 may include a code storage area and a data storage area. The code storage area may store the operating system. The data storage area may store data created during the use of electronic device 300. In addition, internal memory 321 may include high-speed random access memory, and may also include non-volatile memory, such as one or more disk storage components, flash memory components, universal flash storage (UFS), etc. In some embodiments, processor 310 can execute instructions stored in internal memory 321 and / or instructions stored in memory disposed in processor 310, thereby causing electronic device 300 to perform any of the Wi-Fi Direct data transmission methods provided in the embodiments of this application, as well as other applications and data processing.
[0238] Electronic devices 300 include, but are not limited to, smart TVs, large-screen devices, mobile phones, tablets, laptops, large-screen TVs, smart home devices, PDAs, POS terminals, and in-vehicle computers. The embodiments described in this application are not intended to be limiting.
[0239] It should be understood that the specific process by which electronic device 300 performs the above-mentioned steps is described in the preceding text. Figure 4 , Figure 5 and Figure 7 and Figure 9 For the sake of brevity, the descriptions of the execution steps of the smartphone or large-screen device in the various embodiments shown are omitted here.
[0240] It should also be understood that the division of units in the above device is merely a logical functional division. In actual implementation, they can be fully or partially integrated into a single physical entity, or they can be physically separated. Furthermore, all units in the device can be implemented entirely through software calls from processing elements; all units can be implemented entirely in hardware; or some units can be implemented through software calls from processing elements, while others are implemented in hardware. For example, each unit can be a separate processing element, or it can be integrated into a chip within the device. Alternatively, it can be stored as a program in memory, and its function can be called and executed by a processing element within the device. Here, the processing element can also be called a processor, which can be an integrated circuit with signal processing capabilities. In the implementation process, each step of the above method or each of the above units can be implemented through integrated logic circuits in the processor element or through software calls from processing elements. In one example, a unit in any of the above devices can be one or more integrated circuits configured to implement the methods described above, such as one or more application-specific integrated circuits (ASICs), or one or more digital signal processors (DSPs), or one or more field-programmable gate arrays (FPGAs), or a combination of at least two of these forms of integrated circuits. As another example, when a unit in the device can be implemented in the form of a processing element scheduler, the processing element can be a general-purpose processor, such as a central processing unit (CPU) or other processor capable of calling programs. Furthermore, these units can be integrated together to implement a system-on-a-chip (SOC).
[0241] This application also provides a system for establishing a Wi-Fi P2P connection, the system including: a first electronic device (e.g., a smartphone) and a second electronic device (e.g., a large-screen device) provided in the above method embodiments.
[0242] This application also provides a computer-readable storage medium for storing computer program code, the computer program including instructions for executing any of the methods for establishing a Wi-Fi P2P connection provided in the above-described embodiments of this application. The readable medium may be a read-only memory (ROM) or a random access memory (RAM), and this application does not impose any limitations on this.
[0243] This application also provides a computer program product including instructions that, when executed, cause a first electronic device and a second electronic device to perform operations corresponding to those described in the above method.
[0244] This application also provides a chip located in a communication device, the chip including: a processing unit and a communication unit. The processing unit may be, for example, a processor, and the communication unit may be, for example, an input / output interface, pins, or circuits. The processing unit can execute computer instructions to cause the communication device to perform any of the methods for establishing a Wi-Fi P2P connection provided in the above-described embodiments of this application.
[0245] Optionally, the computer instructions are stored in a storage unit.
[0246] Optionally, the storage unit can be an internal storage unit within the chip, such as a register or cache. Alternatively, it can be an external storage unit located within the terminal, such as a ROM or other types of static storage devices capable of storing static information and instructions, such as random access RAM. The processor mentioned above can be a CPU, microprocessor, ASIC, or one or more integrated circuits used to control the execution of a program for transmitting the aforementioned feedback information. The processing unit and the storage unit can be decoupled and located on different physical devices, connected via wired or wireless means to implement their respective functions, thereby supporting the system chip in implementing the various functions described in the above embodiments. Alternatively, the processing unit and the memory can also be coupled to the same device.
[0247] In this embodiment, the communication device, computer-readable storage medium, computer program product or chip are all used to execute the corresponding methods provided above. Therefore, the beneficial effects they can achieve can be referred to the beneficial effects in the corresponding methods provided above, and will not be repeated here.
[0248] It is understood that the memory in the embodiments of this application can be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. Non-volatile memory can be ROM, programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be RAM, which is used as an external cache. RAM has various different types, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct rambus RAM (DRRAM).
[0249] In this application, various objects such as messages / information / devices / network elements / systems / apparatus / actions / operations / processes / concepts may be named. It is understood that these specific names do not constitute a limitation on the relevant objects. The names may be changed depending on the scenario, context, or usage habits. The understanding of the technical meaning of the technical terms in this application should be mainly determined from their functions and technical effects embodied / performed in the technical solution.
[0250] In the various embodiments of this application, unless otherwise specified or in case of logical conflict, the terminology and / or descriptions of different embodiments are consistent and can be referenced by each other. The technical features of different embodiments can be combined to form new embodiments according to their inherent logical relationship.
[0251] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0252] The methods in the embodiments of this application can be implemented, in whole or in part, by software, hardware, firmware, or any combination thereof. When implemented in software, they can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer programs or instructions. When the computer program or instructions are loaded and executed on a computer, the processes or functions described in the embodiments of this application are performed, in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer program or instructions can be stored in a computer-readable storage medium or transmitted through the computer-readable storage medium. The computer-readable storage medium can be any available medium accessible to a computer or a data storage device such as a server integrating one or more available media.
[0253] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0254] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0255] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0256] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0257] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a readable storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned readable storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, ROM, RAM, magnetic disks, or optical disks.
[0258] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for establishing a Wireless Fidelity Direct (WF-P2P) connection, characterized in that, The method includes: Before the first electronic device receives the user's first operation, the first electronic device receives inherent information from the second electronic device for establishing a Wi-Fi P2P connection through a first connection or broadcast. The first operation is used to instruct the establishment of a Wi-Fi P2P connection with the second electronic device. The first connection includes at least one of BLE connection, USB connection, BR connection, NFC connection, Zifeng connection, Wi-Fi connection or local area network-based socket connection. The first electronic device receives the first operation, which includes: selecting the identifier of the second electronic device, or selecting the file to be transferred and selecting the identifier of the second electronic device. In response to the first operation, the first electronic device obtains variable information for establishing a Wi-Fi P2P connection from the second electronic device through the first connection and / or broadcast, and establishes a Wi-Fi P2P connection with the second electronic device based on the inherent information for establishing a Wi-Fi P2P connection and the variable information for establishing a Wi-Fi P2P connection. The inherent information used by the second electronic device to establish a Wi-Fi P2P connection includes: The second electronic device supports at least one of the following: a list of channels, the SSID of the Wi-Fi P2P group when the second electronic device creates the Wi-Fi P2P group, the PWD of the Wi-Fi P2P group when the second electronic device creates the Wi-Fi P2P group, whether the second electronic device supports Wi-Fi P2P connection, whether the second electronic device supports broadband, and device information of the second electronic device. The variable information used by the second electronic device to establish a Wi-Fi P2P connection includes: The Wi-Fi P2P connection status of the second electronic device and / or the frequency of the Wi-Fi hotspot to which the second electronic device is connected.
2. The method according to claim 1, characterized in that, The method further includes: The first electronic device and the second electronic device establish the first connection.
3. The method according to claim 1 or 2, characterized in that, The method further includes: The first electronic device sends second connection information to the second electronic device. The second connection information is used to establish a Wi-Fi P2P connection. The second connection information includes: inherent information of the first electronic device for establishing a Wi-Fi P2P connection and / or variable information of the first electronic device for establishing a Wi-Fi P2P connection.
4. The method according to claim 1 or 2, characterized in that, The method further includes: After the first electronic device receives the first operation, the first electronic device obtains the third connection information of the second electronic device. The third connection information includes: information of the second electronic device for establishing a Wi-Fi P2P connection, in addition to the inherent information of the second electronic device for establishing a Wi-Fi P2P connection and the variable information of the second electronic device for establishing a Wi-Fi P2P connection.
5. The method according to claim 4, characterized in that, In response to the first operation, the first electronic device establishes a Wi-Fi P2P connection with the second electronic device based on inherent information for establishing a Wi-Fi P2P connection and variable information for establishing a Wi-Fi P2P connection, including: The first electronic device determines the frequency of Wi-Fi P2P group establishment, the role allocation of GC devices and GO devices, and the SSID and PWD of the Wi-Fi P2P group based on the inherent information of the second electronic device for establishing a Wi-Fi P2P connection and the variable information of the second electronic device for establishing a Wi-Fi P2P connection, or based on the inherent information of the second electronic device for establishing a Wi-Fi P2P connection, the variable information of the second electronic device for establishing a Wi-Fi P2P connection, and the third connection information. The first electronic device sends a second broadcast message to the second electronic device. The second broadcast message is used to enable the second electronic device to join the Wi-Fi P2P group. The second broadcast message includes: the MAC address, IP address and port number of the first electronic device, the frequency of the Wi-Fi P2P group establishment, the role assignment of GC device and GO device, and the SSID and PWD of the Wi-Fi P2P group.
6. The method according to claim 2, wherein after the first electronic device and the second electronic device establish a first connection, and before the first electronic device receives inherent information from the second electronic device for establishing a Wi-Fi P2P connection through the first connection, the method further comprises: The first electronic device and the second electronic device perform security authentication based on the first connection; After the security authentication is passed, the first electronic device determines that the second electronic device is a trusted device.
7. A method for establishing a communication connection, characterized in that, The method includes: Before the first electronic device receives the user's first operation, the first electronic device receives inherent information for communication connection from the second electronic device via a first connection or broadcast, and the first operation is used to instruct the establishment of the communication connection with the second electronic device. The first electronic device receives the first operation, which includes: selecting the identifier of the second electronic device, or selecting the file to be transferred and selecting the identifier of the second electronic device. In response to the first operation, the first electronic device obtains variable information for the second electronic device to establish the communication connection through the first connection and / or broadcast, and establishes the communication connection with the second electronic device based on the inherent information for the communication connection of the second electronic device and the variable information for the communication connection of the second electronic device. The inherent information used by the second electronic device to establish a communication connection includes: the SSID of the second electronic device and / or the PWD of the second electronic device; The variable information used by the second electronic device to establish a communication connection includes: the operating frequency information and / or communication channel information of the second electronic device.
8. The method according to claim 7, characterized in that, The method further includes: The first electronic device and the second electronic device establish the first connection.
9. The method according to claim 7 or 8, characterized in that, The method further includes: The first electronic device sends fifth connection information to the second electronic device, the fifth connection information including the operating frequency information and / or communication channel information of the first electronic device.
10. The method according to claim 7 or 8, characterized in that, The communication connection is a Wi-Fi connection, and the first connection is a Bluetooth connection.
11. An electronic device, characterized in that, The electronic device includes: A processor; a memory; and a computer program stored in the memory, which, when executed by the processor, causes the electronic device to perform the following steps: Before the electronic device receives the user's first operation, the electronic device receives inherent information from the second electronic device for establishing a Wi-Fi P2P connection via a first connection or broadcast, and the first operation is used to instruct the establishment of a Wi-Fi P2P connection with the second electronic device; The electronic device receives the first operation, which includes: selecting the identifier of the second electronic device, or selecting the file to be transferred and selecting the identifier of the second electronic device. In response to the first operation, the electronic device obtains variable information for establishing a Wi-Fi P2P connection from the second electronic device through the first connection and / or broadcast. Based on the inherent information for establishing a Wi-Fi P2P connection and the variable information for establishing a Wi-Fi P2P connection from the second electronic device, it establishes a Wi-Fi P2P connection with the second electronic device. The first connection includes at least one of BLE connection, USB connection, BR connection, NFC connection, Zifeng connection, Wi-Fi connection, or a socket connection based on a local area network. The inherent information used by the second electronic device to establish a Wi-Fi P2P connection includes: The second electronic device supports at least one of the following: a list of channels, the SSID of the Wi-Fi P2P group when the second electronic device creates the Wi-Fi P2P group, the PWD of the Wi-Fi P2P group when the second electronic device creates the Wi-Fi P2P group, whether the second electronic device supports Wi-Fi P2P connection, whether the second electronic device supports broadband, and device information of the second electronic device. The variable information used by the second electronic device to establish a Wi-Fi P2P connection includes: The Wi-Fi P2P connection status of the second electronic device and / or the frequency of the Wi-Fi hotspot to which the second electronic device is connected.
12. The electronic device according to claim 11, characterized in that, The electronic device also performs the following steps: The electronic device and the second electronic device establish the first connection.
13. The electronic device according to claim 11 or 12, characterized in that, The electronic device also performs the following steps: The electronic device sends second connection information to the second electronic device. The second connection information is used to establish a Wi-Fi P2P connection. The second connection information includes: inherent information of the electronic device for establishing a Wi-Fi P2P connection and / or variable information of the electronic device for establishing a Wi-Fi P2P connection.
14. The electronic device according to claim 11 or 12, characterized in that, The electronic device also performs the following steps: After the electronic device receives the first operation, the electronic device obtains the third connection information of the second electronic device. The third connection information includes: information of the second electronic device for establishing a Wi-Fi P2P connection, in addition to the inherent information of the second electronic device for establishing a Wi-Fi P2P connection and the variable information of the second electronic device for establishing a Wi-Fi P2P connection.
15. The electronic device according to claim 14, characterized in that, The electronic device also performs the following steps: The electronic device determines the frequency of Wi-Fi P2P group establishment, the role allocation of GC devices and GO devices, and the SSID and PWD of the Wi-Fi P2P group based on the inherent information of the second electronic device for establishing a Wi-Fi P2P connection and the variable information of the second electronic device for establishing a Wi-Fi P2P connection, or based on the inherent information of the second electronic device for establishing a Wi-Fi P2P connection, the variable information of the second electronic device for establishing a Wi-Fi P2P connection, and the third connection information. The electronic device sends a second broadcast message to the second electronic device. The second broadcast message is used to enable the second electronic device to join the Wi-Fi P2P group. The second broadcast message includes: the MAC address, IP address and port number of the electronic device, the frequency of the Wi-Fi P2P group establishment, the role assignment of GC device and GO device, and the SSID and PWD of the Wi-Fi P2P group.
16. The electronic device of claim 12, after the electronic device and the second electronic device establish a first connection and before the electronic device receives inherent information from the second electronic device for establishing a Wi-Fi P2P connection through the first connection, the electronic device further performs the following steps: The electronic device and the second electronic device perform security authentication based on the first connection; After the security authentication is passed, the electronic device determines that the second electronic device is a trusted device.
17. An electronic device, characterized in that, The electronic device includes: A processor; a memory; and a computer program stored in the memory, which, when executed by the processor, causes the electronic device to perform the following steps: Before the electronic device receives the user's first operation, the electronic device receives inherent information for communication connection from the second electronic device via a first connection or broadcast, wherein the first operation is used to instruct the establishment of the communication connection with the second electronic device. The electronic device receives the first operation, which includes: selecting the identifier of the second electronic device, or selecting the file to be transferred and selecting the identifier of the second electronic device. In response to the first operation, the electronic device acquires variable information for establishing the communication connection of the second electronic device through the first connection and / or broadcast, and establishes the communication connection with the second electronic device based on the inherent information for establishing the communication connection of the second electronic device and the variable information for establishing the communication connection of the second electronic device. The inherent information used by the second electronic device to establish a communication connection includes: the SSID of the second electronic device and / or the PWD of the second electronic device; The variable information used by the second electronic device to establish a communication connection includes: the operating frequency information and / or communication channel information of the second electronic device.
18. The electronic device according to claim 17, characterized in that, The electronic device also performs the following steps: The electronic device and the second electronic device establish the first connection.
19. The electronic device according to claim 17 or 18, characterized in that, The electronic device performs the following steps: The electronic device sends fifth connection information to the second electronic device, the fifth connection information including the operating frequency information and / or communication channel information of the electronic device.
20. The electronic device according to claim 17 or 18, characterized in that, The communication connection is a Wi-Fi connection, and the first connection is a Bluetooth connection.
21. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, the computer program including program instructions that, when executed by a processor, cause the processor to perform the method as described in any one of claims 1 to 6, or to perform the method as described in any one of claims 7 to 10.
22. A chip, characterized in that, include: A processor for retrieving and running a computer program from memory, causing a communication device on which the chip is mounted to perform the method as described in any one of claims 1 to 6, or the method as described in any one of claims 7 to 10.