Loading wifi/java/android/net/wifi/WifiInfo.java +6 −145 Original line number Diff line number Diff line Loading @@ -22,7 +22,6 @@ import android.net.NetworkInfo.DetailedState; import android.net.NetworkUtils; import android.text.TextUtils; import java.lang.Math; import java.net.InetAddress; import java.net.Inet4Address; import java.net.UnknownHostException; Loading Loading @@ -126,139 +125,31 @@ public class WifiInfo implements Parcelable { public long rxSuccess; /** * Average rate of lost transmitted packets, in units of packets per 5 seconds. * Average rate of lost transmitted packets, in units of packets per second. * @hide */ public double txBadRate; /** * Average rate of transmitted retry packets, in units of packets per 5 seconds. * Average rate of transmitted retry packets, in units of packets per second. * @hide */ public double txRetriesRate; /** * Average rate of successfully transmitted unicast packets, in units of packets per 5 seconds. * Average rate of successfully transmitted unicast packets, in units of packets per second. * @hide */ public double txSuccessRate; /** * Average rate of received unicast data packets, in units of packets per 5 seconds. * Average rate of received unicast data packets, in units of packets per second. * @hide */ public double rxSuccessRate; private static final long RESET_TIME_STAMP = Long.MIN_VALUE; private static final long FILTER_TIME_CONSTANT = 3000; /** * This factor is used to adjust the rate output under the new algorithm * such that the result is comparable to the previous algorithm. * This actually converts from unit 'packets per second' to 'packets per 5 seconds'. */ private static final long OUTPUT_SCALE_FACTOR = 5; private long mLastPacketCountUpdateTimeStamp; /** * @hide */ public int badRssiCount; /** * @hide */ public int linkStuckCount; /** * @hide */ public int lowRssiCount; /** * @hide */ public int score; /** * @hide */ public void updatePacketRates(WifiLinkLayerStats stats, long timeStamp) { 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; if (mLastPacketCountUpdateTimeStamp != RESET_TIME_STAMP && mLastPacketCountUpdateTimeStamp < timeStamp && txBad <= txbad && txSuccess <= txgood && rxSuccess <= rxgood && txRetries <= txretries) { long timeDelta = timeStamp - mLastPacketCountUpdateTimeStamp; double lastSampleWeight = Math.exp(-1.0 * timeDelta / FILTER_TIME_CONSTANT); double currentSampleWeight = 1.0 - lastSampleWeight; txBadRate = txBadRate * lastSampleWeight + (txbad - txBad) * OUTPUT_SCALE_FACTOR * 1000 / timeDelta * currentSampleWeight; txSuccessRate = txSuccessRate * lastSampleWeight + (txgood - txSuccess) * OUTPUT_SCALE_FACTOR * 1000 / timeDelta * currentSampleWeight; rxSuccessRate = rxSuccessRate * lastSampleWeight + (rxgood - rxSuccess) * OUTPUT_SCALE_FACTOR * 1000 / timeDelta * currentSampleWeight; txRetriesRate = txRetriesRate * lastSampleWeight + (txretries - txRetries) * OUTPUT_SCALE_FACTOR * 1000/ timeDelta * currentSampleWeight; } else { txBadRate = 0; txSuccessRate = 0; rxSuccessRate = 0; txRetriesRate = 0; } txBad = txbad; txSuccess = txgood; rxSuccess = rxgood; txRetries = txretries; mLastPacketCountUpdateTimeStamp = timeStamp; } else { txBad = 0; txSuccess = 0; rxSuccess = 0; txRetries = 0; txBadRate = 0; txSuccessRate = 0; rxSuccessRate = 0; txRetriesRate = 0; mLastPacketCountUpdateTimeStamp = RESET_TIME_STAMP; } } /** * This function is less powerful and used if the WifiLinkLayerStats API is not implemented * at the Wifi HAL * @hide */ public void updatePacketRates(long txPackets, long rxPackets) { //paranoia txBad = 0; txRetries = 0; txBadRate = 0; txRetriesRate = 0; if (txSuccess <= txPackets && rxSuccess <= rxPackets) { txSuccessRate = (txSuccessRate * 0.5) + ((double) (txPackets - txSuccess) * 0.5); rxSuccessRate = (rxSuccessRate * 0.5) + ((double) (rxPackets - rxSuccess) * 0.5); } else { txBadRate = 0; txRetriesRate = 0; } txSuccess = txPackets; rxSuccess = rxPackets; } /** * Flag indicating that AP has hinted that upstream connection is metered, * and sensitive to heavy data transfers. Loading @@ -274,7 +165,6 @@ public class WifiInfo implements Parcelable { mRssi = INVALID_RSSI; mLinkSpeed = -1; mFrequency = -1; mLastPacketCountUpdateTimeStamp = RESET_TIME_STAMP; } /** @hide */ Loading @@ -296,11 +186,7 @@ public class WifiInfo implements Parcelable { txSuccessRate = 0; rxSuccessRate = 0; txRetriesRate = 0; lowRssiCount = 0; badRssiCount = 0; linkStuckCount = 0; score = 0; mLastPacketCountUpdateTimeStamp = RESET_TIME_STAMP; } /** Loading Loading @@ -328,12 +214,7 @@ public class WifiInfo implements Parcelable { txRetriesRate = source.txRetriesRate; txSuccessRate = source.txSuccessRate; rxSuccessRate = source.rxSuccessRate; mLastPacketCountUpdateTimeStamp = source.mLastPacketCountUpdateTimeStamp; score = source.score; badRssiCount = source.badRssiCount; lowRssiCount = source.lowRssiCount; linkStuckCount = source.linkStuckCount; } } Loading Loading @@ -451,22 +332,6 @@ public class WifiInfo implements Parcelable { return ScanResult.is5GHz(mFrequency); } /** * @hide * This returns txSuccessRate in packets per second. */ public double getTxSuccessRatePps() { return txSuccessRate / OUTPUT_SCALE_FACTOR; } /** * @hide * This returns rxSuccessRate in packets per second. */ public double getRxSuccessRatePps() { return rxSuccessRate / OUTPUT_SCALE_FACTOR; } /** * Record the MAC address of the WLAN interface * @param macAddress the MAC address in {@code XX:XX:XX:XX:XX:XX} form Loading Loading @@ -658,8 +523,6 @@ public class WifiInfo implements Parcelable { dest.writeDouble(txRetriesRate); dest.writeDouble(txBadRate); dest.writeDouble(rxSuccessRate); dest.writeInt(badRssiCount); dest.writeInt(lowRssiCount); mSupplicantState.writeToParcel(dest, flags); } Loading Loading @@ -689,8 +552,6 @@ public class WifiInfo implements Parcelable { info.txRetriesRate = in.readDouble(); info.txBadRate = in.readDouble(); info.rxSuccessRate = in.readDouble(); info.badRssiCount = in.readInt(); info.lowRssiCount = in.readInt(); info.mSupplicantState = SupplicantState.CREATOR.createFromParcel(in); return info; } Loading wifi/java/android/net/wifi/WifiLinkLayerStats.javadeleted 100644 → 0 +0 −211 Original line number Diff line number Diff line /* * Copyright (C) 2014 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.net.wifi; import android.os.Parcelable; import android.os.Parcel; import java.util.Arrays; /** * A class representing link layer statistics collected over a Wifi Interface. */ /** {@hide} */ public class WifiLinkLayerStats implements Parcelable { private static final String TAG = "WifiLinkLayerStats"; /** * The current status of this network configuration entry. * @see Status */ /** {@hide} */ public int status; /** * The network's SSID. Can either be an ASCII string, * which must be enclosed in double quotation marks * (e.g., {@code "MyNetwork"}, or a string of * hex digits,which are not enclosed in quotes * (e.g., {@code 01a243f405}). */ /** {@hide} */ public String SSID; /** * When set. this is the BSSID the radio is currently associated with. * The value is a string in the format of an Ethernet MAC address, e.g., * <code>XX:XX:XX:XX:XX:XX</code> where each <code>X</code> is a hex digit. */ /** {@hide} */ public String BSSID; /* number beacons received from our own AP */ /** {@hide} */ public int beacon_rx; /* RSSI taken on management frames */ /** {@hide} */ public int rssi_mgmt; /* packets counters */ /** {@hide} */ /* WME Best Effort Access Category (receive mpdu, transmit mpdu, lost mpdu, number of retries)*/ public long rxmpdu_be; /** {@hide} */ public long txmpdu_be; /** {@hide} */ public long lostmpdu_be; /** {@hide} */ public long retries_be; /** {@hide} */ /* WME Background Access Category (receive mpdu, transmit mpdu, lost mpdu, number of retries) */ public long rxmpdu_bk; /** {@hide} */ public long txmpdu_bk; /** {@hide} */ public long lostmpdu_bk; /** {@hide} */ public long retries_bk; /** {@hide} */ /* WME Video Access Category (receive mpdu, transmit mpdu, lost mpdu, number of retries) */ public long rxmpdu_vi; /** {@hide} */ public long txmpdu_vi; /** {@hide} */ public long lostmpdu_vi; /** {@hide} */ public long retries_vi; /** {@hide} */ /* WME Voice Access Category (receive mpdu, transmit mpdu, lost mpdu, number of retries) */ public long rxmpdu_vo; /** {@hide} */ public long txmpdu_vo; /** {@hide} */ public long lostmpdu_vo; /** {@hide} */ public long retries_vo; /** {@hide} */ public int on_time; /** {@hide} */ public int tx_time; /** {@hide} */ public int[] tx_time_per_level; /** {@hide} */ public int rx_time; /** {@hide} */ public int on_time_scan; /** {@hide} */ public WifiLinkLayerStats() { } @Override /** {@hide} */ public String toString() { StringBuilder sbuf = new StringBuilder(); sbuf.append(" WifiLinkLayerStats: ").append('\n'); if (this.SSID != null) { sbuf.append(" SSID: ").append(this.SSID).append('\n'); } if (this.BSSID != null) { sbuf.append(" BSSID: ").append(this.BSSID).append('\n'); } sbuf.append(" my bss beacon rx: ").append(Integer.toString(this.beacon_rx)).append('\n'); sbuf.append(" RSSI mgmt: ").append(Integer.toString(this.rssi_mgmt)).append('\n'); sbuf.append(" BE : ").append(" rx=").append(Long.toString(this.rxmpdu_be)) .append(" tx=").append(Long.toString(this.txmpdu_be)) .append(" lost=").append(Long.toString(this.lostmpdu_be)) .append(" retries=").append(Long.toString(this.retries_be)).append('\n'); sbuf.append(" BK : ").append(" rx=").append(Long.toString(this.rxmpdu_bk)) .append(" tx=").append(Long.toString(this.txmpdu_bk)) .append(" lost=").append(Long.toString(this.lostmpdu_bk)) .append(" retries=").append(Long.toString(this.retries_bk)).append('\n'); sbuf.append(" VI : ").append(" rx=").append(Long.toString(this.rxmpdu_vi)) .append(" tx=").append(Long.toString(this.txmpdu_vi)) .append(" lost=").append(Long.toString(this.lostmpdu_vi)) .append(" retries=").append(Long.toString(this.retries_vi)).append('\n'); sbuf.append(" VO : ").append(" rx=").append(Long.toString(this.rxmpdu_vo)) .append(" tx=").append(Long.toString(this.txmpdu_vo)) .append(" lost=").append(Long.toString(this.lostmpdu_vo)) .append(" retries=").append(Long.toString(this.retries_vo)).append('\n'); sbuf.append(" on_time : ").append(Integer.toString(this.on_time)) .append(" rx_time=").append(Integer.toString(this.rx_time)) .append(" scan_time=").append(Integer.toString(this.on_time_scan)).append('\n') .append(" tx_time=").append(Integer.toString(this.tx_time)) .append(" tx_time_per_level=" + Arrays.toString(tx_time_per_level)); return sbuf.toString(); } /** Implement the Parcelable interface {@hide} */ public int describeContents() { return 0; } /** {@hide} */ public String getPrintableSsid() { if (SSID == null) return ""; final int length = SSID.length(); if (length > 2 && (SSID.charAt(0) == '"') && SSID.charAt(length - 1) == '"') { return SSID.substring(1, length - 1); } /** The ascii-encoded string format is P"<ascii-encoded-string>" * The decoding is implemented in the supplicant for a newly configured * network. */ if (length > 3 && (SSID.charAt(0) == 'P') && (SSID.charAt(1) == '"') && (SSID.charAt(length-1) == '"')) { WifiSsid wifiSsid = WifiSsid.createFromAsciiEncoded( SSID.substring(2, length - 1)); return wifiSsid.toString(); } return SSID; } /** Implement the Parcelable interface {@hide} */ public void writeToParcel(Parcel dest, int flags) { dest.writeString(SSID); dest.writeString(BSSID); dest.writeInt(on_time); dest.writeInt(tx_time); dest.writeIntArray(tx_time_per_level); dest.writeInt(rx_time); dest.writeInt(on_time_scan); } /** Implement the Parcelable interface {@hide} */ public static final Creator<WifiLinkLayerStats> CREATOR = new Creator<WifiLinkLayerStats>() { public WifiLinkLayerStats createFromParcel(Parcel in) { WifiLinkLayerStats stats = new WifiLinkLayerStats(); stats.SSID = in.readString(); stats.BSSID = in.readString(); stats.on_time = in.readInt(); stats.tx_time = in.readInt(); stats.tx_time_per_level = in.createIntArray(); stats.rx_time = in.readInt(); stats.on_time_scan = in.readInt(); return stats; }; public WifiLinkLayerStats[] newArray(int size) { return new WifiLinkLayerStats[size]; } }; } Loading
wifi/java/android/net/wifi/WifiInfo.java +6 −145 Original line number Diff line number Diff line Loading @@ -22,7 +22,6 @@ import android.net.NetworkInfo.DetailedState; import android.net.NetworkUtils; import android.text.TextUtils; import java.lang.Math; import java.net.InetAddress; import java.net.Inet4Address; import java.net.UnknownHostException; Loading Loading @@ -126,139 +125,31 @@ public class WifiInfo implements Parcelable { public long rxSuccess; /** * Average rate of lost transmitted packets, in units of packets per 5 seconds. * Average rate of lost transmitted packets, in units of packets per second. * @hide */ public double txBadRate; /** * Average rate of transmitted retry packets, in units of packets per 5 seconds. * Average rate of transmitted retry packets, in units of packets per second. * @hide */ public double txRetriesRate; /** * Average rate of successfully transmitted unicast packets, in units of packets per 5 seconds. * Average rate of successfully transmitted unicast packets, in units of packets per second. * @hide */ public double txSuccessRate; /** * Average rate of received unicast data packets, in units of packets per 5 seconds. * Average rate of received unicast data packets, in units of packets per second. * @hide */ public double rxSuccessRate; private static final long RESET_TIME_STAMP = Long.MIN_VALUE; private static final long FILTER_TIME_CONSTANT = 3000; /** * This factor is used to adjust the rate output under the new algorithm * such that the result is comparable to the previous algorithm. * This actually converts from unit 'packets per second' to 'packets per 5 seconds'. */ private static final long OUTPUT_SCALE_FACTOR = 5; private long mLastPacketCountUpdateTimeStamp; /** * @hide */ public int badRssiCount; /** * @hide */ public int linkStuckCount; /** * @hide */ public int lowRssiCount; /** * @hide */ public int score; /** * @hide */ public void updatePacketRates(WifiLinkLayerStats stats, long timeStamp) { 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; if (mLastPacketCountUpdateTimeStamp != RESET_TIME_STAMP && mLastPacketCountUpdateTimeStamp < timeStamp && txBad <= txbad && txSuccess <= txgood && rxSuccess <= rxgood && txRetries <= txretries) { long timeDelta = timeStamp - mLastPacketCountUpdateTimeStamp; double lastSampleWeight = Math.exp(-1.0 * timeDelta / FILTER_TIME_CONSTANT); double currentSampleWeight = 1.0 - lastSampleWeight; txBadRate = txBadRate * lastSampleWeight + (txbad - txBad) * OUTPUT_SCALE_FACTOR * 1000 / timeDelta * currentSampleWeight; txSuccessRate = txSuccessRate * lastSampleWeight + (txgood - txSuccess) * OUTPUT_SCALE_FACTOR * 1000 / timeDelta * currentSampleWeight; rxSuccessRate = rxSuccessRate * lastSampleWeight + (rxgood - rxSuccess) * OUTPUT_SCALE_FACTOR * 1000 / timeDelta * currentSampleWeight; txRetriesRate = txRetriesRate * lastSampleWeight + (txretries - txRetries) * OUTPUT_SCALE_FACTOR * 1000/ timeDelta * currentSampleWeight; } else { txBadRate = 0; txSuccessRate = 0; rxSuccessRate = 0; txRetriesRate = 0; } txBad = txbad; txSuccess = txgood; rxSuccess = rxgood; txRetries = txretries; mLastPacketCountUpdateTimeStamp = timeStamp; } else { txBad = 0; txSuccess = 0; rxSuccess = 0; txRetries = 0; txBadRate = 0; txSuccessRate = 0; rxSuccessRate = 0; txRetriesRate = 0; mLastPacketCountUpdateTimeStamp = RESET_TIME_STAMP; } } /** * This function is less powerful and used if the WifiLinkLayerStats API is not implemented * at the Wifi HAL * @hide */ public void updatePacketRates(long txPackets, long rxPackets) { //paranoia txBad = 0; txRetries = 0; txBadRate = 0; txRetriesRate = 0; if (txSuccess <= txPackets && rxSuccess <= rxPackets) { txSuccessRate = (txSuccessRate * 0.5) + ((double) (txPackets - txSuccess) * 0.5); rxSuccessRate = (rxSuccessRate * 0.5) + ((double) (rxPackets - rxSuccess) * 0.5); } else { txBadRate = 0; txRetriesRate = 0; } txSuccess = txPackets; rxSuccess = rxPackets; } /** * Flag indicating that AP has hinted that upstream connection is metered, * and sensitive to heavy data transfers. Loading @@ -274,7 +165,6 @@ public class WifiInfo implements Parcelable { mRssi = INVALID_RSSI; mLinkSpeed = -1; mFrequency = -1; mLastPacketCountUpdateTimeStamp = RESET_TIME_STAMP; } /** @hide */ Loading @@ -296,11 +186,7 @@ public class WifiInfo implements Parcelable { txSuccessRate = 0; rxSuccessRate = 0; txRetriesRate = 0; lowRssiCount = 0; badRssiCount = 0; linkStuckCount = 0; score = 0; mLastPacketCountUpdateTimeStamp = RESET_TIME_STAMP; } /** Loading Loading @@ -328,12 +214,7 @@ public class WifiInfo implements Parcelable { txRetriesRate = source.txRetriesRate; txSuccessRate = source.txSuccessRate; rxSuccessRate = source.rxSuccessRate; mLastPacketCountUpdateTimeStamp = source.mLastPacketCountUpdateTimeStamp; score = source.score; badRssiCount = source.badRssiCount; lowRssiCount = source.lowRssiCount; linkStuckCount = source.linkStuckCount; } } Loading Loading @@ -451,22 +332,6 @@ public class WifiInfo implements Parcelable { return ScanResult.is5GHz(mFrequency); } /** * @hide * This returns txSuccessRate in packets per second. */ public double getTxSuccessRatePps() { return txSuccessRate / OUTPUT_SCALE_FACTOR; } /** * @hide * This returns rxSuccessRate in packets per second. */ public double getRxSuccessRatePps() { return rxSuccessRate / OUTPUT_SCALE_FACTOR; } /** * Record the MAC address of the WLAN interface * @param macAddress the MAC address in {@code XX:XX:XX:XX:XX:XX} form Loading Loading @@ -658,8 +523,6 @@ public class WifiInfo implements Parcelable { dest.writeDouble(txRetriesRate); dest.writeDouble(txBadRate); dest.writeDouble(rxSuccessRate); dest.writeInt(badRssiCount); dest.writeInt(lowRssiCount); mSupplicantState.writeToParcel(dest, flags); } Loading Loading @@ -689,8 +552,6 @@ public class WifiInfo implements Parcelable { info.txRetriesRate = in.readDouble(); info.txBadRate = in.readDouble(); info.rxSuccessRate = in.readDouble(); info.badRssiCount = in.readInt(); info.lowRssiCount = in.readInt(); info.mSupplicantState = SupplicantState.CREATOR.createFromParcel(in); return info; } Loading
wifi/java/android/net/wifi/WifiLinkLayerStats.javadeleted 100644 → 0 +0 −211 Original line number Diff line number Diff line /* * Copyright (C) 2014 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.net.wifi; import android.os.Parcelable; import android.os.Parcel; import java.util.Arrays; /** * A class representing link layer statistics collected over a Wifi Interface. */ /** {@hide} */ public class WifiLinkLayerStats implements Parcelable { private static final String TAG = "WifiLinkLayerStats"; /** * The current status of this network configuration entry. * @see Status */ /** {@hide} */ public int status; /** * The network's SSID. Can either be an ASCII string, * which must be enclosed in double quotation marks * (e.g., {@code "MyNetwork"}, or a string of * hex digits,which are not enclosed in quotes * (e.g., {@code 01a243f405}). */ /** {@hide} */ public String SSID; /** * When set. this is the BSSID the radio is currently associated with. * The value is a string in the format of an Ethernet MAC address, e.g., * <code>XX:XX:XX:XX:XX:XX</code> where each <code>X</code> is a hex digit. */ /** {@hide} */ public String BSSID; /* number beacons received from our own AP */ /** {@hide} */ public int beacon_rx; /* RSSI taken on management frames */ /** {@hide} */ public int rssi_mgmt; /* packets counters */ /** {@hide} */ /* WME Best Effort Access Category (receive mpdu, transmit mpdu, lost mpdu, number of retries)*/ public long rxmpdu_be; /** {@hide} */ public long txmpdu_be; /** {@hide} */ public long lostmpdu_be; /** {@hide} */ public long retries_be; /** {@hide} */ /* WME Background Access Category (receive mpdu, transmit mpdu, lost mpdu, number of retries) */ public long rxmpdu_bk; /** {@hide} */ public long txmpdu_bk; /** {@hide} */ public long lostmpdu_bk; /** {@hide} */ public long retries_bk; /** {@hide} */ /* WME Video Access Category (receive mpdu, transmit mpdu, lost mpdu, number of retries) */ public long rxmpdu_vi; /** {@hide} */ public long txmpdu_vi; /** {@hide} */ public long lostmpdu_vi; /** {@hide} */ public long retries_vi; /** {@hide} */ /* WME Voice Access Category (receive mpdu, transmit mpdu, lost mpdu, number of retries) */ public long rxmpdu_vo; /** {@hide} */ public long txmpdu_vo; /** {@hide} */ public long lostmpdu_vo; /** {@hide} */ public long retries_vo; /** {@hide} */ public int on_time; /** {@hide} */ public int tx_time; /** {@hide} */ public int[] tx_time_per_level; /** {@hide} */ public int rx_time; /** {@hide} */ public int on_time_scan; /** {@hide} */ public WifiLinkLayerStats() { } @Override /** {@hide} */ public String toString() { StringBuilder sbuf = new StringBuilder(); sbuf.append(" WifiLinkLayerStats: ").append('\n'); if (this.SSID != null) { sbuf.append(" SSID: ").append(this.SSID).append('\n'); } if (this.BSSID != null) { sbuf.append(" BSSID: ").append(this.BSSID).append('\n'); } sbuf.append(" my bss beacon rx: ").append(Integer.toString(this.beacon_rx)).append('\n'); sbuf.append(" RSSI mgmt: ").append(Integer.toString(this.rssi_mgmt)).append('\n'); sbuf.append(" BE : ").append(" rx=").append(Long.toString(this.rxmpdu_be)) .append(" tx=").append(Long.toString(this.txmpdu_be)) .append(" lost=").append(Long.toString(this.lostmpdu_be)) .append(" retries=").append(Long.toString(this.retries_be)).append('\n'); sbuf.append(" BK : ").append(" rx=").append(Long.toString(this.rxmpdu_bk)) .append(" tx=").append(Long.toString(this.txmpdu_bk)) .append(" lost=").append(Long.toString(this.lostmpdu_bk)) .append(" retries=").append(Long.toString(this.retries_bk)).append('\n'); sbuf.append(" VI : ").append(" rx=").append(Long.toString(this.rxmpdu_vi)) .append(" tx=").append(Long.toString(this.txmpdu_vi)) .append(" lost=").append(Long.toString(this.lostmpdu_vi)) .append(" retries=").append(Long.toString(this.retries_vi)).append('\n'); sbuf.append(" VO : ").append(" rx=").append(Long.toString(this.rxmpdu_vo)) .append(" tx=").append(Long.toString(this.txmpdu_vo)) .append(" lost=").append(Long.toString(this.lostmpdu_vo)) .append(" retries=").append(Long.toString(this.retries_vo)).append('\n'); sbuf.append(" on_time : ").append(Integer.toString(this.on_time)) .append(" rx_time=").append(Integer.toString(this.rx_time)) .append(" scan_time=").append(Integer.toString(this.on_time_scan)).append('\n') .append(" tx_time=").append(Integer.toString(this.tx_time)) .append(" tx_time_per_level=" + Arrays.toString(tx_time_per_level)); return sbuf.toString(); } /** Implement the Parcelable interface {@hide} */ public int describeContents() { return 0; } /** {@hide} */ public String getPrintableSsid() { if (SSID == null) return ""; final int length = SSID.length(); if (length > 2 && (SSID.charAt(0) == '"') && SSID.charAt(length - 1) == '"') { return SSID.substring(1, length - 1); } /** The ascii-encoded string format is P"<ascii-encoded-string>" * The decoding is implemented in the supplicant for a newly configured * network. */ if (length > 3 && (SSID.charAt(0) == 'P') && (SSID.charAt(1) == '"') && (SSID.charAt(length-1) == '"')) { WifiSsid wifiSsid = WifiSsid.createFromAsciiEncoded( SSID.substring(2, length - 1)); return wifiSsid.toString(); } return SSID; } /** Implement the Parcelable interface {@hide} */ public void writeToParcel(Parcel dest, int flags) { dest.writeString(SSID); dest.writeString(BSSID); dest.writeInt(on_time); dest.writeInt(tx_time); dest.writeIntArray(tx_time_per_level); dest.writeInt(rx_time); dest.writeInt(on_time_scan); } /** Implement the Parcelable interface {@hide} */ public static final Creator<WifiLinkLayerStats> CREATOR = new Creator<WifiLinkLayerStats>() { public WifiLinkLayerStats createFromParcel(Parcel in) { WifiLinkLayerStats stats = new WifiLinkLayerStats(); stats.SSID = in.readString(); stats.BSSID = in.readString(); stats.on_time = in.readInt(); stats.tx_time = in.readInt(); stats.tx_time_per_level = in.createIntArray(); stats.rx_time = in.readInt(); stats.on_time_scan = in.readInt(); return stats; }; public WifiLinkLayerStats[] newArray(int size) { return new WifiLinkLayerStats[size]; } }; }