MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / wifi_join

Function wifi_join

components/drivers/wlan/dev_wlan_cmd.c:468–508  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

466}
467
468static int wifi_join(int argc, char *argv[])
469{
470 const char *ssid = RT_NULL;
471 const char *key = RT_NULL;
472 struct rt_wlan_cfg_info cfg_info;
473
474 rt_memset(&cfg_info, 0, sizeof(cfg_info));
475 if (argc == 2)
476 {
477#ifdef RT_WLAN_CFG_ENABLE
478 /* get info to connect */
479 if (rt_wlan_cfg_read_index(&cfg_info, 0) == 1)
480 {
481 ssid = (char *)(&cfg_info.info.ssid.val[0]);
482 if (cfg_info.key.len)
483 key = (char *)(&cfg_info.key.val[0]);
484 }
485 else
486#endif
487 {
488 rt_kprintf("not find connect info\n");
489 }
490 }
491 else if (argc == 3)
492 {
493 /* ssid */
494 ssid = argv[2];
495 }
496 else if (argc == 4)
497 {
498 ssid = argv[2];
499 /* password */
500 key = argv[3];
501 }
502 else
503 {
504 return -1;
505 }
506 rt_wlan_connect(ssid, key);
507 return 0;
508}
509
510static int wifi_ap(int argc, char *argv[])
511{

Callers

nothing calls this directly

Calls 4

rt_memsetFunction · 0.85
rt_wlan_cfg_read_indexFunction · 0.85
rt_kprintfFunction · 0.85
rt_wlan_connectFunction · 0.85

Tested by

no test coverage detected