Network connection method, electronic device, and readable storage medium
By establishing a connection between the electronic device's STA interface and the AP device on one frequency band, while simultaneously establishing a WiFi network connection on another frequency band using the P2P interface, the problem of electronic devices being unable to establish multi-link connections is solved, thereby improving throughput and data transmission stability.
Patent Information
- Application Number
- CN202310304073.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-21
- Publication Date
- 2025-11-07
- Estimated Expiration
- 2043-03-21
AI Technical Summary
Most electronic devices only support one STA interface, which cannot establish multiple link connections with AP devices, resulting in the inability to achieve multi-link communication and affecting throughput and data transmission stability.
By establishing a connection between the electronic device's STA interface and the AP device on one frequency band, and simultaneously establishing a WiFi network connection on another frequency band using the P2P interface, multi-link communication can be achieved.
This enables multi-link connections between electronic devices and AP devices, improving throughput and data transmission stability while reducing resource waste.
Smart Images

Figure CN118695402B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of terminal, in particular to a network connection method, an electronic device and a readable storage medium. BACKGROUND
[0002] At present, the wireless fidelity (WiFi) technology has gradually matured, and the working frequency bands of WiFi include multiple frequency bands, such as 2.4G, 5G and 6G, and support multi-link communication. With the development of terminal technology, access point (AP) devices supporting multi-link technology are gradually widely promoted, and electronic devices generally establish WiFi connection between the station (Station, STA) interface and the AP device.
[0003] In some scenarios, in order to obtain higher throughput, more stable data transmission and smaller transmission time, it is necessary for the electronic device and the AP to simultaneously establish multiple link connections. However, since most electronic devices only support one STA interface and do not support two or more STA interfaces, the electronic device can usually only establish a link with the AP device and cannot realize multi-link connection. SUMMARY
[0004] The present application provides a network connection method, an electronic device and a readable storage medium, which can solve the problem that the electronic device and the AP device cannot establish a multi-link connection in the related art. The technical solution is as follows:
[0005] In a first aspect, a network connection method is provided, applied to an electronic device, and the method comprises:
[0006] A first application program is started, and the first application program is an application program in the electronic device.
[0007] In the process of data interaction between the first application program and the AP device, the first application program performs data transmission with the access point (AP) device through a first network connection and / or a second network connection, the first network connection is a wireless fidelity (WiFi) network connection established between the station (Station, STA) interface of the electronic device and the AP device in a first frequency band, and the second network connection is a WiFi network connection established between the peer-to-peer (Point-to-Point, P2P) interface of the electronic device and the AP device in a second frequency band, and the second frequency band is different from the first frequency band.
[0008] In this way, the electronic device can also establish a WiFi network connection with the AP device in another frequency band through the P2P interface when the electronic device establishes a WiFi network connection with the AP device in one frequency band through the STA interface, so that the electronic device and the AP device realize multi-link connection.
[0009] As an example of the present application, the first network connection is established before the first application is started; the method further comprises:
[0010] After the first application is started or the first application is triggered to interact with the AP device, the electronic device establishes the second network connection with the AP device in the second frequency band through the P2P interface.
[0011] In this way, after the first application is started or triggered to interact with the AP device, the electronic device establishes the second network connection with the AP device through the P2P interface, that is, the second network connection is established only when needed, so that the occupation of air interface resources can be avoided while realizing multi-link connection, thereby avoiding resource waste.
[0012] As an example of the present application, the electronic device comprises a scanning module and a result storage module, and the P2P interface comprises a first interface, the first interface being used for transmitting data related to the second network connection;
[0013] After the first application is started or the first application is triggered to interact with the AP device, the electronic device establishes the second network connection with the AP device in the second frequency band through the P2P interface, comprising:
[0014] After the first application is started or the first application is triggered to interact with the AP device, the first application triggers the scanning module to perform WiFi signal scanning to obtain a scanning result;
[0015] The scanning module stores the scanning result in the result storage module;
[0016] The first application reads the scanning result from the result storage module and analyzes the scanning result to obtain network connection parameters of the second frequency band;
[0017] The first application sends a first connection instruction to the P2P interface through the first interface, the first connection instruction carrying the network connection parameters;
[0018] In response to the first connection instruction, the P2P interface establishes the second network connection with the AP device in the second frequency band according to the network connection parameters.
[0019] Thus, the first application triggers the scanning module to scan the WiFi signal, and acquires the network connection parameter for connecting the second frequency band according to the scanning result. Then the network connection parameter is sent to the P2P interface through the first interface provided by the P2P interface, so as to establish the second network connection with the AP device in the second frequency band through the P2P interface.
[0020] As an example of the present application, the P2P interface includes an instruction receiving module, a service module, a P2P connection management module, an interface conversion module and a network configuration module;
[0021] The P2P interface establishes the second network connection with the AP device in the second frequency band according to the network connection parameter in response to the first connection instruction, and the method comprises the steps that:
[0022] The instruction receiving module sends the network connection parameter to the service module after receiving the first connection instruction through the first interface;
[0023] The service module sends the network connection parameter to the P2P connection management module through a second interface, and the second interface is used for the service module to transmit data related to the second network connection to the P2P connection management module;
[0024] The P2P connection management module sends the network connection parameter to the interface conversion module;
[0025] The interface conversion module converts the network connection parameter, and sends the converted network connection parameter to the network configuration module;
[0026] The network configuration module establishes the second network connection with the AP device in the second frequency band based on the converted network connection parameter.
[0027] Thus, by establishing a data transmission channel among the instruction receiving module, the service module, the P2P connection management module, the interface conversion module and the network configuration module, the second network connection between the P2P interface and the AP device is established.
[0028] As an example of the present application, the method further comprises:
[0029] The electronic device receives a P2P connection operation;
[0030] In response to the P2P connection operation, the electronic device listens to a probe request frame through the P2P interface, and the probe request frame is a probe request frame broadcasted by other P2P devices;
[0031] The electronic device sends a probe response frame to the other P2P device through the P2P interface after receiving the probe request frame through the P2P interface.
[0032] In a case where the electronic device receives a P2P connection request sent by the other P2P device through the P2P interface, the electronic device disconnects the second network connection established with the AP device in the second frequency band through the P2P interface.
[0033] The electronic device establishes a P2P connection between the electronic device and the other P2P device through the P2P interface.
[0034] In this way, in a case where the electronic device establishes the second network connection with the AP device, if a P2P connection operation is received, the electronic device turns on the listening function of the probe request frame and replies to the probe response frame on the AP channel. Thus, it is ensured that the electronic device can still be discovered by other P2P devices in the process of connecting the AP device. When the other P2P device scans the electronic device, the P2P interface disconnects the connection with the AP device and returns to the P2P connection process, thereby avoiding the problem that the P2P function cannot be used due to the connection with the AP device.
[0035] As an example of the present application, the method further comprises:
[0036] In a case where the electronic device receives a P2P connection request sent by the other P2P device through the P2P interface, if the first application program performs data transmission between the electronic device and the AP device through the P2P interface, the electronic device sends a transmission switching instruction to the first application program before disconnecting the second network connection, and the transmission switching instruction is used to indicate that the second network connection cannot be used for data transmission.
[0037] In this way, in a case where the electronic device performs data transmission with the AP device through the P2P interface, if the electronic device receives a P2P connection request sent by the other P2P device, a data transmission instruction is sent to the first application program before the second network connection is disconnected, so as to instruct the first application program to perform network switching, thereby improving the stability of data transmission.
[0038] As an example of the present application, in a case where the electronic device receives a P2P connection request sent by the other P2P device through the P2P interface, the electronic device disconnects the second network connection established with the AP device in the second frequency band through the P2P interface, which comprises:
[0039] In a case where the electronic device receives a P2P connection request sent by the other P2P device through the P2P interface, the electronic device sends a disconnection request to the AP device through the P2P interface.
[0040] The electronic device disconnects the second network connection established with the AP device in the second frequency band through the P2P interface after receiving the disconnection response sent by the AP device, and the disconnection response is sent after receiving the disconnection request.
[0041] In this way, in the case that a P2P connection request sent by another P2P device is received through the P2P interface, a disconnection request is sent to the AP device through the P2P interface to disconnect the second network connection, so as to facilitate establishing a P2P connection with the other P2P device through the P2P interface.
[0042] As an example of the present application, the P2P interface includes an instruction receiving module, a service module, a P2P connection management module, an interface conversion module, and a network configuration module.
[0043] In the process of data interaction between the first application and the AP device, the first application and the AP device perform data transmission through the first network connection and / or the second network connection, including:
[0044] In the process of data interaction between the first application and the AP device, in the case of selecting to perform data transmission through the second network connection, the first application calls a first interface, and sends data to be transmitted to the instruction receiving module through the first interface, and the first interface is used to transmit data related to the second network connection.
[0045] The instruction receiving module receives the data through the first interface and sends the data to the service module;
[0046] The service module sends the data to the P2P connection management module through a second interface, and the second interface is used for the service module to transmit data related to the second network connection to the P2P connection management module.
[0047] The P2P connection management module sends the data to the interface conversion module.
[0048] The interface conversion module performs interface conversion on the data and sends the converted data to the network configuration module.
[0049] The network configuration module sends the data to the AP device through the second network connection.
[0050] In this way, by establishing a data transmission channel between the modules, the data to be transmitted can be transmitted through the data channel after the second network connection is successfully established, that is, data interaction between the P2P interface and the AP device is realized.
[0051] As an example of the present application, the method further comprises:
[0052] In the case that the first application is closed, the electronic device disconnects the second network connection established between the AP device and the electronic device through the P2P interface.
[0053] Thus, in the case that the first application is closed, the second network connection established between the AP device and the electronic device through the P2P interface is disconnected, so that the air interface resource of the second frequency band can be released, resources are saved, and resource waste is avoided.
[0054] In a second aspect, a network connection apparatus is provided, which has the function of implementing the network connection method in the first aspect. The network connection apparatus comprises at least one module for implementing the network connection method provided in the first aspect.
[0055] In a third aspect, an electronic device is provided, which comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the network connection method in the first aspect when executing the computer program.
[0056] In a fourth aspect, a computer readable storage medium is provided, which stores instructions, and when the instructions are executed on a computer, the computer executes the network connection method in the first aspect.
[0057] In a fifth aspect, a computer program product is provided, which comprises instructions, and when the instructions are executed on a computer, the computer executes the network connection method in the first aspect.
[0058] The technical effects obtained by the second aspect, the third aspect, the fourth aspect, and the fifth aspect are similar to the technical effects obtained by the corresponding technical means in the first aspect, and will not be described here. BRIEF DESCRIPTION OF DRAWINGS
[0059] Figure 1 is a schematic diagram of a multi-link connection according to an example embodiment;
[0060] Figure 2 is a schematic diagram of establishing a WiFi network connection between an electronic device and an AP device according to an example embodiment;
[0061] Figure 3 is a schematic diagram of establishing a second network connection between an electronic device and an AP device according to an example embodiment;
[0062] Figure 4FIG. 7 is a schematic diagram illustrating a method of establishing a second network connection between an electronic device and an AP device according to an example embodiment;
[0063] Figure 5 FIG. 8 is a schematic diagram illustrating a method of establishing a second network connection between an electronic device and an AP device according to another example embodiment;
[0064] Figure 6 FIG. 9 is a schematic diagram illustrating a method of establishing a second network connection between an electronic device and an AP device according to another example embodiment;
[0065] Figure 7 FIG. 10 is a schematic diagram illustrating a software system of an electronic device according to an example embodiment;
[0066] Figure 8 FIG. 11 is a schematic diagram illustrating a flow of a network connection method according to an example embodiment;
[0067] Figure 9 FIG. 12 is a schematic diagram illustrating a method of data transmission between an electronic device and an AP device according to an example embodiment;
[0068] Figure 10 FIG. 13 is a flow schematic diagram illustrating a method of data transmission between an electronic device and an AP device according to an example embodiment;
[0069] Figure 11 FIG. 14 is a schematic diagram illustrating a flow of a network connection method according to another example embodiment;
[0070] Figure 12 FIG. 15 is a schematic diagram illustrating a structure of an electronic device according to an example embodiment. DETAILED DESCRIPTION
[0071] In order to make the objects, technical solutions and advantages of the present application clearer, the embodiments of the present application will be further described in detail below with reference to the drawings.
[0072] It should be understood that the "multiple" mentioned in the present application refers to two or more than two. In the description of the present application, unless otherwise specified, " / " represents the meaning of or, for example, A / B can represent A or B; "and / or" herein only describes the association relationship of the associated objects, which means that there can be three relationships, for example, A and / or B, which can represent the three cases of A alone, A and B together, and B alone. In addition, in order to clearly describe the technical solutions of the present application, the same items or similar items with basically the same function and role are distinguished by using "first", "second", etc. The skilled in the art can understand that "first", "second", etc. do not limit the quantity and execution order, and "first", "second", etc. also do not necessarily mean different.
[0073] In the present application, the reference "one embodiment" or "some embodiments" means that in one or more embodiments of the present application, the specific features, structures or characteristics described in connection with the embodiment are included. Therefore, the statements "in one embodiment", "in some embodiments", "in other some embodiments", "in other some embodiments" and the like appearing in the specification are not necessarily all referring to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized. The terms "include", "contain", "have" and their variants mean "include but not limited to", unless otherwise specifically emphasized.
[0074] At present, WiFi can gradually support more data streams, and multiple frequency bands can be used for data transmission at the same time, for example, WiFi7 can use 2.4GHz, 5GHz and 6GHz three frequency bands at the same time. More and more electronic devices support WiFi7 protocol, and AP devices supporting WiFi7 multi-link technology are also becoming more and more popular. For WiFi7 technology, a multi-link device (MLD) is defined, which can simultaneously establish multiple wireless data links with an AP device, such as Figure 1 As shown, links including 2.4GHz, 5GHz and 6GHz can be established between different STA interfaces and the same AP device, so as to support multi-link communication. However, most electronic device systems (such as Android or Linux) and WiFi drivers only support one STA interface, do not support two or more than two STA interfaces, and do not support MLD, so that these electronic devices can only establish a WiFi network connection with the AP device in one frequency band, for example, as shown in Figure 2 (a) of FIG. 1, the electronic device can only establish a WiFi network connection with the AP device in the 2.4GHz frequency band, or as shown in Figure 2As shown in (b) of FIG. 1, the electronic device can only establish a WiFi network connection between the 5GHz frequency band and the AP device, that is, the multi-link communication cannot be realized. To this end, the embodiment of the present application provides a network connection method, which can establish a network connection with the AP device in one frequency band through the STA interface and establish a network connection with the AP device in another frequency band through the P2P interface at the same time, so as to realize multi-link communication.
[0075] Before the network connection method provided by the embodiment of the present application is introduced in detail, the application scenarios related to the embodiment of the present application are introduced. In some application scenarios, such as game, data download, real-time call and the like, the electronic device and the AP device need to establish multiple WiFi network connections of different frequency bands at the same time, so as to obtain higher throughput, more stable data transmission and smaller transmission delay. As an example, the embodiment of the present application lists the following exemplary application scenarios:
[0076] As an example, after the electronic device is powered on, the user triggers the electronic device to connect the AP device, at this time, the electronic device establishes a WiFi network connection (hereinafter referred to as a first network connection) between the AP device in one frequency band (hereinafter referred to as a first frequency band) through the STA interface, wherein the first frequency band is related to the WiFi network name selected by the user, for example, the first network connection is established in the 2.4GHz frequency band. After an application program in the electronic device is started or triggered to interact with the AP device, the electronic device establishes a WiFi network connection (hereinafter referred to as a second network connection) between the AP device in another frequency band (hereinafter referred to as a second frequency band) through the P2P interface, for example, including the following exemplary application scenarios:
[0077] In one example, please refer to Figure 3 , Figure 3 is a schematic diagram of an application scenario according to an exemplary embodiment, the electronic device is installed with a game application program, before the game application program is started, the electronic device only establishes a first network connection between the AP device in the 2.4GHz frequency band through the STA interface. After the user triggers the electronic device to start the game application program, the game application program triggers the electronic device to establish a second network connection between the AP device in the 5GHz frequency band through the P2P interface. Thus, please refer to Figure 4The electronic device and the AP device establish a dual-link connection, that is, a first network connection link1 is established on the 2.4 GHz frequency band through the STA interface, and a second network connection link2 is established on the 5 GHz frequency band, so that the game application can transmit data through any one of the network connections during running, or transmit data through both of the network connections. That is, in the game scene, since the time delay requirement is high, the electronic device can be triggered to establish a network connection with the AP device through the P2P interface after the game application is started, so as to realize dual-link communication.
[0078] In another example, referring to Figure 5 , Figure 5 is a schematic diagram of an application scenario according to another example embodiment. Before a video call is made through an instant messaging application (such as WeChat TM ), the electronic device only establishes a first network connection with the AP device on the 2.4 GHz frequency band through the STA interface. When the user triggers the electronic device to initiate a video call through the instant messaging application, the instant messaging application triggers the electronic device to establish a second network connection with the AP device on the 5 GHz frequency band through the P2P interface. In this way, during the video call, the instant messaging application can select at least one WiFi network connection for data transmission from the first network connection and the second network connection according to the requirement, so as to ensure stable data transmission and improve real-time transmission.
[0079] Of course, it should be noted that Figure 5 the application scenario shown is only exemplary. In another example, the electronic device can establish a second network connection with the AP device on the 5 GHz frequency band through the P2P interface after starting the instant messaging application, and the embodiments of the present application do not limit this.
[0080] In yet another example, referring to Figure 6 , Figure 6 is a schematic diagram of an application scenario according to another example embodiment. An application management application (such as an application market) is provided in the electronic device. Before an application installation package is downloaded through the application management application, the electronic device only establishes a first network connection with the AP device on the 2.4 GHz frequency band through the STA interface. When the user triggers the electronic device to download the application installation package through the application management application, the application management application triggers the electronic device to establish a second network connection with the AP device on the 5 GHz frequency band through the P2P interface. In this way, when the application installation package is downloaded, the application management application can flexibly select a data link from the first network connection and the second network connection, so as to quickly and completely download the application installation package.
[0081] Similarly, Figure 6The application scenarios shown are exemplary. In another example, after the application management application is started, the electronic device can establish a second network connection with the AP device at the 5 GHz frequency band through the P2P interface, and embodiments of the present application do not limit this.
[0082] It should be noted that the above is only an example of establishing a first network connection at the first frequency band before the application is running, and establishing a second network connection with the AP device at the second frequency band through the P2P interface when the application is running or triggered to interact with the AP device. In another example, after the application is running or triggered to interact with the AP device, the electronic device can also be triggered to establish a first network connection at the first frequency band through the STA interface and a second network connection at the second frequency band through the P2P interface, and embodiments of the present application do not limit this.
[0083] In addition, it should be noted that the above several application scenarios are only exemplary and do not limit the application of the method provided by the embodiments of the present application. The method can also be applied to other application scenarios with low latency, high throughput, and load balancing requirements, and embodiments of the present application do not limit this.
[0084] The method provided by the embodiments of the present application can be applied to an Android system and can also be applied to a Linux system. The software system of the electronic device can adopt a layered architecture, an event-driven architecture, a microkernel architecture, a microservice architecture, or a cloud architecture. The embodiments of the present application take an Android system with a layered architecture as an example to exemplarily describe the software system of the electronic device. Figure 7 is a block diagram of a software system of an electronic device provided by an embodiment of the present application. Referring to Figure 7 , the layered architecture divides the software into several layers, and each layer has a clear role and division of labor. Layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom, the application layer, the application framework layer, the Android runtime and the system layer, and the kernel layer.
[0085] The application layer can include a series of application packages. As Figure 7 shown, the application package can include but is not limited to games, instant messaging, application management (such as an application market), and other application programs, such as call, map, navigation, WLAN, Bluetooth, music, video, short message, etc.
[0086] The application framework layer provides an application programming interface (API) and a programming framework for the applications of the application layer. The application framework layer includes some pre-defined functions. As shown in Figure 7 The application layer includes a WiFi connection module, a scanning module, a result storage module, an instruction receiving module, a service module, a P2P connection management module, an interface conversion module, and a network configuration module. The WiFi connection module is configured to trigger the electronic device to establish a WiFi network connection with an AP device through a STA interface. The scanning module is configured to perform WiFi signal scanning. The result storage module is configured to store the scanning result of the scanning module. The instruction receiving module is configured to receive an instruction or data issued by an application of the application layer to a P2P interface. The service module is configured to establish a data transmission channel between the instruction receiving module and the P2P connection management module, so that the instruction receiving module and the P2P connection management module can interact with each other. The P2P connection management module and the interface conversion module are configured to perform interface conversion on the data issued by the upper layer. The network configuration module is configured to establish a network connection with other electronic devices (such as an AP device).
[0087] The Android runtime includes a core library and a virtual machine. The Android runtime is responsible for the scheduling and management of the Android system. The core library includes two parts: one part is a function function that needs to be called by the java language, and the other part is the core library of Android. The application layer and the application framework layer run in the virtual machine. The virtual machine executes the java files of the application layer and the application framework layer into binary files. The virtual machine is used to manage the object lifecycle, stack management, thread management, security and exception management, and garbage collection.
[0088] The system library can include a plurality of function modules, such as a surface manager, media libraries, a three-dimensional graphics processing library (such as OpenGL ES), a 2D graphics engine (such as SGL), and the like. The surface manager is configured to manage the display subsystem and provide a fusion of 2D and 3D layers for multiple applications. The media library supports playback and recording of a plurality of commonly used audio, video formats, and static image files. The media library can support a plurality of audio and video encoding formats, such as MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, and the like. The three-dimensional graphics processing library is configured to implement three-dimensional graphics drawing, image rendering, synthesis, and layer processing. The 2D graphics engine is a drawing engine for 2D drawing.
[0089] The kernel layer is a layer between hardware and software. The kernel layer contains at least a WiFi driver, a display driver, a camera driver, an audio driver, and a sensor driver.
[0090] Based on the electronic device provided in the above embodiments, the network connection method provided in the embodiments of the present application will be described in detail. As an example of the present application, after the electronic device is powered on, the user triggers the electronic device to connect to an AP device, that is, the electronic device is connected to a WiFi network. In this case, the electronic device establishes a WiFi network connection with the AP device in a first frequency band of the WiFi network through a STA interface, that is, a first network connection is established. Then, when an application program (hereinafter referred to as a first application program) in the electronic device needs to establish a dual-channel connection, the first application program triggers the electronic device to establish a WiFi network connection with the AP device in a second frequency band through a P2P interface at the same time, that is, a second network connection is established. Specifically, please refer to Figure 8 , Figure 8 is a schematic diagram of a flow of a network connection method according to an example embodiment. As an example but not limitation, the method is applied to the electronic device shown in the above Figure 7 The method can include the following or all contents:
[0091] Step 801: After the electronic device is powered on, the WiFi connection module establishes a first network connection with the AP device in a first frequency band through a STA interface in the case of receiving a WiFi connection instruction.
[0092] The WiFi connection instruction can be triggered by the user. For example, the electronic device is provided with a WiFi connection control. When the user wants the electronic device to connect to a WiFi network, the WiFi connection control can be triggered. At this time, the WiFi connection module in the electronic device can receive the WiFi connection instruction. Then, the WiFi connection module triggers the electronic device to establish a first network connection with the AP device in the first frequency band through the STA interface.
[0093] The first frequency band can be selected by the user. For example, in the process of establishing a first network connection with the AP device through the STA interface, the electronic device can display a list of wireless network names of scanned WiFi networks. Then, the user can select a wireless network name to be connected according to the demand, wherein one wireless network name corresponds to one frequency band. Alternatively, the first frequency band can also be any connectable frequency band scanned by the electronic device, that is, the electronic device can also select and connect autonomously.
[0094] Step 802: The first application program is started.
[0095] The first application program is one application program in the electronic device. In one example, the first application program is an application program in the electronic device that has a specified requirement for one or more network services, where the specified requirement includes one or more of low latency, high throughput, or stable transmission. For example, the first application program is a game application program.
[0096] In another example, the first application program is an application program in the electronic device that has a specified requirement for one or more functions. For example, the first application program is an instant messaging application program, and the function that has the specified requirement can be, but is not limited to, a video call function. For another example, the first application program is an application management application program, and the function that has the specified requirement can be, but is not limited to, an application installation package download function.
[0097] Alternatively, the first application program can also be any application program in the electronic device that needs to connect to a network.
[0098] Step 803: The first application program receives an execution operation of a network service.
[0099] The network service can refer to any service related to network communication executed by the first application program, or can also refer to a service related to network communication and having a specified requirement executed by the first application program. In the case where the first application program receives the execution operation of the network service, the first application program is triggered to perform data interaction with the AP device to implement the corresponding network service.
[0100] For example, the first application program is an application market, and the network service is downloading an application program package. In one possible case, as shown in FIG. 8A, after the application market is started, the electronic device displays an application interface of the application market, and then a user triggers a download control (such as the “Install” control in FIG. 8B) of a certain application program in the application interface. Accordingly, the application market receives the execution operation of the network service of downloading the application program package triggered by the user, and then performs data interaction with the AP device to obtain the application program package. Figure 6 Figure 6
[0101] It should be noted that step 803 is optional, that is, the embodiments of the present application are only described by taking the case where the first application program is triggered to subsequently execute the network service by the user through the execution operation of the network service as an example. In another example, the first application program can also automatically execute the network service after being started. For example, the first application program can also automatically request to obtain network data under a certain preset condition after being started, and the embodiments of the present application do not limit this.
[0102] Step 804: In response to the execution operation, the first application program triggers the scanning module to perform WiFi signal scanning.
[0103] As an example of the present application, after receiving the execution operation, the first application triggers the electronic device to establish the second network connection with the AP device through the P2P interface before the data interaction between the electronic device and the AP device, for which the first application triggers the scanning module to perform the WiFi signal scanning to obtain the related data for connecting the second network connection.
[0104] Illustratively, continuing with the above example, when the user clicks the download control of the application in the application interface of the application market, the application market triggers the scanning module to perform the WiFi signal scanning in response to the triggering operation of the user on the download control. For example, the application market can send a scanning instruction to the scanning module to trigger the scanning module to perform the WiFi signal scanning.
[0105] It should be noted that the steps 803 to 804 are optional. As another example of the present application, the first application can also trigger the scanning module to perform the WiFi signal scanning after being started, that is, the first application does not trigger the scanning module to perform the WiFi signal scanning only when being triggered to perform the data interaction with the AP device, but triggers the scanning module to perform the WiFi signal scanning after being started, which is not limited in the present application.
[0106] Step 805: The scanning module performs the WiFi signal scanning to obtain a scanning result.
[0107] In implementation, the scanning module can trigger the WiFi hardware to perform the WiFi signal scanning to obtain the scanning result.
[0108] Step 806: The scanning module stores the scanning result in the result storage module.
[0109] That is, after obtaining the scanning result, the scanning module stores the scanning result in the result storage module, so that the first application obtains the scanning result from the result storage module.
[0110] Step 807: The first application reads the scanning result from the result storage module and analyzes the scanning result to obtain the network connection parameter of the second frequency band.
[0111] In an example, the network connection parameter can include but is not limited to the wireless network name, the password, the network frequency band and the physical address. For example, the network connection parameter includes the service identifier (Service etdentifier, SSID), psk, freq and madAddr, wherein the SSID is the wireless network name, the psk is the password, the freq is the network frequency band, and the madAddr is the physical address. The network connection parameters of different frequency bands are different.
[0112] In a possible case, the parsed result after parsing the scanning result can only include the network connection parameter of an unconnected frequency band, in which case, the network connection parameter of the unconnected frequency band is directly determined as the network connection parameter of the second frequency band. The unconnected frequency band refers to a frequency band other than the first frequency band. That is, when the electronic device has previously established a WiFi network connection with the AP device in the first frequency band, and the parsed result includes the network connection parameters of the first frequency band and another frequency band, the first application program can also query the first frequency band corresponding to the first network connection that has been established, and select the network connection parameter of the other frequency band from the parsed result as the network connection parameter of the second frequency band to perform deduplication processing, so as to avoid establishing different WiFi network connections in the same frequency band.
[0113] In another case, the parsed result after parsing the scanning result can include network connection parameters of multiple unconnected frequency bands, for example, network connection parameters of a 5GHz frequency band and network connection parameters of a 6GHz frequency band. In this case, the first application program can select the network connection parameter of one frequency band from the network connection parameters of multiple unconnected frequency bands as the network connection parameter of the second frequency band according to the demand. As an example but not limitation, the first application program can select according to the network type.
[0114] It should be noted that in a possible case, the network connection parameter can also not include the password of the WiFi network of the second frequency band, but the first application program has previously stored the password of the WiFi network of the second frequency band. In this case, after obtaining the parsed result, the first application program can obtain the corresponding password from the local according to the SSID, and then perform the following step 808 and subsequent operations.
[0115] It should be noted that the above is described by taking the electronic device as an example that has previously connected the second frequency band, that is, the network connection parameter includes the password, or the first application program stores the password of the WiFi network of the second frequency band. In another possible case, the electronic device can not have previously connected the second frequency band. In this case, after the scanning module performs WiFi signal scanning, the scanning result does not include the password of the second frequency band, and the first application program also does not store the password of the second frequency band. In this case, after obtaining the network connection parameter, the first application program can display part or all of the information in the network connection parameter, so as to facilitate the user to input the password according to the displayed information. Exemplarily, the first application program can display the SSID in the network connection parameter, and then the user can input the password corresponding to the displayed SSID, and accordingly, the first application program can obtain the password corresponding to the SSID, and then perform the following step 808 and subsequent operations.
[0116] Step 808: The first application program sends a first connection instruction to the instruction receiving module through the first interface, and the first connection instruction carries the network connection parameter of the second frequency band.
[0117] The first connection instruction is used to request the P2P interface to establish a second network connection with the AP device in the second frequency band based on the network connection parameter.
[0118] The first interface is an interface in the P2P interface for the first application program to call to establish a WiFi network connection with the AP device through the P2P interface. In an example, the following content can be encapsulated in the AddGroup() function of the FWK layer of the electronic device, thereby providing the first application program with a callable first interface, wherein the first interface is connect():
[0119] public boolean p2pGroupAdd(String networkName, String passphrase, intfreq, String peerAddress);
[0120] public void connect(@NonNull WifiConfiguration config, @Nullable ActionListener listener);
[0121] The AddGroup() function is used to implement the related functions of the P2P interface, such as establishing a network connection channel.
[0122] In an example, the instruction receiving module is named as the wifiP2pManager module. In this case, the first application program issues the first connection instruction to the wifiP2pManager module by calling the connect() interface.
[0123] Step 809: After receiving the first connection instruction through the first interface, the instruction receiving module sends the network connection parameter to the service module.
[0124] In an example, after receiving the first connection instruction, the instruction receiving module can parse the first connection instruction to obtain the network connection parameter of the second frequency band, and then the instruction receiving module sends a second connection instruction to the service module, and the second connection instruction carries the network connection parameter of the second frequency band.
[0125] Exemplarily, the second connection instruction is a wifiP2pManager. CONNECT connection instruction, and the naming of the service module is wifiP2pServiceImpl module. In this case, the specific implementation of the instruction receiving module sending the network connection parameter to the service module can include: the wifiP2pManager module sends the wifiP2pManager. CONNECT connection instruction to the wifiP2pServiceImpl module, and the network connection parameter is carried in the wifiP2pManager. CONNECT connection instruction.
[0126] Of course, the above implementation is only exemplary, and in another example, the instruction receiving module can also directly forward the first connection instruction to the service module to transmit the network connection parameter of the second frequency band to the service module.
[0127] Step 810: The service module sends the network connection parameter to the P2P connection management module through the second interface.
[0128] The second interface is an interface in the P2P connection management module, and the second interface is called by the service module to pass data used for interacting with the AP device (such as establishing a WiFi network connection) to the P2P connection management module. Exemplarily, the second interface is the p2pGroupAdd() interface in the above.
[0129] In one example, the P2P connection management module is named wifP2PNative module. In implementation, wifiP2pServiceImpl calls wiFiNative. p2pGroupAdd (ssid, psk, freq, macAddr), thereby sending the network connection parameter including ssid, psk, freq, macAddr to the wifP2PNative module.
[0130] Step 811: The P2P connection management module sends the network connection parameter to the interface conversion module.
[0131] In one example, the interface conversion module is named SupplicantP2plfaceHal.
[0132] In one example, the P2P connection management module calls the mSupplicantP2pIfaceHal.groupAdd interface of the wpa_supplicant_hal of the SupplicantP2pIfaceHal to send the network connection parameters to the interface conversion module. Illustratively, the P2P connection management module calls mSupplicantP2pIfaceHal.groupAdd(ssid, psk, false, freq, macAddr, true) to send the network connection parameters to the interface conversion module.
[0133] Step 812: The interface conversion module interfaces the network connection parameters.
[0134] In one example, the interface conversion module interfaces the network connection parameters, e.g., interfaces the network connection parameters according to the parameter transmission form defined by the network configuration module, to convert the network connection parameters into a form recognizable by the network configuration module.
[0135] Step 813: The interface conversion module sends the converted network connection parameters to the network configuration module.
[0136] In one example, the interface conversion module calls the addGroup_1_2() interface of the network configuration module to transmit the network connection parameters to the network configuration module. Illustratively, in implementation, the interface conversion module calls addGroup_1_2(ssid, psk, isPersistent, freq, macAddr, join) to send the network connection parameters to the network configuration module.
[0137] Step 814: The network configuration module establishes a second network connection with the AP device in the second frequency band based on the converted network connection parameters.
[0138] After receiving the network connection parameters, the network configuration module can establish a WiFi network connection with the AP device in the second frequency band based on the network connection parameters, thereby realizing the establishment of the second network connection with the AP device through the P2P interface. In one example, the network configuration module is named wpa_supplicant. In implementation, the wpa_supplicant establishes a second network connection with the AP device in the second frequency band based on ssid, psk, freq and macAddr.
[0139] In this way, the electronic device realizes the establishment of the second network connection with the AP device in the second frequency band through the P2P interface in the case of the establishment of the first network connection with the AP device in the first frequency band through the STA interface. Illustratively, please refer to Figure 4For example, taking the first frequency band as 2.4 GHz and the second frequency band as 5 GHz, the electronic device establishes a first network connection with the AP device through the STA interface in the 2.4 GHz frequency band and establishes a second network connection with the AP device through the P2P interface in the 5 GHz frequency band. In this case, the dual-link connection may occur through air interface packet capturing.
[0140] It should be noted that in one possible case, the AP device connected through the P2P interface and the AP device connected through the STA interface can be the same AP device. In another possible case, the AP device connected through the P2P interface and the AP device connected through the STA interface can also be different AP devices.
[0141] It should be noted that the embodiments of the present application are described by taking the electronic device establishing the second network connection with the AP device through the P2P interface in the second frequency band when the first application is started or triggered to interact with the AP device for data transmission as an example. In another example, the second network connection can also be established before the first application is started, for example, the electronic device establishes the second network connection at the same time of establishing the first network connection; in yet another example, the first network connection and the second network connection can be triggered by the first application to be established by the electronic device at the same time, for example, the first application is started or triggered to interact with the AP device for data transmission, the first interface is called to send a first connection instruction to the P2P interface, and at the same time, a third connection instruction is sent to the STA interface, so as to trigger the electronic device to establish different WiFi network connections with the AP device through the P2P interface and the STA interface respectively, and the embodiments of the present application are not limited in this regard.
[0142] Step 815: In the case where the WiFi network connection is established, the network configuration module returns a network establishment completion notification to the first application.
[0143] The network establishment completion notification is used to indicate that the second network connection with the AP device in the second frequency band is established through the P2P interface. That is, in order to facilitate the first application to know whether the data transmission can be performed through the P2P interface, the network configuration module can return the network establishment completion notification to the first application after the establishment of the second network connection in the second frequency band based on the network connection parameter is completed. In one example, as shown in Figure 8 The specific implementation of the network configuration module returning the network establishment completion notification to the first application includes: the network configuration module sends the network establishment completion notification to the interface conversion module, the interface conversion module sends the network establishment completion notification to the P2P connection management module, the P2P connection management module sends the network establishment completion notification to the service module, the service module sends the network establishment completion notification to the instruction receiving module, and the instruction receiving module sends the network establishment completion notification to the first application.
[0144] It should be noted that step 815 is an optional operation. In another possible implementation, the first application program can also actively request the network configuration module to query whether the second network connection is successfully established, and the embodiments of the present application do not limit this.
[0145] Thus, for the electronic device which does not support multiple STA interfaces, since the WiFi driver of the electronic device supports the coexistence of the STA interface and the P2P interface, the multiple-link connection can be implemented without additional modification of the WiFi driver, so that more flexible data link selection can be realized during data transmission, so that the WiFi network transmission is more stable and the real-time performance is more guaranteed. In addition, since the electronic device supports multiple-link independent data transmission, higher throughput can be achieved, and more stable data transmission can be achieved in an interference environment. For example, the data transmission process can include the following content of step 816:
[0146] Step 816: In the process of data interaction between the first application program and the AP device, the first application program transmits data with the AP device through the first network connection and / or the second network connection.
[0147] That is, after the first application program determines that the second network connection has been established in the second frequency band, the first application program can select to transmit data with the AP device through the first network connection and / or the second network connection during the data interaction between the first application program and the AP device according to the requirement.
[0148] In one example, in the process of data interaction between the first application program and the AP device, the first application program can select one link from the two links for data transmission according to the air interface load degree, so as to realize air interface load balancing transmission. In the case that both frequency bands are in an idle state, after the first application program selects one frequency band for data transmission, if the selected frequency band is busy, the first application program can also dynamically switch to another frequency band for data transmission. For example, in the case that both the 2.4 GHz frequency band and the 5 GHz frequency band are in an idle state, the first application program can select the 5 GHz frequency band for data transmission. In an interference environment, if the 5 GHz frequency band is busy, the first application program can dynamically switch to the 2.4 GHz frequency band for data transmission. In this way, the stability of data transmission is ensured.
[0149] In another example, for a scene with high data stability requirement, such as a game scene, the first application program can also transmit data through two frequency bands during the data interaction between the first application program and the AP device. In this way, as long as the receiving end receives the data transmitted by the electronic device on one frequency band, the data can be normally received, so that the stability and real-time performance of data transmission can be ensured. For example, as shown in FIG. 8, the first application program can transmit data through the first network connection and the second network connection during the data interaction between the first application program and the AP device.Figure 9 As shown, the electronic device transmits data in the 2.4 GHz frequency band (100 ms of data transmission delay) and the 5 GHz frequency band (5 ms of data transmission delay) at the same time. After the electronic device fails to transmit data in the 2.4 GHz frequency band, the electronic device waits for retransmission in the 2.4 GHz frequency band, during which the electronic device normally receives data in the 5 GHz frequency band, ensuring the reliability of data transmission. In addition, since the data transmission delay of the 5 GHz frequency band is smaller, the real-time performance of data transmission is improved while ensuring the reliability of data transmission.
[0150] As an example of the present application, the data transmission process is introduced by taking the first application selecting data transmission through the second network connection as an example. Specifically, refer to Figure 10 may include the following content:
[0151] A1: The first application sends the data to be transmitted to the instruction receiving module through the first interface.
[0152] The first application calls the first interface to send the data to be transmitted to the instruction receiving module through the first interface. In an example, the first application calls the first interface and sends a data transmission instruction to the first interface, and the data transmission instruction carries the data to be transmitted.
[0153] A2: The instruction receiving module sends the data to the service module.
[0154] A3: The service module sends the data to the P2P connection management module through the second interface.
[0155] In an example, the service module receives the data transmission instruction, parses the data to be transmitted therefrom, and then sends the data to be transmitted to the P2P connection management module.
[0156] A4: The P2P connection management module sends the data to the interface conversion module.
[0157] A5: The interface conversion module performs interface conversion on the data and sends the converted data to the network configuration module.
[0158] The interface conversion module performs interface conversion on the data to be transmitted according to the data format defined by the network configuration module, and then sends the converted data to the network configuration module.
[0159] A6: The network configuration module sends the data to the AP device through the second network connection.
[0160] In the data interaction process, since the data is transmitted through the P2P interface, the data contains P2PIE.
[0161] It should be noted that the above is an example of the first application sending data to the AP device. In one possible case, data can also be sent from the AP device to the first application, in which case the data transmission direction is opposite to the data transmission direction shown in the above Figure 10 and will not be repeated here.
[0162] It should be noted that the above is an example of the first application triggering the electronic device to establish a second network connection with the AP device in the second frequency band through the P2P interface when network data transmission is performed. In another possible case, when the first application performs network data transmission, if the second application has triggered the electronic device to establish a second network connection with the AP device in the second frequency band through the P2P interface, the first application can directly select the first network connection and / or the second network connection for network data transmission, that is, it is not necessary to trigger the electronic device to establish a second network connection in the second frequency band through the P2P interface again.
[0163] As an example of the present application, after the first application ends through the first network connection and / or the second network connection, for example, when the first application is closed, the electronic device can be triggered to disconnect the second network connection established through the P2P interface with the AP device. By way of example, please continue to refer to Figure 8 , which can include the following contents:
[0164] Step 817: The first application receives a closing operation.
[0165] The closing operation is an operation triggered by a user to instruct the electronic device to close the first application.
[0166] Step 818: The first application sends a WiFi disconnection instruction to the instruction receiving module through the first interface.
[0167] The WiFi disconnection instruction is used to instruct to disconnect the second network connection established in the second frequency band through the P2P interface with the AP device. After receiving the closing operation, the first application not only sends the WiFi disconnection instruction to the instruction receiving module, but also exits the running state, that is, the first application is closed.
[0168] Step 819: The instruction receiving module sends the WiFi disconnection instruction to the service module.
[0169] Step 820: The service module sends the WiFi disconnection instruction to the P2P connection management module through the second interface.
[0170] Step 821: The P2P connection management module sends the WiFi disconnection instruction to the interface conversion module.
[0171] Step 822: The interface conversion module converts the WiFi disconnection instruction, and sends the converted WiFi disconnection instruction to the network configuration module.
[0172] The interface conversion module converts the WiFi disconnection instruction according to the data format defined by the network configuration module, and then sends the converted WiFi disconnection instruction to the network configuration module.
[0173] Step 822: In response to the WiFi disconnection instruction, the network configuration module disconnects the second network connection established with the AP device in the second frequency band.
[0174] For example, the network configuration module sends a WiFi disconnection request to the AP device to disconnect the second network connection established with the AP device.
[0175] It should be noted that the embodiments of the present application are only used to illustrate that in the case where the first application is closed, the electronic device disconnects the second network connection established with the AP device through the P2P interface. In another optional example, since the user may not use the first application for a long time (such as more than one day) after opening the first application, that is, in the case where the first application is in a running state, the first application does not perform network data interaction or execute a function with a specified requirement within a preset time period. In this case, the first application can also trigger the electronic device to disconnect the second network connection established with the AP device through the P2P interface, and then trigger the electronic device to establish the second network connection with the AP device through the P2P interface when the first application needs to perform network data interaction or execute a function with a specified requirement.
[0176] In the embodiments of the present application, after the first application is started, data interaction between the electronic device and the AP device can be performed through the first network connection and / or the second network connection. The first network connection is a WiFi network connection established between the electronic device and the AP device in the first frequency band through the STA interface of the electronic device, and the second network connection is a WiFi network connection established between the electronic device and the AP device in the second frequency band through the P2P interface of the electronic device. The second frequency band is different from the first frequency band. That is, the electronic device can establish a WiFi network connection with the AP device in another frequency band through the P2P interface in addition to establishing a WiFi network connection with the AP device in one frequency band through the STA interface, so that multi-link connection between the electronic device and the AP device is realized.
[0177] The electronic device is a P2P device in the case that the electronic device establishes a second network connection with the AP device through the P2P interface. In a normal case, as a P2P device, the P2P protocol prohibits being scanned by other P2P devices after connecting with the AP device (or group owner, GO), however, in this way, it is easy to cause that other P2P devices cannot scan the electronic device in the process that the electronic device establishes the second network connection with the AP device through the P2P interface. In order to avoid this situation, the embodiment of the present application further provides a network connection method, specifically, please refer to Figure 11 , and then taking the case that the method is applied to the electronic device as an example, the method can include the following or all contents:
[0178] Step 1101: After the electronic device is powered on, in the case that a WiFi connection instruction is received, the electronic device establishes a first network connection with the AP device in a first frequency band through a STA interface.
[0179] Step 1102: After the electronic device receives a starting operation of a first application, the electronic device starts the first application.
[0180] Step 1103: After the first application is started or triggered to perform data interaction with the AP device, the electronic device establishes a second network connection with the AP device in a second frequency band through a P2P interface.
[0181] Step 1104: The electronic device performs data transmission with the AP device through the first network connection and / or the second network connection.
[0182] The specific implementation of the above steps 1101 to 1104 can refer to the steps 801 to 816 in the above Figure 8 embodiment, which will not be described in detail here.
[0183] Step 1105: The electronic device receives a P2P connection operation.
[0184] The P2P connection operation is an operation for requesting P2P connection. In an example, a third application is installed in the electronic device, and when a user wants the electronic device to perform P2P connection, the P2P connection operation can be triggered in an application interface of the third application.
[0185] Step 1106: In response to the P2P connection operation, the electronic device listens to a probe request frame through the P2P interface.
[0186] The probe request frame refers to a probe request frame broadcasted by other P2P devices. In some examples, the probe request frame is a probe response frame.
[0187] That is, after the electronic device connects to the AP device through the P2P interface, in the case of receiving the P2P connection operation, the P2P interface opens the listening function of the probe request frame to listen to the probe request frame broadcasted by other P2P devices. In an example, the electronic device can open the probe request frame filter in the above network configuration module (i.e. wpa_supplicant) to enable the WiFi driver to receive the probe request frame, and the filter is used to start or prohibit the listening function of the probe request frame. In an example, the filter is wifi driver P2P response filter.
[0188] Step 1107: After the electronic device receives the probe request frame through the P2P interface, the electronic device sends a probe response frame to other P2P devices through the P2P interface.
[0189] In some examples, the probe response frame is a probe request frame.
[0190] That is, in the case of receiving the probe request frame through the P2P interface, the electronic device replies to the probe response frame of other P2P devices on the corresponding AP channel, so that the electronic device can be discovered by other P2P devices even if it is connected to the AP device through the P2P interface, avoiding the situation that other P2P devices cannot scan the electronic device, thereby avoiding the situation that the P2P function cannot be used in the process of connecting the AP device through the P2P interface.
[0191] Step 1108: The electronic device receives the P2P connection request sent by other P2P devices through the P2P interface.
[0192] In an example, the P2P connection request is an auth request.
[0193] Step 1109: In the case that the first application transmits data with the AP device through the P2P interface, the electronic device sends a transmission switching instruction to the first application, and the transmission switching instruction is used to indicate that the second network connection cannot be used for data transmission.
[0194] In one case, if a P2P connection request sent by another P2P device is received through the P2P interface, it indicates that the other P2P device requests to establish a P2P connection with the electronic device. In this case, if the first application in the electronic device transmits data through the second network connection, in order to enable the first application to quickly switch to transmitting data through the first network connection, a transmission switching instruction can be sent to the first application. In one example, the specific implementation of sending the transmission switching instruction to the first application can include: the network configuration module sends the transmission switching instruction to the interface conversion module, the interface conversion module sends the transmission switching instruction to the P2P connection management module, the P2P connection management module sends the transmission switching instruction to the service module, the service module sends the transmission switching instruction to the instruction receiving module, and the instruction receiving module sends the transmission switching instruction to the first application.
[0195] Step 1110: The electronic device sends a disconnection request to the AP device.
[0196] The disconnection request is used to indicate disconnection of the second network connection established in the second frequency band with the AP device. In one example, the electronic device sends the disconnection request to the AP device through the network configuration module. Illustratively, the disconnection request is deauth_request.
[0197] It should be noted that the above steps 1108 to 1110 are optional operations. In another example, the electronic device can also directly disconnect the second network connection established in the second frequency band with the AP device through the P2P interface in the case that the P2P connection request sent by another P2P device is received through the P2P interface, that is, the first application can also not be notified to switch. In this case, the first application can actively perceive that data cannot be sent through the P2P interface when sending data. In this way, the P2P connection speed can be improved.
[0198] Step 1111: The AP device sends a disconnection response to the electronic device.
[0199] In the case of receiving the disconnection request sent by the electronic device, the AP device disconnects the second network connection and feeds back a disconnection response to the electronic device. In one example, the electronic device receives the disconnection response through the network configuration module, and illustratively, the disconnection response is deauth response.
[0200] Wherein, the above steps 1110 and 1111 are one optional specific implementation of the electronic device disconnecting the second network connection established in the second frequency band with the AP device through the P2P interface.
[0201] Step 1112: The electronic device establishes a P2P connection with another P2P device through the P2P interface.
[0202] That is, after the second network connection between the electronic device and the AP device is disconnected, the electronic device performs the process of establishing a P2P connection with other P2P devices. For example, the electronic device sends a P2P connection response, such as an auth response, to other P2P devices through a P2P interface. Then, the other P2P devices send an authentication request, such as an assoc request, to the electronic device, and the electronic device sends an authentication response, such as an assoc response, to the other P2P devices, thereby establishing a P2P connection through data interaction.
[0203] It should be noted that the electronic device only listens to the probe request frame broadcasted by other P2P devices in the embodiments of the present application. In another example, the electronic device can also broadcast a probe request frame to request a P2P connection with other P2P devices.
[0204] In the embodiments of the present application, when the electronic device establishes a second network connection with the AP device, if a P2P connection operation is received, the electronic device turns on the listening function of the probe request frame and replies to a probe response frame on the AP channel. Thus, the electronic device can still be discovered by other P2P devices during the process of connecting the AP device. When the electronic device is scanned by other P2P devices, the P2P interface disconnects the connection with the AP device and returns to the P2P connection process, thereby avoiding the problem that the P2P function cannot be used due to the connection with the AP device.
[0205] The electronic device in the embodiments of the present application can be a GoPro, a digital camera, a tablet computer, a desktop computer, a laptop computer, a notebook computer, a vehicle-mounted device, an ultra-mobile personal computer (UMPC), a netbook, a cellular phone, a personal digital assistant (PDA), an augmented reality (AR) \ virtual reality (VR) device, a mobile phone, and the like, and the embodiments of the present application are not limited thereto.
[0206] Figure 12 FIG. 1 is a structural schematic diagram of an electronic device according to an embodiment of the present application. As shown in FIG. 1, the electronic device includes a processor 100, a memory 200, a P2P interface 300, and an AP interface 400. Figure 12The electronic device 100 can include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (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, a headset interface 170D, a sensor module 180, a key 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 can include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
[0207] It can be understood that the structure illustrated in the embodiments of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 can include more or fewer components than illustrated, or combine certain components, or split certain components, or different arrangement of components. The illustrated components can be implemented in hardware, software, or a combination of software and hardware.
[0208] The processor 110 can include one or more processing units, such as: the processor 110 can 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. Different processing units can be independent devices, or can be integrated in one or more processors.
[0209] The controller can be the nerve center and command center of the electronic device 100. The controller can generate operation control signals according to instruction operation codes and timing signals, and complete the control of fetching instructions and executing instructions.
[0210] The processor 110 can also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory can hold instructions or data that the processor 110 has just used or is using repeatedly. If the processor 110 needs to use the instructions or data again, it can call them directly from the memory. This avoids repeated access and reduces the waiting time of the processor 110, thus improving the efficiency of the system.
[0211] In some embodiments, the processor 110 can include one or more interfaces, such as an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.
[0212] It can be understood that the interface connection relationship between the modules shown in the embodiments of the present application is only illustrative and does not constitute a structural limitation of the electronic device 100. In other embodiments of the present application, the electronic device 100 can also use different interface connection methods or combinations of multiple interface connection methods in the above embodiments.
[0213] The charging management module 140 is configured to receive charging input from a charger. The charger can be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 can receive charging input from a wired charger through the USB interface 130. In some wireless charging embodiments, the charging management module 140 can receive wireless charging input through the wireless charging coil of the electronic device 100. The charging management module 140 can charge the battery 142 while also supplying power to the electronic device 100 through the power management module 141.
[0214] The power management module 141 is configured to connect the battery 142 and the charging management module 140 to the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140 to power the processor 110, the internal memory 121, the external memory, the display 194, the camera 193, the wireless communication module 160, and the like. The power management module 141 can also be configured to monitor parameters such as the battery capacity, the number of battery cycles, the battery health status (leakage, impedance), and the like. In some other embodiments, the power management module 141 can also be disposed in the processor 110. In some other embodiments, the power management module 141 and the charging management module 140 can also be disposed in the same device.
[0215] The wireless communication module 160 can provide wireless communication solutions applied in the electronic device 100, including wireless local area networks (WLAN) (e.g., wireless fidelity (Wi-Fi) network), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR) technology, and the like. The wireless communication module 160 can be one or more devices integrated with at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, performs frequency modulation and filtering processing on the electromagnetic wave signals, and sends the processed signals to the processor 110. The wireless communication module 160 can also receive signals to be sent from the processor 110, perform frequency modulation and amplification on the signals, and radiate the signals out as electromagnetic waves via the antenna 2.
[0216] The external memory interface 120 can be configured to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 via the external memory interface 120 to implement data storage functions. For example, music, video, and the like can be saved in the external memory card.
[0217] The internal memory 121 can be used to store computer executable program codes including instructions. The processor 110 performs 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 can include a program storage area and a data storage area. The program storage area can store an operating system, application programs required by at least one function (such as a sound playing function, an image playing function, etc.), etc. The data storage area can store data (such as audio data, a phone book, etc.) created by the electronic device 100 during use, etc. In addition, the internal memory 121 can include a high-speed random access memory, and can also include a non-volatile memory such as at least one magnetic disk storage device, a flash memory device, a universal flash storage (UFS), etc.
[0218] The touch sensor 180K, also referred to as a "touch panel". The touch sensor 180K can be disposed on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, also referred to as a "touch panel". The touch sensor 180K is used to detect a touch operation acting on or near it. The touch sensor 180K can pass the detected touch operation to the application processor to determine the touch event type. Visual output related to the touch operation can be provided through the display screen 194. In other embodiments, the touch sensor 180K can also be disposed on the surface of the electronic device 100, which is different from the position where the display screen 194 is located.
[0219] The keys 190 include a power-on key, a volume key, etc. The keys 190 can be mechanical keys or touch keys. The electronic device 100 can receive key input and generate key signal input related to user settings and function control of the electronic device 100.
[0220] In the above embodiments, all or part of the embodiments can be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments can be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present application are generated. The computer can be a general purpose computer, a special purpose computer, a computer network or other programmable apparatus. The 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, such as the computer instructions can be transmitted from one website site, computer, server or data center to another website site, computer, server or data center through wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.) mode. The computer readable storage medium can be any available medium accessible by a computer, or a data storage device such as a server, data center, etc. integrated with one or more available media. The available media can be magnetic media (such as floppy disk, hard disk, magnetic tape), optical media (such as digital versatile disc (DVD)) or semiconductor media (such as solid state disk (SSD)) and the like.
[0221] The above is an optional embodiment provided by the present application, and is not used to limit the present application. Any modification, equivalent replacement, improvement, etc. made within the technical scope disclosed by the present application shall be included in the protection scope of the present application.
Claims
1. A network connection method characterized by, The application is applied to an electronic device, the electronic device comprises a scanning module and a result storage module, a P2P interface comprises a first interface, an instruction receiving module, a service module, a P2P connection management module, an interface conversion module and a network configuration module, the first interface is used for transmitting data related to a second network connection, the method comprises: A first application is started, the first application is an application in the electronic device; In the process of data interaction between the first application and an AP device, the first application transmits data with the AP device through a first network connection and / or a second network connection, the first network connection is a wireless fidelity (WiFi) network connection established between the AP device and the station (STA) interface of the electronic device in a first frequency band, the first network connection is established before the first application is started, the second network connection is a WiFi network connection established between the AP device and the peer-to-peer (P2P) interface of the electronic device in a second frequency band, the second frequency band is different from the first frequency band, and the electronic device is a P2P device in the process of establishing the second network connection between the P2P interface and the AP device; The method further comprises: After the first application is started or the first application is triggered to interact with the AP device, the first application triggers the scanning module to scan a WiFi signal and obtains a scanning result; The scanning module stores the scanning result in the result storage module; The first application reads the scanning result from the result storage module and analyzes the scanning result to obtain network connection parameters of the second frequency band; The first application sends a first connection instruction to the P2P interface through the first interface, the first connection instruction carries the network connection parameters; After the instruction receiving module receives the first connection instruction through the first interface, the instruction receiving module sends the network connection parameters to the service module; The service module sends the network connection parameters to the P2P connection management module through a second interface, the second interface is used for the service module to transmit data related to the second network connection to the P2P connection management module; The P2P connection management module sends the network connection parameters to the interface conversion module; The interface conversion module converts the network connection parameters and sends the converted network connection parameters to the network configuration module; The network configuration module establishes the second network connection with the AP device in the second frequency band based on the converted network connection parameters.
2. The method of claim 1, wherein, The method further comprises: The electronic device receives a P2P connection operation; In response to the P2P connection operation, the electronic device listens to a probe request frame through the P2P interface, the probe request frame is a probe request frame broadcasted by another P2P device; After the electronic device receives the probe request frame through the P2P interface, the electronic device sends a probe response frame to the other P2P device through the P2P interface. In a case where the P2P connection request sent by the other P2P device is received through the P2P interface, the electronic device disconnects the second network connection established with the AP device in the second frequency band through the P2P interface; The electronic device establishes a P2P connection between the P2P interface and the other P2P device.
3. The method of claim 2, wherein, The method further comprises: In a case where the P2P connection request sent by the other P2P device is received through the P2P interface, if the first application program performs data transmission between the P2P interface and the AP device, the electronic device sends a transmission switching instruction to the first application program before disconnecting the second network connection, and the transmission switching instruction is used to indicate that the second network connection cannot be used for data transmission.
4. The method of claim 2, wherein, The electronic device disconnects the second network connection established with the AP device in the second frequency band through the P2P interface in a case where the P2P connection request sent by the other P2P device is received through the P2P interface, comprising: In a case where the P2P connection request sent by the other P2P device is received through the P2P interface, the electronic device sends a disconnection request to the AP device through the P2P interface; After the electronic device receives a disconnection response sent by the AP device, the electronic device disconnects the second network connection established with the AP device in the second frequency band through the P2P interface, and the disconnection response is sent after receiving the disconnection request.
5. The method of any one of claims 1-4, wherein, In the process of data interaction between the first application program and the AP device, the data transmission between the first network connection and / or the second network connection and the AP device comprises: In a case where the first application program selects to perform data transmission through the second network connection in the process of data interaction between the first application program and the AP device, the first application program calls a first interface, sends data to be transmitted to the instruction receiving module through the first interface, and the first interface is used to transmit data related to the second network connection; The instruction receiving module receives the data through the first interface and sends the data to the service module; The service module sends the data to the P2P connection management module through a second interface, and the second interface is used for the service module to transmit data related to the second network connection to the P2P connection management module; The P2P connection management module sends the data to the interface conversion module; The interface conversion module performs interface conversion on the data and sends the converted data to the network configuration module; The network configuration module sends the data to the AP device through the second network connection.
6. The method of any one of claims 1-4, wherein, The method further comprises: In a case where the first application program is closed, the electronic device disconnects the second network connection established with the AP device in the second frequency band through the P2P interface.
7. An electronic device, comprising: A computer program product comprising a computer readable storage medium having stored thereon instructions that, when executed by a computer, cause the computer to perform the method of any one of claims 1-6.
8. A computer-readable storage medium, characterized in that, A computer readable storage medium having stored therein instructions that, when executed by a computer, cause the computer to perform the method of any one of claims 1-6.
Citation Information
Patent Citations
Method and device for establishing network connection and electronic equipment
CN111182614A
Dual WIFI connection method and electronic device
WO2022089515A1