• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2008 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 
17 package android.net.wifi;
18 
19 import android.os.Parcelable;
20 import android.annotation.SystemApi;
21 import android.os.Parcel;
22 
23 import java.util.ArrayList;
24 import java.util.List;
25 
26 /**
27  * Describes the Results of a batched set of wifi scans where the firmware performs many
28  * scans and stores the timestamped results without waking the main processor each time.
29  * @hide
30  * @removed
31  */
32 @Deprecated
33 @SystemApi
34 public class BatchedScanResult implements Parcelable {
35     private static final String TAG = "BatchedScanResult";
36 
37     /** Inidcates this scan was interrupted and may only have partial results. */
38     public boolean truncated;
39 
40     /** The result of this particular scan. */
41     public final List<ScanResult> scanResults = new ArrayList<ScanResult>();
42 
43 
BatchedScanResult()44     public BatchedScanResult() {
45     }
46 
BatchedScanResult(BatchedScanResult source)47     public BatchedScanResult(BatchedScanResult source) {
48         truncated = source.truncated;
49         for (ScanResult s : source.scanResults) scanResults.add(new ScanResult(s));
50     }
51 
52     @Override
toString()53     public String toString() {
54         StringBuffer sb = new StringBuffer();
55 
56         sb.append("BatchedScanResult: ").
57                 append("truncated: ").append(String.valueOf(truncated)).
58                 append("scanResults: [");
59         for (ScanResult s : scanResults) {
60             sb.append(" <").append(s.toString()).append("> ");
61         }
62         sb.append(" ]");
63         return sb.toString();
64     }
65 
66     /** Implement the Parcelable interface {@hide} */
describeContents()67     public int describeContents() {
68         return 0;
69     }
70 
71     /** Implement the Parcelable interface {@hide} */
writeToParcel(Parcel dest, int flags)72     public void writeToParcel(Parcel dest, int flags) {
73         dest.writeInt(truncated ? 1 : 0);
74         dest.writeInt(scanResults.size());
75         for (ScanResult s : scanResults) {
76             s.writeToParcel(dest, flags);
77         }
78     }
79 
80     /** Implement the Parcelable interface {@hide} */
81     public static final @android.annotation.NonNull Creator<BatchedScanResult> CREATOR =
82         new Creator<BatchedScanResult>() {
83             public BatchedScanResult createFromParcel(Parcel in) {
84                 BatchedScanResult result = new BatchedScanResult();
85                 result.truncated = (in.readInt() == 1);
86                 int count = in.readInt();
87                 while (count-- > 0) {
88                     result.scanResults.add(ScanResult.CREATOR.createFromParcel(in));
89                 }
90                 return result;
91             }
92 
93             public BatchedScanResult[] newArray(int size) {
94                 return new BatchedScanResult[size];
95             }
96         };
97 }
98