• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2016 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 package com.android.loganalysis.item;
17 
18 import java.util.Arrays;
19 import java.util.HashSet;
20 import java.util.Set;
21 
22 /**
23  * An {@link IItem} used to store wifi dumps.
24  */
25 public class DumpsysWifiStatsItem extends GenericItem {
26     /** Constant for JSON output */
27     public static final String WIFI_DISCONNECT = "WIFI_DISCONNECT";
28     /** Constant for JSON output */
29     public static final String WIFI_SCAN = "WIFI_SCAN";
30     /** Constant for JSON output */
31     public static final String WIFI_ASSOCIATION = "WIFI_ASSOCIATION";
32 
33     private static final Set<String> ATTRIBUTES = new HashSet<String>(Arrays.asList(
34             WIFI_DISCONNECT, WIFI_SCAN, WIFI_ASSOCIATION));
35 
36      /**
37      * The constructor for {@link DumpsysWifiStatsItem}.
38      */
DumpsysWifiStatsItem()39     public DumpsysWifiStatsItem() {
40         super(ATTRIBUTES);
41     }
42 
43     /**
44      * Set number of times of wifi disconnect
45      */
setNumWifiDisconnect(int numWifiDisconnects)46     public void setNumWifiDisconnect(int numWifiDisconnects) {
47         setAttribute(WIFI_DISCONNECT, numWifiDisconnects);
48     }
49 
50     /**
51      * Set number of times of wifi scan
52      */
setNumWifiScan(int numWifiScans)53     public void setNumWifiScan(int numWifiScans) {
54         setAttribute(WIFI_SCAN, numWifiScans);
55     }
56 
57     /**
58      * Set number of times of wifi associations
59      */
setNumWifiAssociation(int numWifiAssociations)60     public void setNumWifiAssociation(int numWifiAssociations) {
61         setAttribute(WIFI_ASSOCIATION, numWifiAssociations);
62     }
63 
64     /**
65      * Get the number of times wifi disconnected
66      */
getNumWifiDisconnects()67     public int getNumWifiDisconnects() {
68         return (int) getAttribute(WIFI_DISCONNECT);
69     }
70 
71     /**
72      * Get the number of times wifi scan event triggered
73      */
getNumWifiScans()74     public int getNumWifiScans() {
75         return (int) getAttribute(WIFI_SCAN);
76     }
77 
78     /**
79      * Get the number of times wifi association event triggered
80      */
getNumWifiAssociations()81     public int getNumWifiAssociations() {
82         return (int) getAttribute(WIFI_ASSOCIATION);
83     }
84 }
85