diff options
author | Felipe Leme <felipeal@google.com> | 2014-02-03 11:24:21 -0800 |
---|---|---|
committer | Felipe Leme <felipeal@google.com> | 2014-02-05 18:23:22 -0800 |
commit | 70a415e7fe56ecf0b2591d540913f70ed211d66d (patch) | |
tree | 6a15211cd30902abb814c876ceb46b35b1f04a23 /wifi | |
parent | 80ddc85515abc2da10a5bce16fcf491e0a31522b (diff) | |
download | frameworks_base-70a415e7fe56ecf0b2591d540913f70ed211d66d.zip frameworks_base-70a415e7fe56ecf0b2591d540913f70ed211d66d.tar.gz frameworks_base-70a415e7fe56ecf0b2591d540913f70ed211d66d.tar.bz2 |
Added support for WiFi frequency on WifiInfo (getter, settter, and frequency constant).
Bug: 12767819
Change-Id: Ib4a03919d9100861e993c733b7e478dc93dffaae
Diffstat (limited to 'wifi')
-rw-r--r-- | wifi/java/android/net/wifi/WifiInfo.java | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/wifi/java/android/net/wifi/WifiInfo.java b/wifi/java/android/net/wifi/WifiInfo.java index 6a13067..4a6821c 100644 --- a/wifi/java/android/net/wifi/WifiInfo.java +++ b/wifi/java/android/net/wifi/WifiInfo.java @@ -69,6 +69,10 @@ public class WifiInfo implements Parcelable { public static final String LINK_SPEED_UNITS = "Mbps"; private int mLinkSpeed; + /** Frequency in MHz */ + public static final String FREQUENCY_UNITS = "MHz"; + private int mFrequency; + private InetAddress mIpAddress; private String mMacAddress; @@ -86,6 +90,7 @@ public class WifiInfo implements Parcelable { mSupplicantState = SupplicantState.UNINITIALIZED; mRssi = -9999; mLinkSpeed = -1; + mFrequency = -1; } /** @@ -100,6 +105,7 @@ public class WifiInfo implements Parcelable { mNetworkId = source.mNetworkId; mRssi = source.mRssi; mLinkSpeed = source.mLinkSpeed; + mFrequency = source.mFrequency; mIpAddress = source.mIpAddress; mMacAddress = source.mMacAddress; mMeteredHint = source.mMeteredHint; @@ -179,6 +185,20 @@ public class WifiInfo implements Parcelable { } /** + * Returns the current frequency in {@link #FREQUENCY_UNITS}. + * @return the frequency. + * @see #FREQUENCY_UNITS + */ + public int getFrequency() { + return mFrequency; + } + + /** @hide */ + public void setFrequency(int frequency) { + this.mFrequency = frequency; + } + + /** * Record the MAC address of the WLAN interface * @param macAddress the MAC address in {@code XX:XX:XX:XX:XX:XX} form * @hide @@ -303,7 +323,8 @@ public class WifiInfo implements Parcelable { append(", Supplicant state: "). append(mSupplicantState == null ? none : mSupplicantState). append(", RSSI: ").append(mRssi). - append(", Link speed: ").append(mLinkSpeed). + 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); @@ -320,6 +341,7 @@ public class WifiInfo implements Parcelable { dest.writeInt(mNetworkId); dest.writeInt(mRssi); dest.writeInt(mLinkSpeed); + dest.writeInt(mFrequency); if (mIpAddress != null) { dest.writeByte((byte)1); dest.writeByteArray(mIpAddress.getAddress()); @@ -346,6 +368,7 @@ public class WifiInfo implements Parcelable { info.setNetworkId(in.readInt()); info.setRssi(in.readInt()); info.setLinkSpeed(in.readInt()); + info.setFrequency(in.readInt()); if (in.readByte() == 1) { try { info.setInetAddress(InetAddress.getByAddress(in.createByteArray())); |