mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-10-09 23:15:25 +00:00
wireless/wapi: add save_config/reconnect support
Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
parent
6bafe90db4
commit
df1d0e73f8
4 changed files with 322 additions and 20 deletions
|
|
@ -62,6 +62,12 @@
|
|||
|
||||
#define WAPI_IOCTL_COMMAND_NAMEBUFSIZ 24
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
static char g_ioctl_command_namebuf[WAPI_IOCTL_COMMAND_NAMEBUFSIZ];
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
|
@ -135,7 +141,15 @@ static bool wapi_json_update(FAR cJSON *root,
|
|||
}
|
||||
else
|
||||
{
|
||||
if (!strncmp(value, obj->valuestring, strlen(obj->valuestring)))
|
||||
int len = strlen(obj->valuestring);
|
||||
if (len > 0)
|
||||
{
|
||||
if (!strncmp(value, obj->valuestring, len))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (len == 0 && value == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
@ -155,12 +169,6 @@ static bool wapi_json_update(FAR cJSON *root,
|
|||
}
|
||||
#endif /* CONFIG_WIRELESS_WAPI_INITCONF */
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
static char g_ioctl_command_namebuf[WAPI_IOCTL_COMMAND_NAMEBUFSIZ];
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
|
@ -377,7 +385,7 @@ FAR void *wapi_load_config(FAR const char *ifname,
|
|||
|
||||
conf->ifname = ifname;
|
||||
conf->ssidlen = strlen(conf->ssid);
|
||||
conf->phraselen = strlen(conf->passphrase);
|
||||
conf->phraselen = conf->passphrase ? strlen(conf->passphrase) : 0;
|
||||
|
||||
return root;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue