1//
2//  Copyright (C) 2015 Google, Inc.
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
17#include "service/common/bluetooth/scan_settings.h"
18
19namespace bluetooth {
20
21ScanSettings::ScanSettings()
22    : mode_(MODE_LOW_POWER),
23      callback_type_(CALLBACK_TYPE_ALL_MATCHES),
24      result_type_(RESULT_TYPE_FULL),
25      match_count_per_filter_(MATCH_COUNT_MAX_ADVERTISEMENTS) {}
26
27ScanSettings::ScanSettings(Mode mode, CallbackTypeBitField callback_type,
28                           ResultType result_type,
29                           base::TimeDelta report_delay_ms,
30                           MatchMode match_mode,
31                           MatchCount match_count_per_filter)
32    : mode_(mode),
33      callback_type_(callback_type),
34      result_type_(result_type),
35      report_delay_ms_(report_delay_ms),
36      match_mode_(match_mode),
37      match_count_per_filter_(match_count_per_filter) {}
38
39bool ScanSettings::operator==(const ScanSettings& rhs) const {
40  if (mode_ != rhs.mode_) return false;
41
42  if (callback_type_ != rhs.callback_type_) return false;
43
44  if (result_type_ != rhs.result_type_) return false;
45
46  if (report_delay_ms_ != rhs.report_delay_ms_) return false;
47
48  if (match_mode_ != rhs.match_mode_) return false;
49
50  if (match_count_per_filter_ != rhs.match_count_per_filter_) return false;
51
52  return true;
53}
54
55}  // namespace bluetooth
56