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

Function rt_wlan_ap_stop

components/drivers/wlan/dev_wlan_mgnt.c:1355–1399  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1353}
1354
1355rt_err_t rt_wlan_ap_stop(void)
1356{
1357 rt_err_t err = RT_EOK;
1358 struct rt_wlan_complete_des *complete;
1359 rt_uint32_t set = 0, recved = 0;
1360
1361 if (_ap_is_null())
1362 {
1363 return -RT_EIO;
1364 }
1365 RT_WLAN_LOG_D("%s is run", __FUNCTION__);
1366
1367 MGNT_LOCK();
1368 /* create event wait complete */
1369 complete = rt_wlan_complete_create("stop_ap");
1370 if (complete == RT_NULL)
1371 {
1372 MGNT_UNLOCK();
1373 return -RT_ENOMEM;
1374 }
1375 err = rt_wlan_dev_ap_stop(AP_DEVICE());
1376 if (err != RT_EOK)
1377 {
1378 RT_WLAN_LOG_E("ap stop fail");
1379 rt_wlan_complete_delete(complete);
1380 MGNT_UNLOCK();
1381 return err;
1382 }
1383 /* Initializing events that need to wait */
1384 set |= 0x1 << RT_WLAN_DEV_EVT_AP_STOP;
1385 /* Check whether there is a waiting event */
1386 rt_wlan_complete_wait(complete, set, RT_WLAN_START_AP_WAIT_MS, &recved);
1387 rt_wlan_complete_delete(complete);
1388 /* check event */
1389 set = 0x1 << RT_WLAN_DEV_EVT_AP_STOP;
1390 if (!(recved & set))
1391 {
1392 RT_WLAN_LOG_I("ap stop failed!");
1393 MGNT_UNLOCK();
1394 return -RT_ERROR;
1395 }
1396 RT_WLAN_LOG_I("ap stop success!");
1397 MGNT_UNLOCK();
1398 return err;
1399}
1400
1401rt_err_t rt_wlan_ap_get_info(struct rt_wlan_info *info)
1402{

Callers 1

wifi_ap_stopFunction · 0.85

Calls 5

_ap_is_nullFunction · 0.85
rt_wlan_complete_createFunction · 0.85
rt_wlan_dev_ap_stopFunction · 0.85
rt_wlan_complete_deleteFunction · 0.85
rt_wlan_complete_waitFunction · 0.85

Tested by

no test coverage detected