我正在使用WifiWizard来扫描当前网络。为此,我使用以下
WifiWizard.startScan(success, fail);
function success()
{
WifiWizard.getScanResults(networks,fail);
}
function fail()
{
alert('not found');
}
function networks(networkResult)
{
result =(JSON.stringify(networkResult));
alert(JSON.stringify(networkResult));
}
这确实为我提供了像这样的网络结果
networks = [
{ "level": signal_level, // raw RSSI value
"SSID": ssid, // SSID as string, with escaped double quotes: "\"ssid name\""
"BSSID": bssid // MAC address of WiFi router as string
"frequency": frequency of the access point channel in MHz
"capabilities": capabilities // Describes the authentication, key management, and encryption schemes supported by the access point.
"timestamp": timestamp in microseconds (since boot) when this result was last seen.
}
]
但我只想要BSSID,我认为这将是networkResult.BSSID
,但这是未定义的。我如何获得BSSID>
答案 0 :(得分:0)
networkResult变量是一个数组,因此您需要它的第一个元素:
networkResult[0]['BSSID']
或
networkResult[0].BSSID