Trình trợ giúp Wi-Fi
public class WifiHelper
extends Object
java.lang.Object |
↳ | com.android.tradefed.device.WifiHelper |
Lớp trợ giúp để thao tác các dịch vụ wifi trên thiết bị.
Bản tóm tắt
Phương thức công khai |
---|
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) |
boolean | disableWifi () |
boolean | disconnectFromNetwork () |
boolean | enableWifi () |
static File | extractWifiUtilApk () Phương thức trợ giúp để trích xuất apk sử dụng wifi từ đường dẫn lớp |
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) |
Lĩnh vực
INSTRUMENTATION_PKG
public static final String INSTRUMENTATION_PKG
nhà thầu công cộng
Trình trợ giúp Wi-Fi
public WifiHelper (ITestDevice device)
Thông số |
---|
device | ITestDevice |
Trình trợ giúp Wi-Fi
public WifiHelper (ITestDevice device,
String wifiUtilApkPath)
Thông số |
---|
device | ITestDevice |
wifiUtilApkPath | String |
Trình trợ giúp Wi-Fi
public WifiHelper (ITestDevice device,
String wifiUtilApkPath,
boolean doSetup)
Trình xây dựng thay thế có thể bỏ qua việc thiết lập apk wifi.
Thông số |
---|
device | ITestDevice |
wifiUtilApkPath | String |
doSetup | boolean |
Phương thức công khai
thêmMởMạng
public boolean addOpenNetwork (String ssid)
thêmMởMạng
public boolean addOpenNetwork (String ssid,
boolean scanSsid)
Thông số |
---|
ssid | String |
scanSsid | boolean |
addWpaPskMạng
public boolean addWpaPskNetwork (String ssid,
String psk)
Thông số |
---|
ssid | String |
psk | String |
addWpaPskMạng
public boolean addWpaPskNetwork (String ssid,
String psk,
boolean scanSsid)
Thông số |
---|
ssid | String |
psk | String |
scanSsid | boolean |
kiểm tra kết nối
public boolean checkConnectivity (String urlToCheck)
Thông số |
---|
urlToCheck | String |
dọn dẹp
public void cleanUp ()
kết nối với mạng
public boolean connectToNetwork (String ssid,
String psk,
String urlToCheck)
Thông số |
---|
ssid | String |
psk | String |
urlToCheck | String |
kết nối với mạng
public IWifiHelper.WifiConnectionResult connectToNetwork (String ssid,
String psk,
String urlToCheck,
boolean scanSsid)
Thông số |
---|
ssid | String |
psk | String |
urlToCheck | String |
scanSsid | boolean |
trả lại |
---|
IWifiHelper.WifiConnectionResult | |
vô hiệu hóaWifi
public boolean disableWifi ()
ngắt kết nối khỏi mạng
public boolean disconnectFromNetwork ()
kích hoạtWifi
public boolean enableWifi ()
public static File extractWifiUtilApk ()
Phương thức trợ giúp để trích xuất apk sử dụng wifi từ đường dẫn lớp
nhậnBSSID
public String getBSSID ()
getIpAddress
public String getIpAddress ()
getSSID
public String getSSID ()
getWifiInfo
public getWifiInfo ()
hasValidIp
public boolean hasValidIp ()
làWifiEnabled
public boolean isWifiEnabled ()
removeAllNetworks
public boolean removeAllNetworks ()
bắt đầuMonitor
public boolean startMonitor (long interval,
String urlToCheck)
Thông số |
---|
interval | long |
urlToCheck | String |
dừng theo dõi
public stopMonitor ()
chờ đợiIp
public boolean waitForIp (long timeout)
waitForWifiĐã tắt
public boolean waitForWifiDisabled (long timeout)
waitForWifiĐã tắt
public boolean waitForWifiDisabled ()
waitForWifiEnabled
public boolean waitForWifiEnabled (long timeout)
waitForWifiEnabled
public boolean waitForWifiEnabled ()
chờ đợiWifiState
public boolean waitForWifiState (WifiState... expectedStates)
Thông số |
---|
expectedStates | WifiState |