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