chromium/device/bluetooth/bluetooth_low_energy_scan_filter.cc

// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "device/bluetooth/bluetooth_low_energy_scan_filter.h"

#include <optional>

#include "base/logging.h"
#include "base/memory/ptr_util.h"

namespace {

// These values can be found in the "BlueZ D-Bus Advertisement Monitor API
// Description": //third_party/bluez/current/doc/advertisement-monitor-api.txt
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 =;

// These values are based on real-world testing with the goal that they will be
// as high as possible without any false negatives at 1.5/6/20 feet,
// respectively.
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

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 {}

// static
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) {}

// static
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 {}

}  // namespace device