Network connection method and device, storage medium and electronic equipment
By searching and analyzing network parameter information within the Bluetooth connection range of smart home devices and reconnecting to the historical network, the problem of equipment offline caused by changes in the network environment is solved to ensure that the equipment is always online.
Patent Information
- Application Number
- CN202411280091.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-12
- Publication Date
- 2024-11-22
AI Technical Summary
Smart home devices are offline due to changes in the network environment (such as WIFI disconnection or router password change), and the existing technology has not effectively solved it.
By searching for other devices within the Bluetooth connection range of the device, receiving and parsing network parameter information, and reconnecting to the network in the history, ensuring that the device is always online.
It effectively solves the problem of offline equipment caused by changes in the network environment, ensuring that the equipment is always online.
Smart Images

Figure CN119012405A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of smart home technology, and more specifically, to a network connection method and device, a storage medium, and an electronic device. Background Art
[0002] In the related art, when the network environment changes, including Wi-Fi disconnection or router password change, smart home devices will lose network connection due to the inability to adapt to these changes, resulting in device offline problems.
[0003] In the related art, no effective solution has been proposed for the problem of device offline caused by changes in the network environment. Summary of the invention
[0004] The embodiments of the present application provide a network connection method and device, a storage medium, and an electronic device to at least solve the problem of device offline caused by changes in the network environment in the related art.
[0005] According to an embodiment of the embodiments of the present application, a network connection method is provided, including: when a first device is disconnected from a first network, searching for a second device by Bluetooth within the Bluetooth connection range of the first device; when the first device and the second device have successfully established a Bluetooth connection, receiving network parameter information sent by the second device, wherein the network parameter information is parameter information input by a target object into the second device; and connecting to a second network according to the network parameter information, wherein the second network is a network that the first device has connected to in a historical time period.
[0006] In an optional embodiment, a Bluetooth search for a second device is performed within the Bluetooth connection range of the first device, including: when multiple devices are searched within the Bluetooth connection range, determining the connection time of the multiple devices with the first device to obtain multiple connection times; determining a target connection time whose connection time is closest to the current time from the multiple connection times; and determining the device corresponding to the target connection time as the second device.
[0007] In an optional embodiment, a Bluetooth search for a second device is performed within the Bluetooth connection range of the first device, including: when multiple devices are searched within the Bluetooth connection range, determining the signal strengths of the multiple devices to obtain multiple signal strengths; determining the strongest target signal strength from the multiple signal strengths; and determining the device corresponding to the target signal strength as the second device.
[0008] In an optional embodiment, a Bluetooth search for a second device is performed within the Bluetooth connection range of the first device, comprising: in a case where multiple devices are searched within the Bluetooth connection range, determining a first device type of the multiple devices to obtain multiple first device types; screening the first device type through a preset model to obtain multiple second device types, wherein a third device corresponding to the second device type has a function of transmitting information; determining connection distances between multiple third devices corresponding to the multiple second device types and the first device to obtain multiple connection distances; determining a minimum target connection distance from the multiple connection distances; and determining the device corresponding to the target connection distance as the second device.
[0009] In an optional embodiment, after receiving the network parameter information sent by the second device, the method further includes: when the network parameter information is received and the network interface of the second network carried in the network parameter information is not successfully parsed, checking whether the data format of the network parameter information complies with the parsing rules of the first device; when the data format does not comply with the parsing rules, sending a first notification message to the second device, wherein the first notification message is used to instruct the second device to resend the network parameter information that complies with the parsing rules; and connecting to the second network according to the network parameter information resent by the second device.
[0010] In an optional embodiment, after receiving the network parameter information sent by the second device, the method further includes: determining whether the first device has connection permission to connect to the second network; if the first device does not have the connection permission, sending a second notification message to the second network, wherein the second notification message is used to instruct the second device to request the control center for the connection permission of the first device to connect to the second network; if the request of the second device is successful, connecting to the second network according to the network parameter information.
[0011] In an optional embodiment, connecting to the second network according to the network parameter information includes: determining a network interface of the second network according to the network parameter information; obtaining configuration data of the second network through the network interface; and connecting to the second network according to the configuration data.
[0012] According to another aspect of the present invention, a network connection device is also provided, including: a search module, used to search for a second device through Bluetooth within the Bluetooth connection range of the first device when the first device is disconnected from the first network; a receiving module, used to receive network parameter information sent by the second device when the first device and the second device have successfully established a Bluetooth connection, wherein the network parameter information is parameter information input by the target object into the second device; and a connection module, used to connect to a second network according to the network parameter information, wherein the second network is a network to which the first device has been connected in a historical time period.
[0013] According to another aspect of the embodiments of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the above-mentioned network connection method when running.
[0014] According to another aspect of an embodiment of the present application, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the network connection method through the computer program.
[0015] According to another aspect of the embodiments of the present application, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the network connection method described above is implemented.
[0016] In an embodiment of the present application, when the network environment changes, the first device is disconnected from the first network, the first device searches for the second device via Bluetooth, establishes a connection with the second device, receives network parameter information sent by the second device, wherein the network parameter information is parameter information input by the target object in the second device, and connects to the second network according to the network parameter information, wherein the second network is a network that the first device has connected to in a historical time period. The above technical solution solves the problem of device offline caused by changes in the network environment in the related technology, so as to ensure that the device is always online. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0018] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0019] Figure 1 It is a hardware environment diagram of a network connection method according to an embodiment of the present application;
[0020] Figure 2 is a flow chart of a network connection method according to an embodiment of the present application;
[0021] Figure 3 is a flow chart of a network connection method according to an optional embodiment of the present application;
[0022] Figure 4 A flowchart of an error code detection method for connecting a network according to an optional embodiment of the present application;
[0023] Figure 5 This is a flowchart of an automatic network configuration method according to an optional embodiment of the present application;
[0024] Figure 6 This is an interface design diagram of a network connection method according to an optional embodiment of the present application;
[0025] Figure 7 An interactive flow chart of a network connection method according to an optional embodiment of the present application;
[0026] Figure 8 It is a structural block diagram of a network connection device according to an embodiment of the present application. DETAILED DESCRIPTION
[0027] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0028] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0029] According to one aspect of an embodiment of the present application, a network connection method is provided. The network connection method is widely used in smart home (Smart Home), smart home, smart home device ecology, smart residential (Intelligence House) ecology and other whole-house intelligent digital control application scenarios. Optionally, in this embodiment, the above network connection method can be applied to Figure 1 In the hardware environment composed of the first device 102 and the second device 104 shown in FIG. Figure 1 As shown, the first device 102 is connected to the second device 104 via a network, and can be used to provide services (such as application services, etc.) for the first device 102 or a client installed on the first device 102. A database can be set on the first device 102 or independently of the first device 102 to provide data storage services for the first device 102 and the second device 104. Cloud computing and / or edge computing services can be configured on the first device 102 or independently of the first device 102 to provide data computing services for the first device 102 and the second device 104.
[0030] The network may include but is not limited to at least one of the following: wired network, wireless network. The wired network may include but is not limited to at least one of the following: wide area network, metropolitan area network, local area network, and the wireless network may include but is not limited to at least one of the following: WIFI (Wireless Fidelity), Bluetooth. The first device 102 and the second device 104 may be but are not limited to PC, mobile phone, tablet computer, smart air conditioner, smart range hood, smart refrigerator, smart oven, smart stove, smart washing machine, smart water heater, smart washing equipment, smart dishwasher, smart projection equipment, smart TV, smart clothes drying rack, smart curtain, smart audio and video, smart socket, smart audio, smart speaker, smart fresh air equipment, smart kitchen and bathroom equipment, smart bathroom equipment, smart sweeping robot, smart window cleaning robot, smart mopping robot, smart air purification equipment, smart steamer, smart microwave oven, smart kitchen treasure, smart purifier, smart water dispenser, system platform, etc.
[0031] In this embodiment, a network connection method is provided, which is applied to the first device. Figure 2 : is a flow chart of a network connection method according to an embodiment of the present application, the process includes the following steps:
[0032] Step S202, when the first device is disconnected from the first network, searching for a second device via Bluetooth within the Bluetooth connection range of the first device;
[0033] Step S204: when the first device and the second device have successfully established a Bluetooth connection, receiving network parameter information sent by the second device, wherein the network parameter information is parameter information input by the target object into the second device;
[0034] Step S206: connecting to a second network according to the network parameter information, wherein the second network is a network that the first device has connected to in a historical time period.
[0035] In an embodiment of the present application, when the first device is disconnected from the first network, a Bluetooth search for a second device is performed within the Bluetooth connection range of the first device; when the first device and the second device have successfully established a Bluetooth connection, network parameter information sent by the second device is received, wherein the network parameter information is parameter information input by the target object in the second device; and the second network is connected to the first device in accordance with the network parameter information, wherein the second network is a network that the first device has connected to in a historical time period. The above technical solution solves the problem of device offline caused by changes in the network environment in the related technology, so as to ensure that the device is always online.
[0036] In an optional embodiment, a Bluetooth search for a second device is performed within the Bluetooth connection range of the first device, including: when multiple devices are searched within the Bluetooth connection range, determining the connection time of the multiple devices with the first device to obtain multiple connection times; determining a target connection time whose connection time is closest to the current time from the multiple connection times; and determining the device corresponding to the target connection time as the second device.
[0037] The first device needs to search for other devices within its connection range via Bluetooth. During the search, the first device will find multiple devices. The first device needs to obtain the connection time with each searched device. The connection time refers to the time point when a Bluetooth connection is successfully established between two devices. After collecting the connection times of all devices, the first device needs to compare these times and find the time point closest to the current time. During the comparison process, the connection time with the smallest difference from the current time is found, and this time point is called the target connection time. Finally, the first device determines the corresponding device as the second device based on the target connection time.
[0038] Optionally, assume that the first device searches for three devices via Bluetooth: device A, device B, and device C. The connection time between device A and the first device is 14:55, the connection time between device B and the first device is 14:00, and the connection time between device C and the first device is 13:30. Assuming that the current time is 15:00, device A is closest to the current time, and device A is determined to be the second device.
[0039] In an optional embodiment, a Bluetooth search for a second device is performed within the Bluetooth connection range of the first device, including: when multiple devices are searched within the Bluetooth connection range, determining the signal strengths of the multiple devices to obtain multiple signal strengths; determining the strongest target signal strength from the multiple signal strengths; and determining the device corresponding to the target signal strength as the second device.
[0040] When the first device starts scanning, it detects all devices within the Bluetooth connection range. After searching for multiple devices, the first device needs to determine the signal strength of these multiple devices. Signal strength is an indicator of the communication quality between Bluetooth devices, usually expressed in decibel milliwatts dBm. Higher signal strength means better communication quality. After obtaining the signal strength of multiple devices, compare the signal strengths of the multiple devices. Determine the target signal strength with the strongest signal strength, and determine the device with the strongest signal strength as the second device.
[0041] Optionally, assume that the first device searches for three devices via Bluetooth: device A, device B, and device C. The signal strength of device A is 70 dBm, the signal strength of device B is 80 dBm, and the signal strength of device C is 65 dBm. By comparing the signal strengths of these devices and determining that the signal strength of device B is the strongest, device B is the second device.
[0042] In an optional embodiment, a Bluetooth search for a second device is performed within the Bluetooth connection range of the first device, comprising: in a case where multiple devices are searched within the Bluetooth connection range, determining a first device type of the multiple devices to obtain multiple first device types; screening the first device type through a preset model to obtain multiple second device types, wherein a third device corresponding to the second device type has a function of transmitting information; determining connection distances between multiple third devices corresponding to the multiple second device types and the first device to obtain multiple connection distances; determining a minimum target connection distance from the multiple connection distances; and determining the device corresponding to the target connection distance as the second device.
[0043] When multiple devices are searched within the Bluetooth connection range of the first device, it is necessary to determine the first device type to which each device belongs. For example, mobile phones, headphones, keyboards, mice, etc. The first device type is screened through a preset model to exclude device types that cannot be used to transmit information in the first device type. The remaining device types that can be used to transmit information are the second device types, such as collections, tablets, computers, etc. Determine the third device corresponding to the second device type, and calculate the connection distance between each third device and the first device. After obtaining all the connection distances, determine the minimum target connection distance from these connection distances, which means that the communication quality between the device and the first device is better. The device corresponding to the target connection distance is determined as the second device.
[0044] In an optional embodiment, after receiving the network parameter information sent by the second device, the method further includes: when the network parameter information is received and the network interface of the second network carried in the network parameter information is not successfully parsed, checking whether the data format of the network parameter information complies with the parsing rules of the first device; when the data format does not comply with the parsing rules, sending a first notification message to the second device, wherein the first notification message is used to instruct the second device to resend the network parameter information that complies with the parsing rules; and connecting to the second network according to the network parameter information resent by the second device.
[0045] The first device receives network parameter information sent by the second device. These network parameter information include the network interface and password of the second network, etc., which are used to help the first device connect to the second network. During the parsing process, the first device failed to successfully parse the network interface information of the second network. The first device will further check whether the data format of the received network parameter information complies with the parsing rules of the first device. Parsing rules are a set of standards used by the first device to analyze and use data. If the check finds that the data format does not comply with the parsing rules of the first device, the first device will send a first notification message to the second device. The purpose of this first notification message is to inform the second device that the above network parameter information does not comply with the parsing rules of the first device, and request to resend the network parameter information that complies with the parsing rules of the first device. After receiving the first notification message, the second device will resend the network parameter information that complies with the parsing rules of the first device. The first device connects to the second network based on the network parameter information that complies with the parsing rules resent by the second device.
[0046] In an optional embodiment, after receiving the network parameter information sent by the second device, the method further includes: determining whether the first device has connection permission to connect to the second network; if the first device does not have the connection permission, sending a second notification message to the second network, wherein the second notification message is used to instruct the second device to request the control center for the connection permission of the first device to connect to the second network; if the request of the second device is successful, connecting to the second network according to the network parameter information.
[0047] After receiving the network parameter information, the first device needs to check whether it has permission to connect to the second network. This is because different networks have different access control policies to ensure that only authorized devices can connect. If the first device does not have connection permission, it is necessary to send a second notification message to the second device. The purpose of this step is to notify the second device that the first device needs to obtain connection permission for the second network. After receiving the second notification message, the second device will request connection permission for the first device from the control center. It should be clear that the control center can be an automatic authorization system. In the case where the second device successfully requests connection permission to the first device, the first device will connect to the second network based on the network parameter information sent by the second device.
[0048] In an optional embodiment, connecting to the second network according to the network parameter information includes: determining a network interface of the second network according to the network parameter information; obtaining configuration data of the second network through the network interface; and connecting to the second network according to the configuration data.
[0049] Determine the network interface of the second network according to the network parameter information, wherein the network interface includes a wired Ethernet interface, a wireless Wi-Fi interface, or other types of network interfaces. According to the network interface of the second network, obtain the configuration data of the second network. The configuration data includes the IP address, subnet mask, gateway, etc. of the second network. Connect to the second network according to the configuration data.
[0050] In order to better understand the process of the above-mentioned network connection method, the following describes the process of the above-mentioned network connection implementation method in combination with an optional embodiment, but is not intended to limit the technical solution of the embodiment of the present application.
[0051] Figure 3 is a flow chart of a network connection method according to an optional embodiment of the present invention, such as Figure 3 As shown, the specific steps include:
[0052] In the case of a problem with the network connection, the current device, i.e., the first device, attempts to connect to the first network, i.e., the previously configured network, and checks whether the connection to the first network is successful. If the connection to the first network is successful, the connection to the first network is maintained and the state of the first network is detected. If the first network is in a stable state, the connection to the first network is maintained. If the first network is in an unstable state, Bluetooth is activated to search for a second device within the Bluetooth connection range of the first device. If the connection to the first network fails, Bluetooth is activated to search for the second device.
[0053] In the case of starting Bluetooth to search for the second device, determine whether the second device is found. In the case where the second device is not found, continue scanning to search for the second device. In the case of finding the second device, establish a Bluetooth connection with the second device and wait for instructions from the target object (equivalent to the network parameter information in the above embodiment). In the case of not receiving instructions from the target object, the current device continues to wait for instructions from the target object. In the case of receiving instructions from the target object, parse the instructions of the target object to obtain the network parameter information in the instructions, try to connect to the second network according to the network parameter information, and determine whether the second network is successfully connected. In the case of a successful connection to the second network, maintain the second network connection and disconnect the Bluetooth connection. In the case of a failed connection to the second network, continue to receive instructions from the target object via Bluetooth.
[0054] Figure 4 FIG. 1 is a flowchart of an error code detection method for connecting a network according to an optional embodiment of the present application. Figure 4 As shown, the specific steps include:
[0055] The first device attempts to connect to the first network, that is, the previously configured network, and checks whether the first network is successfully connected. If the first network connection is successful, the first device performs normal operations. If the first network connection fails, the first device obtains an error code for the connection failure, records and parses the error code. Determine whether the error code is a common error code stored in the preset scheme.
[0056] In the case where the above error code is a common error code, search the preset solution to see if the target object provides a solution corresponding to the current error. When the target object provides a solution corresponding to the current error, process it according to the solution provided by the target object. For example, when the error code is 100X, the network password configured for the first device in the preset solution is wrong, and the correct network password provided by the target object is searched in the preset solution to reconnect the network with the correct network password. When the target object does not provide a solution corresponding to the current error, perform an automatic recovery operation to restore the connection with the first network. In the case of restoring the connection to the first network, detect the status of the first network. When the first network is in a stable state, the first device operates normally. When the first network is in an unstable state, recapture the error code, repeat the parsing of the error code and subsequent operations.
[0057] In the case where the above error code is not a common error code, the error code is parsed. If the parsing is successful, the first network state is detected, and when the first network is in a stable state, the first device operates normally. When the first network is in an unstable state, the error code is recaptured, and the parsing of the error code and subsequent operations are repeated. If the parsing fails, the unknown error is reported to the server or recorded in the log.
[0058] Figure 5 is an automatic network configuration flow chart of a network connection method according to an optional embodiment of the present application, such as Figure 5 As shown, the specific steps include:
[0059] The first device attempts to connect to the first network and checks whether the connection to the first network is successful. If the connection to the first network is successful, the state of the first network is detected. When the first network is in a stable state, the first device performs normal operations. When the first network is in an unstable state, the network configuration process is triggered. If the connection to the first network fails, the network configuration process is triggered.
[0060] After the network configuration process is triggered, a network configuration prompt is displayed to the target object to inform the target object that the network needs to be reset. The target object can choose to use the device-side network configuration or the App-side network configuration. When the target object chooses to use the device-side network configuration, the first device automatically searches for an available network. When an available network is searched, the first device attempts to connect to the network. If the connection is successful, the first device continues to operate normally. If the connection fails, the network configuration process ends. When an unavailable network is searched, the network configuration process ends.
[0061] In the case where the target object can choose to use the App-side network configuration, the user is prompted to turn on Bluetooth to search for the second device. When the first device and the second device have successfully established a Bluetooth connection, the target object writes the network parameter information of the second network on the second device, and the second device sends the network parameter information to the first device. The first device attempts to connect to the second network based on the network parameter information. If the second network is successfully connected, the second network status is detected. When the second network is in a stable state, the first device operates normally. When the second network is in an unstable state, the network configuration process is triggered again. In the case of a connection failure to the second network, the target object is prompted with a connection failure, and the target object is allowed to re-enter the network parameter information of the third network.
[0062] Figure 6 This is an interface design diagram of a network connection method according to an optional embodiment of the present application, such as Figure 6 As shown, the specific steps include:
[0063] In this embodiment, two reasons for causing the device to go offline are shown, namely, WIFI disconnection and incorrect router password, and two different interactive entrances are shown, namely, by clicking on the device card and the details page, reconfiguring WIFI, entering the WIFI settings page, entering network parameter information, and completing network configuration. The last picture shows a style for setting up a WIFI network, that is, entering the WIFI name and password to configure the network.
[0064] Figure 7is an interactive flow chart of a network connection method according to an optional embodiment of the present application, such as Figure 7 As shown, the specific steps include:
[0065] In this embodiment, part of the interactive logic of reconnecting the first device to the network through the second device is demonstrated. When the second device does not turn on Bluetooth and is not close to the first device, "The device is offline, please turn on Bluetooth and approach the device to reset WIFI" is displayed on the second device. When the second device turns on Bluetooth, "WIFI setting is not completed, please keep Bluetooth on and approach the device to set WIFI" is displayed on the second device. When the second device turns off Bluetooth, "The device is offline, please turn on Bluetooth and approach the device to reset WIFI" is displayed on the second device. When the second device approaches the first device, "WIFI setting is not completed, remote control is not available, please complete WIFI setting" is displayed on the second device. Click to reset WIFI to enter the setting process. When the WIFI setting is successful, none of the above states are displayed. When the WIFI setting fails, "WIFI setting is not completed, remote control is not available, please complete WIFI setting" is displayed, and "WIFI setting is not completed, please keep Bluetooth on and approach the device to set WIFI" is displayed when leaving the first device. Turning off Bluetooth displays "The device is offline, please turn on Bluetooth and approach the device to reset WIFI".
[0066] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, an operating terminal, or a network device, etc.) to execute the methods of each embodiment of the present application.
[0067] Figure 8 is a structural block diagram of a network connection device according to an embodiment of the present application; Figure 8 As shown, including:
[0068] A search module 80, configured to perform a Bluetooth search for a second device within a Bluetooth connection range of the first device when the first device is disconnected from the first network;
[0069] A receiving module 82, configured to receive network parameter information sent by the second device when the first device and the second device have successfully established a Bluetooth connection, wherein the network parameter information is parameter information input by the target object into the second device;
[0070] The connection module 84 is configured to connect to a second network according to the network parameter information, wherein the second network is a network that the first device has connected to in a historical time period.
[0071] In an embodiment of the present application, when the first device is disconnected from the first network, a Bluetooth search for a second device is performed within the Bluetooth connection range of the first device; when the first device and the second device have successfully established a Bluetooth connection, network parameter information sent by the second device is received, wherein the network parameter information is parameter information input by the target object in the second device; and the second network is connected to the first device in accordance with the network parameter information, wherein the second network is a network that the first device has connected to in a historical time period. The above technical solution solves the problem of device offline caused by changes in the network environment in the related technology, so as to ensure that the device is always online.
[0072] In an optional embodiment, the search module 80 is also used to determine the connection time between the multiple devices and the first device when multiple devices are searched within the Bluetooth connection range, so as to obtain multiple connection times; determine a target connection time whose connection time is closest to the current time from the multiple connection times; and determine the device corresponding to the target connection time as the second device.
[0073] In an optional embodiment, the search module 80 is also used to determine the signal strengths of the multiple devices when multiple devices are searched within the Bluetooth connection range, and obtain multiple signal strengths; determine the strongest target signal strength from the multiple signal strengths; and determine the device corresponding to the target signal strength as the second device.
[0074] In an optional embodiment, the search module 80 is further used to determine the first device type of the multiple devices when multiple devices are searched within the Bluetooth connection range, and obtain multiple first device types; filter the first device type through a preset model to obtain multiple second device types, wherein the third device corresponding to the second device type has the function of transmitting information; determine the connection distance between the multiple third devices corresponding to the multiple second device types and the first device, and obtain multiple connection distances; determine the minimum target connection distance from the multiple connection distances; and determine the device corresponding to the target connection distance as the second device.
[0075] In an optional embodiment, the receiving module 82 is also used to check whether the data format of the network parameter information complies with the parsing rules of the first device when the network parameter information is received and the network interface of the second network carried in the network parameter information is not successfully parsed; if the data format does not comply with the parsing rules, send a first notification message to the second device, wherein the first notification message is used to instruct the second device to resend the network parameter information that complies with the parsing rules; and connect to the second network according to the network parameter information resent by the second device.
[0076] In an optional embodiment, the receiving module 82 is further used to determine whether the first device has the connection permission to connect to the second network; if the first device does not have the connection permission, send a second notification message to the second network, wherein the second notification message is used to instruct the second device to request the control center for the connection permission of the first device to connect to the second network; if the request of the second device is successful, connect to the second network according to the network parameter information.
[0077] In an optional embodiment, the connection module 84 is further used to determine the network interface of the second network according to the network parameter information; obtain the configuration data of the second network through the network interface; and connect to the second network according to the configuration data.
[0078] An embodiment of the present application further provides a storage medium, which includes a stored program, wherein the program executes any of the above methods when it is run.
[0079] Optionally, in this embodiment, the storage medium may be configured to store program codes for executing the following steps:
[0080] S1, when the first device is disconnected from the first network, searching for the second device by Bluetooth within the Bluetooth connection range of the first device;
[0081] S2, when the first device and the second device have successfully established a Bluetooth connection, receiving network parameter information sent by the second device, wherein the network parameter information is parameter information input by the target object into the second device;
[0082] S3: Connect to a second network according to the network parameter information, wherein the second network is a network that the first device has connected to in a historical time period.
[0083] An embodiment of the present application further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0084] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0085] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:
[0086] S1, when the first device is disconnected from the first network, searching for the second device by Bluetooth within the Bluetooth connection range of the first device;
[0087] S2, when the first device and the second device have successfully established a Bluetooth connection, receiving network parameter information sent by the second device, wherein the network parameter information is parameter information input by the target object into the second device;
[0088] S3: Connect to a second network according to the network parameter information, wherein the second network is a network that the first device has connected to in a historical time period.
[0089] Optionally, in this embodiment, the above-mentioned storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store program codes.
[0090] An embodiment of the present application further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps in any one of the above method embodiments are implemented.
[0091] An embodiment of the present application further provides another computer program product, including a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in any of the above method embodiments are implemented.
[0092] The embodiments of the present application also provide a computer program, which includes computer instructions, which are stored in a computer-readable storage medium; a processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the steps in any one of the above method embodiments.
[0093] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be described in detail here.
[0094] Obviously, those skilled in the art should understand that the above modules or steps of the present application can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.
[0095] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A network connection method, characterized in that: include: When the first device is disconnected from the first network, searching for the second device via Bluetooth within the Bluetooth connection range of the first device; When the first device and the second device have successfully established a Bluetooth connection, receiving network parameter information sent by the second device, wherein the network parameter information is parameter information input by the target object into the second device; Connecting to a second network according to the network parameter information, wherein the second network is a network that the first device has connected to in a historical time period.
2. The network connection method according to claim 1, characterized in that: The method of searching for a second device via Bluetooth within a Bluetooth connection range of the first device includes: When multiple devices are searched within the Bluetooth connection range, determining the connection time between the multiple devices and the first device to obtain multiple connection times; Determine a target connection time whose connection time is closest to the current time from the multiple connection times; The device corresponding to the target connection time is determined as the second device.
3. The network connection method according to claim 1, characterized in that: The method of searching for a second device via Bluetooth within a Bluetooth connection range of the first device includes: When multiple devices are searched within the Bluetooth connection range, determining the signal strengths of the multiple devices to obtain multiple signal strengths; determining a strongest target signal strength from among the plurality of signal strengths; The device corresponding to the target signal strength is determined as the second device.
4. The network connection method according to claim 1, characterized in that: The method of searching for a second device via Bluetooth within a Bluetooth connection range of the first device includes: In a case where multiple devices are searched within the Bluetooth connection range, determining first device types of the multiple devices to obtain multiple first device types; The first device type is screened by a preset model to obtain a plurality of second device types, wherein the third device corresponding to the second device type has a function of transmitting information; Determine connection distances between a plurality of third devices corresponding to the plurality of second device types and the first device to obtain a plurality of connection distances; Determining a minimum target connection distance from the plurality of connection distances; The device corresponding to the target connection distance is determined as the second device.
5. The network connection method according to claim 1, characterized in that: After receiving the network parameter information sent by the second device, the method further includes: Upon receiving the network parameter information and failing to successfully parse the network interface of the second network carried in the network parameter information, checking whether the data format of the network parameter information complies with the parsing rule of the first device; When the data format does not conform to the parsing rule, sending a first notification message to the second device, wherein the first notification message is used to instruct the second device to resend the network parameter information that conforms to the parsing rule; Connect to the second network according to the network parameter information resent by the second device.
6. The network connection method according to claim 1, characterized in that: After receiving the network parameter information sent by the second device, the method further includes: Determining whether the first device has connection authority to connect to the second network; When the first device does not have the connection permission, sending a second notification message to the second network, wherein the second notification message is used to instruct the second device to request the control center for the connection permission of the first device to connect to the second network; In case the second device request is successful, the second network is connected according to the network parameter information.
7. The network connection method according to claim 1, characterized in that: Connecting to a second network according to the network parameter information includes: Determine a network interface of the second network according to the network parameter information; Acquiring configuration data of the second network through the network interface; The second network is connected according to the configuration data.
8. A network connection device, characterized in that: include: A search module, configured to perform a Bluetooth search for a second device within a Bluetooth connection range of the first device when the first device is disconnected from the first network; A receiving module, configured to receive network parameter information sent by the second device when the first device and the second device have successfully established a Bluetooth connection, wherein the network parameter information is parameter information input by a target object into the second device; A connection module is used to connect to a second network according to the network parameter information, wherein the second network is a network that the first device has connected to in a historical time period.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein the program executes the method described in any one of claims 1 to 7 when executed.
10. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to execute the method according to any one of claims 1 to 7 through the computer program.
