#include "device/bluetooth/bluetooth_low_energy_scan_filter.h"
#include <optional>
#include "base/logging.h"
#include "base/memory/ptr_util.h"
namespace {
constexpr int16_t kRSSIThresholdMin = …;
constexpr int16_t kRSSIThresholdMax = …;
constexpr base::TimeDelta kTimeoutMin = …;
constexpr base::TimeDelta kTimeoutMax = …;
constexpr uint8_t kPatternValueMaxLength = …;
constexpr base::TimeDelta kRSSISamplingPeriodMin = …;
constexpr base::TimeDelta kRSSISamplingPeriodMax = …;
constexpr int16_t kImmediateDeviceFoundRSSIThreshold = …;
constexpr int16_t kImmediateDeviceLostRSSIThreshold = …;
constexpr int16_t kNearDeviceFoundRSSIThreshold = …;
constexpr int16_t kNearDeviceLostRSSIThreshold = …;
constexpr int16_t kFarDeviceFoundRSSIThreshold = …;
constexpr int16_t kFarDeviceLostRSSIThreshold = …;
int16_t GetDeviceFoundRSSIThreshold(
device::BluetoothLowEnergyScanFilter::Range range) { … }
int16_t GetDeviceLostRSSIThreshold(
device::BluetoothLowEnergyScanFilter::Range range) { … }
base::TimeDelta GetRoundedRSSISamplingPeriod(
base::TimeDelta rssi_sampling_period) { … }
}
namespace device {
BluetoothLowEnergyScanFilter::Pattern::Pattern(
uint8_t start_position,
AdvertisementDataType data_type,
const std::vector<uint8_t>& value)
: … { … }
BluetoothLowEnergyScanFilter::Pattern::Pattern(const Pattern&) = default;
BluetoothLowEnergyScanFilter::Pattern::~Pattern() = default;
bool BluetoothLowEnergyScanFilter::Pattern::IsValid() const { … }
std::unique_ptr<BluetoothLowEnergyScanFilter>
BluetoothLowEnergyScanFilter::Create(
Range device_range,
base::TimeDelta device_found_timeout,
base::TimeDelta device_lost_timeout,
const std::vector<Pattern>& patterns,
std::optional<base::TimeDelta> rssi_sampling_period) { … }
std::unique_ptr<BluetoothLowEnergyScanFilter>
BluetoothLowEnergyScanFilter::Create(
int16_t device_found_rssi_threshold,
int16_t device_lost_rssi_threshold,
base::TimeDelta device_found_timeout,
base::TimeDelta device_lost_timeout,
const std::vector<BluetoothLowEnergyScanFilter::Pattern>& patterns,
std::optional<base::TimeDelta> rssi_sampling_period) { … }
BluetoothLowEnergyScanFilter::BluetoothLowEnergyScanFilter(
int16_t device_found_rssi_threshold,
int16_t device_lost_rssi_threshold,
base::TimeDelta device_found_timeout,
base::TimeDelta device_lost_timeout,
std::vector<Pattern> patterns,
std::optional<base::TimeDelta> rssi_sampling_period)
: … { … }
BluetoothLowEnergyScanFilter::~BluetoothLowEnergyScanFilter() = default;
bool BluetoothLowEnergyScanFilter::IsValid() const { … }
}