1 /**************************************************************************//**
2 *
3 * @copyright (C) 2019 Nuvoton Technology Corp. All rights reserved.
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 *
7 * Change Logs:
8 * Date            Author       Notes
9 * 2022-9-19       Wayne        First version
10 *
11 ******************************************************************************/
12 
13 #include <rtthread.h>
14 
15 #if defined(PKG_USING_AT_DEVICE)
16 
17 #include <at_device.h>
18 
at_wifi_set(int argc,char ** argv)19 static void at_wifi_set(int argc, char **argv)
20 {
21     struct at_device_ssid_pwd sATDConf;
22     struct at_device *at_dev = RT_NULL;
23 
24     /* If the number of arguments less than 2 */
25     if (argc != 3)
26     {
27         rt_kprintf("\n");
28         rt_kprintf("at_wifi_set <ssid> <password>\n");
29         return ;
30     }
31 
32     sATDConf.ssid     = argv[1]; //ssid
33     sATDConf.password = argv[2]; //password
34 
35     if ((at_dev = at_device_get_first_initialized()) != RT_NULL)
36         at_device_control(at_dev, AT_DEVICE_CTRL_SET_WIFI_INFO, &sATDConf);
37     else
38     {
39         rt_kprintf("Can't find any initialized AT device.\n");
40     }
41 }
42 
43 #ifdef FINSH_USING_MSH
44     MSH_CMD_EXPORT(at_wifi_set, AT device wifi set ssid / password function);
45 #endif
46 
47 #endif /* #if defined(PKG_USING_AT_DEVICE) */
48 
49