Wireless connection method, apparatus and electronic device
By employing multiple wireless communication modes in terminal devices and prioritizing the establishment of wireless communication channels with shorter communication distances, the problem of long wireless communication distances is solved, improving data transmission efficiency and user experience.
Patent Information
- Application Number
- CN202211737176.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-31
- Publication Date
- 2026-01-16
- Estimated Expiration
- 2042-12-31
AI Technical Summary
In existing technologies, when transmitting data between wireless access points and other communication devices, the communication distance is relatively long, resulting in low data transmission efficiency.
A first wireless communication channel is established with a first wireless access point using a first wireless communication mode, and a second wireless communication channel is established with a second wireless access point using a second wireless communication mode. The second wireless communication channel, which has a shorter communication distance, is prioritized when using the two wireless communication modes supported by the same communication module.
It improves the data transmission efficiency between terminal devices within a local area network and enhances the user experience of terminal devices, especially in scenarios such as screen mirroring and file transfer, by reducing data transmission latency.
Smart Images

Figure CN116193631B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of communication technology, in particular to a wireless connection method, device and electronic equipment. BACKGROUND
[0002] With the continuous development of wireless communication technology, the types of wireless communication technology supported by electronic equipment are also increasing.
[0003] After the electronic equipment accesses the wireless access point based on the wireless communication technology, data can be transmitted between the wireless access point and other communication equipment. However, there is a defect that the communication distance is large when data is transmitted between the wireless access point and other communication equipment. SUMMARY
[0004] The present application provides a wireless connection method, device and electronic equipment, as follows:
[0005] A wireless connection method, comprising:
[0006] establishing a first wireless communication channel with a first wireless access point through a first wireless communication mode;
[0007] determining a second wireless access point and access point information of the second wireless access point;
[0008] establishing a second wireless communication channel with the second wireless access point through a second wireless communication mode based on the access point information of the second wireless access point;
[0009] wherein the first wireless communication mode and the second wireless communication mode belong to two wireless communication modes supported by a first communication module;
[0010] If a first terminal device having the first communication module and a second terminal device as the second wireless access point belong to the same local area network, the communication distance of the first terminal device through the second wireless communication mode to interact data with the second terminal device is less than the communication distance of the first terminal device through the first wireless communication mode to interact data with the second terminal device.
[0011] The above method, preferably, after determining the second wireless access point and the access point information of the second wireless access point, further comprises:
[0012] setting a target parameter as a target identifier, the target identifier being used to indicate that a wireless communication channel is established based on the second wireless communication mode;
[0013] The second wireless communication channel with the second wireless access point through the second wireless communication mode based on the access point information of the second wireless access point comprises:
[0014] In response to the target parameter being the target identification, a second wireless communication channel is established with the second wireless access point based on the access point information of the second wireless access point and via the second wireless communication mode.
[0015] Preferably, the method further comprises:
[0016] In response to the target parameter being the target identification, a channel connection function in the operating system is invoked with the target delivery parameter as an input parameter, the channel connection function being a function for establishing a wireless communication channel related to the first communication module, and the target delivery parameter being a parameter for indicating the second wireless communication mode.
[0017] In response to the target delivery parameter, the second wireless communication channel is established with the second wireless access point based on the access point information of the second wireless access point and via the second wireless communication mode by the channel connection function.
[0018] Preferably, the method further comprises:
[0019] In response to the target delivery parameter, a connection manager corresponding to the second wireless communication mode is created by the channel connection function.
[0020] The second wireless communication channel is established with the second wireless access point based on the access point information of the second wireless access point and via the second wireless communication mode by the connection manager.
[0021] Preferably, the method further comprises:
[0022] The state machine is started by the connection manager.
[0023] The second wireless communication channel is established with the second wireless access point based on the access point information of the second wireless access point and via the second wireless communication mode by the state machine.
[0024] Preferably, the method further comprises:
[0025] detecting whether the first wireless communication channel is still in a connection creation state at a current time;
[0026] suspending a connection operation of the first wireless communication channel if the first wireless communication channel is in the connection creation state and the connection is not completed;
[0027] continuing the connection operation of the first wireless communication channel after confirming that the second wireless communication channel is successfully connected.
[0028] In the method, preferably, the second wireless access point and the access point information of the second wireless access point are determined by:
[0029] establishing a third wireless communication channel with the second terminal device based on a third wireless communication mode supported by the second communication module;
[0030] obtaining the access point information of the second wireless access point established by the second terminal device based on the third wireless communication channel.
[0031] In the method, preferably, the third wireless communication channel is established based on the third wireless communication mode by:
[0032] detecting a wireless broadcast message sent by the second terminal device based on the third wireless communication mode, the wireless broadcast message being used to request a connection with a terminal device supporting the second wireless communication mode;
[0033] in response to the wireless broadcast message, wirelessly connecting to the second terminal device based on the third wireless communication mode, the wireless connection request indicating that the first terminal device supports the second wireless communication mode, and the wireless connection request being able to trigger the second terminal device to create a second wireless access point corresponding to the second wireless communication mode;
[0034] establishing the third wireless communication channel with the second terminal device after detecting an approval indication of the second terminal device to the wireless connection request.
[0035] A wireless connection device comprises:
[0036] a first channel establishment unit configured to establish a first wireless communication channel with a first wireless access point through a first wireless communication mode;
[0037] an access point determination unit configured to determine a second wireless access point and access point information of the second wireless access point;
[0038] a second channel establishment unit, configured to establish a second wireless communication channel with the second wireless access access point through a second wireless communication mode based on the access point information of the second wireless access access point;
[0039] The first wireless communication mode and the second wireless communication mode belong to two wireless communication modes supported by the first communication module.
[0040] If the first terminal device with the first communication module and the second terminal device as the second wireless access access point belong to the same local area network, a communication distance at which the first terminal device is capable of interacting data with the second terminal device through the second wireless communication mode is less than a communication distance at which the first terminal device is capable of interacting data with the second terminal device through the first wireless communication mode.
[0041] An electronic device comprises:
[0042] a first communication module, configured to support a first wireless communication mode and a second wireless communication mode;
[0043] a processing module, configured to establish a first wireless communication channel with a first wireless access access point through the first wireless communication mode; determine a second wireless access access point and access point information of the second wireless access access point; and establish a second wireless communication channel with the second wireless access access point through the second wireless communication mode based on the access point information of the second wireless access access point.
[0044] If the first terminal device with the first communication module and the second terminal device as the second wireless access access point belong to the same local area network, a communication distance at which the first terminal device is capable of interacting data with the second terminal device through the second wireless communication mode is less than a communication distance at which the first terminal device is capable of interacting data with the second terminal device through the first wireless communication mode. BRIEF DESCRIPTION OF DRAWINGS
[0045] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative effort on the basis of the provided drawings.
[0046] Figure 1 A flowchart of a wireless connection method provided for the first embodiment of the present application;
[0047] Figure 2 An example diagram of establishing a wireless communication channel between terminal devices in the embodiments of the present application;
[0048] Figure 3 FIG. 1 is an example diagram of communication distances between a main WiFi channel and an auxiliary WiFi channel in an embodiment of the present application;
[0049] Figure 4 FIG. 2 is an example diagram of data transmission between a main WiFi channel and an auxiliary WiFi channel in an embodiment of the present application;
[0050] Figure 5 FIG. 3 is another flowchart of a wireless connection method provided by an embodiment of the present application;
[0051] Figure 6 FIG. 4 is a flowchart of a wireless connection method provided by an embodiment of the present application; Figure 7
[0052] Figure 8 FIG. 5 is an example diagram of transmission of different types of data between a main WiFi channel and an auxiliary WiFi channel in an embodiment of the present application;
[0053] Figure 9 FIG. 6 is a structural schematic diagram of a wireless connection apparatus provided by an embodiment of the present application;
[0054] Figure 10 FIG. 7 is a structural schematic diagram of an electronic device provided by an embodiment of the present application;
[0055] Figure 11 FIG. 8 is a flowchart of a process of establishing an auxiliary WiFi between devices in a multi-device interconnection scenario. DETAILED DESCRIPTION
[0056] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort belong to the scope of protection of the present application.
[0057] Reference Figure 1 FIG. 9 is an implementation flowchart of a wireless connection method provided by an embodiment of the present application. The method can be applied to an electronic device with a communication module, such as a first terminal device as shown in FIG. 10. The first terminal device can be a mobile phone or the like. The technical solution in the present embodiment is mainly used to improve the use experience of the terminal device. Figure 2
[0058] Specifically, the method in the present embodiment can include the following steps:
[0059] Step 101: Establish a first wireless communication channel with a first wireless access point through a first wireless communication mode.
[0060] As in a possible case, the first wireless communication mode can be a first WiFi mode, also referred to as a primary WiFi mode, the first wireless access point can be an access point AP created by a gateway device, a router or other electronic device, and the first wireless communication channel can be a first WiFi channel. Based on this, a first terminal device (such as a mobile phone) accesses the AP created by the gateway device through the gateway device connected thereto to establish a first WiFi channel, also referred to as a primary WiFi channel. Based on the primary WiFi channel, the first terminal device can access network data.
[0061] Step 102: determining a second wireless access point and access point information of the second wireless access point.
[0062] The second wireless access point can be an AP created by a second terminal device, such as shown in Figure 2 The second terminal device is a device (such as a tablet) that is different from the first terminal device and is not a gateway. For example, the first terminal device can determine the second wireless access point by scanning surrounding access points or other manners and obtain access point information of the second wireless access point.
[0063] Specifically, the access point information includes a name and an access password of the second wireless access point.
[0064] Step 103: based on the access point information of the second wireless access point, establishing a second wireless communication channel with the second wireless access point through a second wireless communication mode.
[0065] As in a possible case, the second wireless communication mode can be a second WiFi mode, also referred to as a WiFi direct mode or a secondary WiFi mode, and the second wireless communication channel can be a second WiFi channel, also referred to as a secondary WiFi channel or a WiFi direct channel.
[0066] Specifically, on the first terminal device, based on the name and the access password in the access point information, the second wireless access point is accessed through the second wireless communication mode to establish a second wireless communication channel between the first terminal device and the second terminal device that creates the second wireless access point, such as shown in Figure 2
[0067] The first wireless communication mode and the second wireless communication mode belong to two wireless communication modes supported by the first communication module. For example, the first communication module can be a WiFi module, such as a WiFi chip, etc. That is, in the case that the first terminal device has the first communication module, the first terminal device can have the first wireless communication mode and the second wireless communication mode, based on which the first terminal device can simultaneously establish the first wireless communication channel and the second wireless communication channel with other devices, respectively. For example, a mobile phone establishes a main WiFi channel with a router, and at the same time, the mobile phone establishes an auxiliary WiFi channel with a tablet.
[0068] It should be noted that if the first terminal device having the first communication module and the second terminal device as the second wireless access point belong to the same local area network, the communication distance of the first terminal device interacting with the second terminal device through the second wireless communication mode is less than the communication distance of the first terminal device interacting with the second terminal device through the first wireless communication mode.
[0069] If the first terminal device and the second terminal device belong to the same local area network, the first terminal device and the second terminal device can both connect to the first wireless access point in the first wireless communication mode, and the first terminal device also connects to the second wireless access point created by the second terminal device in the second wireless communication mode. Based on this, in the first wireless communication mode, the communication distance of the first terminal device and the second terminal device interacting with each other is the sum of the communication distance between the first terminal device and the first wireless access point and the communication distance between the second terminal device and the first wireless access point. In the second wireless communication mode, the communication distance of the first terminal device and the second terminal device interacting with each other is the spatial distance between the first terminal device and the second terminal device. That is, the first terminal device and the second terminal device perform point-to-point interaction data transmission, and thus the communication distance of the first terminal device and the second terminal device interacting with each other in the first wireless communication mode is obviously greater than the communication distance of the first terminal device and the second terminal device interacting with each other in the second wireless communication mode.
[0070] For example, taking the first terminal device as a mobile phone, the first wireless access point as a router in the local area network where the mobile phone is located, and the second terminal device as a tablet in the local area network, the tablet creates a second wireless access point, and the mobile phone and the tablet access the first wireless access point AP1 created by the router, thereby establishing a main WiFi channel on the mobile phone. Moreover, the mobile phone accesses the second wireless access point AP2 created by the tablet to establish an auxiliary WiFi channel. Thus, in the main WiFi mode, the mobile phone and the tablet realize interaction data transmission through the router, and in the auxiliary WiFi mode, the mobile phone and the tablet directly perform interaction data transmission, such as Figure 3As shown in FIG. 6, it can be seen that the communication distance L2 of the data interaction between the mobile phone and the tablet in the main WiFi mode is obviously higher than the communication distance L1 of the data interaction between the mobile phone and the tablet in the auxiliary WiFi mode.
[0071] Specifically, the first wireless communication channel can be used for the first terminal device to access network data, and the second wireless communication channel can be used for data transmission between the first terminal device and the second terminal device. For example, the mobile phone accesses Internet data through the main WiFi channel, and transmits the screen projection data to the tablet for display through the auxiliary WiFi channel, as shown in FIG. 6. Figure 4 As shown in FIG. 6, the mobile phone can transmit the screen projection data to the tablet through the communication channel with a shorter communication distance while being able to access the Internet data, thereby avoiding screen projection lag.
[0072] As can be seen from the above, in the wireless connection method provided in Embodiment One of the present application, in the case of establishing a first wireless communication channel with a first wireless access access point through a first wireless communication mode, a second wireless channel can be established with a second wireless access access point based on the determined access point information of the second wireless access access point through a second wireless communication mode. Here, the first wireless communication mode and the second wireless communication mode belong to two wireless communication modes supported by the same communication module, and if the first terminal device with the first communication module of the communication module and the second terminal device as the second wireless access access point belong to the same local area network, then the communication distance of the first terminal device to interact data with the second terminal device through the second wireless communication mode is less than the communication distance of the first terminal device to interact data with the second terminal device through the first wireless communication mode. As can be seen, in the present application, the terminal devices in the local area network can establish two wireless communication channels with different communication distances based on the same communication module, and then realize different functions based on the wireless communication channels with different communication distances, thereby improving the use experience of the terminal device.
[0073] In an implementation manner, after determining the second wireless access access point and the access point information of the second wireless access access point in step 102, the method in the present embodiment can further include the following steps, as shown in FIG. 5. Figure 5
[0074] Step 104: setting the target parameter as a target identifier, the target identifier being used to indicate that the wireless communication channel is established based on the second wireless communication mode.
[0075] Wherein, the first terminal device generates the target parameter according to the communication demand and sets the target parameter as the target identifier, so as to represent that the first terminal device needs to establish the wireless communication channel based on the second wireless communication mode, such as the auxiliary WiFi channel.
[0076] Based on this, in step 103, based on the access point information of the second wireless access access point, a second wireless communication channel is established with the second wireless access access point through the second wireless communication mode, specifically through the following way:
[0077] In response to the target parameter being the target identifier, based on the access point information of the second wireless access access point, a second wireless communication channel is established with the second wireless access access point through the second wireless communication mode.
[0078] For example, in the case where the first terminal device determines that the target parameter is the target identifier, it can be determined that a wireless communication channel needs to be established based on the second wireless communication mode. At this time, the first terminal device can start the process of establishing the second wireless communication channel. Specifically, it can include the following steps, as shown in Figure 6
[0079] Step 601: In response to the target parameter being the target identifier, the channel connection function in the operating system is called with the target delivery parameter as the input parameter.
[0080] The channel connection function is a function for establishing a wireless communication channel related to the first communication module, and the target delivery parameter is a parameter for indicating the second wireless communication mode.
[0081] For example, the channel connection function can be a channel connection function in the operating system of the first terminal device, such as the startAdditionalClientModeManage method of ActiveModeWarden, which can establish a WiFi channel.
[0082] The target delivery parameter can be represented by ROLE_CLIENT_SECONDARY_LONG_ALIVE to indicate that the channel connection function establishes a secondary second wireless communication mode.
[0083] Step 602: In response to the target delivery parameter, based on the access point information of the second wireless access access point, a second wireless communication channel is established with the second wireless access access point through the channel connection function based on the second wireless communication mode.
[0084] Specifically, step 602 can first respond to the target delivery parameter to create a connection manager corresponding to the second wireless communication mode through the channel connection function; then, based on the access point information of the second wireless access access point, a second wireless communication channel is established with the second wireless access access point through the connection manager.
[0085] For example, the ConcreteClientModeManager in the mobile phone creates the connection manager ConcreteClientModeManager by calling the startAdditionalClientModeManage method of the ActiveModeWarden with ROLE_CLIENT_SECONDARY_LONG_ALIVE as the transmission parameter, and establishes the secondary WiFi channel with the AP of the tablet according to the name and access password of the AP created by the tablet.
[0086] Specifically, when the first terminal device establishes the second wireless communication channel with the second wireless access point based on the access point information of the second wireless access point through the connection manager, the following method can be used:
[0087] First, the state machine is started through the connection manager, and then the second wireless communication channel is established with the second wireless access point in the second wireless communication mode based on the access point information of the second wireless access point through the state machine.
[0088] For example, the ConcreteClientModeManager in the mobile phone starts the idle state machine through CMD_START, and limits or clears the current processing flow of the state machine corresponding to the main Wi-Fi channel, that is, suspends the establishment of the main WiFi channel. The state machine started in the ConcreteClientModeManager establishes the secondary WiFi channel between the mobile phone and the tablet in the secondary WiFi mode.
[0089] It can be seen that in the embodiment, the access point list does not need to be established, and the access point scanning according to the list is also not needed. Instead, the channel connection function is directly called, and then the connection manager is created through the channel connection function to start the corresponding state machine, so as to establish the second wireless communication channel. Therefore, in the embodiment, the rate of channel establishment can be improved by reducing the flow in the process of establishing the second wireless communication channel.
[0090] In an implementation manner, after the second wireless access point and the access point information of the second wireless access point are determined in step 102, the embodiment can further include the following processing:
[0091] First, it is detected whether the first wireless communication channel is still in the connection creation state at the current time. If the first wireless communication channel is in the connection creation state and the connection has not been completed, the connection operation of the first wireless communication channel can be suspended until the connection of the second wireless communication channel is confirmed to be successful, and then the connection operation of the first wireless communication channel is continued.
[0092] That is, the priority of the second wireless communication channel is higher than the priority of the first wireless communication channel, after the second wireless access point is determined and the access point information of the second wireless access point is obtained on the first terminal device, the establishment of the first wireless communication channel which is not established yet is suspended, and the second wireless communication channel is established preferentially, until the second wireless communication channel is established, and then the establishment of the first wireless communication channel is continued.
[0093] For example, after the phone discovers the AP created by the tablet, the oemPain parameter indicating the establishment of the auxiliary WiFi channel is generated, and then when the oemPain parameter determines that the auxiliary WiFi channel needs to be established with the AP, if the phone is currently establishing the main WiFi channel with the AP created by the router, the establishment of the main WiFi channel is suspended, and the auxiliary WiFi channel is established preferentially, so as to preferentially realize the fast transmission of data between the phone and the tablet, and after the auxiliary WiFi channel is established, the establishment process of the main WiFi channel is continued.
[0094] In an implementation manner, the second wireless access point and the access point information of the second wireless access point are determined in step 102, and the determination is specifically implemented by the following manner, as shown in the following. Figure 7
[0095] Step 701: establishing a third wireless communication channel with the second terminal device based on a third wireless communication mode, and the third wireless communication mode is a communication mode supported by the second communication module.
[0096] For example, the second communication module can be a Bluetooth module, and the third wireless communication mode is a Bluetooth direct connection mode. Based on this, the phone establishes a Bluetooth direct connection channel with the tablet in the Bluetooth direct connection mode.
[0097] Step 702: obtaining the access point information of the second wireless access point established by the second terminal device based on the third wireless communication channel.
[0098] For example, the phone receives the name and access password of the AP established by the tablet through the Bluetooth direct connection channel between the phone and the tablet.
[0099] Specifically, in step 701, when the third wireless communication channel is established with the second terminal device based on the third wireless communication mode, the following processing is specifically included.
[0100] First, the second terminal device sends a wireless broadcast message based on the third wireless communication mode, and the wireless broadcast message is used to request to connect the terminal device supporting the second wireless communication mode;
[0101] After that, in response to the wireless broadcast message, a wireless connection request is sent to the second terminal device based on the third wireless communication mode, the wireless connection request indicates that the first terminal device supports the second wireless communication mode, and the wireless connection request can trigger the second terminal device to create a second wireless access point corresponding to the second wireless communication mode.
[0102] Finally, after detecting the consent indication of the second terminal device to the wireless connection request, a third wireless communication channel is established with the second terminal device.
[0103] That is, the low-power Bluetooth broadcast information is continuously sent on the second terminal device, that is, the wireless broadcast of the third wireless communication mode, and a broadcast identifier can be carried in the low-power Bluetooth broadcast information, which is used to indicate that a terminal device supporting the auxiliary WIFI mode is needed.
[0104] After that, the first terminal device such as a mobile phone receives the Bluetooth broadcast message and confirms that it supports the auxiliary WIFI mode. At this time, a response, that is, a wireless connection request, can be returned to the second terminal device. The response indicates that the first terminal device supports the auxiliary WIFI mode and needs to access the wireless access point of the second terminal device, and also triggers the second terminal device to create a second wireless access point. It should be noted that the wireless access point of the second terminal device can be pre-created, or the wireless access point of the second terminal device can be created after the response returned by the first terminal device is obtained.
[0105] After that, the second terminal device receives the response, and the first terminal device and the second terminal device can establish a low-power Bluetooth connection, that is, a third wireless communication channel. Based on the Bluetooth low-power connection, the first terminal device can obtain the name and access password of the wireless access point created by the second terminal device from the second terminal device.
[0106] Finally, the first terminal device accesses the wireless access point of the second terminal device based on the name and password of the wireless access point.
[0107] For example, a tablet sends a low-power Bluetooth broadcast message outward, and a broadcast identifier can be carried in the low-power Bluetooth broadcast message, which is used to indicate that a terminal device supporting the auxiliary WIFI mode is needed to be connected.
[0108] After that, the mobile phone receives the Bluetooth broadcast message broadcast by the tablet and confirms that it supports the auxiliary WIFI mode. At this time, a response message is returned to the tablet to indicate that the mobile phone supports the auxiliary WIFI mode, and also triggers the tablet to create an AP. It should be noted that the AP created by the tablet can be pre-created, or created after the response message is received.
[0109] After receiving the response message, the mobile phone and the tablet can establish a Bluetooth low energy connection, based on which the mobile phone can obtain the name and access password of the AP created by the tablet from the tablet.
[0110] After that, the mobile phone creates a connection manager ConcreteClientModeManager by calling the startAdditionalClientModeManage method of ActiveModeWarden, with ROLE_CLIENT_SECONDARY_LONG_ALIVE as the transmission parameter.
[0111] After that, the ConcreteClientModeManager in the mobile phone starts the state machine by CMD_START, and limits or clears the current processing flow of the state machine corresponding to the main Wi-Fi channel, i.e., suspends the establishment of the main Wi-Fi channel, and the state machine started by the ConcreteClientModeManager establishes the auxiliary Wi-Fi channel between the mobile phone and the tablet in the auxiliary Wi-Fi mode.
[0112] In an implementation manner, when the first terminal device transmits data to the second terminal device, the wireless communication channel used for transmitting the data can be determined according to the type of the data. For example, when the data type is a first type, the first terminal device transmits data to the second terminal device through a first wireless communication channel; when the data type is a second type, the first terminal device transmits data to the second terminal device through a second wireless communication channel.
[0113] The data type can be obtained by analyzing the data format, or can be obtained by analyzing the application program to which the data belongs.
[0114] For example, when the data type is a video type, the mobile phone directly transmits video data to the tablet through a WiFi direct channel to realize screen projection, as shown in FIG. 1. Figure 8
[0115] For another example, when the data type is a text type, the mobile phone transmits text data to the tablet through a main Wi-Fi channel through a local area network established by a router to realize file transmission.
[0116] Reference Figure 9 is a structural schematic diagram of a wireless connection device provided in Embodiment Two of the present application, which can be configured in an electronic device with a communication module, such as a first terminal device as shown in FIG. 1. Figure 2 The first terminal device can be a mobile phone or the like. The technical solution in the present embodiment is mainly used for improving the use experience of the terminal device.
[0117] Specifically, the device in the embodiment can include the following units:
[0118] The first channel establishing unit 901 is configured to establish a first wireless communication channel with a first wireless access access point through a first wireless communication mode.
[0119] The access point determining unit 902 is configured to determine a second wireless access access point and access point information of the second wireless access access point.
[0120] The second channel establishing unit 903 is configured to establish a second wireless communication channel with the second wireless access access point through a second wireless communication mode based on the access point information of the second wireless access access point.
[0121] The first wireless communication mode and the second wireless communication mode belong to two wireless communication modes supported by a first communication module.
[0122] If a first terminal device with the first communication module and a second terminal device as the second wireless access access point belong to the same local area network, a communication distance at which the first terminal device is capable of interacting data with the second terminal device through the second wireless communication mode is less than a communication distance at which the first terminal device is capable of interacting data with the second terminal device through the first wireless communication mode.
[0123] As can be seen from the above, in the wireless connection device provided in the second embodiment of the present application, in the case of establishing a first wireless communication channel with a first wireless access access point through a first wireless communication mode, a second wireless channel can be established with a second wireless access access point through a second wireless communication mode based on the determined access point information of the second wireless access access point. The first wireless communication mode and the second wireless communication mode belong to two wireless communication modes supported by the same communication module. Moreover, if a first terminal device with the first communication module and a second terminal device as the second wireless access access point belong to the same local area network, a communication distance at which the first terminal device is capable of interacting data with the second terminal device through the second wireless communication mode is less than a communication distance at which the first terminal device is capable of interacting data with the second terminal device through the first wireless communication mode. It can be seen that in the embodiment of the present application, the terminal device in the local area network can be established with two wireless communication channels with different communication distances based on the same communication module, and different functions can be realized based on the wireless communication channels with different communication distances, thereby improving the use experience of the terminal device.
[0124] In an implementation, the access point determining unit 902, after determining the second wireless access access point and the access point information of the second wireless access access point, is further configured to set the target parameter as a target identifier, the target identifier being used to indicate that the wireless communication channel is established based on the second wireless communication mode.
[0125] The second channel establishing unit 903 is specifically configured to, in response to the target parameter being the target identifier, establish a second wireless communication channel with the second wireless access access point based on the access point information of the second wireless access access point through the second wireless communication mode. For example, in response to the target parameter being the target identifier, a channel connection function in an operating system is called with a target delivery parameter as an input parameter, the channel connection function being a function for establishing a wireless communication channel related to the first communication module, the target delivery parameter being a parameter used to indicate the second wireless communication mode; in response to the target delivery parameter, a second wireless communication channel is established with the second wireless access access point based on the access point information of the second wireless access access point through the channel connection function based on the second wireless communication mode.
[0126] Specifically, the second channel establishing unit 903, in response to the target delivery parameter, establishes a second wireless communication channel with the second wireless access access point based on the access point information of the second wireless access access point through the channel connection function based on the second wireless communication mode, is specifically configured to, in response to the target delivery parameter, create a connection manager corresponding to the second wireless communication mode through the channel connection function; and establish a second wireless communication channel with the second wireless access access point through the connection manager based on the access point information of the second wireless access access point.
[0127] For example, the second channel establishing unit 903, in establishing a second wireless communication channel with the second wireless access access point based on the access point information of the second wireless access access point through the connection manager, is specifically configured to start a state machine through the connection manager; and establish a second wireless communication channel with the second wireless access access point through the state machine based on the access point information of the second wireless access access point in the second wireless communication mode.
[0128] In an implementation, the access point determining unit 902, after determining the second wireless access access point and the access point information of the second wireless access access point, is further configured to detect whether the first wireless communication channel is still in a connection creation state at a current time; if the first wireless communication channel is in the connection creation state and the connection has not been completed, suspend the connection operation of the first wireless communication channel; and after confirming that the second wireless communication channel is successfully connected, continue to perform the connection operation of the first wireless communication channel.
[0129] In an implementation, the access point determining unit 902 is specifically configured to: establish a third wireless communication channel with the second terminal device based on a third wireless communication mode, the third wireless communication mode being a communication mode supported by the second communication module; and obtain the access point information of the second wireless access access point established by the second terminal device based on the third wireless communication channel.
[0130] In an implementation, when the access point determining unit 902 establishes the third wireless communication channel with the second terminal device based on the third wireless communication mode, the access point determining unit 902 is specifically configured to: detect a wireless broadcast message sent by the second terminal device based on the third wireless communication mode, the wireless broadcast message being used to request to connect to a terminal device supporting the second wireless communication mode; in response to the wireless broadcast message, send a wireless connection request to the second terminal device based on the third wireless communication mode, the wireless connection request indicating that the first terminal device supports the second wireless communication mode, and the wireless connection request being able to trigger the second terminal device to create the second wireless access access point corresponding to the second wireless communication mode; and establish the third wireless communication channel with the second terminal device after detecting an approval indication of the second terminal device to the wireless connection request.
[0131] Reference Figure 10 An electronic device according to Embodiment Three of the present application is shown in FIG. 3. The electronic device can include the following structure. Figure 2 The electronic device can include the following structure.
[0132] The first communication module 1001 is configured to support a first wireless communication mode and a second wireless communication mode. For example, the first communication module 1001 can be a WiFi module. In addition, the electronic device can include other communication modules, such as a Bluetooth module.
[0133] The processing module 1002 is configured to: establish a first wireless communication channel with a first wireless access access point through the first wireless communication mode; determine a second wireless access access point and access point information of the second wireless access access point; and establish a second wireless communication channel with the second wireless access access point through the second wireless communication mode based on the access point information of the second wireless access access point.
[0134] If the first terminal device having the first communication module and the second terminal device serving as the second wireless access access point belong to the same local area network, a communication distance at which the first terminal device is able to interact with the second terminal device through the second wireless communication mode is less than a communication distance at which the first terminal device is able to interact with the second terminal device through the first wireless communication mode.
[0135] From the above, in the electronic device provided in Embodiment Three of the present application, in the case where the first wireless communication channel is established through the first wireless access access point by the first wireless communication mode, the second wireless channel can be established through the second wireless access access point by the second wireless communication mode based on the determined access point information of the second wireless access access point. Here, the first wireless communication mode and the second wireless communication mode belong to two wireless communication modes supported by the same communication module, and if the first terminal device with the first communication module and the second terminal device as the second wireless access access point belong to the same local area network, the communication distance of the first terminal device from the second terminal device for data interaction through the second wireless communication mode is less than the communication distance of the first terminal device from the second terminal device for data interaction through the first wireless communication mode. It can be seen that in the present application, two wireless communication channels with different communication distances can be established for the terminal device in the local area network based on the same communication module, and different functions can be realized based on the wireless communication channels with different communication distances, thereby improving the use experience of the terminal device.
[0136] In addition, the electronic device in the present embodiment can also include a storage module, a display module, an input module and the like. Of course, the electronic device can also have more or less components, and there is no limitation thereto. Figure 10
[0137] On the other hand, the present application also provides a computer readable storage medium, wherein at least one instruction, at least one program, a code set or an instruction set is stored in the computer readable storage medium, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by a processor to implement the wireless access method according to any one of the above embodiments.
[0138] The present application also provides a computer program, which includes computer instructions stored in a computer readable storage medium. When the computer program is run on an electronic device, it is used to execute the wireless access method in any one of the above embodiments.
[0139] Taking a multi-device interconnection scenario as an example, in the multi-device interconnection, the secondary WiFi connection speed of the current Android is about 6-7s to connect normally, because the secondary WiFi (i.e., auxiliary WiFi channel) connection needs to add the hotspot information WifiConfigration to NetworkSuggestions, start the BootStrapProcessor (bsp) layer to scan the surrounding hotspots, and 2 times of bsp scanning are needed from the start of connection to the completion of connection, and each time of bsp scanning result returns about 1-1.5s. If the first bsp scanning does not scan the hotspot information to be connected, the secondary WiFi connection fails, and the WifiManagerstartScan needs to be restarted.
[0140] It can be seen that the current implementation of the secondary WiFi connection is time-consuming, and the current state of the primary WiFi needs to be considered during connection. If the first bsp scanning does not scan the hotspot information, the secondary WiFi needs to be scanned multiple times to normally connect.
[0141] Therefore, the following manner is proposed in the present application:
[0142] When connecting the secondary WiFi, the WifiManagerconnect() is directly started to start the secondary WiFi (i.e., auxiliary WiFi channel, also referred to as auxiliary WiFi) connection state machine for direct connection, without considering the connection state of the primary WiFi. If the primary WiFi is in connection, the system resources are occupied and will be suspended, and the primary WiFi connection is continued after the secondary WiFi connection.
[0143] Therefore, the connection speed after adopting the scheme of the present application is 4s-5s, and even can reach 3-4s at the fastest. It is not limited by the first scanning of bsp, and the bsp can simultaneously perform WiFi hotspot scanning during the connection equipment process.
[0144] Referring to the flow shown in Figure 11 In the multi-device interconnection, the BLE broadcast is sent through the low-power Bluetooth GATT (Generic Attribute Profile) framework, and the broadcast parameter carries whether the device supports the secondary WiFi connection. When device A such as a tablet wants to connect device B such as a mobile phone, if device B supports the secondary WiFi, device A establishes a Wi-fiDirect hotspot, device B obtains the name of the WiFiDirect hotspot such as a service set identifier (ssid) and an access password (password), and connects the Wi-fiDirect hotspot of device A through the auxiliary WiFi. The specific process of establishing the secondary WiFi connection on device B is as follows:
[0145] The device B calls the connect() interface of the WifiManager, and distinguishes whether to connect the primary or secondary WiFi according to the different oemPain parameters of WifiConfigration.
[0146] If the oemPain is true, that is, the secondary WiFi needs to be connected, the channel connection function, that is, the startAdditionalClientModeManage method of the ActiveModeWarden, is called, wherein the secondary WiFi is connected through the target transmission parameter ROLE_CLIENT_SECONDARY_LONG_ALIVE, the ConcreteClientModeManager for connecting the secondary WiFi is directly created (ROLE_CLIENT_PRIMARY is connected to the primary WiFi), the idle state machine is started through CMD_START in the ConcreteClientModeManager, and the existing processing flow of the primary WiFi state machine is limited or cleared.
[0147] According to ROLE_CLIENT_SECONDARY_LONG_ALIVE, the ScanOnlyState scanning (an IP address will be assigned to the device B after the connection) is started, and the ConnectModeState secondary WiFi connection preparation is started, so that the secondary WiFi is connected after the scanning of the traditional flow to the WiFi information, and the first scanning time is saved. If the primary WiFi is also connected, the primary WiFi connection is temporarily stopped according to the secondary WiFi connection state, and the secondary WiFi connection is preferentially performed, so that the rate of establishing the secondary WiFi is further accelerated, and after the secondary WiFi connection is completed, the primary WiFi connection is continued.
[0148] It should be noted that each of the embodiments in the specification adopts a progressive manner for description, and each embodiment focuses on the difference from other embodiments, and the same and similar parts of each embodiment can be referred to. Meanwhile, the features recorded in each embodiment in the specification can be replaced or combined, so that the person skilled in the art can realize or use the present application. For the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the related parts are referred to the part of the method embodiment.
[0149] Finally, it should be noted that, in this document, the term "only" is used simply to contrast with another entity or action, and does not necessarily require or imply that there is any such actual relationship or order between the entities or actions. Also, the terms "comprises", "comprising", or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can also include other elements not expressly listed or inherent to such process, method, article, or apparatus. An element proceeded by "comprises... a" does not, without more constraints, exclude the existence of additional identical elements in the process, method, article, or apparatus that comprises the element.
[0150] The above description of disclosed embodiments provides enabling teaching for making or using the application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein can be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
[0151] The above is only the preferred embodiment of the present application, it should be noted that, for those skilled in the art, without departing from the principles of the present application, can make a number of improvements and refinements, these improvements and refinements should also be considered as the protection scope of the present application.
Claims
1. A method for wireless connection, comprising: establishing a first wireless communication channel with a first wireless access point via a first wireless communication mode; determining a second wireless access point and access point information of the second wireless access point; establishing a second wireless communication channel with the second wireless access point via a second wireless communication mode based on the access point information of the second wireless access point; creating a connection manager via a channel connection function to initiate a corresponding state machine, and enabling the establishment of the second wireless communication channel based on the access point information and the state machine; wherein the first wireless communication mode and the second wireless communication mode belong to two wireless communication modes supported by a first communication module; if a first terminal device having the first communication module and a second terminal device as the second wireless access point belong to a same local area network, a communication distance at which the first terminal device is capable of interacting data with the second terminal device via the second wireless communication mode is less than a communication distance at which the first terminal device is capable of interacting data with the second terminal device via the first wireless communication mode. 2.The method of claim 1, after determining the second wireless access point and the access point information of the second wireless access point, further comprising: setting a target parameter as a target identifier, the target identifier being used to indicate the establishment of the wireless communication channel based on the second wireless communication mode; the establishing of the second wireless communication channel with the second wireless access point via the second wireless communication mode based on the access point information of the second wireless access point comprises: in response to the target parameter being the target identifier, establishing the second wireless communication channel with the second wireless access point via the second wireless communication mode based on the access point information of the second wireless access point. 3.The method of claim 2, the establishing of the second wireless communication channel with the second wireless access point via the second wireless communication mode based on the access point information of the second wireless access point in response to the target parameter being the target identifier comprises: in response to the target parameter being the target identifier, calling a channel connection function in an operating system with a target delivery parameter as an input parameter, the channel connection function being a function for establishing a wireless communication channel related to the first communication module, the target delivery parameter being a parameter for indicating the second wireless communication mode; in response to the target delivery parameter, establishing the second wireless communication channel with the second wireless access point via the channel connection function based on the second wireless communication mode based on the access point information of the second wireless access point. 4.The method of claim 3, the establishing of the second wireless communication channel with the second wireless access point via the channel connection function based on the second wireless communication mode based on the access point information of the second wireless access point in response to the target delivery parameter comprises: in response to the target delivery parameter, creating a connection manager corresponding to the second wireless communication mode via the channel connection function. establish, by the connection manager, a second wireless communication channel with the second wireless access point based on the access point information of the second wireless access point.
5. The method of claim 4, wherein the establishing, by the connection manager, the second wireless communication channel with the second wireless access point based on the access point information of the second wireless access point comprises: starting a state machine by the connection manager; establishing, by the state machine, the second wireless communication channel with the second wireless access point based on the access point information of the second wireless access point using the second wireless communication mode.
6. The method of claim 1, wherein after determining the second wireless access point and the access point information of the second wireless access point, the method further comprises: detecting whether the first wireless communication channel is still in a connection creation state at a current time; suspending a connection operation of the first wireless communication channel if the first wireless communication channel is in the connection creation state and the connection has not been completed; resuming the connection operation of the first wireless communication channel after confirming that the second wireless communication channel is successfully connected.
7. The method of claim 1, wherein the determining the second wireless access point and the access point information of the second wireless access point comprises: establishing a third wireless communication channel with a second terminal device based on a third wireless communication mode, the third wireless communication mode being a communication mode supported by a second communication module of the first terminal device; and obtaining the access point information of the second wireless access point established by the second terminal device based on the third wireless communication channel.
8. The method of claim 7, wherein the establishing the third wireless communication channel based on the third wireless communication mode comprises: detecting a wireless broadcast message sent by the second terminal device based on the third wireless communication mode, the wireless broadcast message being used to request a connection with a terminal device supporting the second wireless communication mode; in response to the wireless broadcast message, sending a wireless connection request to the second terminal device based on the third wireless communication mode, the wireless connection request indicating that the first terminal device supports the second wireless communication mode, and the wireless connection request being able to trigger the second terminal device to create the second wireless access point corresponding to the second wireless communication mode; and establishing the third wireless communication channel with the second terminal device after detecting an indication of consent to the wireless connection request sent by the second terminal device.
9. A wireless connection apparatus, comprising: a first channel establishing unit configured to establish a first wireless communication channel with a first wireless access point based on a first wireless communication mode; an access point determining unit configured to determine a second wireless access point and access point information of the second wireless access point; a second channel establishing unit configured to establish a second wireless communication channel with the second wireless access point based on the access point information of the second wireless access point using a second wireless communication mode. The connection manager is created by a channel connection function to start a corresponding state machine, and based on the access point information and the state machine, the establishment of the second wireless communication channel is implemented. The first wireless communication mode and the second wireless communication mode belong to two wireless communication modes supported by the first communication module. If the first terminal device with the first communication module and the second terminal device as the second wireless access access point belong to the same local area network, the communication distance of the first terminal device from the second terminal device through the second wireless communication mode is less than the communication distance of the first terminal device from the second terminal device through the first wireless communication mode.
10. An electronic device comprising: A first communication module for supporting a first wireless communication mode and a second wireless communication mode; A processing module for establishing a first wireless communication channel with a first wireless access access point through the first wireless communication mode; Determining a second wireless access access point and access point information of the second wireless access access point; Based on the access point information of the second wireless access access point, a second wireless communication channel is established with the second wireless access access point through the second wireless communication mode; The connection manager is created by a channel connection function to start a corresponding state machine, and based on the access point information and the state machine, the establishment of the second wireless communication channel is implemented. If the first terminal device with the first communication module and the second terminal device as the second wireless access access point belong to the same local area network, the communication distance of the first terminal device from the second terminal device through the second wireless communication mode is less than the communication distance of the first terminal device from the second terminal device through the first wireless communication mode.
Citation Information
Patent Citations
Method and equipment for equipment information interaction between terminals
CN112118539A
Method for data transmission and related products
US20200260513A1