WIFI communication method and electronic device
By using the public behavior frame to carry negotiation information on the WiFi channel and directly executing the negotiation process on the WiFi channel, the problem of low WiFi P2P connection negotiation efficiency in the existing technology is solved, the connection is quickly established and security is enhanced.
Patent Information
- Application Number
- PCT/CN2024/084232
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-04-28
- Filing Date
- 2024-03-27
- Publication Date
- 2024-10-31
AI Technical Summary
The existing technology requires negotiation through an out-of-band channel before establishing a WiFi P2P connection, which is inefficient, resulting in slower connection speeds and possible degradation of WiFi link performance in the case of dual-band adaptive concurrency.
By using public behavior frames on the WiFi channel to carry negotiation information, the negotiation process is performed directly on the WiFi channel, avoiding out-of-band channels, improving negotiation speed and efficiency, and encrypting information through session keys to enhance communication security.
It achieves the rapid establishment of WiFi P2P connections, improves connection speed and success rate, avoids performance degradation caused by dual-band adaptive concurrency, and enhances communication security.
Smart Images

Figure CN2024084232_31102024_PF_FP_ABST
Abstract
Description
WiFi communication method and electronic equipment
[0001] CROSS-REFERENCE TO RELATED APPLICATIONS
[0002] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office of the People's Republic of China on April 28, 2023, with application number 202310488105.5 and application name "A WiFi Communication Method and Electronic Device", the entire contents of which are incorporated by reference into this application. Technical Field
[0003] The present application relates to the field of communication technology, and in particular to a WiFi communication method and electronic equipment. Background Art
[0004] Terminal devices can transmit service data and other information through wireless fidelity (WiFi) peer-to-peer (P2P) connections. Before establishing a WiFi P2P connection, terminal devices must negotiate the WiFi P2P connection mode, the channel to be used, and the network identifier and key to be used. Based on this information, the WiFi P2P connection is then established. Without a wireless local area network (WLAN), current terminal devices must complete the WiFi P2P pre-link negotiation through an out-of-band channel (such as a Bluetooth link). This approach is inefficient and reduces the speed of WiFi P2P link establishment.
[0005] Summary of the Invention
[0006] The present application provides a WiFi communication method and electronic device for efficiently implementing a negotiation process before WiFi P2P link establishment and improving the speed of establishing WiFi P2P connections.
[0007] In a first aspect, an embodiment of the present application provides a WiFi communication method, applied to a first electronic device, the method comprising: sending first information to a second electronic device; wherein the first information includes an identifier of a first WiFi channel and an address of the first electronic device; receiving a first public behavior frame sent by the second electronic device via the first WiFi channel; wherein the first public behavior frame includes the address of the first electronic device; and in response to the first public behavior frame, executing a negotiation process for establishing a WiFi point-to-point (P2P) connection with the second electronic device via the first WiFi channel.
[0008] In this method, the first WiFi channel can be the WiFi channel that the first electronic device desires to use for performing a negotiation process with the second electronic device. After the first electronic device sends the identifier of the first WiFi channel to the second electronic device and receives the response information, i.e., the first public action frame, sent by the second electronic device, it can use the first WiFi channel to perform the negotiation process with the second electronic device. The public action frame is a management message reserved for manufacturer use in the WiFi protocol. The transmission of the public action frame can be carried on a WiFi channel (i.e., the first WiFi channel). Therefore, the transmission of the public action frame between the first and second electronic devices does not require an out-of-band channel, resulting in higher transmission efficiency. Furthermore, the execution of the negotiation process before the first and second electronic devices establish a link (i.e., establish a WiFi P2P connection) can also be carried on the first WiFi channel, without requiring an out-of-band channel. Therefore, the execution speed and efficiency of the negotiation process are higher, and the stability is better. This not only helps to increase the speed of establishing the WiFi P2P connection, but also avoids the problem of reduced WiFi link performance caused by dual-band adaptive concurrency in the first or second electronic device.
[0009] In one possible design, the negotiation process includes: authenticating with the second electronic device, and after successful authentication, sending a second public behavior frame to the second electronic device through the first WiFi channel; wherein the second public behavior frame includes at least one of the following: an identifier of the WiFi channel supported by the first electronic device, an identifier of the second WiFi channel, and information indicating the P2P role of the first electronic device; receiving a third public behavior frame sent by the second electronic device through the first WiFi channel; wherein the third public behavior frame includes at least one of the following: an identifier of the second WiFi channel, information indicating the P2P role of the first electronic device, information indicating the P2P role of the second electronic device, a first key for establishing a WiFi P2P connection, and Internet Protocol IP information of the first electronic device.
[0010] In this method, the information in the second public behavior frame is the negotiation information of the first electronic device. By sending the negotiation information of the first electronic device to the second electronic device, the second electronic device can determine the information that needs to be referenced when the first electronic device and the second electronic device establish a WiFi P2P connection based on the information. The information in the third public behavior frame is the information that needs to be referenced when the first electronic device and the second electronic device establish a WiFi P2P connection. Through the above method, the first electronic device and the second electronic device can carry the negotiation information through a public signaling frame that can be transmitted on the WiFi channel, thereby completing the negotiation process before the WiFi P2P link is established. Therefore, the speed and efficiency of the negotiation process are high, which helps to improve the speed of establishing a WiFi P2P connection.
[0011] In one possible design, the authentication with the second electronic device includes: sending a fourth public behavior frame to the second electronic device through the first WiFi channel; wherein the fourth public behavior frame includes authentication information; and receiving a fifth public behavior frame sent by the second electronic device through the first WiFi channel; wherein the fifth public behavior frame is used to notify successful authentication.
[0012] In this method, the first electronic device and the second electronic device can carry the interactive information in the authentication process through a common signaling frame that can be transmitted on the WiFi channel, thereby completing the authentication process in the negotiation process before the WiFi P2P link is established. The execution speed and efficiency are both high, which helps to improve the speed of establishing the WiFi P2P connection.
[0013] In one possible design, after successful authentication, before sending a second public behavior frame to the second electronic device through the first WiFi channel, the method further includes: negotiating a second key with the second electronic device through the first WiFi channel and the public behavior frame; wherein the second key is used to: encrypt information sent to the second electronic device, or decrypt information from the second electronic device.
[0014] In this method, the first and second electronic devices can use common signaling frames transmitted over a WiFi channel to carry the interactive information in the key negotiation process, thereby completing the key negotiation process during the negotiation process before establishing a WiFi P2P link. This method is highly efficient and helps to speed up the establishment of WiFi P2P connections. Furthermore, by encrypting the interactive information between the first and second electronic devices using a key, communication security can be improved.
[0015] In one possible design, sending the first information to the second electronic device includes: sending the first information to the second electronic device via a low-power Bluetooth communication method or a StarFlash low-power communication method.
[0016] In this method, information is sent in a low-power manner, which is easy to implement and has a high communication success rate and efficiency.
[0017] In one possible design, the first public behavior frame also includes at least one of the following: an identifier of a WiFi channel supported by the second electronic device, an identifier of the second WiFi channel, and information indicating a P2P role of the second electronic device.
[0018] In this method, the above information is the negotiation information of the second electronic device. By carrying the negotiation information of the second electronic device on the first public behavior frame and sending it to the first electronic device, on the one hand, the first electronic device can determine the information that needs to be referenced when the first electronic device and the second electronic device establish a WiFi P2P connection based on the information. On the other hand, using a public signaling frame that can be transmitted on a WiFi channel to carry the negotiation information can realize the sending and receiving of the negotiation information without the help of an out-of-band channel, which can improve the speed and efficiency of executing the negotiation process, thereby improving the speed of establishing a WiFi P2P connection.
[0019] In one possible design, the negotiation process includes: sending a second public behavior frame to the second electronic device through the first WiFi channel; wherein the second public behavior frame includes at least one of the following: an identifier of the second WiFi channel, information for indicating the P2P role of the first electronic device, information for indicating the P2P role of the second electronic device, a first key for establishing a WiFi P2P connection, and Internet Protocol IP information of the first electronic device.
[0020] In this method, the information in the second public action frame is the information required by the first and second electronic devices to establish a WiFi P2P connection. Using public signaling frames that can be transmitted over WiFi channels to carry this information enables the sending and receiving of negotiation information without the need for out-of-band channels, improving the speed and efficiency of the negotiation process and, consequently, the speed of establishing WiFi P2P connections.
[0021] In one possible design, before sending the first information to the second electronic device, the method also includes: establishing a communication connection with the second electronic device; authenticating the second electronic device, and after successful authentication, negotiating a second key with the second electronic device; sending the first information to the second electronic device includes: when initiating a service, sending the first information encrypted with the second key to the second electronic device; receiving the first public behavior frame sent by the second electronic device through the first WiFi channel includes: receiving the first public behavior frame encrypted with the second key sent by the second electronic device through the first WiFi channel.
[0022] In this method, the first electronic device can establish a communication connection and perform authentication with the second electronic device before initiating a service. Then, when initiating the service, the first electronic device and the second electronic device do not need to perform the authentication again during the negotiation process, thereby improving the speed of executing the negotiation process. In addition, the first and second electronic devices can use public signaling frames that can be transmitted on the WiFi channel to carry the interactive information in the key negotiation process, thereby completing the key negotiation process in the negotiation process before the WiFi P2P link is established. The execution speed and efficiency are both high, which helps to improve the speed of establishing the WiFi P2P connection. By encrypting the interactive information between the first and second electronic devices with a key, the security of the communication can be improved.
[0023] In one possible design, the method further includes: establishing a WiFi P2P connection with the second electronic device after executing the negotiation process; wherein establishing the WiFi P2P connection with the second electronic device specifically includes: executing an authentication process and an association process with the second electronic device without executing a four-way handshake process; and determining, based on the second key, an encryption key for a WiFi P2P link to be used after establishing the WiFi P2P connection. The WiFi P2P link to be used after establishing the WiFi P2P connection is the second WiFi link.
[0024] In this method, the encryption key of the WiFi P2P link used after the WiFi P2P connection is established can be determined based on the second key determined in the negotiation process. Therefore, the four-way handshake process for negotiating the key (the key is used to determine the encryption key of the WiFi P2P link used after the WiFi P2P connection is established) can be omitted, thereby further improving the speed and efficiency of WiFi P2P link establishment.
[0025] In a second aspect, an embodiment of the present application provides a WiFi communication method, applied to a second electronic device, the method comprising: receiving first information from a first electronic device; wherein the first information includes an identifier of a first WiFi channel and an address of the first electronic device;
[0026] Sending a first public action frame to the second electronic device via the first WiFi channel; wherein the first public action frame includes the address of the first electronic device;
[0027] A negotiation process for establishing a WiFi point-to-point (P2P) connection is performed with the first electronic device through the first WiFi channel.
[0028] In one possible design, the negotiation process includes: authenticating with the first electronic device, and after successful authentication, receiving a second public behavior frame sent by the first electronic device through the first WiFi channel; wherein the second public behavior frame includes at least one of the following: an identifier of the WiFi channel supported by the first electronic device, an identifier of the second WiFi channel, and information indicating the P2P role of the first electronic device; sending a third public behavior frame to the first electronic device through the first WiFi channel; wherein the third public behavior frame includes at least one of the following: an identifier of the second WiFi channel, information indicating the P2P role of the first electronic device, information indicating the P2P role of the second electronic device, a first key for establishing a WiFi P2P connection, and Internet Protocol IP information of the first electronic device.
[0029] In one possible design, the authentication with the first electronic device includes: receiving a fourth public behavior frame sent by the first electronic device through the first WiFi channel; wherein the fourth public behavior frame includes authentication information; and sending a fifth public behavior frame to the first electronic device through the first WiFi channel; wherein the fifth public behavior frame is used to notify successful authentication.
[0030] In one possible design, after successful authentication, before receiving a second public behavior frame sent by the first electronic device through the first WiFi channel, the method further includes: negotiating a second key with the first electronic device through the first WiFi channel and the public behavior frame; wherein the second key is used to: decrypt information from the first electronic device, or encrypt information sent to the first electronic device.
[0031] In one possible design, the receiving of the first information from the first electronic device includes: receiving the first information sent by the first electronic device via a low-power Bluetooth communication method or a StarFlash low-power communication method.
[0032] In one possible design, the first public behavior frame also includes at least one of the following: an identifier of a WiFi channel supported by the second electronic device, an identifier of the second WiFi channel, and information indicating a P2P role of the second electronic device.
[0033] In one possible design, the negotiation process includes: receiving a second public behavior frame sent by the first electronic device through the first WiFi channel; wherein the second public behavior frame includes at least one of the following: an identifier of the second WiFi channel, information for indicating the P2P role of the first electronic device, information for indicating the P2P role of the second electronic device, a first key for establishing a WiFi P2P connection, and Internet protocol IP information of the first electronic device.
[0034] In one possible design, before receiving the first information from the first electronic device, the method also includes: establishing a communication connection with the first electronic device; authenticating the first electronic device, and after successful authentication, negotiating a second key with the first electronic device; the receiving of the first information from the first electronic device includes: receiving the first information encrypted with the second key from the first electronic device; the sending of the first public behavior frame to the first electronic device through the first WiFi channel includes: sending the first public behavior frame encrypted with the second key to the first electronic device through the first WiFi channel.
[0035] In one possible design, the method further includes: establishing a WiFi P2P connection with the first electronic device after executing the negotiation process; wherein establishing the WiFi P2P connection with the first electronic device specifically includes: executing an authentication process and an association process with the first electronic device without executing a four-way handshake process; and determining, based on the second key, an encryption key for a WiFi P2P link to be used after establishing the WiFi P2P connection. The WiFi P2P link to be used after establishing the WiFi P2P connection is the second WiFi link.
[0036] In a third aspect, an embodiment of the present application provides a WiFi communication method, applied to a first electronic device, the method comprising: sending first information to a second electronic device; wherein the first information includes an identifier of a first WiFi channel; receiving second information from the second electronic device; wherein the second information includes an identifier of the first WiFi channel; in response to the second information, establishing a WiFi connection with a soft access point of the second electronic device through the first WiFi channel; wherein the soft access point is a soft access point pre-negotiated by the first electronic device and the second electronic device.
[0037] In this method, the first WiFi channel may be the working channel that the first electronic device expects to use after establishing a WiFi connection with the second electronic device. After the first electronic device sends the identifier of the first WiFi channel to the second electronic device, and after receiving the response information, i.e., the second information, sent by the second electronic device, it may use the first WiFi channel to perform the link establishment process with the second electronic device. Without the help of a local area network and when the electronic device cannot customize the message in the private protocol to accelerate the WiFi link establishment speed, this method can quickly establish a WiFi connection. In addition, the first electronic device can negotiate with the second electronic device in advance to determine the soft access point corresponding to the establishment of the WiFi connection, which can further improve the speed of WiFi link establishment. In this method, the first electronic device and / or the second electronic device may be a PC device, and this method can quickly and efficiently establish a WiFi link for the PC device.
[0038] In one possible design, before sending the first information to the second electronic device, the method also includes: after establishing a communication connection with the second electronic device, negotiating a first key with the second electronic device; sending the first information to the second electronic device includes: when initiating a service, sending the first information encrypted using the first key to the second electronic device; receiving the second information from the second electronic device includes: receiving the second information encrypted using the first key from the second electronic device.
[0039] In this method, the first electronic device can perform a key negotiation process with the second electronic device before initiating a service. When initiating the service, the first electronic device does not need to perform a key negotiation process with the second electronic device, thereby improving the efficiency of WiFi link establishment. Furthermore, the exchanged information between the first and second electronic devices is encrypted using a key, which can improve communication security.
[0040] In one possible design, establishing a WiFi connection with the soft access point of the second electronic device through the first WiFi channel includes: connecting to the soft access point of the second electronic device through the first WiFi channel using a second key, and authenticating with the second electronic device; wherein the second key is: a key pre-negotiated by the first electronic device and the second electronic device, or a set key.
[0041] In this method, the first electronic device can connect to the soft access point of the second electronic device using a key pre-negotiated with the second electronic device or a set key. This eliminates the need for the first electronic device to negotiate a key with the second electronic device during the link establishment process, improving link establishment speed and efficiency.
[0042] In one possible design, sending the first information to the second electronic device includes: sending the first information to the second electronic device via a low-power Bluetooth communication method or a Starflash low-power communication method; receiving the second information from the second electronic device includes: receiving the second information sent by the second electronic device via a low-power Bluetooth communication method or a Starflash low-power communication method.
[0043] In this method, information is sent in a low-power manner, which is easy to implement and has a high communication success rate and efficiency.
[0044] In a fourth aspect, an embodiment of the present application provides a WiFi communication method, applied to a second electronic device, the method comprising: receiving first information from a first electronic device; wherein the first information includes an identifier of a first WiFi channel; creating a soft access point, and sending second information to the first electronic device; wherein the second information includes an identifier of the first WiFi channel; establishing a WiFi connection between the soft access point and the first electronic device through the first WiFi channel; wherein the soft access point is a soft access point pre-negotiated by the first electronic device and the second electronic device.
[0045] In one possible design, before receiving the first information from the first electronic device, the method also includes: after establishing a communication connection with the first electronic device, negotiating a first key with the first electronic device; the receiving of the first information from the first electronic device includes: receiving the first information encrypted using the first key from the first electronic device; and the sending of the second information to the first electronic device includes: sending the second information encrypted using the first key to the first electronic device.
[0046] In one possible design, establishing a WiFi connection between the soft access point and the first electronic device through the first WiFi channel includes: establishing a connection with the first electronic device through the first WiFi channel using a second key, and authenticating with the first electronic device; wherein the second key is: a key pre-negotiated by the first electronic device and the second electronic device, or a set key.
[0047] In one possible design, the receiving of the first information from the first electronic device includes: receiving the first information sent by the first electronic device via a low-power Bluetooth communication method or a Starflash low-power communication method; the sending of the second information to the first electronic device includes: sending the second information to the first electronic device via a low-power Bluetooth communication method or a Starflash low-power communication method.
[0048] In a fifth aspect, the present application provides an electronic device, comprising a memory and one or more processors; wherein the memory is used to store computer program code, and the computer program code comprises computer instructions; when the computer instructions are executed by the one or more processors, the electronic device executes the method described in the first aspect or any possible design of the first aspect, or executes the method described in the second aspect or any possible design of the second aspect, or executes the method described in the third aspect or any possible design of the third aspect, or executes the method described in the fourth aspect or any possible design of the fourth aspect.
[0049] In a sixth aspect, the present application provides a computer-readable storage medium storing a computer program. When the computer program runs on an electronic device, the electronic device executes the method described in the first aspect or any possible design of the first aspect, or executes the method described in the second aspect or any possible design of the second aspect, or executes the method described in the third aspect or any possible design of the third aspect, or executes the method described in the fourth aspect or any possible design of the fourth aspect.
[0050] In the seventh aspect, the present application provides a computer program product, which includes a computer program or instructions. When the computer program or instructions are run on an electronic device, the electronic device executes the method described in the first aspect or any possible design of the first aspect, or executes the method described in the second aspect or any possible design of the second aspect, or executes the method described in the third aspect or any possible design of the third aspect, or executes the method described in the fourth aspect or any possible design of the fourth aspect.
[0051] In an eighth aspect, the present application provides a chip system, comprising a processor and a memory, wherein the memory stores instructions; when the instructions are executed by the processor, the method described in the first aspect or any possible design of the first aspect is implemented, or the method described in the second aspect or any possible design of the second aspect is implemented, or the method described in the third aspect or any possible design of the third aspect is implemented, or the method described in the fourth aspect or any possible design of the fourth aspect is implemented. The chip system may be composed of a chip, or may include a chip and other discrete devices.
[0052] For the beneficial effects of the second aspect, please refer to the description of the beneficial effects of the first aspect. For the beneficial effects of the fourth aspect, please refer to the description of the beneficial effects of the third aspect. For the beneficial effects of the fifth to eighth aspects, please refer to the beneficial effects of the first to fourth aspects. No further details will be given here. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] FIG1 is a schematic diagram of the hardware architecture of an electronic device provided in an embodiment of the present application;
[0054] FIG2 is a schematic diagram of a software architecture of an electronic device provided in an embodiment of the present application;
[0055] FIG3 is a flow chart of a WiFi communication method provided in an embodiment of the present application;
[0056] FIG4 is a schematic diagram of a negotiation process method provided in an embodiment of the present application;
[0057] FIG5 is a schematic diagram of a flow chart of a WiFi communication method provided in an embodiment of the present application;
[0058] FIG6 is a flow chart of a WiFi P2P link establishment method provided in an embodiment of the present application;
[0059] FIG7 is a flow chart of a WiFi P2P link establishment method provided in an embodiment of the present application;
[0060] FIG8 is a schematic diagram of a flow chart of a WiFi communication method provided in an embodiment of the present application;
[0061] FIG9 is a flow chart of a WiFi communication method provided in an embodiment of the present application;
[0062] FIG10 is a schematic diagram of a WiFi communication method provided in an embodiment of the present application;
[0063] FIG11 is a schematic diagram of a WiFi communication method provided in an embodiment of the present application;
[0064] FIG12 is a schematic diagram of a WiFi communication method provided in an embodiment of the present application;
[0065] FIG13 is a schematic diagram of a WiFi communication method provided in an embodiment of the present application;
[0066] FIG14 is a schematic structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0067] In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the embodiments of the present application will be further described in detail below with reference to the accompanying drawings.
[0068] In the description of the embodiments of this application, the terms "first" and "second" are used for descriptive purposes only and should not be understood to indicate or imply relative importance or implicitly specify the number of technical features indicated. Therefore, features specified as "first" or "second" may explicitly or implicitly include one or more of the features.
[0069] To facilitate understanding, exemplary descriptions of concepts related to this application are provided for reference.
[0070] 1) Electronic equipment, which can be a device with processing and communication functions. In the embodiments of the present application, the electronic equipment can also be referred to as a terminal or terminal device.
[0071] In some embodiments of the present application, the electronic device may be a portable device, such as a mobile phone, a tablet computer, a laptop computer, a PDA, a wearable device with wireless communication function (for example, a watch, a bracelet, a helmet, a headset, etc.), a vehicle, a vehicle-mounted device, an augmented reality (AR) / virtual reality (VR) device, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), a smart home device (for example, a smart TV, a smart speaker, etc.), an intelligent robot, a workshop equipment, a wireless terminal in industrial control, a wireless terminal in self-driving, a wireless terminal in remote medical surgery, a wireless terminal in a smart grid, a wireless terminal in transportation safety, a wireless terminal in a smart city, or a wireless terminal in a smart home, a flying device (for example, an intelligent robot, a hot air balloon, a drone, an airplane), etc.
[0072] Among them, a wearable device is a portable device that a user can wear directly on the body or integrate into the user's clothes or accessories.
[0073] In some embodiments of the present application, the electronic device may also be a portable terminal device that also includes other functions such as a personal digital assistant and / or a music player. Or a portable terminal device with other operating systems. The portable terminal device may also be other portable terminal devices, such as a laptop computer with a touch-sensitive surface (e.g., a touch panel). It should also be understood that in some other embodiments of the present application, the electronic device may not be a portable terminal device, but a desktop computer with a touch-sensitive surface (e.g., a touch panel).
[0074] 2) Station (STA), also known as workstation or wireless workstation, refers to a device connected to a wireless network. These devices can communicate with other devices within the wireless network or with the outside of the wireless network through an access point.
[0075] In the embodiment of the present application, STA may be an electronic device that supports WiFi connection.
[0076] 3) Access Point (AP), also known as access node, wireless access point or hotspot, is a device used to connect STAs to a wireless network. APs enable communication between wireless and wired networks and are the core device for building a wireless LAN.
[0077] An AP can be an access point in a WiFi system, or a module or unit that performs some of the functions of an access point, such as a centralized unit (CU) or a distributed unit (DU), or a router, bridge, or wireless gateway. This application does not limit the specific technology or device form used by the AP.
[0078] In the embodiment of the present application, the AP may be an electronic device with a WiFi access function.
[0079] 4) WiFi P2P, also known as WiFi Direct, is a WiFi-based technology launched by the WiFi Alliance that allows direct device-to-device connections. WiFi P2P enables one-to-one or one-to-many communication between devices without the need for a local area network (LAN) or access point (AP). WiFi P2P has a wide range of applications. As long as the device supports the relevant WiFi P2P protocols, it can implement various interactive services (such as file transfer and screen sharing).
[0080] The Wi-Fi P2P architecture defines two device roles: group owner (GO) and group client (GC). A GO performs AP-like functions, while a GC functions like a STA and requires a connection to the GO. Multiple devices in a Wi-Fi P2P network can determine their roles through negotiation.
[0081] 5) Dual-band adaptive concurrent (DBAC) mode refers to a mode in which WLAN devices (i.e., devices that support WLAN communication) communicate using time-division multiplexing of different frequency bands.
[0082] Currently, WLAN devices support the 2.4 GHz and 5 GHz frequency bands. When a WLAN device integrates a software architecture that includes the media access control layer, physical layer, and radio frequency, and the radio frequency has only one path, the WLAN device can only operate in one frequency band (generally the 2.4 GHz band). This operating mode is called single-band single concurrent (SBSC) mode. When a WLAN device integrates a software architecture that includes the media access control layer, physical layer, and radio frequency, and the radio frequency has two paths, one of which supports the 2.4 GHz band and the other supports the 5 GHz band, the WLAN device can support switching to one of the 2.4 GHz and 5 GHz bands, but cannot support operation in both bands simultaneously. This operating mode is called dual-band single concurrent (DBSC) mode. When a WLAN device integrates two software architectures including the media access control layer, physical layer, and radio frequency (RF), and the RF has two sets of paths, one of which supports the 2.4 GHz band and the other supports the 5 GHz band, the WLAN device can support operation in the 2.4 GHz band and the 5 GHz band separately, or simultaneously. This operating mode is called dual-band dual concurrent (DBSC) mode.
[0083] Due to the high cost of WLAN devices that support DBDC mode, few currently support it. For devices that don't support DBDC mode, if they support DBSC mode, they can dynamically switch between the 2.4 GHz and 5 GHz bands, achieving time-division multiplexing communication across the two bands. This operating mode is known as DBAC mode. In DBAC mode, a WLAN device can only operate on one band at a time and cannot operate simultaneously on multiple bands. In DBAC mode, WLAN devices need to dynamically switch between the two bands, resulting in reduced service quality.
[0084] It should be understood that in the embodiments of the present application, "at least one" refers to one or more, and "more" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: the existence of A alone, the existence of A and B at the same time, and the existence of B alone, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can represent: a, b, c, a and b, a and c, b and c, or a, b and c, where a, b, c can be single or multiple.
[0085] When terminal devices interact with each other, they can transmit business data through a WiFi P2P connection. Furthermore, in order to improve the security of business interaction, terminal devices can transmit business data through an encrypted WiFi P2P connection channel. Currently, a terminal device needs to at least know the service set identifier (SSID) or basic service set identifier (BSSID) of the other device, as well as the pre-shared key (PSK) in advance, in order to establish an encrypted WiFi P2P channel with the other device. In addition, current terminal devices can support operation in multiple modes. When the WiFi chip in the terminal device coexists in STA mode (i.e., the mode in which the terminal device operates as a STA) and P2P mode (i.e., the mode in which the terminal device operates as a P2P device), if the terminal device operates in different channels in STA mode and P2P mode, it will enter DBAC mode, i.e., the terminal device time-division multiplexes the two channels, which will significantly reduce the communication performance of the terminal device. Currently, to address this issue, before establishing a Wi-Fi P2P connection, devices can negotiate a mutually acceptable operating channel through bilateral channel negotiation. This ensures that both devices in the connection operate on the negotiated channel, preventing them from entering DBAC mode and improving communication performance. Furthermore, before establishing a Wi-Fi P2P connection, devices can negotiate their respective Wi-Fi P2P roles (GO or GC).
[0086] In summary, when establishing a WiFi P2P connection or accessing an encrypted AP, terminal devices need to negotiate the connection mode and channel to be used, exchange information such as SSID and key, and negotiate the roles of both ends. Currently, terminal devices can achieve this negotiation through the following methods:
[0087] Method 1: User scans the QR code to establish WiFi P2P
[0088] In this method, the GO / AP device can present the information required for WiFi P2P link establishment to the user via a QR code. The user can then use a terminal device (such as a mobile phone) to actively scan the QR code to obtain the information required to establish a link with the GO / AP device, and then establish a WiFi P2P connection with the GO / AP device based on this information.
[0089] This method requires users to actively participate in the negotiation and chain establishment process, resulting in a poor user experience and a long time consumption, resulting in a very slow chain establishment speed.
[0090] Method 2: Negotiate via wireless LAN
[0091] In this method, two devices that need to establish a Wi-Fi P2P connection connect to the same Wi-Fi hotspot. All information needed for link establishment on both ends is forwarded through the Wi-Fi hotspot, enabling negotiation and interaction of link establishment information. Currently, negotiation based on this method typically takes 1.2 to 1.5 seconds.
[0092] This method requires both devices to be connected to the same Wi-Fi hotspot. If they are not connected to the same Wi-Fi hotspot, the solution will fail. Furthermore, the latency of the interaction between the two devices is affected by the network quality of the connected Wi-Fi hotspot and the services currently being transmitted via Wi-Fi. Therefore, the latency of the interaction between the two devices is unstable, resulting in unstable link establishment speeds.
[0093] Method 3: Negotiate by temporarily establishing a Bluetooth link
[0094] In this method, two devices that need to establish a Wi-Fi P2P connection first establish a Bluetooth connection. The Bluetooth link then forwards information about the connection between the two devices, allowing for negotiation and interaction. Currently, this negotiation typically takes 2 to 3 seconds.
[0095] As Bluetooth is increasingly used by various electronic peripherals, the success rate of establishing Bluetooth links will continue to decrease, and Bluetooth transmission latency may also fluctuate significantly. Therefore, using the Bluetooth channel to negotiate link establishment information in this method may affect the speed of WiFi P2P link establishment, resulting in a poor user experience.
[0096] Method 4: WiFi P2P self-discovery connection
[0097] In this method, two devices in a Wi-Fi P2P connection negotiate through processes such as provision discovery (PD), GO negotiation, and Wi-Fi protected setup before establishing a Wi-Fi P2P connection. Currently, this negotiation method takes more than 5 seconds.
[0098] This method involves many negotiation processes and is time-consuming, so the link establishment speed is low.
[0099] Method 5: Negotiation through neighbor awareness networking (NAN)
[0100] NAN is a method developed by the Wi-Fi Alliance to connect devices. It can coexist with P2P, Wi-Fi hotspot, and Wi-Fi STA functions. Two devices connected in a Wi-Fi P2P connection can use the NAN connection to negotiate after establishing it. Currently, negotiation using this method typically takes more than two seconds.
[0101] This method also takes a long time to complete the negotiation, so the speed of establishing a WiFi P2P link is slow. In addition, there are currently few devices that support NAN features, so this method cannot support the current demand for large-scale device interconnection.
[0102] To address the above issues and improve the speed and success rate of WiFi P2P link establishment, embodiments of the present application provide a WiFi communication method and electronic device. This solution can quickly implement the negotiation process before WiFi P2P link establishment without an out-of-band negotiation channel, thereby reducing connection latency and improving the speed and success rate of WiFi P2P link establishment.
[0103] The technical solutions provided in the embodiments of this application can be executed by any computing device with processing and computing capabilities, such as an electronic device. For an introduction to the performance of the electronic device, please refer to the description in the above conceptual description. The following description uses the application of the technical solutions of this application in an electronic device as an example. The implementation process for application in other computing devices is similar and will not be repeated here.
[0104] 1 , the structure of an electronic device to which the method provided in an embodiment of the present application is applicable is introduced.
[0105] As shown in Figure 1, the electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a USB interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a SIM card interface 195, etc.
[0106] The sensor module 180 may include a gyroscope sensor, an acceleration sensor, a proximity light sensor, a fingerprint sensor, a touch sensor, a temperature sensor, a pressure sensor, a distance sensor, a magnetic sensor, an ambient light sensor, an air pressure sensor, a bone conduction sensor, and the like.
[0107] It should be understood that the electronic device 100 shown in FIG1 is merely an example and does not limit the electronic device, and the electronic device may have more or fewer components than shown in the figure, may combine two or more components, or may have a different component configuration. The various components shown in FIG1 may be implemented in hardware, including one or more signal processing and / or application-specific integrated circuits, software, or a combination of hardware and software.
[0108] The processor 110 may include one or more processing units, for example: the processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Among them, different processing units can be independent devices or integrated into one or more processors. Among them, the controller can be the nerve center and command center of the electronic device 100. The controller can generate operation control signals based on the instruction opcode and timing signal to complete the control of instruction fetching and execution.
[0109] Processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in processor 110 is a cache memory. This memory can store instructions or data that have just been used or are being recycled by processor 110. If processor 110 needs to use the same instruction or data again, it can directly access the memory. This avoids duplicate accesses, reduces processor 110 latency, and thus improves system efficiency.
[0110] The execution of the WiFi communication method provided in the embodiment of the present application can be controlled by the processor 110 or completed by calling other components, such as calling the processing program of the embodiment of the present application stored in the internal memory 121, or calling the processing program of the embodiment of the present application stored in a third-party device through the external memory interface 120, to control the wireless communication module 160 to communicate data with other devices, thereby improving the intelligence and convenience of the electronic device 100 and enhancing the user experience. The processor 110 can include different components. For example, when a CPU and a GPU are integrated, the CPU and GPU can cooperate to execute the WiFi communication method provided in the embodiment of the present application. For example, part of the algorithm in the WiFi communication method is executed by the CPU, and another part of the algorithm is executed by the GPU to achieve faster processing efficiency.
[0111] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a MiniLED, a MicroLed, a Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include one or N display screens 194, where N is a positive integer greater than 1. The display screen 194 can be used to display information input by the user or information provided to the user, as well as various graphical user interfaces (GUIs). For example, the display screen 194 can display photos, videos, web pages, or files.
[0112] In the embodiment of the present application, the display screen 194 can be an integrated flexible display screen, or a spliced display screen consisting of two rigid screens and a flexible screen located between the two rigid screens.
[0113] Camera 193 (either a front-facing camera or a rear-facing camera, or one camera serving as both) is used to capture still images or videos. Typically, camera 193 includes a photosensitive element, such as a lens assembly and an image sensor. The lens assembly includes multiple lenses (convex or concave) that capture light signals reflected from the object to be photographed and transmit the captured light signals to the image sensor. The image sensor generates an original image of the object to be photographed based on the light signals.
[0114] The internal memory 121 can be used to store computer executable program code, which includes instructions. The processor 110 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121. The internal memory 121 may include a program storage area and a data storage area. The program storage area may store the code of the operating system, application programs (such as functions corresponding to the WiFi communication method, etc.). The data storage area may store data created during the use of the electronic device 100.
[0115] The internal memory 121 may also store one or more computer programs corresponding to the algorithms corresponding to the WiFi communication methods provided in the embodiments of the present application. The one or more computer programs are stored in the internal memory 121 and configured to be executed by the one or more processors 110. The one or more computer programs include instructions, which can be used to perform the various steps in the following embodiments.
[0116] In addition, the internal memory 121 may include a high-speed random access memory and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.
[0117] Of course, the code of the algorithm corresponding to the WiFi communication method provided in the embodiment of the present application can also be stored in an external memory. In this case, the processor 110 can run the code of the algorithm corresponding to the WiFi communication method stored in the external memory through the external memory interface 120.
[0118] The sensor module 180 may include a gyro sensor, an acceleration sensor, a proximity light sensor, a fingerprint sensor, a touch sensor, and the like.
[0119] A touch sensor, also known as a "touch panel," can be provided on the display screen 194. The touch sensor and the display screen 194 form a touch display screen, also known as a "touch screen." The touch sensor is used to detect touch operations applied to or near the touch sensor. The touch sensor can transmit the detected touch operations to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In other embodiments, the touch sensor can also be provided on the surface of the electronic device 100, at a location different from that of the display screen 194.
[0120] For example, the display screen 194 of the electronic device 100 displays a main interface, which includes icons of multiple applications (such as a camera application). For example, a user can click the icon of the camera application in the main interface through the touch sensor to trigger the processor 110 to start the camera application and turn on the camera 193. The display screen 194 displays the interface of the camera application, such as the viewfinder interface.
[0121] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
[0122] Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In other embodiments, the antennas can be used in conjunction with a tuning switch.
[0123] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110. In an embodiment of the present application, the mobile communication module 150 can also be used to exchange information with other devices.
[0124] The modem processor may include a modulator and a demodulator. The modulator is used to modulate the low-frequency baseband signal to be transmitted into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After being processed by the baseband processor, the low-frequency baseband signal is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to the speaker 170A, the receiver 170B, etc.) or displays an image or video through the display screen 194. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 110 and be set in the same device as the mobile communication module 150 or other functional modules.
[0125] The wireless communication module 160 can provide wireless communication solutions applied to the electronic device 100, including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared technology (IR), etc. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110. The wireless communication module 160 can also receive the signal to be transmitted from the processor 110, frequency modulate it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2. In the embodiment of the present application, the wireless communication module 160 is used to establish a connection with other electronic devices and exchange data. Alternatively, the wireless communication module 160 can be used to access an access point device, send control instructions to other electronic devices, or receive data sent from other electronic devices.
[0126] In addition, the electronic device 100 can implement audio functions through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor. For example, music playback, recording, etc. The electronic device 100 can receive input from the key 190 and generate key signal input related to the user settings and function control of the electronic device 100. The electronic device 100 can use the motor 191 to generate a vibration prompt (such as an incoming call vibration prompt). The indicator 192 in the electronic device 100 can be an indicator light, which can be used to indicate the charging status, power changes, and can also be used to indicate messages, missed calls, notifications, etc. The SIM card interface 195 in the electronic device 100 is used to connect the SIM card. The SIM card can be inserted into the SIM card interface 195 or pulled out from the SIM card interface 195 to achieve contact and separation with the electronic device 100.
[0127] It should be understood that in actual applications, the electronic device 100 may include more or fewer components than those shown in FIG1 , and the embodiments of the present application are not limited thereto. The illustrated electronic device 100 is merely an example, and the electronic device 100 may have more or fewer components than those shown in the figure, may combine two or more components, or may have different component configurations. The various components shown in the figure may be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and / or application-specific integrated circuits.
[0128] The software system of the electronic device 100 can adopt a layered architecture, an event-driven architecture, a microkernel architecture, a microservice architecture, or a cloud architecture. The layered architecture divides the software into several layers, each with a clear role and division of labor. The layers communicate with each other through software interfaces. For example, as shown in Figure 2, the software architecture can be divided into four layers, from top to bottom: the application layer, the application framework layer (Framework, FWK), the runtime and system library, and the (Linux) kernel layer.
[0129] The application layer is the top layer of the operating system, including native applications of the operating system, such as camera, gallery, calendar, Bluetooth, music, video, information, etc., and may also include third-party applications. The application involved in the embodiment of the present application is referred to as application (APP), which is a software program that can realize one or more specific functions. Typically, multiple applications can be installed in an electronic device, such as a camera application, a mailbox application, a learning application, etc. The applications mentioned below may be system applications that are installed on the electronic device when it leaves the factory, or they may be third-party applications that the user downloads from the Internet or obtains from other electronic devices while using the electronic device.
[0130] Of course, developers can write applications and install them into this layer. In one possible implementation, applications can be developed using the Java language by calling the application programming interface (API) provided by the application framework layer. Developers can use the application framework to interact with the underlying layer of the operating system (such as the kernel layer) and develop their own applications.
[0131] The application framework layer provides the application API and programming framework. It includes predefined functions and can include a window manager, content provider, view system, telephony manager, resource manager, and notification manager.
[0132] The window manager is used to manage window programs. The window manager can obtain the display size, determine whether there is a status bar, lock the display (or screen), capture the display, etc.
[0133] Content providers are used to store and retrieve data and make it accessible to applications. The data may include files (such as documents, videos, images, audio), text, and other information.
[0134] The view system includes visual controls, such as those that display text, images, and documents. The view system is used to build applications. The interface within a display window can be composed of one or more views. For example, the interface for a text notification icon might include a view that displays text and a view that displays an image.
[0135] The phone manager provides communication functionality for electronic devices. The notification manager enables applications to display notifications in the status bar, which can be used to convey informational messages and automatically disappear after a short period of time without user interaction.
[0136] In some embodiments of the present application, the application framework layer may include a communication unit and a WiFi P2P link establishment unit. The communication unit can be used to trigger the electronic device to prepare to establish a WiFi P2P connection with other electronic devices, or it can be understood that the communication unit can be used to trigger the electronic device to perform a negotiation process before establishing a WiFi P2P connection with other electronic devices. Optionally, the communication unit can use a low-power Bluetooth low energy (BLE) communication method or a sparklink low energy (SLE) access technology to communicate with other electronic devices. The WiFi P2P link establishment unit is used to use a public action frame (public action) reserved for manufacturers in the WiFi protocol to carry authentication and negotiation data before the electronic device establishes a WiFi P2P connection with other electronic devices, to complete the authentication with other electronic devices and the negotiation of WiFi P2P link establishment information such as working channels and keys. The WiFi P2P link establishment unit can also be used to establish a WiFi P2P connection with other electronic devices based on the negotiated information after the negotiation is completed. Among them, the public behavior frame (i.e., public action message or action message) is a management message defined in the WiFi protocol and reserved for manufacturers to use. The public behavior frame can also be called an action frame or a public signaling frame, etc. The name of the public behavior frame is not restricted in the embodiment of the present application.
[0137] The runtime includes the core library and the virtual machine. The runtime is responsible for the scheduling and management of the system.
[0138] The system's core library consists of two parts: one containing the Java language's callable functions and the other the system's core library. The application layer and application framework layer run within a virtual machine. For example, in Java, the virtual machine executes Java files from the application and framework layers as binary files. The virtual machine manages object lifecycles, stack management, thread management, security and exception management, and garbage collection.
[0139] The system library can include multiple functional modules. For example: surface manager, media library, 3D graphics processing library (for example: OpenGL ES), 2D graphics engine (for example: SGL), image processing library, etc. The surface manager is used to manage the display subsystem and provides the fusion of 2D and 3D layers for multiple applications. The media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.564, MP3, AAC, AMR, JPG, PNG, etc. The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, synthesis and layer processing, etc. The 2D graphics engine is a drawing engine for 2D drawing.
[0140] The kernel layer provides the operating system's core system services, such as security, memory management, process management, the network protocol stack, and the driver model. These services are all implemented at the kernel layer. The kernel layer also serves as an abstraction layer between the hardware and software stacks. This layer contains many drivers related to electronic devices, including the display driver, the keyboard driver for input devices, the Flash driver for memory-based devices, the camera driver, the audio driver, the Bluetooth driver, and the Wi-Fi driver.
[0141] In some embodiments of the present application, a Bluetooth driver can be used to drive the Bluetooth function of an electronic device to perform low-power Bluetooth communication with other electronic devices under the control of a low-power communication unit. A WiFi driver can be used to drive the WiFi chip of an electronic device to perform WiFi communication with other electronic devices under the control of a WiFi P2P link establishment unit.
[0142] It should be understood that the functional services described above are only examples. In actual applications, electronic devices can also be divided into more or fewer functional services according to other factors, or the functions of each service can be divided in other ways, or the functional services can be not divided but work as a whole.
[0143] In combination with the hardware architecture of the electronic device shown in FIG1 and the software architecture of the electronic device shown in FIG2 , the solution provided in this application is described in detail below in combination with specific embodiments.
[0144] The solution provided in the embodiments of the present application can be applied in a scenario where two electronic devices with low-power communication capabilities and WiFi P2P communication capabilities automatically negotiate to establish a WiFi P2P connection. Establishing a WiFi P2P connection can also be understood as establishing WiFi P2P communication or establishing a WiFi P2P communication link. After the WiFi P2P connection is established, the two electronic devices can exchange business data.
[0145] For ease of explanation, in the embodiments of the present application, establishing a WiFi P2P connection is referred to as link establishment, and the process of authentication before establishing a WiFi P2P connection and negotiating the information required to establish the WiFi P2P connection (such as working channel, key, etc.) is referred to as negotiation process.
[0146] Exemplarily, the two electronic devices mentioned above can be a mobile phone and a tablet, a mobile phone and a personal computer (PC), a mobile phone and a smart screen, a tablet and a smart screen, etc.
[0147] In some embodiments of the present application, in addition to the low-power communication capability and WiFi P2P communication capability described above, the electronic device that establishes a WiFi P2P connection also has the ability to customize the public behavior frame interaction of a private protocol (that is, the electronic device can use a private protocol). Among them, a private protocol is a protocol that has not been adopted or approved by an international or national standardization organization, is customized by the manufacturer itself, and is only used between devices produced or authorized by the manufacturer itself. The private protocol described in the embodiment of the present application can be a protocol related to the public behavior frame reserved for use by manufacturers in the WiFi protocol, and the ability to customize the public behavior frame interaction of the private protocol described in the embodiment of the present application can be the ability to communicate using public behavior frames.
[0148] The WiFi P2P negotiation and link establishment process in this scenario will be exemplarily described below with reference to the first and second embodiments.
[0149] Example 1
[0150] 3 , taking a scenario where a first electronic device establishes a WiFi P2P connection with a second electronic device as an example, a WiFi communication method provided in an embodiment of the present application may include:
[0151] S301: The first electronic device sends a negotiation request to the second electronic device; wherein the negotiation request is used to request execution of a negotiation process, and the negotiation process is used to establish a WiFi P2P connection.
[0152] Specifically, the negotiation process is used to negotiate and determine information required to establish a WiFi P2P connection. The first electronic device can establish a WiFi P2P connection with the second electronic device based on the information.
[0153] In this embodiment, when initiating a service that requires interaction with a second electronic device, the first electronic device may begin executing step S301 and subsequent steps to establish a WiFi P2P connection with the second electronic device. After establishing the WiFi P2P connection with the second electronic device, the first electronic device may begin executing the service that requires interaction with the second electronic device.
[0154] In some embodiments of the present application, the negotiation request may include at least one of the following: the identification of the first electronic device, the identification of the second electronic device, the address of the first electronic device, and the channel through which the first electronic device expects to interact with the second electronic device in public behavior frames.
[0155] In some embodiments of the present application, the identifier of the electronic device may be information that can uniquely identify the electronic device, such as a device name, a device identification code (ID), or a device address. The address of the electronic device may be the address of the WiFi P2P interface of the electronic device, which may be a media access control (MAC) address.
[0156] In some embodiments of the present application, the first electronic device can send a negotiation request to the second electronic device through a directed broadcast method, wherein the communication method adopted can be a low-power communication method such as BLE, SLE (not using a Bluetooth connection method), and sending a negotiation request can trigger the second electronic device to perform a negotiation process before establishing a WiFi P2P connection with the first electronic device. Specifically, the first electronic device can send a negotiation request through a broadcast message carrying the identification of the second electronic device. After the second electronic device receives the broadcast message, it can determine that the broadcast message is a directed broadcast message sent to the second electronic device based on the identification of the second electronic device carried in the broadcast message, and then respond to the broadcast message.
[0157] S302: The second electronic device sends a first public action frame to the first electronic device in response to the received negotiation request; wherein the first public action frame is used to confirm the execution of the negotiation process.
[0158] The first public action frame may be used as a negotiation response message for confirming the negotiation request.
[0159] In the embodiment of the present application, the first public action frame belongs to the management frame (also called management message) defined in the WiFi protocol.
[0160] In some embodiments of the present application, the first public action frame may include at least one of the following: an address of the first electronic device, an address of the second electronic device, and an identifier of the second electronic device, wherein the identifier of the second electronic device may be carried in a payload of the first public action frame.
[0161] S303: The first electronic device and the second electronic device execute a negotiation process; wherein, during the negotiation process, interaction information between the first electronic device and the second electronic device is sent via a public behavior frame.
[0162] In some embodiments of the present application, as shown in FIG4 , the negotiation process may include the following steps:
[0163] S401: The first electronic device sends a second public action frame to the second electronic device; wherein the second public action frame is used to request authentication of the first electronic device.
[0164] The second public action frame may serve as an authentication request, and authentication data corresponding to the authentication request is encapsulated in the second public action frame.
[0165] In some embodiments of the present application, after the first electronic device receives the first public behavior frame from the second electronic device, it can confirm that the second electronic device agrees to perform the negotiation process before establishing a WiFi connection with the first electronic device, and it can be considered that a communication link based on the public behavior frame is established with the second electronic device.
[0166] S402: The second electronic device sends a third public action frame to the first electronic device; wherein the third public action frame is used to confirm that the authentication is successful.
[0167] S403: The first electronic device and the second electronic device negotiate to determine a session key.
[0168] S404: The first electronic device sends a fourth public action frame to the second electronic device; wherein the fourth public action frame includes negotiation information of the first electronic device encrypted using the session key.
[0169] In some embodiments of the present application, the destination address of the fourth public behavior frame is the address of the second electronic device, for example, it may be the address of the second electronic device carried in the negotiation request. The negotiation information of the first electronic device may include at least one of the following: the WiFi capability of the first electronic device (for example, it may include the WiFi channels supported by the first electronic device, etc.), the expected channel of the first electronic device, the expected P2P role of the first electronic device (GC or GO), etc. Among them, the expected channel is the working channel that the first electronic device expects to use after establishing a WiFi P2P connection with the second electronic device. The expected channel can be a channel selected by the electronic device from the supported channels (for example, a channel with better communication quality, etc.).
[0170] S405: The second electronic device determines link establishment information based on the negotiation information of the first electronic device and the negotiation information of the second electronic device obtained after decrypting the fourth public behavior frame. The link establishment information is used to indicate information required for the first electronic device to establish a WiFi P2P connection with the second electronic device.
[0171] After receiving the fourth public action frame from the first electronic device, the second electronic device can use the session key negotiated and determined with the first electronic device to decrypt the fourth public action frame to obtain the negotiation information of the first electronic device contained therein. Based on the negotiation information of the first electronic device and the negotiation information of the second electronic device, the second electronic device can determine the most appropriate channel to use after the first and second electronic devices establish a WiFi P2P connection, as well as the P2P roles of the first and second electronic devices.
[0172] In some embodiments of the present application, the negotiation information of the second electronic device may include at least one of the following: the WiFi capability of the second electronic device (for example, it may include the WiFi channels supported by the second electronic device, etc.), the desired channel of the second electronic device, the desired P2P role of the second electronic device (GC or GO), etc.
[0173] In some embodiments of the present application, the link establishment information may include at least one of the following: the P2P role of the first electronic device, the P2P role of the second electronic device, the channel used to establish the WiFi P2P connection, the pre-shared key (also known as a pre-shared password or shared key, etc.), and the Internet protocol (IP) information of the first electronic device.
[0174] S406: The second electronic device sends a fifth public action frame to the first electronic device; wherein the fifth public action frame includes link establishment information encrypted by using the session key.
[0175] After receiving the fifth public action frame, the first electronic device may use the session key negotiated and determined with the second electronic device to decrypt the fifth public action frame to obtain link establishment information, and then determine the information required to establish a WiFi P2P connection with the second electronic device based on the link establishment information.
[0176] Optionally, after step S303, the following step S304 may be further included:
[0177] S304: The first electronic device establishes a WiFi P2P connection with the second electronic device.
[0178] Among them, in one possible solution, if the P2P role of the first electronic device is GC and the P2P role of the second electronic device is GO, the second electronic device can wait for the first electronic device to connect, and the first electronic device can determine that the P2P role of the first electronic device is GC based on the fifth public behavior frame from the second electronic device. The first electronic device can send a connection request to the second electronic device, and the second electronic device can respond to the connection request and establish a WiFi P2P connection with the first electronic device.
[0179] In another possible solution, if the P2P role of the first electronic device is GO and the P2P role of the second electronic device is GC, the second electronic device can send a connection request to the first electronic device, and the first electronic device can establish a WiFi P2P connection with the second electronic device in response to the connection request after receiving the connection request from the second electronic device.
[0180] After the first electronic device establishes a WiFi P2P connection with the second electronic device, an encrypted WiFi P2P communication link is established between the first electronic device and the second electronic device, and the first electronic device and the second electronic device can exchange business data based on the communication link.
[0181] Through the methods provided in the above embodiments, the first and second electronic devices can quickly and efficiently complete the pre-Wi-Fi P2P link negotiation process based on the public behavior frames in the Wi-Fi protocol, thereby improving the subsequent link establishment speed. This solution can achieve an encrypted Wi-Fi P2P connection within 1 second. Furthermore, the pre-link negotiation process can also resolve DBAC issues that may arise during Wi-Fi P2P connections, thereby establishing a more stable transmission channel for subsequent services.
[0182] It should be noted that the implementation process provided in the above embodiment is only an example of the method process applicable to the embodiment of the present application. The execution order of each step can be adjusted accordingly according to actual needs, and other steps can be added or some steps can be reduced.
[0183] Example 2
[0184] 5 , taking a scenario where a first electronic device establishes a WiFi P2P connection with a second electronic device as an example, a WiFi communication method provided in an embodiment of the present application may include:
[0185] S501: The first electronic device and the second electronic device establish a communication connection in advance, complete device authentication, and negotiate to determine a session key.
[0186] The session key is used to encrypt or decrypt information exchanged between the first electronic device and the second electronic device. The first electronic device and the second electronic device can use the session key to encrypt information sent to the other end and use the session key to decrypt information from the other end.
[0187] In some embodiments of the present application, a first electronic device and a second electronic device may establish a communication connection after being brought into proximity with each other. The communication connection may be established by Bluetooth communication, wireless local area network communication, or the like. The communication connection may be initiated by either the first electronic device or the second electronic device.
[0188] In some embodiments of the present application, after the first electronic device establishes a communication connection with the second electronic device, after completing device authentication and negotiating and determining the session key, the communication link can be disconnected, and the device can be kept alive only through low-power communication methods, and then the following steps S502 and subsequent steps can be continued.
[0189] Regarding the device authentication process and the session key negotiation process, reference may be made to the relevant methods in the negotiation method before establishing a traditional WiFi P2P link, and will not be described in detail in the embodiments of the present application.
[0190] S502: When initiating a service requiring interaction with a second electronic device, the first electronic device sends a negotiation request encrypted with a session key to the second electronic device; wherein the negotiation request is used to request execution of a negotiation process, and the negotiation process is used to establish a WiFi P2P connection.
[0191] Specifically, the negotiation process is used to negotiate and determine information required to establish a WiFi P2P connection. The first electronic device can establish a WiFi P2P connection with the second electronic device based on the information.
[0192] Regarding the negotiation request, please refer to the introduction in the aforementioned step S301 and will not be repeated here.
[0193] In some embodiments of the present application, the first electronic device can use a directed broadcast method to send a negotiation request encrypted with a session key to the second electronic device, where the communication method used can be a low-power communication method such as BLE, SLE (not using a Bluetooth connection method). By sending the negotiation request, the second electronic device can be triggered to execute a negotiation process before establishing a WiFi P2P connection with the first electronic device.
[0194] S503: The second electronic device sends a first public action frame to the first electronic device in response to the decrypted negotiation request; wherein the first public action frame includes negotiation information of the second electronic device encrypted using the session key.
[0195] After receiving the encrypted negotiation request from the first electronic device, the second electronic device may decrypt the encrypted negotiation request using the session key determined in advance through negotiation with the first electronic device to obtain a decrypted negotiation request.
[0196] The destination address of the first public action frame is the address of the first electronic device, for example, the address of the first electronic device carried in the negotiation request. Regarding the negotiation information of the second electronic device, please refer to the relevant description in the above embodiment 1, which will not be repeated here.
[0197] S504: The first electronic device determines link establishment information based on the negotiation information of the second electronic device obtained after decrypting the first public behavior frame and the negotiation information of the first electronic device; wherein the link establishment information is used to indicate information required for the first electronic device to establish a WiFi P2P connection with the second electronic device.
[0198] After receiving the first public behavior frame from the second electronic device, the first electronic device can use the session key pre-negotiated with the first electronic device to decrypt the first public behavior frame to obtain the negotiation information of the second electronic device contained therein.
[0199] Regarding the negotiation information and link establishment information of the first electronic device, reference may be made to the relevant descriptions in the aforementioned embodiment 1, and will not be repeated here.
[0200] S505: The first electronic device sends a second public action frame to the second electronic device; wherein the second public action frame includes link establishment information encrypted by using the session key.
[0201] After receiving the second public action frame, the second electronic device can use the session key pre-negotiated and determined with the first electronic device to decrypt the second public action frame to obtain link establishment information, and then determine the information required to establish a WiFi P2P connection with the first electronic device based on the link establishment information.
[0202] Optionally, after step S505, the following step S506 may be further included:
[0203] S506: The first electronic device establishes a WiFi P2P connection with the second electronic device.
[0204] In one possible solution, if the P2P role of the first electronic device is GO and the P2P role of the second electronic device is GC, the first electronic device may wait for the second electronic device to connect. The second electronic device may determine that the P2P role of the second electronic device is GC based on the second public behavior frame from the first electronic device, and then the second electronic device may send a connection request to the first electronic device. The first electronic device may respond to the connection request and establish a WiFi P2P connection with the second electronic device.
[0205] In another possible solution, if the P2P role of the first electronic device is GC and the P2P role of the second electronic device is GO, the first electronic device can send a connection request to the second electronic device, and the second electronic device can establish a WiFi P2P connection with the first electronic device in response to the connection request after receiving the connection request from the first electronic device.
[0206] After the first electronic device establishes a WiFi P2P connection with the second electronic device, an encrypted WiFi P2P communication link is established between the first electronic device and the second electronic device, and the first electronic device can start executing services that require interaction with the second electronic device.
[0207] Through the methods provided in the above embodiments, when initiating interactive services, the first and second electronic devices can quickly and efficiently complete the pre-Wi-Fi P2P link negotiation process based on the public behavior frames in the Wi-Fi protocol, thereby improving the subsequent link establishment speed. This solution can achieve an encrypted Wi-Fi P2P connection within 1 second. Furthermore, the pre-link negotiation process can also resolve DBAC issues that may arise in Wi-Fi P2P connections, thereby establishing a more stable transmission channel for subsequent services.
[0208] Compared to the method provided in Example 1, the method provided in this embodiment further reduces the number of interactions via public behavior frames, thereby achieving faster negotiation than in Example 1 and further improving the speed of WiFi P2P link establishment. Furthermore, the negotiation request is encrypted using a session key, further enhancing security and preventing malicious link establishment attacks.
[0209] It should be noted that the specific implementation process provided in the above embodiment is only an example of the method process applicable to the embodiment of the present application. The execution order of each step can be adjusted accordingly according to actual needs, and other steps can be added or some steps can be reduced.
[0210] In the method described in the first or second embodiment, as an optional implementation, the first electronic device and the second electronic device may establish a WiFi P2P connection using a traditional link establishment method. Specifically, as shown in FIG6 , the method for establishing a WiFi P2P connection between the first electronic device and the second electronic device using a traditional link establishment method may include:
[0211] S601: The first electronic device and the second electronic device execute an authentication process.
[0212] Among them, the authentication (Auth) process can be the authentication process that needs to be performed to establish a WiFi connection as specified in the WiFi protocol or standard, and will not be described in detail in the embodiments of the present application.
[0213] S602: The first electronic device and the second electronic device execute an association process.
[0214] Among them, the association (Assoc) process can be an association process that needs to be executed to establish a WiFi connection as specified in the WiFi protocol or standard, and will not be described in detail in the embodiments of the present application.
[0215] S603: The first electronic device and the second electronic device perform a four-way handshake process.
[0216] Among them, the four-way handshake (4 aay handshake) process can be a four-way handshake process specified in the WiFi protocol or standard (used for negotiating keys), which will not be described in detail in the embodiments of this application.
[0217] S604: The first electronic device determines an encryption key for the WiFi P2P link after the WiFi P2P connection is established based on the key determined by executing the four-way handshake process.
[0218] S605: The second electronic device determines the encryption key of the WiFi P2P link after the WiFi P2P connection is established according to the key determined by executing the four-way handshake process.
[0219] The specific implementation process of the above method can be implemented by referring to the method for establishing a WiFi connection specified in the WiFi protocol or standard, and will not be described in detail in the embodiments of this application.
[0220] As another optional implementation scheme, according to the introduction in the aforementioned embodiment, the first electronic device and the second electronic device have already negotiated and determined a session key during the negotiation process. Therefore, when establishing a WiFi P2P connection, the first electronic device and the second electronic device may not perform the four-way handshake process (for key negotiation), but may instead use the session key determined in the negotiation process to replace the key determined in the four-way handshake process (it can also be considered that the session key determined in the negotiation process is used as the key determined in the four-way handshake process). As shown in Figure 7, based on this solution, the method for the first electronic device and the second electronic device to establish a WiFi P2P connection may include:
[0221] S701: The first electronic device and the second electronic device perform an authentication process.
[0222] S702: The first electronic device and the second electronic device execute an association process.
[0223] The specific implementation process of the above steps S701 to S702 can be implemented by referring to the method for establishing a WiFi connection specified in the WiFi protocol or standard, and will not be described in detail in the embodiment of this application.
[0224] S703: The first electronic device determines an encryption key for the WiFi P2P link after the WiFi P2P connection is established based on the session key determined by executing the negotiation process.
[0225] S704: The second electronic device determines an encryption key for the WiFi P2P link after the WiFi P2P connection is established according to the session key determined by executing the negotiation process.
[0226] Through the above method, the link establishment process between the first electronic device and the second electronic device can be further simplified, thereby improving the link establishment efficiency between the first electronic device and the second electronic device.
[0227] Currently, there are some electronic devices that do not have the ability to interact with public behavior frames of customized private protocols. Such electronic devices cannot perform WiFi P2P negotiation and link establishment with other electronic devices using the method provided in the first or second embodiment.
[0228] In view of this, an embodiment of the present application further provides a WiFi communication method, which can be applied to a scenario in which an electronic device that cannot customize a public behavior frame interaction of a private protocol performs WiFi P2P negotiation and link establishment with other electronic devices.
[0229] The WiFi P2P negotiation and link establishment process in this scenario will be exemplarily described below with reference to the third and fourth embodiments.
[0230] Example 3
[0231] 8 , taking the scenario where a first electronic device establishes a WiFi P2P connection with a second electronic device, and the P2P role of the first electronic device is GC and the P2P role of the second electronic device is GO as an example, a WiFi communication method provided in an embodiment of the present application may include:
[0232] S801: The first electronic device and the second electronic device establish a communication connection in advance, and negotiate to determine a session key, a network identifier of the second electronic device, and a pre-shared key; wherein the session key is used to encrypt or decrypt interactive information between the first electronic device and the second electronic device.
[0233] The network identifier of the second electronic device is used to identify a soft AP created by the second electronic device, and the network identifier may be an SSID. The pre-shared key may be used to access the soft AP created by the second electronic device.
[0234] In some embodiments of the present application, a first electronic device and a second electronic device may establish a communication connection after being brought into proximity with each other. The communication connection may be established by Bluetooth communication, wireless local area network communication, or the like. The communication connection may be initiated by either the first electronic device or the second electronic device.
[0235] In some embodiments of the present application, after the first electronic device establishes a communication connection with the second electronic device, after completing the negotiation, the communication link can be disconnected, and the device can be kept alive only through low-power communication methods, and then the following steps S802 and subsequent steps can be executed.
[0236] S802: When initiating a service that requires interaction with a second electronic device, the first electronic device sends a connection request to the second electronic device; wherein the connection request is used to request to establish a WiFi P2P connection with the second electronic device.
[0237] The first electronic device may use the session key to encrypt the information carried in the connection request, and the second electronic device may use the session key to decrypt the information carried in the connection request.
[0238] In some embodiments of the present application, the connection request carries the identifier of the first electronic device, the identifier of the second electronic device, and the desired channel of the first electronic device. Optionally, the identifier of the electronic device can be the universally unique identifier (UUID) of the electronic device or the hash value of the UUID of the electronic device.
[0239] S803: The second electronic device determines, in response to the connection request, a channel for establishing a WiFi P2P connection with the first electronic device.
[0240] The second electronic device may determine the best available channel for establishing a WiFi P2P connection with the first electronic device based on the desired channel of the first electronic device and the channels supported by the second electronic device, and then create a soft AP.
[0241] S804: The second electronic device sends first indication information to the first electronic device; wherein the first indication information is used to indicate the channel.
[0242] The second electronic device may use the session key to encrypt the first indication information, and the first electronic device may use the session key to decrypt the first indication information.
[0243] S805: The first electronic device establishes a WiFi P2P connection with the second electronic device according to the channel, the network identifier of the second electronic device, and the pre-shared key.
[0244] The first electronic device can operate in the channel and connect to the soft AP created by the second electronic device based on the network identifier and pre-shared key of the second electronic device, thereby establishing a WiFi P2P connection with the second electronic device.
[0245] S806: The first electronic device and the second electronic device perform device authentication.
[0246] After the authentication is completed, an encrypted WiFi P2P communication link is successfully established between the first electronic device and the second electronic device, and the first electronic device can start to execute services that require interaction with the second electronic device.
[0247] Through the methods provided in the above embodiments, when initiating interactive services, the first and second electronic devices can quickly and efficiently complete the negotiation process before establishing a Wi-Fi P2P link, even without customizing public behavior frames for proprietary protocols. This can improve subsequent link establishment speed. This solution can achieve an encrypted Wi-Fi P2P connection within 1 second. Furthermore, by pre-negotiating the pre-shared key required to establish the Wi-Fi P2P connection, link establishment speed can be further improved.
[0248] Example 4
[0249] 9 , taking a scenario where a first electronic device establishes a WiFi P2P connection with a second electronic device, and the P2P role of the first electronic device is a GC and the P2P role of the second electronic device is a GO as an example, a WiFi communication method provided in an embodiment of the present application may include:
[0250] S901: The first electronic device sends a connection request to the second electronic device; wherein the connection request is used to request to establish a WiFi P2P connection with the second electronic device.
[0251] Regarding the connection request, reference may be made to the introduction in step S602 in the aforementioned third embodiment, which will not be repeated here.
[0252] S902: The second electronic device determines, in response to the connection request, a channel for establishing a WiFi P2P connection with the first electronic device.
[0253] Regarding the specific implementation of this step, reference may be made to the method described in step S603 of the aforementioned embodiment 3, which will not be repeated here.
[0254] S903: The second electronic device sends first indication information to the first electronic device; wherein the first indication information is used to indicate the channel and the network identifier of the second electronic device.
[0255] In some embodiments of the present application, in the above steps S701 to S703, the interaction process between the first electronic device and the second electronic device can be implemented through a low-power communication method (such as BLE communication, SLE communication, etc.).
[0256] S904: The first electronic device establishes a WiFi P2P connection with the second electronic device according to the channel, the network identifier of the second electronic device, and the set pre-shared key.
[0257] The set pre-shared key may be pre-negotiated between the first electronic device and the second electronic device, or may be a pre-set key obtained from the cloud.
[0258] In some embodiments of the present application, the link establishment process may also be initiated by the second electronic device, and the above steps S901 to S902 may be replaced by the following steps S1 to S3:
[0259] S1: The second electronic device sends a connection request to the first electronic device, wherein the connection request is used to request to establish a WiFi P2P connection with the second electronic device.
[0260] In some embodiments of the present application, the connection request includes an identifier of the second electronic device, and may also include an identifier of the first electronic device and a desired channel of the second electronic device. Optionally, the identifier of the electronic device may be a universally unique identifier (UUID) of the electronic device or a hash value of the UUID of the electronic device.
[0261] S2: The first electronic device sends a connection response to the second electronic device; wherein the connection response is used to confirm the establishment of the WiFi P2P connection.
[0262] In some embodiments of the present application, the connection request carries the desired channel of the first electronic device.
[0263] S3: The second electronic device determines a channel for establishing a WiFi P2P connection with the first electronic device.
[0264] The second electronic device may determine the best available channel for establishing a WiFi P2P connection with the first electronic device based on the desired channel of the first electronic device and the channels supported by the second electronic device, and then create a soft AP.
[0265] Through the methods provided in the above embodiments, when initiating interactive services, the first and second electronic devices can quickly and efficiently complete the negotiation process before establishing a Wi-Fi P2P link, even without customizing public behavior frames for proprietary protocols. This can improve subsequent link establishment speed. This solution can achieve an encrypted Wi-Fi P2P connection within 1 second. Furthermore, by pre-negotiating the pre-shared key required to establish the Wi-Fi P2P connection, link establishment speed can be further improved.
[0266] Based on the above embodiments and the same technical concept, an embodiment of the present application further provides a WiFi communication method, as shown in FIG10 , the method comprising:
[0267] S1001: A first electronic device sends first information to a second electronic device; wherein the first information includes an identifier of a first WiFi channel and an address of the first electronic device.
[0268] The first WiFi channel may be a channel through which the first electronic device expects to exchange public behavior frames with the second electronic device.
[0269] In some embodiments of the present application, the first information may further include at least one of the following: an identifier of the first electronic device, and an identifier of the second electronic device.
[0270] For example, the first information may be the information included in the negotiation request described in the aforementioned embodiment. The first electronic device may then send the first information to the second electronic device by sending a negotiation request to the second electronic device. For details on the specific content of the first information, please refer to the description of the corresponding content in the aforementioned embodiment and will not be detailed here.
[0271] In some embodiments of the present application, a first electronic device may send first information to a second electronic device when initiating a service. The first electronic device may send the first information to the second electronic device via a low-power Bluetooth communication method or a Starflash low-power communication method. The specific implementation methods can be referred to the description in the aforementioned embodiments and will not be described in detail here.
[0272] S1002: The first electronic device receives a first public action frame sent by the second electronic device through a first WiFi channel; wherein the first public action frame includes the address of the first electronic device.
[0273] Since the first public action frame includes the address of the first electronic device, the first public action frame can be used as response information fed back by the second electronic device to the first electronic device, and can be used to indicate agreement to use the first WiFi channel to exchange public signaling frames.
[0274] In some embodiments of the present application, the first public behavior frame may further include information such as the address of the second electronic device, the identifier of the second electronic device, and the identifier of the first WiFi channel.
[0275] Illustratively, the first public behavior frame may be the first public behavior frame described in the aforementioned embodiment.
[0276] S1003: The first electronic device performs a negotiation process for establishing a WiFi point-to-point (P2P) connection with the second electronic device via the first WiFi channel in response to the first public behavior frame.
[0277] In one possible solution, the negotiation process may include the following steps: a first electronic device authenticates itself with a second electronic device, and after successful authentication, transmits a second public action frame to the second electronic device via a first WiFi channel; wherein the second public action frame includes at least one of the following: an identifier of a WiFi channel supported by the first electronic device, an identifier of a second WiFi channel (which is the operating channel the first electronic device desires to use after establishing a WiFi P2P connection with the second electronic device), and information indicating the P2P role of the first electronic device (which is the P2P role desired by the first electronic device). After transmitting the second public action frame, the first electronic device may receive a third public action frame transmitted by the second electronic device via the first WiFi channel; wherein the third public action frame includes at least one of the following: an identifier of the second WiFi channel, information indicating the P2P role of the first electronic device (which is the P2P role ultimately assigned to the first electronic device), information indicating the P2P role of the second electronic device (which is the P2P role ultimately assigned to the second electronic device), a first key for establishing the WiFi P2P connection (which may be, for example, the pre-shared key described in the aforementioned embodiment), and Internet Protocol (IP) information of the first electronic device.
[0278] The information included in the second public action frame is the negotiation information of the first electronic device. After the first electronic device sends the second public action frame to the second electronic device, the second electronic device can determine the link establishment information based on the information included in the second public action frame and the negotiation information of the second electronic device itself, that is, the information that the first electronic device and the second electronic device can refer to when establishing a WiFi P2P connection. The third public action frame can also be sent to the first electronic device via the first WiFi channel. The information included in the third public action frame is the link establishment information.
[0279] In some embodiments of the present application, when the first electronic device and the second electronic device are authenticating, the first electronic device may send a fourth public action frame to the second electronic device via the first WiFi channel; wherein the fourth public action frame includes authentication information. After the second electronic device receives the fourth public action frame, it may authenticate the first electronic device based on the authentication information in the fourth public action frame. And after the authentication is successful, it may send a fifth public action frame to the first electronic device, wherein the fifth public action frame is used to notify the authentication success. After the first electronic device receives the fifth public action frame sent by the second electronic device via the first WiFi channel, it may determine that the authentication is successful.
[0280] In some embodiments of the present application, the interactive information between the first electronic device and the second electronic device can be encrypted using a key. Specifically, after determining that the authentication is successful, the first electronic device can negotiate a second key with the second electronic device through the first WiFi channel and the public behavior frame before sending the second public behavior frame to the second electronic device through the first WiFi channel; wherein the second key is used to encrypt the interactive information between the first electronic device and the second electronic device. Specifically, the first electronic device can use the second key to encrypt information sent to the second electronic device, or decrypt information from the second electronic device. The second electronic device can use the second key to encrypt information sent to the first electronic device, or decrypt information from the first electronic device.
[0281] For example, the specific implementation of the negotiation process described in the above solution can be implemented with reference to the method shown in FIG4 . The second public action frame can be the fourth public action frame described in step S404 of the above embodiment, and the third public action frame can be the fifth public action frame described in step S406 of the above embodiment. The second key can be the session key described in step S403 of the above embodiment.
[0282] In some embodiments of the present application, when the WiFi channel determined by the second electronic device to be used when establishing a WiFi P2P connection based on the negotiation information of the first electronic device and the negotiation information of the second electronic device is not the second WiFi channel desired by the first electronic device, the identifier of the second WiFi channel in the third public signaling frame may also be replaced with the identifier of a third WiFi channel, where the third WiFi channel is the WiFi channel determined by the second electronic device to be used when establishing a WiFi P2P connection based on the negotiation information of the first electronic device and the negotiation information of the second electronic device. In this scenario, after receiving the third public signaling frame, the first electronic device can establish a WiFi P2P connection with the second electronic device through the third WiFi channel.
[0283] In another possible solution, the first public action frame also includes at least one of the following: an identifier of a WiFi channel supported by the second electronic device, an identifier of a second WiFi channel (the operating channel that the second electronic device expects to use after establishing a WiFi P2P connection with the first electronic device), and information indicating the P2P role of the second electronic device (the P2P role expected by the second electronic device). In this solution, the information included in the first public action frame is negotiation information of the second electronic device. In this solution, the negotiation process may include the following steps: the first electronic device sends a second public action frame to the second electronic device via the first WiFi channel; wherein the second public action frame includes at least one of the following: an identifier of the second WiFi channel, information indicating the P2P role of the first electronic device (the P2P role finally determined for the first electronic device), information indicating the P2P role of the second electronic device (the P2P role finally determined for the second electronic device), a first key for establishing a WiFi P2P connection (for example, the pre-shared key described in the aforementioned embodiment), and Internet Protocol (IP) information of the first electronic device.
[0284] After the first electronic device receives the first public action frame sent by the second electronic device, the first electronic device can determine link establishment information based on the information included in the first public action frame and the first electronic device's own negotiation information. This information can be used as a reference when the first electronic device and the second electronic device establish a WiFi P2P connection. The first electronic device can then send a second public action frame to the second electronic device via the first WiFi channel. The information included in the second public action frame is the link establishment information.
[0285] In some embodiments of the present application, before a first electronic device sends a first message to a second electronic device, the first electronic device may establish a communication connection with the second electronic device in advance, authenticate the second electronic device, and, after successful authentication, negotiate a second key with the second electronic device. Based on this, the first electronic device may send the first message encrypted with the second key to the second electronic device when initiating a service. After sending the first message, the first electronic device may receive a first public action frame encrypted with the second key, sent by the second electronic device via the first WiFi channel.
[0286] For example, the specific implementation of the negotiation process described in the above solution can be implemented with reference to the relevant method shown in FIG5 . The first public action frame can be the first public action frame described in steps S503 and S504 of the aforementioned embodiment, and the second public action frame can be the second public action frame described in step S505 of the aforementioned embodiment. The second key can be the session key described in step S501 of the aforementioned embodiment.
[0287] In some embodiments of the present application, after the first electronic device and the second electronic device perform a negotiation process, the first electronic device can establish a WiFi P2P connection with the second electronic device. Specific implementation processes can be implemented with reference to the method shown in FIG6 or FIG7 , and are not further described here.
[0288] In the above method, the specific steps executed by the first electronic device can refer to the relevant introduction in the above embodiments, and will not be described in detail here.
[0289] Based on the above embodiments and the same technical concept, an embodiment of the present application further provides a WiFi communication method, as shown in FIG11 , the method comprising:
[0290] S1101: The second electronic device receives first information from the first electronic device; wherein the first information includes an identifier of a first WiFi channel and an address of the first electronic device.
[0291] S1102: The second electronic device sends a first public action frame to a second electronic device through the first WiFi channel; wherein the first public action frame includes the address of the first electronic device.
[0292] S1103: The second electronic device and the first electronic device perform a negotiation process for establishing a WiFi point-to-point (P2P) connection through the first WiFi channel.
[0293] In the above method, the specific steps executed by the second electronic device can be found in the relevant introduction of the above embodiments, and will not be described in detail here.
[0294] Based on the above embodiments and the same technical concept, an embodiment of the present application further provides a WiFi communication method, as shown in FIG12 , the method comprising:
[0295] S1201: A first electronic device sends first information to a second electronic device; wherein the first information includes an identifier of a first WiFi channel.
[0296] In some embodiments of the present application, the first information may further include an identifier of the second electronic device and a desired channel of the first electronic device.
[0297] Illustratively, the first information may be the information included in the connection request described in step S802 or step S901 in the aforementioned embodiment.
[0298] S1202: The first electronic device receives second information from the second electronic device; wherein the second information includes an identifier of the first WiFi channel.
[0299] Illustratively, the second information may be the first indication information described in step S804 or S903 in the aforementioned embodiment.
[0300] In some embodiments of the present application, the first WiFi channel is the operating channel that the first electronic device expects to use after establishing a WiFi P2P connection with the second electronic device. When the second electronic device determines to use the first WiFi channel as the channel to use after the first and second electronic devices establish a WiFi P2P connection, the second electronic device may send the above-mentioned second information to the first electronic device. When the operating channel determined by the second electronic device to be used after the first and second electronic devices establish a WiFi P2P connection is not the first WiFi channel, the identifier of the first WiFi channel included in the above-mentioned second information may be replaced with the identifier of a third WiFi channel, wherein the third WiFi channel is the operating channel determined by the second electronic device to be used after the first and second electronic devices establish a WiFi P2P connection.
[0301] In some embodiments of the present application, the interactive information between the first electronic device and the second electronic device can be encrypted using a key. Specifically, before the first electronic device sends the first information to the second electronic device, the first electronic device and the second electronic device can negotiate and determine the first key (for example, the session key described in the method shown in Figure 8 or Figure 9) after establishing a communication connection. Based on this, the first electronic device can send the first information encrypted with the first key to the second electronic device when initiating a business, and the second electronic device can receive the first information decrypted with the first key sent by the first electronic device, and decrypt the information with the first key before using it. The second electronic device can send the second information encrypted with the first key to the first electronic device, and the first electronic device can receive the second information encrypted with the first key from the second electronic device, and decrypt the information with the first key before using it.
[0302] S1203: The first electronic device establishes a WiFi connection with a soft access point of the second electronic device through the first WiFi channel in response to the second information; wherein the soft access point is a soft access point pre-negotiated by the first electronic device and the second electronic device.
[0303] Before initiating the service, the first electronic device and the second electronic device may establish a communication connection in advance and negotiate to determine information related to the software access point of the second electronic device (for the first and second electronic devices to establish a WiFi connection) (such as the SSID, etc.). Optionally, after negotiating to determine the soft access point of the second electronic device, the first and second electronic devices may disconnect. When initiating the service, the first and second electronic devices may establish a WiFi connection between the soft access point of the first electronic device and the second electronic device.
[0304] When the first electronic device and the second electronic device establish a WiFi connection, the first electronic device can connect to the soft access point of the second electronic device through the first WiFi channel using the second key and authenticate with the second electronic device; wherein the second key is: a key pre-negotiated by the first electronic device and the second electronic device, or a set key.
[0305] In the above method, the specific steps executed by the second electronic device can refer to the relevant introduction of the method shown in Figure 8 or Figure 9 in the above embodiment, and will not be described in detail here.
[0306] Based on the above embodiments and the same technical concept, an embodiment of the present application further provides a WiFi communication method, as shown in FIG13 , the method comprising:
[0307] S1301: The second electronic device receives first information from the first electronic device; wherein the first information includes an identifier of a first WiFi channel.
[0308] S1302: The second electronic device creates a soft access point and sends second information to the first electronic device; wherein the second information includes an identifier of the first WiFi channel.
[0309] S1303: The second electronic device establishes a WiFi connection between the first electronic device and the soft access point through the first WiFi channel. The soft access point is a soft access point pre-negotiated by the first electronic device and the second electronic device.
[0310] In the above method, the specific steps executed by the second electronic device can refer to the relevant introduction of the method shown in Figure 8 or Figure 9 in the above embodiment, and will not be described in detail here.
[0311] Based on the above embodiments and the same technical concept, an embodiment of the present application further provides an electronic device for implementing the WiFi communication method provided in the embodiment of the present application. As shown in Figure 14, the electronic device 1400 may include: a memory 1401, one or more processors 1402, and one or more computer programs (not shown). The above-mentioned components may be coupled via one or more communication buses 1403. Optionally, the electronic device 1400 may further include a display screen 1404.
[0312] Among them, one or more computer programs (codes) are stored in the memory 1401, and one or more computer programs include computer instructions; one or more processors 1402 call the computer instructions stored in the memory 1401, so that the electronic device 1400 executes the WiFi communication method provided in the above-mentioned embodiment of the present application.
[0313] In a specific implementation, the memory 1401 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more disk storage devices, flash memory devices or other non-volatile solid-state storage devices. The memory 1401 can store an operating system (hereinafter referred to as system), such as an embedded operating system such as ANDROID, IOS, WINDOWS, or LINUX. The memory 1401 can be used to store the implementation program of the embodiment of the present application. The memory 1401 can also store a network communication program, which can be used to communicate with one or more additional devices, one or more user devices, and one or more network devices.
[0314] The one or more processors 1402 may be a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the program of the present application.
[0315] The display screen 1404 is used to display application interfaces and other related user interfaces.
[0316] It should be noted that Figure 14 is only one implementation of the electronic device 1400 provided in an embodiment of the present application. In actual applications, the electronic device 1400 may also include more or fewer components. For details, please refer to the specific structure and description shown in Figure 1, and no limitation is given here.
[0317] Based on the above embodiments and the same technical concept, an embodiment of the present application also provides a computer-readable storage medium, which stores a computer program. When the computer program runs on an electronic device, the electronic device executes the method provided in the above embodiments.
[0318] Based on the above embodiments and the same technical concept, an embodiment of the present application also provides a computer program product, which includes a computer program or instructions. When the computer program or instructions are run on an electronic device, the electronic device executes the method provided in the above embodiments.
[0319] Based on the above embodiments and the same technical concept, embodiments of the present application further provide a chip system, which includes a processor and a memory, wherein the memory stores instructions; when the instructions are executed by the processor, the display method provided in the above embodiments can be implemented. The chip system can be composed of a chip alone, or it can include a chip and other discrete components.
[0320] The methods provided in the embodiments of the present application may be implemented in whole or in part through software, hardware, firmware, or any combination thereof. When implemented using software, they may be implemented in whole or in part in the form of a computer program product. A computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions according to the embodiments of the present invention are generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, a network device, a user device, or other programmable device. Computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) method. A computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that includes one or more available media. Available media can be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., digital video discs (DVDs), or semiconductor media (e.g., SSDs), etc.
[0321] Obviously, those skilled in the art may make various changes and modifications to the present application without departing from the scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is intended to include these modifications and variations.
Claims
1. A wireless fidelity WiFi communication method, applied to a first electronic device, characterized in that: The method comprises: Sending first information to a second electronic device; wherein the first information includes an identifier of a first WiFi channel and an address of the first electronic device; Receiving a first public behavior frame sent by the second electronic device through the first WiFi channel; wherein the first public behavior frame includes an address of the first electronic device; In response to the first public behavior frame, a negotiation process for establishing a WiFi point-to-point (P2P) connection is performed with the second electronic device through the first WiFi channel.
2. The method according to claim 1, characterized in that The negotiation process includes: Authenticate with the second electronic device, and after successful authentication, send a second public behavior frame to the second electronic device through the first WiFi channel; wherein the second public behavior frame includes at least one of the following: an identifier of a WiFi channel supported by the first electronic device, an identifier of a second WiFi channel, and information indicating a P2P role of the first electronic device; Receive a third public behavior frame sent by the second electronic device through the first WiFi channel; wherein the third public behavior frame includes at least one of the following: an identifier of the second WiFi channel, information used to indicate a P2P role of the first electronic device, information used to indicate a P2P role of the second electronic device, a first key for establishing a WiFi P2P connection, and Internet protocol IP information of the first electronic device.
3. The method according to claim 2, characterized in that The authenticating with the second electronic device includes: Sending a fourth public behavior frame to the second electronic device through the first WiFi channel; wherein the fourth public behavior frame includes authentication information; Receive a fifth public action frame sent by the second electronic device through the first WiFi channel; wherein the fifth public action frame is used to notify that the authentication is successful.
4. The method according to claim 2 or 3, characterized in that After the authentication is successful, before sending the second public behavior frame to the second electronic device through the first WiFi channel, the method further includes: A second key is negotiated with the second electronic device via the first WiFi channel and a public behavior frame; wherein the second key is used to: encrypt information sent to the second electronic device, or decrypt information from the second electronic device.
5. The method according to any one of claims 1 to 4, characterized in that: The sending the first information to the second electronic device includes: The first information is sent to the second electronic device via a low-power Bluetooth communication method or a StarFlash low-power communication method.
6. The method according to claim 1, characterized in that The first public behavior frame also includes at least one of the following: an identifier of a WiFi channel supported by the second electronic device, an identifier of a second WiFi channel, and information indicating a P2P role of the second electronic device.
7. The method according to claim 6, characterized in that The negotiation process includes: A second public behavior frame is sent to the second electronic device via the first WiFi channel; wherein the second public behavior frame includes at least one of the following: an identifier of the second WiFi channel, information indicating the P2P role of the first electronic device, information indicating the P2P role of the second electronic device, a first key for establishing a WiFi P2P connection, and Internet Protocol IP information of the first electronic device.
8. The method according to claim 6 or 7, characterized in that Before sending the first information to the second electronic device, the method further includes: establishing a communication connection with the second electronic device; Authenticating with the second electronic device, and after successful authentication, negotiating a second key with the second electronic device; The sending the first information to the second electronic device includes: When initiating a service, sending the first information encrypted by the second key to the second electronic device; The receiving a first public behavior frame sent by the second electronic device through the first WiFi channel includes: The first public behavior frame encrypted by the second key and sent by the second electronic device through the first WiFi channel is received.
9. The method according to claim 4 or 8, characterized in that The method further comprises: After executing the negotiation process, establishing a WiFi P2P connection with the second electronic device; The step of establishing a WiFi P2P connection with the second electronic device specifically includes: Performing an authentication process and an association process with the second electronic device without performing a four-way handshake process; An encryption key of a WiFi P2P link used after establishing a WiFi P2P connection is determined according to the second key.
10. A WiFi communication method, applied to a second electronic device, characterized in that: The method comprises: Receiving first information from a first electronic device; wherein the first information includes an identifier of a first WiFi channel and an address of the first electronic device; Sending a first public behavior frame to the second electronic device through the first WiFi channel; wherein the first public behavior frame includes the address of the first electronic device; A negotiation process for establishing a WiFi point-to-point (P2P) connection is performed with the first electronic device through the first WiFi channel.
11. The method according to claim 10, characterized in that The negotiation process includes: Authenticate with the first electronic device, and after successful authentication, receive a second public behavior frame sent by the first electronic device through the first WiFi channel; wherein the second public behavior frame includes at least one of the following: an identifier of a WiFi channel supported by the first electronic device, an identifier of a second WiFi channel, and information indicating a P2P role of the first electronic device; A third public behavior frame is sent to the first electronic device through the first WiFi channel; wherein the third public behavior frame includes at least one of the following: an identifier of the second WiFi channel, information indicating a P2P role of the first electronic device, information indicating a P2P role of the second electronic device, a first key for establishing a WiFi P2P connection, and Internet Protocol IP information of the first electronic device.
12. The method according to claim 11, characterized in that The authenticating with the first electronic device includes: Receiving a fourth public behavior frame sent by the first electronic device through the first WiFi channel; wherein the fourth public behavior frame includes authentication information; A fifth public action frame is sent to the first electronic device through the first WiFi channel; wherein the fifth public action frame is used to notify that the authentication is successful.
13. The method according to claim 11 or 12, characterized in that: After the authentication is successful, before receiving a second public behavior frame sent by the first electronic device through the first WiFi channel, the method further includes: A second key is negotiated with the first electronic device via the first WiFi channel and a public behavior frame; wherein the second key is used to: decrypt information from the first electronic device, or encrypt information sent to the first electronic device.
14. The method according to any one of claims 10 to 13, characterized in that: The receiving first information from the first electronic device includes: Receive the first information sent by the first electronic device via a low-power Bluetooth communication method or a StarFlash low-power communication method.
15. The method according to claim 10, characterized in that The first public behavior frame also includes at least one of the following: an identifier of a WiFi channel supported by the second electronic device, an identifier of a second WiFi channel, and information indicating a P2P role of the second electronic device.
16. The method according to claim 15, characterized in that The negotiation process includes: Receive a second public behavior frame sent by the first electronic device through the first WiFi channel; wherein the second public behavior frame includes at least one of the following: an identifier of the second WiFi channel, information used to indicate the P2P role of the first electronic device, information used to indicate the P2P role of the second electronic device, a first key for establishing a WiFi P2P connection, and Internet Protocol IP information of the first electronic device.
17. The method according to claim 15 or 16, characterized in that Before receiving the first information from the first electronic device, the method further includes: Establishing a communication connection with the first electronic device; Authenticating with the first electronic device, and after successful authentication, negotiating a second key with the first electronic device; The receiving first information from the first electronic device includes: receiving the first information encrypted by using the second key from the first electronic device; The sending a first public behavior frame to the first electronic device through the first WiFi channel includes: The first public behavior frame encrypted by using the second key is sent to the first electronic device through the first WiFi channel.
18. The method according to claim 13 or 17, characterized in that The method further comprises: After executing the negotiation process, establishing a WiFi P2P connection with the first electronic device; The step of establishing a WiFi P2P connection with the first electronic device specifically includes: Performing an authentication process and an association process with the first electronic device without performing a four-way handshake process; An encryption key of a WiFi P2P link used after establishing a WiFi P2P connection is determined according to the second key.
19. An electronic device, characterized in that: The electronic device includes a memory and one or more processors; The memory is used to store computer program code, which includes computer instructions; when the computer instructions are executed by the one or more processors, the electronic device executes the method as claimed in any one of claims 1 to 9, or executes the method as claimed in any one of claims 10 to 18.
20. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program runs on an electronic device, the electronic device executes the method according to any one of claims 1 to 9, or executes the method according to any one of claims 10 to 18.
21. A computer program product, characterized in that The computer program product includes a computer program or instructions. When the computer program or instructions are executed on an electronic device, the electronic device executes the method according to any one of claims 1 to 9, or executes the method according to any one of claims 10 to 18.
Citation Information
Patent Citations
Method for peer-to-peer group formation in direct communication system and device therefor
CN104813735A
Wireless network connection method, device and system
CN105451367A
Connection establishment method and electronic equipment
CN114697929A
Electronic device and method for forming wi-fi direct group thereof
US20190053302A1
