// Copyright 2015 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef DEVICE_BLUETOOTH_BLUETOOTH_DISCOVERY_FILTER_H_ #define DEVICE_BLUETOOTH_BLUETOOTH_DISCOVERY_FILTER_H_ #include <stdint.h> #include <memory> #include <optional> #include <set> #include <string> #include <vector> #include "base/containers/flat_set.h" #include "device/bluetooth/bluetooth_common.h" #include "device/bluetooth/bluetooth_export.h" #include "device/bluetooth/public/cpp/bluetooth_uuid.h" namespace device { // ***************************************************************************** // BluetoothDiscoveryFilter is a class which stores information used to filter // out Bluetooth devices at the operating system level while doing discovery. // If you want to filter by RSSI or path loss set them directly in the class // with the SetRSSI() and SetPathloss() functions. However, if you are looking // for a device with a particular name and/or set of services you must add a // DeviceInfoFilter. // Here is an example usage for DeviceInfoFilters: // // BluetoothDiscoveryFilter discovery_filter(BLUETOOTH_TRANSPORT_LE); // BluetoothDiscoveryFilter::DeviceInfoFilter device_filter; // device_filter.uuids.insert(BluetoothUUID("1019")); // device_filter.uuids.insert(BluetoothUUID("1020")); // discovery_filter.AddDeviceFilter(device_filter); // // BluetoothDiscoveryFilter::DeviceInfoFilter device_filter2; // device_filter2.uuids.insert(BluetoothUUID("1021")); // device_filter2.name = "this device"; // discovery_filter.AddDeviceFilter(device_filter2); // // When we add |device_filter| to |discovery_filter| our filter will only return // devices that have both the uuid 1019 AND 1020. When we add |device_filter2| // we will then allow devices though that have either (uuid 1019 AND 1020) OR // (uuid 1021 and a device name of "this device"). // ***************************************************************************** class DEVICE_BLUETOOTH_EXPORT BluetoothDiscoveryFilter { … }; } // namespace device #endif // DEVICE_BLUETOOTH_BLUETOOTH_DISCOVERY_FILTER_H_