Assistente de Wi-Fi
public
class
WifiHelper
extends Object
java.lang.Object | |
↳ | com.android.tradefed.device.WifiHelper |
Classe auxiliar para manipular serviços de Wi-Fi no dispositivo.
Resumo
Campos | |
---|---|
public
static
final
String |
INSTRUMENTATION_PKG
|
Construtores públicos | |
---|---|
WifiHelper(ITestDevice device)
|
|
WifiHelper(ITestDevice device, String wifiUtilApkPath)
|
|
WifiHelper(ITestDevice device, String wifiUtilApkPath, boolean doSetup)
Construtor alternativo que pode pular a configuração do APK de Wi-Fi. |
|
WifiHelper(ITestDevice device, String wifiUtilApkPath, boolean doSetup, boolean useV2)
Construtor para especificar se o novo assistente de Wi-Fi v2 será usado. |
Métodos públicos | |
---|---|
boolean
|
addOpenNetwork(String ssid)
|
boolean
|
addOpenNetwork(String ssid, boolean scanSsid)
|
boolean
|
addWpaPskNetwork(String ssid, String psk)
|
boolean
|
addWpaPskNetwork(String ssid, String psk, boolean scanSsid)
|
boolean
|
checkConnectivity(String urlToCheck)
|
void
|
cleanUp()
|
boolean
|
connectToNetwork(String ssid, String psk, String urlToCheck)
|
IWifiHelper.WifiConnectionResult
|
connectToNetwork(String ssid, String psk, String urlToCheck, boolean scanSsid, String defaultType)
|
IWifiHelper.WifiConnectionResult
|
connectToNetwork(String ssid, String psk, String urlToCheck, boolean scanSsid)
|
boolean
|
disableWifi()
|
boolean
|
disconnectFromNetwork()
|
boolean
|
enableWifi()
|
static
File
|
extractWifiUtilApk()
Método auxiliar para extrair o APK utilit de Wi-Fi do caminho de classe |
String
|
getBSSID()
|
String
|
getIpAddress()
|
String
|
getSSID()
|
|
getWifiInfo()
|
boolean
|
hasValidIp()
|
boolean
|
isWifiEnabled()
|
boolean
|
removeAllNetworks()
|
boolean
|
startMonitor(long interval, String urlToCheck)
|
|
stopMonitor()
|
boolean
|
waitForIp(long timeout)
|
boolean
|
waitForWifiDisabled(long timeout)
|
boolean
|
waitForWifiDisabled()
|
boolean
|
waitForWifiEnabled(long timeout)
|
boolean
|
waitForWifiEnabled()
|
boolean
|
waitForWifiState(WifiState... expectedStates)
|
Campos
PKG
public static final String INSTRUMENTATION_PKG
Construtores públicos
Assistente de Wi-Fi
public WifiHelper (ITestDevice device)
Parâmetros | |
---|---|
device |
ITestDevice |
Gera | |
---|---|
DeviceNotAvailableException |
Assistente de Wi-Fi
public WifiHelper (ITestDevice device, String wifiUtilApkPath)
Parâmetros | |
---|---|
device |
ITestDevice |
wifiUtilApkPath |
String |
Gera | |
---|---|
DeviceNotAvailableException |
Assistente de Wi-Fi
public WifiHelper (ITestDevice device, String wifiUtilApkPath, boolean doSetup)
Construtor alternativo que pode pular a configuração do APK de Wi-Fi.
Parâmetros | |
---|---|
device |
ITestDevice |
wifiUtilApkPath |
String |
doSetup |
boolean |
Gera | |
---|---|
DeviceNotAvailableException |
Assistente de Wi-Fi
public WifiHelper (ITestDevice device, String wifiUtilApkPath, boolean doSetup, boolean useV2)
Construtor para especificar se o novo assistente de Wi-Fi v2 será usado. as operações da v2 não precisam install the wifi util apk.
Parâmetros | |
---|---|
device |
ITestDevice |
wifiUtilApkPath |
String |
doSetup |
boolean |
useV2 |
boolean |
Gera | |
---|---|
DeviceNotAvailableException |
Métodos públicos
addOpenNetwork
public boolean addOpenNetwork (String ssid)
Parâmetros | |
---|---|
ssid |
String |
Retorna | |
---|---|
boolean |
Gera | |
---|---|
DeviceNotAvailableException |
addOpenNetwork
public boolean addOpenNetwork (String ssid, boolean scanSsid)
Parâmetros | |
---|---|
ssid |
String |
scanSsid |
boolean |
Retorna | |
---|---|
boolean |
Gera | |
---|---|
DeviceNotAvailableException |
addWpaPskNetwork
public boolean addWpaPskNetwork (String ssid, String psk)
Parâmetros | |
---|---|
ssid |
String |
psk |
String |
Retorna | |
---|---|
boolean |
Gera | |
---|---|
DeviceNotAvailableException |
addWpaPskNetwork
public boolean addWpaPskNetwork (String ssid, String psk, boolean scanSsid)
Parâmetros | |
---|---|
ssid |
String |
psk |
String |
scanSsid |
boolean |
Retorna | |
---|---|
boolean |
Gera | |
---|---|
DeviceNotAvailableException |
verificarConectividade
public boolean checkConnectivity (String urlToCheck)
Parâmetros | |
---|---|
urlToCheck |
String |
Retorna | |
---|---|
boolean |
Gera | |
---|---|
DeviceNotAvailableException |
connectToNetwork
public boolean connectToNetwork (String ssid, String psk, String urlToCheck)
Parâmetros | |
---|---|
ssid |
String |
psk |
String |
urlToCheck |
String |
Retorna | |
---|---|
boolean |
Gera | |
---|---|
DeviceNotAvailableException |
connectToNetwork
public IWifiHelper.WifiConnectionResult connectToNetwork (String ssid, String psk, String urlToCheck, boolean scanSsid, String defaultType)
Parâmetros | |
---|---|
ssid |
String |
psk |
String |
urlToCheck |
String |
scanSsid |
boolean |
defaultType |
String |
Retorna | |
---|---|
IWifiHelper.WifiConnectionResult |
Gera | |
---|---|
DeviceNotAvailableException |
connectToNetwork
public IWifiHelper.WifiConnectionResult connectToNetwork (String ssid, String psk, String urlToCheck, boolean scanSsid)
Parâmetros | |
---|---|
ssid |
String |
psk |
String |
urlToCheck |
String |
scanSsid |
boolean |
Retorna | |
---|---|
IWifiHelper.WifiConnectionResult |
Gera | |
---|---|
DeviceNotAvailableException |
desconexão da rede
public boolean disconnectFromNetwork ()
Retorna | |
---|---|
boolean |
Gera | |
---|---|
DeviceNotAvailableException |
extrair WifiUtilApk
public static File extractWifiUtilApk ()
Método auxiliar para extrair o APK utilit de Wi-Fi do caminho de classe
Retorna | |
---|---|
File |
getSSID (Identificador do conjunto de serviços)
public String getSSID ()
Retorna | |
---|---|
String |
Gera | |
---|---|
DeviceNotAvailableException |
Compatível com Wi-Fi
public boolean isWifiEnabled ()
Retorna | |
---|---|
boolean |
Gera | |
---|---|
DeviceNotAvailableException |
removeAllNetworks
public boolean removeAllNetworks ()
Retorna | |
---|---|
boolean |
Gera | |
---|---|
DeviceNotAvailableException |
startMonitor
public boolean startMonitor (long interval, String urlToCheck)
Parâmetros | |
---|---|
interval |
long |
urlToCheck |
String |
Retorna | |
---|---|
boolean |
Gera | |
---|---|
DeviceNotAvailableException |
"waitForIp"
public boolean waitForIp (long timeout)
Parâmetros | |
---|---|
timeout |
long |
Retorna | |
---|---|
boolean |
Gera | |
---|---|
DeviceNotAvailableException |
"waitForWiFiDisabled"
public boolean waitForWifiDisabled (long timeout)
Parâmetros | |
---|---|
timeout |
long |
Retorna | |
---|---|
boolean |
Gera | |
---|---|
DeviceNotAvailableException |
"waitForWiFiDisabled"
public boolean waitForWifiDisabled ()
Retorna | |
---|---|
boolean |
Gera | |
---|---|
DeviceNotAvailableException |
espera por Wi-FiEnabled
public boolean waitForWifiEnabled (long timeout)
Parâmetros | |
---|---|
timeout |
long |
Retorna | |
---|---|
boolean |
Gera | |
---|---|
DeviceNotAvailableException |
espera por Wi-FiEnabled
public boolean waitForWifiEnabled ()
Retorna | |
---|---|
boolean |
Gera | |
---|---|
DeviceNotAvailableException |
"waitForWiFiState"
public boolean waitForWifiState (WifiState... expectedStates)
Parâmetros | |
---|---|
expectedStates |
WifiState |
Retorna | |
---|---|
boolean |
Gera | |
---|---|
DeviceNotAvailableException |