ScanClient.java revision 233a9ce2117ae01d2ead214f0629b4aa1ff0ad85
1/*
2 * Copyright (C) 2013 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 com.android.bluetooth.gatt;
18
19import android.bluetooth.le.BluetoothLeScanSettings;
20import android.bluetooth.le.ScanFilter;
21
22import java.util.List;
23import java.util.UUID;
24
25/**
26 * Helper class identifying a client that has requested LE scan results.
27 *
28 * @hide
29 */
30/* package */class ScanClient {
31
32    /**
33     * Default scan window value
34     */
35    private static final int LE_SCAN_WINDOW_MS = 100;
36
37    /**
38     * Default scan interval value
39     */
40    private static final int LE_SCAN_INTERVAL_MS = 100;
41
42    int appIf;
43    boolean isServer;
44    UUID[] uuids;
45    int scanWindow, scanInterval;
46    BluetoothLeScanSettings settings;
47    List<ScanFilter> filters;
48
49    ScanClient(int appIf, boolean isServer) {
50        this(appIf, isServer, new UUID[0], LE_SCAN_WINDOW_MS, LE_SCAN_INTERVAL_MS);
51    }
52
53    ScanClient(int appIf, boolean isServer, UUID[] uuids) {
54        this(appIf, isServer, uuids, LE_SCAN_WINDOW_MS, LE_SCAN_INTERVAL_MS);
55    }
56
57    ScanClient(int appIf, boolean isServer, UUID[] uuids, int scanWindow, int scanInterval) {
58        this(appIf, isServer, uuids, scanWindow, scanInterval, null, null);
59    }
60
61    ScanClient(int appIf, boolean isServer, BluetoothLeScanSettings settings,
62            List<ScanFilter> filters) {
63        this(appIf, isServer, new UUID[0], LE_SCAN_WINDOW_MS, LE_SCAN_INTERVAL_MS,
64                settings, filters);
65    }
66
67    private ScanClient(int appIf, boolean isServer, UUID[] uuids, int scanWindow, int scanInterval,
68            BluetoothLeScanSettings settings, List<ScanFilter> filters) {
69        this.appIf = appIf;
70        this.isServer = isServer;
71        this.uuids = uuids;
72        this.scanWindow = scanWindow;
73        this.scanInterval = scanInterval;
74        this.settings = settings;
75        this.filters = filters;
76    }
77}
78