summaryrefslogtreecommitdiff
path: root/service/common/bluetooth/scan_settings.cc
blob: dac03919ada8084cd8236bd72f1b10c339ef9f0b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//
//  Copyright (C) 2015 Google, Inc.
//
//  Licensed under the Apache License, Version 2.0 (the "License");
//  you may not use this file except in compliance with the License.
//  You may obtain a copy of the License at:
//
//  http://www.apache.org/licenses/LICENSE-2.0
//
//  Unless required by applicable law or agreed to in writing, software
//  distributed under the License is distributed on an "AS IS" BASIS,
//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//  See the License for the specific language governing permissions and
//  limitations under the License.
//

#include "bluetooth/scan_settings.h"

namespace bluetooth {

ScanSettings::ScanSettings()
    : mode_(MODE_LOW_POWER),
      callback_type_(CALLBACK_TYPE_ALL_MATCHES),
      result_type_(RESULT_TYPE_FULL),
      match_count_per_filter_(MATCH_COUNT_MAX_ADVERTISEMENTS) {}

ScanSettings::ScanSettings(Mode mode, CallbackTypeBitField callback_type,
                           ResultType result_type,
                           base::TimeDelta report_delay_ms,
                           MatchMode match_mode,
                           MatchCount match_count_per_filter)
    : mode_(mode),
      callback_type_(callback_type),
      result_type_(result_type),
      report_delay_ms_(report_delay_ms),
      match_mode_(match_mode),
      match_count_per_filter_(match_count_per_filter) {}

bool ScanSettings::operator==(const ScanSettings& rhs) const {
  if (mode_ != rhs.mode_) return false;

  if (callback_type_ != rhs.callback_type_) return false;

  if (result_type_ != rhs.result_type_) return false;

  if (report_delay_ms_ != rhs.report_delay_ms_) return false;

  if (match_mode_ != rhs.match_mode_) return false;

  if (match_count_per_filter_ != rhs.match_count_per_filter_) return false;

  return true;
}

}  // namespace bluetooth