public class WifiInfo extends Object implements Parcelable
Parcelable.ClassLoaderCreator<T>, Parcelable.Creator<T>
Modifier and Type | Field and Description |
---|---|
int |
badRssiCount |
static Parcelable.Creator<WifiInfo> |
CREATOR
Implement the Parcelable interface
|
static String |
DEFAULT_MAC_ADDRESS
Default MAC address reported to a client that does not have the
android.permission.LOCAL_MAC_ADDRESS permission.
|
static String |
FREQUENCY_UNITS
Frequency in MHz
|
static int |
INVALID_RSSI |
static String |
LINK_SPEED_UNITS
Link speed in Mbps
|
int |
linkStuckCount |
int |
lowRssiCount |
static int |
MAX_RSSI |
static int |
MIN_RSSI |
long |
rxSuccess |
double |
rxSuccessRate |
int |
score |
long |
txBad |
double |
txBadRate |
long |
txRetries |
double |
txRetriesRate |
long |
txSuccess |
double |
txSuccessRate |
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_ELIDE_DUPLICATES, PARCELABLE_WRITE_RETURN_VALUE
Constructor and Description |
---|
WifiInfo() |
WifiInfo(WifiInfo source)
Copy constructor
|
Modifier and Type | Method and Description |
---|---|
int |
describeContents()
Implement the Parcelable interface
|
String |
getBSSID()
Return the basic service set identifier (BSSID) of the current access point.
|
static NetworkInfo.DetailedState |
getDetailedStateOf(SupplicantState suppState)
Map a supplicant state into a fine-grained network connectivity state.
|
int |
getFrequency()
Returns the current frequency in
FREQUENCY_UNITS . |
boolean |
getHiddenSSID() |
int |
getIpAddress() |
int |
getLinkSpeed()
Returns the current link speed in
LINK_SPEED_UNITS . |
String |
getMacAddress() |
boolean |
getMeteredHint() |
int |
getNetworkId()
Each configured network has a unique small integer ID, used to identify
the network when performing operations on the supplicant.
|
int |
getRssi()
Returns the received signal strength indicator of the current 802.11
network, in dBm.
|
String |
getSSID()
Returns the service set identifier (SSID) of the current 802.11 network.
|
SupplicantState |
getSupplicantState()
Return the detailed state of the supplicant's negotiation with an
access point, in the form of a
SupplicantState object. |
WifiSsid |
getWifiSsid() |
boolean |
hasRealMacAddress() |
boolean |
is24GHz() |
boolean |
is5GHz() |
boolean |
isEphemeral() |
static String |
removeDoubleQuotes(String string) |
void |
reset() |
void |
setBSSID(String BSSID) |
void |
setEphemeral(boolean ephemeral) |
void |
setFrequency(int frequency) |
void |
setInetAddress(InetAddress address) |
void |
setLinkSpeed(int linkSpeed) |
void |
setMacAddress(String macAddress)
Record the MAC address of the WLAN interface
|
void |
setMeteredHint(boolean meteredHint) |
void |
setNetworkId(int id) |
void |
setRssi(int rssi) |
void |
setSSID(WifiSsid wifiSsid) |
void |
setSupplicantState(SupplicantState state) |
String |
toString()
Returns a string representation of the object.
|
void |
updatePacketRates(long txPackets,
long rxPackets)
This function is less powerful and used if the WifiLinkLayerStats API is not implemented
at the Wifi HAL
|
void |
updatePacketRates(WifiLinkLayerStats stats)
TODO: get actual timestamp and calculate true rates
|
void |
writeToParcel(Parcel dest,
int flags)
Implement the Parcelable interface
|
public static final String DEFAULT_MAC_ADDRESS
public static final int INVALID_RSSI
public static final int MIN_RSSI
public static final int MAX_RSSI
public static final String LINK_SPEED_UNITS
public static final String FREQUENCY_UNITS
public long txBad
public long txRetries
public long txSuccess
public long rxSuccess
public double txBadRate
public double txRetriesRate
public double txSuccessRate
public double rxSuccessRate
public int badRssiCount
public int linkStuckCount
public int lowRssiCount
public int score
public static final Parcelable.Creator<WifiInfo> CREATOR
public WifiInfo()
public WifiInfo(WifiInfo source)
public void updatePacketRates(WifiLinkLayerStats stats)
public void updatePacketRates(long txPackets, long rxPackets)
public void reset()
public void setSSID(WifiSsid wifiSsid)
public String getSSID()
public WifiSsid getWifiSsid()
public void setBSSID(String BSSID)
public String getBSSID()
null
if there is no network currently connected.XX:XX:XX:XX:XX:XX
public int getRssi()
Use WifiManager.calculateSignalLevel(int, int)
to convert this number into
an absolute signal level which can be displayed to a user.
public void setRssi(int rssi)
public int getLinkSpeed()
LINK_SPEED_UNITS
.LINK_SPEED_UNITS
public void setLinkSpeed(int linkSpeed)
public int getFrequency()
FREQUENCY_UNITS
.FREQUENCY_UNITS
public void setFrequency(int frequency)
public boolean is24GHz()
public boolean is5GHz()
public void setMacAddress(String macAddress)
macAddress
- the MAC address in XX:XX:XX:XX:XX:XX
formpublic String getMacAddress()
public boolean hasRealMacAddress()
getMacAddress()
has a real MAC address.public void setMeteredHint(boolean meteredHint)
public boolean getMeteredHint()
public void setEphemeral(boolean ephemeral)
public boolean isEphemeral()
public void setNetworkId(int id)
public int getNetworkId()
public SupplicantState getSupplicantState()
SupplicantState
object.SupplicantState
public void setSupplicantState(SupplicantState state)
public void setInetAddress(InetAddress address)
public int getIpAddress()
public boolean getHiddenSSID()
true
if this network does not broadcast its SSID, so an
SSID-specific probe request must be used for scans.public static NetworkInfo.DetailedState getDetailedStateOf(SupplicantState suppState)
suppState
- the supplicant stateNetworkInfo.DetailedState
public String toString()
Object
toString
method returns a string that
"textually represents" this object. The result should
be a concise but informative representation that is easy for a
person to read.
It is recommended that all subclasses override this method.
The toString
method for class Object
returns a string consisting of the name of the class of which the
object is an instance, the at-sign character `@
', and
the unsigned hexadecimal representation of the hash code of the
object. In other words, this method returns a string equal to the
value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())
public int describeContents()
describeContents
in interface Parcelable
Parcelable.CONTENTS_FILE_DESCRIPTOR
public void writeToParcel(Parcel dest, int flags)
writeToParcel
in interface Parcelable
dest
- The Parcel in which the object should be written.flags
- Additional flags about how the object should be written.
May be 0 or Parcelable.PARCELABLE_WRITE_RETURN_VALUE
.