Added description to wifi_station_listap

This commit is contained in:
dnc40085 2015-05-11 05:38:23 -07:00
parent cf54f85549
commit aca2b7724b
1 changed files with 31 additions and 0 deletions

View File

@ -436,6 +436,37 @@ static int wifi_station_setauto( lua_State* L )
return 0; return 0;
} }
/**
* wifi.sta.listap()
* Description:
* scan and get ap list as a lua table into callback function.
* Syntax:
* wifi.sta.getap(function(table))
* wifi.sta.getap(cfg, function(table))
* Parameters:
* cfg: table that contains scan configuration
* function(table): a callback function to receive ap table when scan is done
this function receive a table, the key is the ssid,
value is other info in format: authmode,rssi,bssid,channel
* Returns:
* nil
*
* Example:
--original function left intact to preserve backward compatibility
wifi.sta.getap(function(T) for k,v in pairs(T) do print(k..":"..v) end end)
--if no scan configuration is desired cfg can be set to nil or previous example can be used
wifi.sta.getap(nil, function(T) for k,v in pairs(T) do print(k..":"..v) end end)
--scan configuration
scan_cfg={}
scan_cfg.ssid="myssid" --if set to nil, ssid is not filtered
scan_cfg.bssid="AA:AA:AA:AA:AA:AA" --if set to nil, MAC address is not filtered
scan_cfg.channel=0 --if set to nil, channel will default to 0(scans all channels), if set scan will be faster
scan_cfg.show_hidden=1 --if set to nil, show_hidden will default to 0
wifi.sta.getap(scan_cfg, function(T) for k,v in pairs(T) do print(k..":"..v) end end)
*/
static int wifi_station_listap( lua_State* L ) static int wifi_station_listap( lua_State* L )
{ {
if(wifi_get_opmode() == SOFTAP_MODE) if(wifi_get_opmode() == SOFTAP_MODE)