Methods Summary |
---|
public int | describeContents()Implement the Parcelable interface {@hide}
return 0;
|
public java.lang.String | getBSSID()Return the basic service set identifier (BSSID) of the current access point.
The BSSID may be {@code null} if there is no network currently connected.
return mBSSID;
|
public static android.net.NetworkInfo.DetailedState | getDetailedStateOf(SupplicantState suppState)Map a supplicant state into a fine-grained network connectivity state.
return stateMap.get(suppState);
|
public int | getFrequency()Returns the current frequency in {@link #FREQUENCY_UNITS}.
return mFrequency;
|
public boolean | getHiddenSSID()
if (mWifiSsid == null) return false;
return mWifiSsid.isHidden();
|
public int | getIpAddress()
int result = 0;
if (mIpAddress instanceof Inet4Address) {
result = NetworkUtils.inetAddressToInt((Inet4Address)mIpAddress);
}
return result;
|
public int | getLinkSpeed()Returns the current link speed in {@link #LINK_SPEED_UNITS}.
return mLinkSpeed;
|
public java.lang.String | getMacAddress()
return mMacAddress;
|
public boolean | getMeteredHint(){@hide}
return mMeteredHint;
|
public int | getNetworkId()Each configured network has a unique small integer ID, used to identify
the network when performing operations on the supplicant. This method
returns the ID for the currently connected network.
return mNetworkId;
|
public int | getRssi()Returns the received signal strength indicator of the current 802.11
network, in dBm.
Use {@link android.net.wifi.WifiManager#calculateSignalLevel} to convert this number into
an absolute signal level which can be displayed to a user.
return mRssi;
|
public java.lang.String | getSSID()Returns the service set identifier (SSID) of the current 802.11 network.
If the SSID can be decoded as UTF-8, it will be returned surrounded by double
quotation marks. Otherwise, it is returned as a string of hex digits. The
SSID may be <unknown ssid> if there is no network currently connected.
if (mWifiSsid != null) {
String unicode = mWifiSsid.toString();
if (!TextUtils.isEmpty(unicode)) {
return "\"" + unicode + "\"";
} else {
return mWifiSsid.getHexString();
}
}
return WifiSsid.NONE;
|
public SupplicantState | getSupplicantState()Return the detailed state of the supplicant's negotiation with an
access point, in the form of a {@link SupplicantState SupplicantState} object.
return mSupplicantState;
|
public WifiSsid | getWifiSsid()
return mWifiSsid;
|
public boolean | is24GHz()
return ScanResult.is24GHz(mFrequency);
|
public boolean | is5GHz()
return ScanResult.is5GHz(mFrequency);
|
public static java.lang.String | removeDoubleQuotes(java.lang.String string){@hide}
if (string == null) return null;
final int length = string.length();
if ((length > 1) && (string.charAt(0) == '"") && (string.charAt(length - 1) == '"")) {
return string.substring(1, length - 1);
}
return string;
|
public void | reset()
setInetAddress(null);
setBSSID(null);
setSSID(null);
setNetworkId(-1);
setRssi(INVALID_RSSI);
setLinkSpeed(-1);
setFrequency(-1);
setMeteredHint(false);
txBad = 0;
txSuccess = 0;
rxSuccess = 0;
txRetries = 0;
txBadRate = 0;
txSuccessRate = 0;
rxSuccessRate = 0;
txRetriesRate = 0;
lowRssiCount = 0;
badRssiCount = 0;
linkStuckCount = 0;
score = 0;
|
public void | setBSSID(java.lang.String BSSID)
mBSSID = BSSID;
|
public void | setFrequency(int frequency)
this.mFrequency = frequency;
|
public void | setInetAddress(java.net.InetAddress address)
mIpAddress = address;
|
public void | setLinkSpeed(int linkSpeed)
this.mLinkSpeed = linkSpeed;
|
public void | setMacAddress(java.lang.String macAddress)Record the MAC address of the WLAN interface
this.mMacAddress = macAddress;
|
public void | setMeteredHint(boolean meteredHint){@hide}
mMeteredHint = meteredHint;
|
public void | setNetworkId(int id)
mNetworkId = id;
|
public void | setRssi(int rssi)
if (rssi < INVALID_RSSI)
rssi = INVALID_RSSI;
if (rssi > MAX_RSSI)
rssi = MAX_RSSI;
mRssi = rssi;
|
public void | setSSID(WifiSsid wifiSsid)
mWifiSsid = wifiSsid;
|
public void | setSupplicantState(SupplicantState state)
mSupplicantState = state;
|
void | setSupplicantState(java.lang.String stateName)Set the SupplicantState from the string name
of the state.
mSupplicantState = valueOf(stateName);
|
public java.lang.String | toString()
StringBuffer sb = new StringBuffer();
String none = "<none>";
sb.append("SSID: ").append(mWifiSsid == null ? WifiSsid.NONE : mWifiSsid).
append(", BSSID: ").append(mBSSID == null ? none : mBSSID).
append(", MAC: ").append(mMacAddress == null ? none : mMacAddress).
append(", Supplicant state: ").
append(mSupplicantState == null ? none : mSupplicantState).
append(", RSSI: ").append(mRssi).
append(", Link speed: ").append(mLinkSpeed).append(LINK_SPEED_UNITS).
append(", Frequency: ").append(mFrequency).append(FREQUENCY_UNITS).
append(", Net ID: ").append(mNetworkId).
append(", Metered hint: ").append(mMeteredHint).
append(", score: ").append(Integer.toString(score));
return sb.toString();
|
public void | updatePacketRates(WifiLinkLayerStats stats)TODO: get actual timestamp and calculate true rates
if (stats != null) {
long txgood = stats.txmpdu_be + stats.txmpdu_bk + stats.txmpdu_vi + stats.txmpdu_vo;
long txretries = stats.retries_be + stats.retries_bk
+ stats.retries_vi + stats.retries_vo;
long rxgood = stats.rxmpdu_be + stats.rxmpdu_bk + stats.rxmpdu_vi + stats.rxmpdu_vo;
long txbad = stats.lostmpdu_be + stats.lostmpdu_bk
+ stats.lostmpdu_vi + stats.lostmpdu_vo;
txBadRate = (txBadRate * 0.5)
+ ((double) (txbad - txBad) * 0.5);
txSuccessRate = (txSuccessRate * 0.5)
+ ((double) (txgood - txSuccess) * 0.5);
rxSuccessRate = (rxSuccessRate * 0.5)
+ ((double) (rxgood - rxSuccess) * 0.5);
txRetriesRate = (txRetriesRate * 0.5)
+ ((double) (txretries - txRetries) * 0.5);
txBad = txbad;
txSuccess = txgood;
rxSuccess = rxgood;
txRetries = txretries;
} else {
txBad = 0;
txSuccess = 0;
rxSuccess = 0;
txRetries = 0;
txBadRate = 0;
txSuccessRate = 0;
rxSuccessRate = 0;
txRetriesRate = 0;
}
|
public void | updatePacketRates(long txPackets, long rxPackets)This function is less powerful and used if the WifiLinkLayerStats API is not implemented
at the Wifi HAL
//paranoia
txBad = 0;
txRetries = 0;
txBadRate = 0;
txRetriesRate = 0;
txSuccessRate = (txSuccessRate * 0.5)
+ ((double) (txPackets - txSuccess) * 0.5);
rxSuccessRate = (rxSuccessRate * 0.5)
+ ((double) (rxPackets - rxSuccess) * 0.5);
txSuccess = txPackets;
rxSuccess = rxPackets;
|
static SupplicantState | valueOf(java.lang.String stateName)
if ("4WAY_HANDSHAKE".equalsIgnoreCase(stateName))
return SupplicantState.FOUR_WAY_HANDSHAKE;
else {
try {
return SupplicantState.valueOf(stateName.toUpperCase(Locale.ROOT));
} catch (IllegalArgumentException e) {
return SupplicantState.INVALID;
}
}
|
public void | writeToParcel(android.os.Parcel dest, int flags)Implement the Parcelable interface {@hide}
dest.writeInt(mNetworkId);
dest.writeInt(mRssi);
dest.writeInt(mLinkSpeed);
dest.writeInt(mFrequency);
if (mIpAddress != null) {
dest.writeByte((byte)1);
dest.writeByteArray(mIpAddress.getAddress());
} else {
dest.writeByte((byte)0);
}
if (mWifiSsid != null) {
dest.writeInt(1);
mWifiSsid.writeToParcel(dest, flags);
} else {
dest.writeInt(0);
}
dest.writeString(mBSSID);
dest.writeString(mMacAddress);
dest.writeInt(mMeteredHint ? 1 : 0);
dest.writeInt(score);
dest.writeDouble(txSuccessRate);
dest.writeDouble(txRetriesRate);
dest.writeDouble(txBadRate);
dest.writeDouble(rxSuccessRate);
dest.writeInt(badRssiCount);
dest.writeInt(lowRssiCount);
mSupplicantState.writeToParcel(dest, flags);
|