1/*
2 * Copyright (C) 2014 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.net.wifi;
18
19import android.annotation.SystemApi;
20
21import android.os.Parcel;
22import android.os.Parcelable;
23
24import java.util.HashMap;
25
26/**
27 * Connection Statistics For a WiFi Network.
28 * @hide
29 */
30@SystemApi
31public class WifiNetworkConnectionStatistics implements Parcelable {
32    private static final String TAG = "WifiNetworkConnnectionStatistics";
33
34    public int numConnection;
35    public int numUsage;
36
37    public WifiNetworkConnectionStatistics(int connection, int usage) {
38        numConnection = connection;
39        numUsage = usage;
40    }
41
42    public WifiNetworkConnectionStatistics() { }
43
44
45    @Override
46    public String toString() {
47        StringBuilder sbuf = new StringBuilder();
48        sbuf.append("c=").append(numConnection);
49        sbuf.append(" u=").append(numUsage);
50        return sbuf.toString();
51    }
52
53
54    /** copy constructor*/
55    public WifiNetworkConnectionStatistics(WifiNetworkConnectionStatistics source) {
56        numConnection = source.numConnection;
57        numUsage = source.numUsage;
58    }
59
60    /** Implement the Parcelable interface */
61    public int describeContents() {
62        return 0;
63    }
64
65    /** Implement the Parcelable interface */
66    @Override
67    public void writeToParcel(Parcel dest, int flags) {
68        dest.writeInt(numConnection);
69        dest.writeInt(numUsage);
70    }
71
72    /** Implement the Parcelable interface */
73    public static final Creator<WifiNetworkConnectionStatistics> CREATOR =
74        new Creator<WifiNetworkConnectionStatistics>() {
75            public WifiNetworkConnectionStatistics createFromParcel(Parcel in) {
76                int numConnection = in.readInt();
77                int numUsage = in.readInt();
78                WifiNetworkConnectionStatistics stats =
79                        new WifiNetworkConnectionStatistics(numConnection, numUsage);
80                return stats;
81            }
82
83            public WifiNetworkConnectionStatistics[] newArray(int size) {
84                return new WifiNetworkConnectionStatistics[size];
85            }
86        };
87}
88