Changed wifi.sta.getrssi() to allow user to request RSSI from alternate

BSSID even if bssid_set==0 in STATION config
This commit is contained in:
dnc40085 2015-05-09 20:13:53 -07:00
parent bdda245a82
commit 90e8bfd5e4
1 changed files with 13 additions and 17 deletions

View File

@ -483,27 +483,23 @@ static int wifi_station_getrssi( lua_State* L )
config.ssid = ssid; config.ssid = ssid;
} }
if(sta_conf.bssid_set==1) // check if STATION is configured to connect to a specific AP's BSSID if(lua_isstring(L, 2)) //check if user specified an alternate BSSID to check
{ {
if(lua_isstring(L, 2)) //check if user specified an alternate BSSID to check char mac[6];
{ unsigned len = 0;
char mac[6]; const char *macaddr = luaL_checklstring( L, 2, &len );
unsigned len = 0; if(len!=17)
const char *macaddr = luaL_checklstring( L, 2, &len ); return luaL_error( L, "wrong arg type" );
if(len!=17) os_str2macaddr(mac, macaddr);
return luaL_error( L, "wrong arg type" ); config.bssid = mac;
os_str2macaddr(mac, macaddr); }
config.bssid = mac; else if (sta_conf.bssid_set==1) // check if STATION is configured to connect to a specific AP's BSSID
// c_memcpy(config.bssid, mac, 6); {
} config.bssid = sta_conf.bssid;
else //user did NOT specify an alternate BSSID to check
{
config.bssid = sta_conf.bssid;
}
} }
else //STATION is NOT configured to connect to a specific AP else //STATION is NOT configured to connect to a specific AP
{ {
config.bssid = NULL; config.bssid = NULL;
} }
config.channel=channel; config.channel=channel;