BatchedScanSettings.java revision 8e628dadc321bf49e93e482540df87431d014b01
10451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt/*
20451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt * Copyright (C) 2008 The Android Open Source Project
30451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt *
40451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt * Licensed under the Apache License, Version 2.0 (the "License");
50451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt * you may not use this file except in compliance with the License.
60451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt * You may obtain a copy of the License at
70451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt *
80451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt *      http://www.apache.org/licenses/LICENSE-2.0
90451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt *
100451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt * Unless required by applicable law or agreed to in writing, software
110451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt * distributed under the License is distributed on an "AS IS" BASIS,
120451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
130451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt * See the License for the specific language governing permissions and
140451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt * limitations under the License.
150451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt */
160451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt
170451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwaltpackage android.net.wifi;
180451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt
190451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwaltimport android.os.Parcelable;
200451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwaltimport android.os.Parcel;
210451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt
220451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwaltimport java.util.ArrayList;
230451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwaltimport java.util.Collection;
240451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt
250451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt/**
260451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt * Describes the settings for batched wifi scans where the firmware performs many
270451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt * scans and stores the timestamped results without waking the main processor each time.
280451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt * This can give information over time with minimal battery impact.
290451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt * @hide pending review
300451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt */
310451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwaltpublic class BatchedScanSettings implements Parcelable {
320451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt    private static final String TAG = "BatchedScanSettings";
330451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt
340451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt    /** Used to indicate no preference for an int value */
350451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt    public final static int UNSPECIFIED = Integer.MAX_VALUE;
360451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt
370451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt    // TODO - make MIN/mAX dynamic and gservices adjustable.
380451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt    public final static int MIN_SCANS_PER_BATCH = 2;
390451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt    public final static int MAX_SCANS_PER_BATCH = 255;
400451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt    public final static int DEFAULT_SCANS_PER_BATCH = MAX_SCANS_PER_BATCH;
410451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt
420451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt    public final static int MIN_AP_PER_SCAN = 2;
430451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt    public final static int MAX_AP_PER_SCAN = 255;
440451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt    public final static int DEFAULT_AP_PER_SCAN = 16;
450451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt
460451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt    public final static int MIN_INTERVAL_SEC = 0;
470451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt    public final static int MAX_INTERVAL_SEC = 3600;
480451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt    public final static int DEFAULT_INTERVAL_SEC = 30;
490451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt
500451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt    public final static int MIN_AP_FOR_DISTANCE = 0;
510451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt    public final static int MAX_AP_FOR_DISTANCE = MAX_AP_PER_SCAN;
520451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt    public final static int DEFAULT_AP_FOR_DISTANCE = 0;
530451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt
548e628dadc321bf49e93e482540df87431d014b01Robert Greenwalt    public final static int MAX_WIFI_CHANNEL = 196;
550451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt
560451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt    /** The expected number of scans per batch.  Note that the firmware may drop scans
570451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt     *  leading to fewer scans during the normal batch scan duration.  This value need not
580451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt     *  be specified (may be set to {@link UNSPECIFIED}) by the application and we will try
590451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt     *  to scan as many times as the firmware can support.  If another app requests fewer
600451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt     *  scans per batch we will attempt to honor that.
610451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt     */
620451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt    public int maxScansPerBatch;
630451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt
640451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt    /** The maximum desired AP listed per scan.  Fewer AP may be returned if that's all
650451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt     *  that the driver detected.  If another application requests more AP per scan that
660451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt     *  will take precedence.  The if more channels are detected than we request, the APs
670451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt     *  with the lowest signal strength will be dropped.
680451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt     */
690451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt    public int maxApPerScan;
700451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt
710451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt    /** The channels used in the scan.  If all channels should be used, {@code null} may be
720451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt     *  specified.  If another application requests more channels or all channels, that
730451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt     *  will take precedence.
740451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt     */
750451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt    public Collection<String> channelSet;
760451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt
770451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt    /** The time between the start of two sequential scans, in seconds.  If another
780451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt     *  application requests more frequent scans, that will take precedence.  If this
790451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt     * value is less than the duration of a scan, the next scan should start immediately.
800451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt     */
810451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt    public int scanIntervalSec;
820451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt
830451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt    /** The number of the best (strongest signal) APs for which the firmware will
840451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt     *  attempt to get distance information (RTT).  Not all firmware supports this
850451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt     *  feature, so it may be ignored.  If another application requests a greater
860451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt     *  number, that will take precedence.
870451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt     */
880451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt    public int maxApForDistance;
890451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt
900451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt    public BatchedScanSettings() {
910451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt        clear();
920451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt    }
930451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt
940451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt    public void clear() {
950451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt        maxScansPerBatch = UNSPECIFIED;
960451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt        maxApPerScan = UNSPECIFIED;
970451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt        channelSet = null;
980451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt        scanIntervalSec = UNSPECIFIED;
990451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt        maxApForDistance = UNSPECIFIED;
1000451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt    }
1010451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt
1020451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt    public BatchedScanSettings(BatchedScanSettings source) {
1030451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt        maxScansPerBatch = source.maxScansPerBatch;
1040451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt        maxApPerScan = source.maxApPerScan;
1050451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt        if (source.channelSet != null) {
1060451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt            channelSet = new ArrayList(source.channelSet);
1070451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt        }
1080451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt        scanIntervalSec = source.scanIntervalSec;
1090451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt        maxApForDistance = source.maxApForDistance;
1100451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt    }
1110451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt
1120451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt    private boolean channelSetIsValid() {
1130451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt        if (channelSet == null || channelSet.isEmpty()) return true;
1140451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt        for (String channel : channelSet) {
1150451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt            try {
1160451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt                int i = Integer.parseInt(channel);
1178e628dadc321bf49e93e482540df87431d014b01Robert Greenwalt                if (i > 0 && i <= MAX_WIFI_CHANNEL) continue;
1180451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt            } catch (NumberFormatException e) {}
1190451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt            if (channel.equals("A") || channel.equals("B")) continue;
1200451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt            return false;
1210451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt        }
1220451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt        return true;
1230451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt    }
1240451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt    /** @hide */
1250451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt    public boolean isInvalid() {
1260451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt        if (maxScansPerBatch != UNSPECIFIED && (maxScansPerBatch < MIN_SCANS_PER_BATCH ||
1270451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt                maxScansPerBatch > MAX_SCANS_PER_BATCH)) return true;
1280451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt        if (maxApPerScan != UNSPECIFIED && (maxApPerScan < MIN_AP_PER_SCAN ||
1290451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt                maxApPerScan > MAX_AP_PER_SCAN)) return true;
1300451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt        if (channelSetIsValid() == false) return true;
1310451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt        if (scanIntervalSec != UNSPECIFIED && (scanIntervalSec < MIN_INTERVAL_SEC ||
1320451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt                scanIntervalSec > MAX_INTERVAL_SEC)) return true;
1330451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt        if (maxApForDistance != UNSPECIFIED && (maxApForDistance < MIN_AP_FOR_DISTANCE ||
1340451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt                maxApForDistance > MAX_AP_FOR_DISTANCE)) return true;
1350451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt        return false;
1360451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt    }
1370451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt
1380451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt    @Override
1390451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt    public boolean equals(Object obj) {
1400451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt        if (obj instanceof BatchedScanSettings == false) return false;
1410451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt        BatchedScanSettings o = (BatchedScanSettings)obj;
1420451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt        if (maxScansPerBatch != o.maxScansPerBatch ||
1430451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt              maxApPerScan != o.maxApPerScan ||
1440451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt              scanIntervalSec != o.scanIntervalSec ||
1450451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt              maxApForDistance != o.maxApForDistance) return false;
1460451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt        if (channelSet == null) {
1470451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt            return (o.channelSet == null);
1480451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt        }
1490451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt        return channelSet.equals(o.channelSet);
1500451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt    }
1510451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt
1520451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt    @Override
1530451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt    public int hashCode() {
1540451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt        return maxScansPerBatch +
1550451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt                (maxApPerScan * 3) +
1560451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt                (scanIntervalSec * 5) +
1570451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt                (maxApForDistance * 7) +
1580451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt                (channelSet.hashCode() * 11);
1590451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt    }
1600451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt
1610451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt    @Override
1620451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt    public String toString() {
1630451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt        StringBuffer sb = new StringBuffer();
1640451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt        String none = "<none>";
1650451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt
1660451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt        sb.append("BatchScanSettings [maxScansPerBatch: ").
1670451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt                append(maxScansPerBatch == UNSPECIFIED ? none : maxScansPerBatch).
1680451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt                append(", maxApPerScan: ").append(maxApPerScan == UNSPECIFIED? none : maxApPerScan).
1690451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt                append(", scanIntervalSec: ").
1700451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt                append(scanIntervalSec == UNSPECIFIED ? none : scanIntervalSec).
1710451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt                append(", maxApForDistance: ").
1720451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt                append(maxApForDistance == UNSPECIFIED ? none : maxApForDistance).
1730451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt                append(", channelSet: ");
1740451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt        if (channelSet == null) {
1750451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt            sb.append("ALL");
1760451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt        } else {
1770451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt            sb.append("<");
1780451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt            for (String channel : channelSet) {
1790451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt                sb.append(" " + channel);
1800451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt            }
1810451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt            sb.append(">");
1820451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt        }
1830451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt        sb.append("]");
1840451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt        return sb.toString();
1850451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt    }
1860451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt
1870451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt    /** Implement the Parcelable interface {@hide} */
1880451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt    public int describeContents() {
1890451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt        return 0;
1900451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt    }
1910451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt
1920451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt    /** Implement the Parcelable interface {@hide} */
1930451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt    public void writeToParcel(Parcel dest, int flags) {
1940451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt        dest.writeInt(maxScansPerBatch);
1950451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt        dest.writeInt(maxApPerScan);
1960451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt        dest.writeInt(scanIntervalSec);
1970451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt        dest.writeInt(maxApForDistance);
1980451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt        dest.writeInt(channelSet == null ? 0 : channelSet.size());
1990451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt        if (channelSet != null) {
2000451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt            for (String channel : channelSet) dest.writeString(channel);
2010451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt        }
2020451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt    }
2030451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt
2040451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt    /** Implement the Parcelable interface {@hide} */
2050451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt    public static final Creator<BatchedScanSettings> CREATOR =
2060451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt        new Creator<BatchedScanSettings>() {
2070451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt            public BatchedScanSettings createFromParcel(Parcel in) {
2080451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt                BatchedScanSettings settings = new BatchedScanSettings();
2090451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt                settings.maxScansPerBatch = in.readInt();
2100451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt                settings.maxApPerScan = in.readInt();
2110451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt                settings.scanIntervalSec = in.readInt();
2120451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt                settings.maxApForDistance = in.readInt();
2130451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt                int channelCount = in.readInt();
2140451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt                if (channelCount > 0) {
2150451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt                    settings.channelSet = new ArrayList(channelCount);
2160451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt                    while (channelCount-- > 0) {
2170451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt                        settings.channelSet.add(in.readString());
2180451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt                    }
2190451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt                }
2200451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt                return settings;
2210451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt            }
2220451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt
2230451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt            public BatchedScanSettings[] newArray(int size) {
2240451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt                return new BatchedScanSettings[size];
2250451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt            }
2260451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt        };
2270451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt}
228