Disclosure of Invention
In view of this, the present disclosure provides a wireless network connection method and apparatus, an electronic device, and a storage medium.
In a first aspect, the present application provides a wireless network connection method, which may include:
monitoring a first broadcast message on a Bluetooth broadcast channel, wherein the first broadcast message carries first identification information of second equipment and a first connection key for accessing the second equipment;
and establishing wireless fidelity WiFi connection with the second equipment according to the first identification information and the first connection key.
In some possible embodiments, the method further comprises:
according to the first identification information and the first connection key, performing a preliminary operation of establishing WiFi connection with the second equipment;
establishing WiFi connection with the second equipment according to the first identification information and the first connection key, wherein the WiFi connection comprises the following steps:
determining a target device to be connected with the first device by WiFi from the second device;
when the target equipment is determined, if the execution of the preparation operation is completed, establishing WiFi connection with the second equipment based on the execution result of the preparation operation;
And when the target equipment is determined, if the preparation operation is not executed, executing the preparation operation, and after the execution of the preparation operation is finished, establishing WiFi connection with the second equipment based on the execution result of the preparation operation.
In some possible embodiments, the method further comprises:
monitoring a first broadcast message on a Bluetooth broadcast channel and monitoring a second broadcast message on a WiFi broadcast channel, wherein the second broadcast message carries second identification information of second equipment;
determining, from the second device, a target device to establish a WiFi connection with the first device, including:
displaying a connection prompt according to the second broadcast message; the connection prompt comprises: second identification information of one or more second devices scanned on the WiFi broadcast channel;
and determining a target device to be connected with the first device by WiFi from the plurality of second devices when the confirmation indication acting on the connection prompt is detected.
In some possible embodiments, the preliminary operation comprises at least one of:
mutual authentication between the first device and the second device;
capability information interaction between the first device and the second device.
In some possible implementations, determining, from the second device, a target device to establish a WiFi connection with the first device includes: determining the distance between the first equipment and each second equipment according to the signal intensity of the WiFi signal and/or the Bluetooth signal of the second equipment;
And selecting a target device from the second devices according to the distance.
In some possible embodiments, the method further comprises:
and stopping the execution of the preparation operation between the first device and any one of the second devices except the target device when the target device is determined.
In a second aspect, the present application provides a wireless network connection method performed by a second device, including:
broadcasting a first broadcast message on a Bluetooth broadcast channel, wherein the first broadcast message carries identification information of a second device and a connection key for accessing the second device;
and receiving a wireless fidelity WiFi connection request sent by the first equipment, and establishing WiFi connection with the first equipment.
In some possible embodiments, the method further comprises:
and broadcasting a second broadcast message on the WiFi broadcast channel while broadcasting the first broadcast message on the Bluetooth broadcast channel, wherein the second broadcast message carries the identification information of the second device.
In a third aspect, the present application provides a wireless network connection device, for application to a first apparatus, comprising a number of functional units for implementing any one of the methods of the first aspect. The wireless network connection device includes:
The first monitoring module is used for monitoring a first broadcast message on a Bluetooth broadcast channel, wherein the first broadcast message carries first identification information of the second equipment and a first connection key accessed to the second equipment;
and the WiFi connection module is used for establishing wireless fidelity WiFi connection with the second equipment according to the first identification information and the first connection key.
In some possible embodiments, the apparatus further comprises:
the first execution module is used for executing the preparation operation of establishing WiFi connection with the second equipment according to the first identification information and the first connection key;
WiFi connection module still includes: the first determining module is used for determining target equipment to be connected with the first equipment through WiFi from the second equipment;
WiFi connection module specifically is used for: when the target equipment is determined, if the execution of the preparation operation is completed, establishing WiFi connection with the second equipment based on the execution result of the preparation operation; and when the target equipment is determined, if the preparation operation is not executed, executing the preparation operation, and after the execution of the preparation operation is finished, establishing WiFi connection with the second equipment based on the execution result of the preparation operation.
In some possible embodiments, the apparatus further comprises:
The second monitoring module is used for monitoring the first broadcast message on the Bluetooth broadcast channel and monitoring the second broadcast message on the WiFi broadcast channel, wherein the second broadcast message carries second identification information of the second equipment;
the first determining module is specifically configured to: displaying a connection prompt according to the second broadcast message; the connection prompt comprises: second identification information of one or more second devices scanned on the WiFi broadcast channel; and determining a target device to be connected with the first device by WiFi from the plurality of second devices when the confirmation indication acting on the connection prompt is detected.
In some possible embodiments, the preliminary operation comprises at least one of:
mutual authentication between the first device and the second device;
capability information interaction between the first device and the second device.
In some possible embodiments, the first determining module is specifically configured to: determining the distance between the first equipment and each second equipment according to the signal intensity of the WiFi signal and/or the Bluetooth signal of the second equipment; and selecting a target device from the second devices according to the distance.
In some possible embodiments, the apparatus further comprises:
And the execution stopping module is used for stopping the execution of the preparation operation between the first equipment and any one of the second equipment except the target equipment when the target equipment is determined.
In a fourth aspect, the present application provides a wireless network connection apparatus, applied to a second device, including:
the first broadcasting module is used for broadcasting a first broadcasting message on a Bluetooth broadcasting channel, wherein the first broadcasting message carries identification information of the second equipment and a connection key for accessing the second equipment;
and the receiving module is used for receiving the wireless fidelity WiFi connection request sent by the first equipment and establishing WiFi connection with the first equipment.
In some possible embodiments, the apparatus further comprises:
and the second broadcasting module is used for broadcasting the second broadcasting message on the WiFi broadcasting channel while broadcasting the first broadcasting message on the Bluetooth broadcasting channel, wherein the second broadcasting message carries the identification information of the second equipment.
In a fifth aspect, the present application further provides an electronic device, including:
a memory for storing processor-executable instructions;
a processor; wherein the processor is configured to: for executing executable instructions, implementing the method as the first or second aspect and possible implementation thereof.
In a sixth aspect, the present application provides a computer readable storage medium storing an executable program, wherein the executable program when executed by a processor implements a method as in the first or second aspect and possible implementations thereof.
Compared with the prior art, the technical scheme provided by the embodiment of the application has the beneficial effects that:
in the application, the AP may send the WiFi broadcast message through the WiFi broadcast channel, and simultaneously may send the first broadcast message carrying the first identification information of the AP and the first connection key of the access second device through the bluetooth broadcast channel. As such, the other device monitors for a first broadcast message broadcast by the AP on the bluetooth broadcast channel; when an access available AP exists according to the WiFi broadcast channel monitoring result, the first identification information and the first connection key can be acquired according to the first broadcast channel, and wireless fidelity WiFi connection with the second device is started. Therefore, the first identification information and the corresponding login key are directly acquired through the Bluetooth broadcast channel, when the second equipment to be connected is scanned, the WiFi connection process with the second equipment is started, the connection is not required to be established after the user selects the target equipment, the operation flow of the user is reduced, and the user experience is improved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Detailed Description
In the following description, reference is made to the accompanying drawings which form a part hereof and which show by way of illustration specific aspects in which embodiments of the application may be practiced. It is to be understood that the embodiments of the present application may be used in other respects and may include structural or logical changes not depicted in the drawings. The following detailed description is, therefore, not to be taken in a limiting sense, and the scope of the present application is defined by the appended claims. For example, it should be understood that the disclosure in connection with the described methods may be equally applicable to a corresponding apparatus or device for performing the methods, and vice versa. For example, if one or more specific method steps are described, the corresponding apparatus may comprise one or more units, such as functional units, to perform the one or more described method steps (e.g., one unit performing one or more steps, or multiple units each performing one or more of the multiple steps), even if such one or more units are not explicitly described or illustrated in the figures. On the other hand, if a specific apparatus is described based on one or more units such as a functional unit, for example, the corresponding method may include one step to perform the functionality of the one or more units (e.g., one step to perform the functionality of the one or more units, or multiple steps each to perform the functionality of one or more units, even if such one or more steps are not explicitly described or illustrated in the figures). Further, it is to be understood that features of the various exemplary embodiments and/or aspects described herein may be combined with each other, unless explicitly stated otherwise.
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Fig. 1 is a schematic flow chart of an embodiment of a wireless network connection method in the embodiments of the present application, where the wireless network connection method may be performed by a first device, and referring to fig. 1, the wireless network connection method may include:
s101, monitoring a first broadcast message on a Bluetooth broadcast channel; the first broadcast message carries first identification information of the second device and a first connection key for accessing the second device.
And S102, establishing wireless fidelity WiFi connection with the second equipment according to the first identification information and the first connection key.
The first device and the second device in the embodiments of the present application may be an intelligent terminal having functions of WiFi hotspot broadcasting, bluetooth broadcasting, and receiving corresponding broadcast signals. For example, a device such as a smart phone, tablet computer or computer.
The first identification information is generated according to a certain preset rule according to the identification of the second equipment and is used for identity authentication when WiFi connection is established between the equipment. For example, the first identification information may be a service set identification (service set identifier, SSID). Alternatively, the first identification may also be a basic service set (basic service set identifier, BSSID), a service identification number (extended service set identifier, ESSID), etc.
For example, taking the first identification information as an SSID as an example, the first device is used as a scanner device, the second device is used as a broadcaster device, and in the WiFi connection process, the connection stage affects the user experience process, except for the scanning stage of the scanner, mainly in the connection authentication process of the scanner device and the target AP of the broadcaster device. If the target AP sets that the connection key is required for identity authentication, the scanner equipment only can acquire the SSID through WiFi scanning, but cannot acquire the corresponding connection key. Therefore, when establishing the WiFi connection, if the target device to be connected sets a key to perform identity authentication, the process of establishing the WiFi connection with the target device needs to be started after the user selects the target device to be connected and obtains the connection key.
In this embodiment of the present application, through bluetooth scanning, the first device may not only obtain, through bluetooth scanning, an SSID corresponding to a target AP to be connected, but also obtain, at the same time, a corresponding connection key broadcasted by the AP on a bluetooth broadcast channel. After the first identification information and the first connection key are acquired, the WiFi connection establishment process with the corresponding second equipment is directly triggered, the user does not need to wait for selection, connection authentication with the target equipment AP is directly started, and the connection efficiency is improved, so that the user can directly connect successfully when confirming the connection of the target equipment, the time in the connection process can be effectively saved, the connection efficiency is improved, and the user experience is improved.
In one embodiment, a first device may simultaneously listen for a first broadcast message broadcast by one or more second devices.
Based on this, the above method may further include: and the first equipment executes preparation operation for establishing WiFi connection with one or more second equipment according to the acquired first identification information and the first connection key.
The preliminary operation may be: any operation prior to establishing a WiFi connection between a first device and a second device, including but not limited to at least one of:
Mutual authentication between the first device and the second device;
capability information interaction between the first device and the second device.
It is to be appreciated that the process of WiFi connection establishment can include a scanning phase, an authentication phase, an association phase.
The scanning phase is used for the scanner device to discover the AP that can be connected, i.e. the discovery process of the network to be connected. The scanner device discovers surrounding connectable APs by monitoring broadcast messages sent by the APs on channels supported by the scanner device, wherein the broadcast messages carry the identification information of the APs and/or connection keys for accessing the APs.
The authentication stage is used for authenticating whether the determined target network can be connected, namely, performing identity authentication. Authentication is performed, for example, by setting an authentication key or the like.
In the association phase, the scanner device sends network status information to the AP to confirm whether the scanner device matches the AP and whether the AP can be accessed. For example, the network status information may be used to indicate the type of network to which the connection is to join and/or capability information of the device, etc., and the AP confirms whether the network status information of the device matches, and thus confirms whether the device is capable of accessing the network.
In this embodiment, step S101 may include a scanning stage in the WiFi connection process, and the preparation operation may include the authentication stage and the association stage.
The execution sequence of the authentication phase and the association phase may be exchanged, for example, after the scanner device scans the AP to be connected, key authentication may be performed first, and then it may be verified whether the network state information of the scanner device is matched; or, after the network state information of the scanner device is successfully matched, the identity authentication can be performed through the secret key.
In the embodiment of the application, after the first device obtains the first identification information and the corresponding first connection key through bluetooth scanning, the first device directly executes the authentication and association phase process of the WiFi connection process, so that the waiting time in the connection process is saved, and the connection efficiency is improved. Based on this, as shown in fig. 2, the step S102 may include:
s201, determining a target device to be connected with the first device through WiFi from the second device;
s202, when the target equipment is determined, if the execution of the preparation operation is completed, establishing WiFi connection with the second equipment based on the execution result of the preparation operation; and/or the number of the groups of groups,
and S203, when the target equipment is determined, if the preparation operation is not executed, executing the preparation operation, and after the execution of the preparation operation is finished, establishing WiFi connection with the second equipment based on the execution result of the preparation operation.
In one embodiment, the preliminary operation not performed may be: the execution of the authentication phase and/or the association phase described above in the preliminary operation is not completed temporarily.
It will be appreciated that the first device, upon discovery of the one or more second devices to be connected via the scanning phase, begins performing a preliminary operation procedure with the one or more second devices. The authentication phase and/or the association phase need to be passed, and each phase needs to be executed for a certain execution time. In the case where the target device determines that the authentication phase and/or the association phase are not performed, the execution of the preliminary operation may be waited. For example: in the case where the authentication phase is performed before the association phase, the preliminary operation may not be performed: the authentication phase is also in the middle of the execution, the association phase has not yet been performed. Or may also be: the authentication phase is executed completely, and the association phase is also in the process of execution. In the case of performing the association phase and then performing the authentication phase, the preliminary operation may not be performed: the association phase is also in the middle of the execution, the authentication phase has not yet been performed. Or may also be: the association phase is executed, and the authentication phase is also in the process of execution.
In another embodiment, the preliminary operation not performed may also be: the authentication phase and/or the association phase in the preliminary operation fail to be executed.
Specifically, in the case where the authentication phase is performed before the association phase, the preliminary operation may not be performed: the authentication phase fails to execute and the association phase has not yet started executing. Or may also be: the authentication phase has been successfully executed and the association phase has failed to be executed. In the case of performing the association phase and then performing the authentication phase, the preliminary operation may not be performed: the association phase fails to execute and the authentication phase has not yet started executing. Or may also be: the association phase has been successfully executed and the authentication phase has failed to be executed.
It may be appreciated that the authentication phase involves a process of identity authentication, for example, authentication by setting an authentication key, where it is required to verify whether a first connection key acquired by a first device is consistent with a current connection key of a second device to be connected, and if the connection keys are inconsistent, execution failure of the authentication phase may result.
Illustratively, the first broadcast message received by the first device carries a first connection key for accessing the second device, and the second device modifies its corresponding connection key after broadcasting the first broadcast message. At this time, when the first device performs identity authentication through the currently acquired first connection key, it may be displayed that the first connection key is inconsistent with the current connection key of the second device, thereby causing authentication failure. In this case, since the failure of the authentication phase is only caused by the inconsistent keys, the authentication process may be reinitiated by again listening to the broadcast message sent by the second device to obtain the corresponding first connection key. For example, a threshold value of the number of times of reinitialization may be preset in advance, and if the threshold value of the number of times is exceeded or authentication failure is displayed, it is determined that the authentication process of the preliminary operation fails.
And a process of verifying whether the network state information is matched is involved in the association phase. For example, a first device sends network status information to a second device, which determines whether the network status information matches. When the network status information does not match, a failure of the association phase execution may occur. For example, the network state information indicates a type of network to which the first device is to join that is inconsistent with the type of network provided by the second device. And/or the network status information indicates that the device capability information of the first device does not match the capability information requirement of the access device by the network provided by the second device.
In this embodiment of the present application, when determining the target device, if the preliminary operation is performed, the first device may directly establish WiFi connection with the second device according to the result of performing the preliminary operation. If the preparation operation is still in the execution process, the WiFi connection with the second device is only required to be established after the preparation operation is completed, and the preparation operation process is not required to be restarted, so that the waiting time in the connection process can be reduced. In addition, since the preliminary operation involves a verification process of whether the identity authentication and/or network state information of the first device are matched when accessing the second device, if the authentication phase and/or the scanning phase fails to be executed, it indicates that the first device is not suitable for accessing the network provided by the corresponding second device. Therefore, by the preliminary operation, the partially unsuitable second devices can also be screened out in advance, and the discovery process of the second devices can be optimized.
In one embodiment, the method may further include: while listening to the first broadcast message on the bluetooth broadcast channel, listening to the second broadcast message on the WiFi broadcast channel.
The second broadcast message carries second identification information of the second device. The second identification information may include a name in addition to the SSID indicating the first identification information. The second identification information may be generated according to a device characteristic of the second device, for example, the second identification information may be a device model number of the second device, or the like. Or the second identification information can also be any character which is input by a user in a customized way and accords with a certain rule. For example, the second identification information may be any format character within 32-bit characters.
It can be understood that, in the above process of performing the preliminary operation, the second device to be connected sets an authentication key to perform identity authentication, and in the authentication stage, it needs to be verified whether the first connection key acquired by the first device is consistent with the current authentication key of the second device to be connected. The authentication key is a key for identity authentication set by the second device when the preparation operation is executed, the first connection key is a key used for formally establishing WiFi connection with the second device when the first device completes the preparation operation. Therefore, the first device needs to acquire the first connection key based on bluetooth scanning before performing the preliminary operation. And for the second device not provided with the authentication key, the first device can directly perform authentication without acquiring the first connection key. At this time, the first device may also trigger execution of the preliminary operation based on the WiFi scan.
Based on this, in one embodiment, when the second device does not set the authentication key, the method may further include: and the first equipment executes preparation operation for establishing WiFi connection with one or more second equipment according to the acquired second identification information.
The first device monitors second broadcast messages broadcast by one or more second devices on the WiFi broadcast channel at the same time, and obtains second identification information of the one or more second devices from the second broadcast messages. And executing the authentication phase and the association phase of the WiFi connection process with the corresponding second equipment respectively based on the acquired one or more pieces of second identification information.
In another embodiment, when the second device does not set the authentication key, the method may further include: and the first equipment executes preparation operation for establishing WiFi connection with one or more second equipment according to the acquired first identification information and second identification information.
Specifically, taking the SSID as an example of the first identification information and the SSID as the second identification information. The first device monitors a first broadcast message on a Bluetooth channel and monitors a second broadcast message on a WiFi channel respectively, and obtains SSIDs of one or more second devices from the first broadcast message and the second broadcast message. And de-duplicating the SSID obtained in the two modes, and executing the authentication stage and the association stage of the WiFi connection process based on the de-duplicated SSID and the corresponding second equipment.
In this embodiment, the first device may simultaneously scan and discover the second device to be connected based on two scanning modes of WiFi scanning and bluetooth scanning, so as to improve scanning efficiency, speed up discovery time for the second device to be connected, and further improve efficiency of performing preparation operation.
In other possible embodiments, when the second device sets the authentication key, the first device may directly perform the preliminary operation without acquiring the first connection key.
In one embodiment, the authentication key set by the second device is a fixed key.
For example, taking the first identification information and the second identification information as SSID, the first device stores a fixed key in advance, when one or more SSIDs broadcasted by the second device are obtained based on bluetooth scanning and/or WiFi scanning, the first device performs the authentication phase and the association phase of the WiFi connection process with the corresponding second device respectively, and when performing identity authentication in the authentication phase, the first device directly performs trial authentication with the pre-stored fixed key. And when the authentication is not passed, acquiring the first connection key in the second broadcast message based on Bluetooth scanning for authentication.
In another embodiment, the authentication key set by the second device is a fixed format key.
Illustratively, taking the first identification information and the second identification information as SSID examples, a relationship function between the SSID and the first connection key is stored in the first device. When the SSID broadcasted by one or more second devices is acquired based on Bluetooth scanning and/or WiFi scanning, corresponding first connection keys are calculated based on the acquired SSID and the relation function respectively. During the authentication phase of performing the preliminary operation, the first connection key obtained using the calculation attempts to perform an identity procedure with the corresponding second device, respectively. And when the authentication is not passed, acquiring the first connection key in the second broadcast message based on Bluetooth scanning for authentication.
Fig. 3 is a schematic flow chart of an embodiment of selecting a target device in the embodiments of the present application, and referring to fig. 3, the method may include:
s301, displaying a connection prompt according to the second broadcast message;
and S302, when a confirmation instruction acting on the connection prompt is detected, determining a target device to be connected with the first device through WiFi from a plurality of second devices.
Wherein, the connection suggestion includes: second identification information of the one or more second devices scanned over the WiFi broadcast channel.
The first device acquires the second identification information carried in the second broadcast message after monitoring the second broadcast message on the WiFi broadcast channel, displays the acquired one or more pieces of second identification information on a display interface of the first device, and determines a second device corresponding to the selected second device identification as a target device based on a selection operation of a user.
In one embodiment, the order of the second identification information in the displayed connection prompt may be ordered based on the WiFi signal strength order of the second device corresponding to the second identification information.
It will be appreciated that the closer the scanner device is to the broadcaster device, the higher the signal strength of the broadcaster will be monitored. When the target equipment to be connected is selected, the second identification information is displayed in the range which is closer to the target equipment, so that the second identification information displayed preferentially is more likely to be selected based on the signal intensity sequence of the broadcasting party receiving the broadcast message, a user can conveniently and quickly find the target equipment to be connected, and the user experience is improved.
In one embodiment, the plurality of second identification information in the connection hint may also be determined concurrently from the first broadcast message and the second broadcast message.
For example, taking the first identification information and the second identification information as SSID, the first device monitors the first broadcast message and the second broadcast message at the same time, and obtains the SSID of the second device carried in the first broadcast message and the SSID of the second device carried in the second broadcast message respectively. And performing de-duplication on the acquired SSID, and displaying the de-duplicated SSID on a display interface of the first device.
In this embodiment of the application, carry out two kinds of scanning modes of wiFi scanning and bluetooth scanning simultaneously, confirm the connection prompt message jointly, scanning efficiency is higher, can obtain the connection prompt message more quick.
In one embodiment, determining, from the second device, the target device to establish the WiFi connection with the first device may further include:
determining the distance between the first equipment and each second equipment according to the signal intensity of the WiFi signal and/or the Bluetooth signal of the second equipment;
and selecting a target device from the second devices according to the distance.
In one embodiment, the first device determines a distance between the first device and the second device based on the WiFi signal strength.
Specifically, in the process of performing WiFi scanning, the first device acquires the WiFi signal strength of the second device of the broadcasting party at the same time. For example, the WiFi signal strength may be a corresponding second device WiFi received signal strength indication (Received Signal Strength Indication, RSSI). The distance between the first device and each second device is determined based on a calculation function of the RSSI and the distance of the WiFi.
In one embodiment, the first device determines a distance between the first device and the second device based on bluetooth signal strength.
Specifically, the first device acquires the bluetooth signal strength of the second device of the broadcasting party at the same time in the bluetooth scanning process. For example, the RSSI value of the bluetooth signal, and the distance between the first device and each second device is determined based on a calculated function of the RSSI and distance of bluetooth.
In one embodiment, the first device determines a distance between the first device and the second device based on both the WiFi signal strength and the bluetooth signal strength.
Specifically, a relationship coefficient between bluetooth signal strength and WiFi signal strength is calculated first. The first equipment simultaneously performs WiFi scanning and Bluetooth scanning, and simultaneously acquires WiFi signal intensity and Bluetooth signal intensity of the corresponding second equipment. And converting the WiFi signal intensity value and the Bluetooth signal intensity value into uniform WiFi signal intensity values or Bluetooth signal intensity values based on the relation coefficient. And then determining the distance between the first device and each second device by using a calculation function of the signal intensity and the distance based on the converted signal intensity value.
Taking the RSSI of the WiFi signal intensity and the RSSI of the Bluetooth signal intensity as an example, assuming that the conversion coefficient of the RSSI of the Bluetooth signal intensity is X, after the first device obtains the WiFi signal intensity and the Bluetooth signal intensity of each second device, multiplying the RSSI of the Bluetooth signal by the conversion coefficient X, and determining the distance between the first device and each second device based on the converted unified calculation function of the RSSI of the WiFi signal intensity and the distance.
In one embodiment, the method may further include:
when the target device is determined, execution of the preliminary operation between the first device and any one of the second devices other than the target device is stopped.
It will be appreciated that after the determination of the target device to be connected, no further provision for establishing a WiFi connection with a second device other than the target device is required. Then, at this time, no matter whether or not the device performing the preliminary operation is the target device, the second device other than the target device does not need to perform the preliminary operation. Thus, after the target device is determined, the preparatory operation with any other device is stopped.
In one embodiment, after the first device establishes the WiFi connection with the second device, the method may further include:
the first device establishes a message channel with a second device that establishes a WiFi connection.
In particular, the message channel is used as a file transfer channel between devices. After establishing WiFi connection between the first equipment and the second equipment, when file transmission is needed, a message channel is established between the first equipment and the second equipment to carry out file information transmission interaction. After the message channel is established, the first device and the second device can directly realize end-to-end communication. When the file is transmitted, any one of the first device and the second device can write the file to be transmitted into the message channel, and the other device reads the information from the message channel, so that quick interaction between the devices is realized. The transmission file may be any type of file such as an audio file, a video file, a text file, and the like.
For example, the message channel may be a Socket, which is an abstraction of an endpoint that communicates bi-directionally between application processes on different hosts in the network. One socket is the end of the network where processes communicate, providing a mechanism for application layer processes to exchange data using network protocols.
In the embodiment of the application, a first broadcast message is monitored on a Bluetooth broadcast channel, wherein the first broadcast message carries first identification information of a second device and a first connection key for accessing the second device; and establishing wireless fidelity WiFi connection with the second equipment according to the first identification information and the first connection key. In this way, the first identification information and the corresponding login key are directly acquired through the Bluetooth broadcast channel, and when the second equipment to be connected is scanned, the WiFi connection process with the second equipment is started, and the connection is not required to be established after the user selects the target equipment. And the operation flow of the user is reduced, and the user experience is improved.
Fig. 4 is a flowchart of another embodiment of a wireless network connection method in the embodiment of the present application, which is applied to the second device shown in fig. 1, and is shown in fig. 4, where the wireless network connection method may include:
S401, broadcasting a first broadcast message on a Bluetooth broadcast channel, wherein the first broadcast message carries identification information of a second device and a connection key for accessing the second device;
s402, receiving a wireless fidelity WiFi connection request sent by the first equipment, and establishing WiFi connection with the first equipment.
In one embodiment, the second device periodically broadcasts the first broadcast message on a bluetooth broadcast channel.
For example, a broadcast period of the first broadcast message broadcast by the second device may be preset in advance, for example, the broadcast period is defaulted to a value of 100 ms, that is, the second device broadcasts the connection key that carries the identification information of the second device and accesses the second device on the bluetooth broadcast channel every 100 ms.
In one embodiment, the method may further include:
and broadcasting a second broadcast message on the WiFi broadcast channel while broadcasting the first broadcast message on the Bluetooth broadcast channel, wherein the second broadcast message carries the identification information of the second device.
Specifically, the second device broadcasts the first broadcast message on the bluetooth broadcast channel with a preset broadcast period, and takes the broadcast period as 100 ms as an example, and the second device broadcasts the second broadcast message on the WiFi broadcast channel while broadcasting the first broadcast message on the bluetooth broadcast channel once every 100 ms.
In the embodiment of the application, a first broadcast message is monitored on a Bluetooth broadcast channel, wherein the first broadcast message carries first identification information of a second device and a first connection key for accessing the second device; and establishing wireless fidelity WiFi connection with the second equipment according to the first identification information and the first connection key. In this way, the first identification information and the corresponding login key are directly acquired through the Bluetooth broadcast channel, and when the second equipment to be connected is scanned, the WiFi connection process with the second equipment is started, and the connection is not required to be established after the user selects the target equipment. And the operation flow of the user is reduced, and the user experience is improved.
The wireless network connection method will be described in detail with reference to the following examples.
The WiFi connection procedure needs to be performed sequentially including: the broadcasting party creates an AP based on an SSID of a certain preset rule and performs WiFi broadcasting, the scanning party scans the AP through WiFi, the scanning party selects a target AP to be connected after acquiring an AP scanning result, the scanning party performs authentication based on scanning or password input and other modes to start establishing WiFi connection, and after establishing WiFi connection is successful, the scanning party establishes message channel logic connection with the broadcasting party.
Fig. 5 is a schematic diagram of a wireless network connection flow. See the scheme shown in fig. 5, where: the scanner can only find the device to be connected through WiFi scanning, the WiFi scanning cannot acquire a connection key for identity authentication in the WiFi connection process, and meanwhile, the scanner only starts to trigger the WiFi connection process after determining the AP to be connected. The connection time required in the WiFi connection process is long, resulting in poor user experience.
Based on the above-mentioned problems, fig. 6 is a flow chart of a wireless network connection method in the embodiment of the present application, and see fig. 6 for a schematic diagram: taking a first device as a scanner and a second device as a broadcaster as an example. The wireless network connection mode comprises the following steps:
the broadcasting method is based on an AP with a preset rule SSID, the SSID is broadcasted by WiFi based on a WiFi broadcasting channel, and meanwhile, the SSID of the AP and a corresponding password are encoded into a Bluetooth broadcasting channel to carry out Bluetooth broadcasting.
The scanning party performs WiFi scanning and Bluetooth scanning simultaneously, and generates a scanning list after performing duplication removal on SSID carried in the scanned WiFi broadcasting message and Bluetooth broadcasting message;
the scanner performs a preliminary operation, that is, a pre-connection procedure, with the corresponding broadcaster based on the SSID and the corresponding password acquired by the bluetooth scan. The pre-connection process comprises an authentication stage and an association stage in the WiFi connection process.
And the scanner receives the AP corresponding to the SSID selected by the user based on the scanning list and establishes WiFi connection as target equipment.
The broadcasting party and the scanning party execute a pre-connection process, and after receiving the WiFi connection confirmation request, the broadcasting party establishes WiFi connection with the scanning party.
The scanner detects whether the current equipment is successfully connected with WiFi, if yes, a message channel establishment request is initiated to a broadcaster with successful connection.
If the scanner detects that the current WiFi network is still in the connection process, the scanner waits for the message to pass the establishment request after the connection is successful.
After receiving the message channel establishment request from the scanner, the broadcaster establishes a message channel with the scanner.
After the scanner establishes a message channel with the broadcaster, the scanner performs file information transmission interaction based on the message.
In the embodiment of the application, a first broadcast message is monitored on a Bluetooth broadcast channel, wherein the first broadcast message carries first identification information of a second device and a first connection key for accessing the second device; and establishing wireless fidelity WiFi connection with the second equipment according to the first identification information and the first connection key. In this way, the first identification information and the corresponding login key are directly acquired through the Bluetooth broadcast channel, and when the second equipment to be connected is scanned, the WiFi connection process with the second equipment is started, and the connection is not required to be established after the user selects the target equipment. And the operation flow of the user is reduced, and the user experience is improved.
Based on the same inventive concept, the embodiments of the present application provide a wireless network connection device, which may be applied to a first apparatus, including a plurality of functional units for implementing the wireless network connection method described above.
Fig. 7 is a schematic structural diagram of a wireless network connection device according to an embodiment of the present application, and referring to fig. 7, the wireless network connection device 700 may include:
a first monitoring module 701, configured to monitor a first broadcast message on a bluetooth broadcast channel, where the first broadcast message carries first identification information of a second device and a first connection key for accessing the second device;
the WiFi connection module 702 is configured to establish a WiFi connection with the second device according to the first identification information and the first connection key.
In some possible embodiments, the apparatus further comprises:
the first execution module is used for executing the preparation operation of establishing WiFi connection with the second equipment according to the first identification information and the first connection key;
the WiFi connection module 702 further includes: the first determining module is used for determining target equipment to be connected with the first equipment through WiFi from the second equipment;
the WiFi connection module 702 is specifically configured to: when the target equipment is determined, if the execution of the preparation operation is completed, establishing WiFi connection with the second equipment based on the execution result of the preparation operation; and when the target equipment is determined, if the preparation operation is not executed, executing the preparation operation, and after the execution of the preparation operation is finished, establishing WiFi connection with the second equipment based on the execution result of the preparation operation.
In some possible embodiments, the apparatus further comprises:
the second monitoring module is used for monitoring the first broadcast message on the Bluetooth broadcast channel and monitoring the second broadcast message on the WiFi broadcast channel, wherein the second broadcast message carries second identification information of the second equipment;
the first determining module is specifically configured to: displaying a connection prompt according to the second broadcast message; the connection prompt comprises: second identification information of one or more second devices scanned on the WiFi broadcast channel; and determining a target device to be connected with the first device by WiFi from the plurality of second devices when the confirmation indication acting on the connection prompt is detected.
In some possible embodiments, the preliminary operation comprises at least one of:
mutual authentication between the first device and the second device;
capability information interaction between the first device and the second device.
In some possible embodiments, the first determining module is specifically configured to: determining the distance between the first equipment and each second equipment according to the signal intensity of the WiFi signal and/or the Bluetooth signal of the second equipment; and selecting a target device from the second devices according to the distance.
In some possible embodiments, the apparatus further comprises:
And the execution stopping module is used for stopping the execution of the preparation operation between the first equipment and any one of the second equipment except the target equipment when the target equipment is determined.
It should be noted that, the specific implementation process of the first listening module 701 and the WiFi connection module 702 may refer to the detailed descriptions of the embodiments of fig. 1 to 3, and for brevity of the description, the description is omitted here.
Based on the same inventive concept, the embodiments of the present application provide a wireless network connection apparatus, which may be applied to a second device, including a plurality of functional units for implementing the wireless network connection method described above.
Fig. 8 is a schematic structural diagram of a wireless network connection device according to an embodiment of the present application, and referring to fig. 8, a wireless network connection device 800 may include:
a first broadcasting module 801, configured to broadcast a first broadcast message on a bluetooth broadcast channel, where the first broadcast message carries identification information of a second device and a connection key for accessing the second device;
the receiving module 802 is configured to receive a WiFi connection request sent by the first device, and establish a WiFi connection with the first device.
In some possible embodiments, the apparatus further comprises:
And the second broadcasting module is used for broadcasting the second broadcasting message on the WiFi broadcasting channel while broadcasting the first broadcasting message on the Bluetooth broadcasting channel, wherein the second broadcasting message carries the identification information of the second equipment.
Based on the same inventive concept, embodiments of the present application provide an electronic device that may be consistent with the information recommendation method described in one or more of the embodiments described above. Fig. 9 is a schematic structural diagram of an electronic device in the embodiment of the present application, and referring to fig. 9, an electronic device 900 may be implemented by using general purpose computer hardware, including a processor 901 and a memory 902.
In some possible implementations, the at least one processor may constitute any physical device having circuitry to perform logical operations on one or more inputs. For example, the at least one processor may include one or more Integrated Circuits (ICs) including Application Specific Integrated Circuits (ASICs), microchips, microcontrollers, microprocessors, all or part of a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), a Digital Signal Processor (DSP), a Field Programmable Gate Array (FPGA), or other circuit suitable for executing instructions or performing logic operations. The instructions executed by the at least one processor may, for example, be preloaded into a memory integrated with or embedded in the controller, or may be stored in a separate memory. The memory may include Random Access Memory (RAM), read Only Memory (ROM), hard disk, optical disk, magnetic media, flash memory, other permanent, fixed, or volatile memory, or any other mechanism that is capable of storing instructions. In some embodiments, at least one processor may comprise more than one processor. Each processor may have a similar structure, or the processors may have different configurations electrically connected or disconnected from each other. For example, the processors may be separate circuits or integrated in a single circuit. When more than one processor is used, the processors may be configured to operate independently or cooperatively. The processors may be coupled in electrical, magnetic, optical, acoustical, mechanical, or by other means that allow them to interact.
Based on the same inventive concept, the present application provides a computer storage medium storing computer executable instructions that, when executed by a processor, enable implementation of a wireless network connection method according to one or more embodiments described above.
It will be understood by those skilled in the art that the sequence number of each step in the above embodiment does not mean that the execution sequence of each process should be determined by the function and the internal logic, and should not limit the implementation process of the embodiment of the present invention.
The foregoing is merely illustrative of specific embodiments of the present application, and the scope of the present application is not limited thereto, and any changes or substitutions easily contemplated by those skilled in the art within the technical scope of the present application should be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.