1 //
2 //  Copyright 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 "bluetooth/advertise_settings.h"
18 
19 namespace bluetooth {
20 
AdvertiseSettings(Mode mode,base::TimeDelta timeout,TxPowerLevel tx_power_level,bool connectable)21 AdvertiseSettings::AdvertiseSettings(Mode mode, base::TimeDelta timeout,
22                                      TxPowerLevel tx_power_level,
23                                      bool connectable)
24     : mode_(mode),
25       timeout_(timeout),
26       tx_power_level_(tx_power_level),
27       connectable_(connectable) {}
28 
29 // Default values are taken from the AdvertiseSettings.java
AdvertiseSettings()30 AdvertiseSettings::AdvertiseSettings()
31     : mode_(MODE_LOW_POWER),
32       tx_power_level_(TX_POWER_LEVEL_MEDIUM),
33       connectable_(true) {}
34 
operator ==(const AdvertiseSettings & rhs) const35 bool AdvertiseSettings::operator==(const AdvertiseSettings& rhs) const {
36   if (mode_ != rhs.mode_) return false;
37 
38   if (timeout_ != rhs.timeout_) return false;
39 
40   if (tx_power_level_ != rhs.tx_power_level_) return false;
41 
42   if (connectable_ != rhs.connectable_) return false;
43 
44   return true;
45 }
46 
47 }  // namespace bluetooth
48