From 4eeecb25509f91ac7a6e2cde76dac782fbec5360 Mon Sep 17 00:00:00 2001 From: vandwalle Date: Fri, 25 Jul 2014 17:10:56 -0700 Subject: introduce WifiConnectionstatistics This CL is dependent on I10584a447fecd977df3eefd8e2cc028bd26ec0e3 Change-Id: I51fbbf062feb22c5f16b438675519064cc43e160 --- .../net/wifi/WifiNetworkConnectionStatistics.java | 87 ++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 wifi/java/android/net/wifi/WifiNetworkConnectionStatistics.java (limited to 'wifi/java/android/net/wifi/WifiNetworkConnectionStatistics.java') diff --git a/wifi/java/android/net/wifi/WifiNetworkConnectionStatistics.java b/wifi/java/android/net/wifi/WifiNetworkConnectionStatistics.java new file mode 100644 index 0000000..c7d62e5 --- /dev/null +++ b/wifi/java/android/net/wifi/WifiNetworkConnectionStatistics.java @@ -0,0 +1,87 @@ +/* + * 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.annotation.SystemApi; + +import android.os.Parcel; +import android.os.Parcelable; + +import java.util.HashMap; + +/** + * Connection Statistics For a WiFi Network. + * @hide + */ +@SystemApi +public class WifiNetworkConnectionStatistics implements Parcelable { + private static final String TAG = "WifiNetworkConnnectionStatistics"; + + public int numConnection; + public int numUsage; + + public WifiNetworkConnectionStatistics(int connection, int usage) { + numConnection = connection; + numUsage = usage; + } + + public WifiNetworkConnectionStatistics() { } + + + @Override + public String toString() { + StringBuilder sbuf = new StringBuilder(); + sbuf.append("c=").append(numConnection); + sbuf.append(" u=").append(numUsage); + return sbuf.toString(); + } + + + /** copy constructor*/ + public WifiNetworkConnectionStatistics(WifiNetworkConnectionStatistics source) { + numConnection = source.numConnection; + numUsage = source.numUsage; + } + + /** Implement the Parcelable interface */ + public int describeContents() { + return 0; + } + + /** Implement the Parcelable interface */ + @Override + public void writeToParcel(Parcel dest, int flags) { + dest.writeInt(numConnection); + dest.writeInt(numUsage); + } + + /** Implement the Parcelable interface */ + public static final Creator CREATOR = + new Creator() { + public WifiNetworkConnectionStatistics createFromParcel(Parcel in) { + int numConnection = in.readInt(); + int numUsage = in.readInt(); + WifiNetworkConnectionStatistics stats = + new WifiNetworkConnectionStatistics(numConnection, numUsage); + return stats; + } + + public WifiNetworkConnectionStatistics[] newArray(int size) { + return new WifiNetworkConnectionStatistics[size]; + } + }; +} -- cgit v1.1