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;
}
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;
const char *macaddr = luaL_checklstring( L, 2, &len );
if(len!=17)
return luaL_error( L, "wrong arg type" );
os_str2macaddr(mac, macaddr);
config.bssid = mac;
// c_memcpy(config.bssid, mac, 6);
}
else //user did NOT specify an alternate BSSID to check
{
config.bssid = sta_conf.bssid;
}
char mac[6];
unsigned len = 0;
const char *macaddr = luaL_checklstring( L, 2, &len );
if(len!=17)
return luaL_error( L, "wrong arg type" );
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
{
config.bssid = sta_conf.bssid;
}
else //STATION is NOT configured to connect to a specific AP
{
config.bssid = NULL;
config.bssid = NULL;
}
config.channel=channel;