disclosure of Invention
The technical problem to be solved by the present invention is to provide a Wifi configuration method and device, so as to solve the problem in the prior art that when Wifi configuration is wrong, the success rate of subsequent configuration is low.
in order to achieve the purpose, the invention adopts the following technical scheme:
According to an aspect of the present invention, a Wifi configuration method is provided, which is used in a control terminal, and includes the following steps:
in the process of configuring and accessing the network for the Wifi equipment, if the configuration failure of the Wifi equipment is detected, acquiring an error code of smartlink/softAP configuration failure from the Wifi equipment through a softAP configuration mode;
outputting the error code;
And after the user to be detected finishes error correction according to the error code, continuing to finish softAP configuration with the Wifi equipment.
Further, detecting whether the Wifi device fails to configure the configuration includes:
and sending a configuration message to the Wifi equipment, and if the configuration success message fed back by the Wifi equipment is not received within the preset time, judging that the Wifi equipment fails to be configured.
Further, acquiring an error code of failed smartlink configuration from the Wifi device through a softAP configuration mode, including:
switching from the smartlink configuration mode to the softAP configuration mode;
And under a softAP configuration mode, establishing connection with the Wifi equipment to acquire an error code of which smartlink configuration fails.
Further, the completing softAP configuration with the Wifi device includes:
Acquiring a wireless access point list from the Wifi equipment;
Selecting a wireless access point from the wireless access point list, and configuring the SSID and the password of the wireless access point;
and sending the SSID and the password of the selected wireless access point to the Wifi equipment.
further, the error codes comprise configuration timeout, authentication failure, failure of DHCP to acquire IP address and error codes of no-scan wireless access point.
According to another aspect of the present invention, a Wifi configuration method is provided, which is used in Wifi devices, and includes the following steps:
In the process that a control terminal controls configuration and network access, if configuration failure is detected, acquiring error codes of smartlink/softAP configuration failure;
Sending the error code to a control terminal in a softAP configuration mode;
And completing softAP configuration according to the configuration information sent by the control terminal.
Further, the method for detecting whether the configuration fails includes:
And if the wireless access point is detected to be unable to be connected within the preset time after the network access of the configuration is confirmed, determining that the configuration is failed.
Further, after the Wifi device obtains an error code that smartlink configuration fails, the smartlink configuration mode is switched to the softAP configuration mode.
further, the completing softAP configuration according to the configuration information sent by the control terminal includes:
When the control terminal acquires a wireless access point list, the acquired wireless access point list is sent to the control terminal;
and connecting the wireless access points according to the SSID and the password of the wireless access points sent by the control terminal.
Further, the error code is obtained according to an API interface function of a chip adopted by the Wifi device.
Further, the error codes comprise configuration timeout, authentication failure, failure of DHCP to acquire IP address and error codes of no-scan wireless access point.
according to another aspect of the present invention, there is provided a Wifi configuration device for controlling a terminal, including:
the first detection unit is used for detecting whether the Wifi equipment fails to be configured or not in the process of configuring the Wifi equipment into a network;
the first obtaining unit is used for obtaining an error code of smartlink/softAP configuration failure from the Wifi equipment through a softAP configuration mode when the first detecting unit detects that the Wifi equipment configuration failure occurs;
An output unit for outputting the error code;
and the first configuration unit is used for continuing to complete softAP configuration with the Wifi equipment after the user finishes error correction according to the error code.
further, the detection unit is specifically configured to:
Sending a configuration message to the Wifi equipment;
and if the configuration success message fed back by the Wifi equipment is not received within the preset time, judging that the Wifi equipment fails to be configured.
further, the first obtaining unit is specifically configured to:
Switching from the smartlink configuration mode to the softAP configuration mode;
And under a softAP configuration mode, establishing connection with the Wifi equipment to acquire an error code of which smartlink configuration fails.
further, the first configuration unit includes:
the acquisition module is used for acquiring a wireless access point list from the Wifi equipment;
the configuration module is used for selecting a wireless access point from the wireless access point list and configuring the SSID and the password of the wireless access point;
and the sending module is used for sending the SSID and the password of the selected wireless access point to the Wifi equipment.
further, the error codes output by the output unit comprise configuration timeout, authentication failure, failure of DHCP to acquire IP address and error codes of no-scan wireless access point.
according to another aspect of the present invention, there is provided a Wifi configuration apparatus, for use in Wifi devices, including:
The second detection unit is used for detecting whether the configuration is failed or not in the process of controlling the configuration and the network access by the control terminal;
the second acquisition unit is used for acquiring an error code of the configuration failure of smartlink/softAP when the second detection unit detects the configuration failure;
the transmitting unit is used for transmitting the error code to the control terminal in the softAP configuration mode;
And the second configuration unit is used for completing softAP configuration according to the configuration information sent by the control terminal.
Further, the second detection unit is specifically configured to:
and if the wireless access point is detected to be unable to be connected within the preset time after the network access of the configuration is confirmed, determining that the configuration is failed.
further, the apparatus further includes a switching unit, configured to, when the Wifi device fails to configure in the smartlink configuration mode, obtain an error code indicating that the smartlink configuration fails, and switch to the softAP configuration mode.
Further, the second configuration unit includes:
The control terminal comprises a sending module and a receiving module, wherein the sending module is used for sending an acquired wireless access point list to the control terminal when the control terminal acquires the wireless access point list;
And the connection module is used for connecting the wireless access points according to the SSID and the password of the wireless access points sent by the control terminal.
Further, the second obtaining unit obtains the error code according to an API interface function of a chip adopted by the Wifi device.
further, the error codes acquired by the second acquisition unit include configuration timeout, authentication failure, failure of acquiring the IP address by DHCP, and no wireless access point scan error codes.
The invention has the following beneficial effects:
according to the Wifi configuration method and device provided by the embodiment of the invention, when Wifi configuration is carried out, under the condition that the configuration is not successful, the error code of configuration failure is obtained through the softAP configuration mode. The error code provides the user with a specific reason for the failure to configure. Therefore, the user can correct the specific problem of the configuration according to the failure reason and continue to complete the softAP configuration. The Wifi configuration method provides a more transparent and friendly configuration mode for users, and can effectively improve the success rate of configuration.
The foregoing description is only an overview of the technical solutions of the present invention, and the embodiments of the present invention are described below in order to make the technical means of the present invention more clearly understood and to make the above and other objects, features, and advantages of the present invention more clearly understandable.
Detailed Description
the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
the embodiment of the invention provides a Wifi configuration method, which is used in a control terminal, and as shown in fig. 1, the Wifi configuration method comprises the following steps:
s101, in the process of configuring and accessing the network for the Wifi equipment, if the Wifi equipment is detected to be unsuccessfully configured, acquiring an error code of smartlink/softAP configuration failure from the Wifi equipment through a softAP configuration mode;
s102, outputting an error code;
s103, after the user finishes error correction according to the error code, continuing to finish softAP configuration with Wifi equipment.
in the process of configuring the Wifi equipment for network access, a smartlink mode or a softAP configuration mode is adopted, and once the configuration failure of the Wifi equipment is detected, the configuration error code is obtained from the Wifi equipment. Wherein, detecting whether Wifi equipment configures the failed mode includes: sending a configuration message to the Wifi equipment; and if the configuration success message fed back by the Wifi equipment is not received within the preset time, judging that the Wifi equipment fails to be configured.
Specifically, acquiring the configuration error code requires being in the softAP configuration mode. Therefore, when acquiring the smartlink configuration error code, the smartlink configuration mode needs to be switched to the softAP configuration mode; and under the softAP configuration mode, establishing connection with Wifi equipment to acquire error codes of smartlink configuration failure. For the softAP configuration mode, connection with the Wifi equipment is established, and the error code is directly acquired. And the control terminal and the Wifi equipment establish connection by adopting a TCP protocol. After the connection is established, the control terminal needs to send an error code request for failing configuration acquisition to the Wifi device, and output the error code after receiving the error code sent by the Wifi device, so that a user can match a corresponding error reason according to the error code, and error correction is facilitated. The error codes comprise configuration overtime, authentication failure, failure of DHCP to acquire IP address and error codes of wireless access points which cannot be scanned.
And the user corrects the error after acquiring the error reason. For example, prompting that DHCP fails to obtain IP address, the user detects whether the router configuration is full; after prompting that the authentication fails, the user can input the password again; when the AP cannot be scanned, detecting the distance between the Wifi equipment and the router; prompting configuration overtime, detecting the working state of the control terminal and the like.
And after the error correction is finished, the user gives a correction finishing instruction to the control terminal. And after detecting that the user completes the error correction instruction according to the error code, the control terminal continues to perform softAP configuration with the Wifi equipment. Specifically, when configuration is performed, a wireless access point list is acquired from Wifi equipment at first; then, selecting a wireless access point from the wireless access point list, and configuring the SSID and the password of the wireless access point; and finally, the SSID and the password of the selected wireless access point are sent to the Wifi equipment.
based on the above, in the Wifi configuration method of the embodiment of the present invention, when Wifi configuration is performed on Wifi equipment, after a configuration failure condition is detected, an error code of the configuration failure is obtained and output in a softAP configuration mode. The error code provides the user with the specific failure reason for configuration, and the user can modify the specific problem of configuration according to the failure reason and continue to complete the configuration. Therefore, the invention provides a more transparent and friendly configuration mode for users, and can effectively improve the success rate of configuration.
An embodiment of the present invention provides a Wifi configuration method, which is used in Wifi devices, and as shown in fig. 2, includes the following steps:
s201, in the process that a control terminal controls configuration and network access, if configuration failure is detected, acquiring an error code of smartlink/softAP configuration failure;
s202, sending the error code to a control terminal in a softAP configuration mode;
And S203, completing softAP configuration according to the configuration information sent by the control terminal.
And when the configuration failure is detected in the network access configuration process, acquiring a specific error code through an API (application program interface) function of the chip. The method for detecting whether the configuration of the Wifi equipment fails comprises the following steps: and detecting whether the connection with the wireless access point AP is realized within a preset time after the confirmation of the network access of the configuration, if the connection is not realized, judging that the configuration is failed, otherwise, judging that the configuration is successful. And if the configuration is successful, feeding back a successful configuration message to the control terminal, and connecting the AP according to the stored configuration information. The error codes comprise configuration overtime, authentication failure, failure of DHCP to acquire IP address and error codes of wireless access points which cannot be scanned.
when the error code is sent to the control terminal, a TCP connection needs to be established with the control terminal in the softAP configuration mode. And after the control terminal sends the acquisition request, sending the error code out. Therefore, after the Wifi device acquires the error code of the smartlink configuration failure, the smartlink configuration mode is switched to the softAP configuration mode. And transmitting the error code in the softAP configuration mode.
Further, when the Wifi device completes the softAP configuration according to the configuration information sent by the control terminal, the method comprises the following steps:
receiving a request of acquiring a wireless access point list from a control terminal, and sending the acquired wireless access point list to the control terminal;
And receiving the SSID and the password of the wireless access point sent by the control terminal, and connecting the wireless access point according to the SSID and the password.
based on the above, in the Wifi configuration method of the embodiment of the present invention, when the configuration of the Wifi device fails, the error code of the configuration failure is obtained, and in the softAP configuration mode, the error code is sent to the control terminal, so that the configuration of the softAP configuration mode is continuously completed with the control terminal. Therefore, the error code is acquired through the Wifi equipment, so that the control terminal can conveniently acquire the reason of the configuration failure, and the success rate of the subsequent Wifi configuration is improved.
as shown in fig. 3, an embodiment of the present invention provides a Wifi configuration method, and a specific implementation process of the present invention is mainly described by taking smartlink configuration failure as an example. The method comprises the following steps:
S301, the mobile phone APP enters a smartlink configuration interface, and meanwhile, the Wifi device is triggered to enter a smartlink configuration mode.
s302, configuring a multicast packet by using a mobile phone APP and smartlink, and sending the multicast packet to Wifi equipment.
S303, the Wifi device judges whether the configuration is successful within 1 minute: if the configuration is successful, feeding back a successful configuration message to the control terminal; and when the configuration fails, acquiring the error code, and switching to a softAP configuration correction mode.
s304, if the time for sending the configuration multicast packet by the mobile phone APP exceeds the preset 1 minute, switching to a configuration interface of a softAP modification configuration mode, simultaneously calling the SDK module to establish TCP connection with the Wifi equipment, and sending an error code obtaining request to the Wifi equipment.
S305, the Wifi equipment sends the obtained error code to the mobile phone APP.
s306, the SDK module of the mobile phone APP receives the error code and reports the APP; the APP displays a specific error reason to a user according to the error code; and meanwhile, continuously calling the SDK module to acquire the AP list.
s307, the Wifi device obtains the AP list through scanning and sends the AP list to the mobile phone APP;
S308, the mobile phone APP selects an AP from the AP list, obtains the SSID and the password of the AP input by the user, and sends the SSID and the password to the Wifi equipment.
And S309, after the SSID and the password are stored by the Wifi equipment, restarting and connecting the selected AP according to the SSID and the password.
the method and the device have the advantages that when smartlink configuration fails, the configuration failure error code is obtained and stored, the softAP configuration mode is automatically switched to, and the user is prompted through a mobile phone APP matching correction method in the softAP configuration mode. The user can correct the cause of the error according to the prompt, such as checking a configuration password, checking whether the IP of the device connected to the router is full and cannot be allocated, checking whether the router is too far away, and the like. This provides a more transparent and user friendly configuration; meanwhile, after error correction, softAP configuration is continuously completed, and the configuration success rate is improved.
As shown in fig. 4, an embodiment of the present invention further provides a Wifi configuration apparatus, which is used in a control terminal, and includes:
The first detection unit is used for detecting whether the Wifi equipment fails to be configured or not in the process of configuring the Wifi equipment into a network;
the first obtaining unit is used for obtaining an error code of the configuration failure of smartlink/softAP from the Wifi equipment through a softAP configuration mode when the first detecting unit detects that the configuration of the Wifi equipment fails;
An output unit for outputting an error code;
And the first configuration unit is used for continuing to complete softAP configuration with the Wifi equipment after the user finishes error correction according to the error code.
Further, the detection unit is specifically configured to:
Sending a configuration message to the Wifi equipment;
And if the configuration success message fed back by the Wifi equipment is not received within the preset time, judging that the Wifi equipment fails to be configured.
further, the first obtaining unit is specifically configured to:
switching from the smartlink configuration mode to the softAP configuration mode;
And under the softAP configuration mode, establishing connection with Wifi equipment to acquire error codes of smartlink configuration failure.
Further, the first configuration unit includes:
the acquisition module is used for acquiring a wireless access point list from the Wifi equipment;
the configuration module is used for selecting a wireless access point from the wireless access point list and configuring the SSID and the password of the wireless access point;
And the sending module is used for sending the SSID and the password of the selected wireless access point to the Wifi equipment.
further, the error codes output by the output unit comprise configuration timeout, authentication failure, failure of DHCP to acquire IP address and error codes of no-scan wireless access point.
Referring to fig. 5, an embodiment of the present invention further provides a Wifi configuration apparatus, which is used in Wifi devices, and includes:
The second detection unit is used for detecting whether the configuration is failed or not in the process of controlling the configuration and the network access by the control terminal;
the second acquisition unit is used for acquiring error codes of smartlink/softAP configuration failure when the second detection unit detects that the configuration fails;
the transmitting unit is used for transmitting the error code to the control terminal in the softAP configuration mode;
and the second configuration unit is used for completing softAP configuration according to the configuration information sent by the control terminal.
Further, the second detection unit is specifically configured to:
And if the wireless access point is detected to be unable to be connected within the preset time after the network access of the configuration is confirmed, determining that the configuration is failed.
Further, the apparatus further includes a switching unit, configured to, when the Wifi device fails to configure in the smartlink configuration mode, obtain an error code indicating that the smartlink configuration fails, and switch to the softAP configuration mode.
Further, the second configuration unit includes:
the sending module is used for sending the acquired wireless access point list to the control terminal when the control terminal acquires the wireless access point list;
and the connection module is used for connecting the wireless access points according to the SSID and the password of the wireless access points sent by the control terminal.
Further, the second obtaining unit obtains the error code according to an API interface function of a chip adopted by the Wifi device.
Further, the error codes acquired by the second acquisition unit comprise configuration timeout, authentication failure, failure of acquiring the IP address by the DHCP and error codes of no wireless access point scanning.
it will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware related to instructions of a computer program, which can be stored in a computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above.
Although the present application has been described with reference to embodiments, those skilled in the art will appreciate that there are numerous variations and permutations of the present application without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.