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_result.h"
18
19 #include <base/logging.h>
20
21 #include "service/common/bluetooth/util/address_helper.h"
22
23 namespace bluetooth {
24
ScanResult(const std::string & device_address,const std::vector<uint8_t> & scan_record,int rssi)25 ScanResult::ScanResult(const std::string& device_address,
26 const std::vector<uint8_t>& scan_record, int rssi)
27 : device_address_(device_address), scan_record_(scan_record), rssi_(rssi) {
28 CHECK(util::IsAddressValid(device_address)) << "Invalid BD_ADDR given: "
29 << device_address;
30 }
31
operator ==(const ScanResult & rhs) const32 bool ScanResult::operator==(const ScanResult& rhs) const {
33 if (device_address_ != rhs.device_address_) return false;
34
35 if (scan_record_ != rhs.scan_record_) return false;
36
37 if (rssi_ != rhs.rssi_) return false;
38
39 return true;
40 }
41
42 } // namespace bluetooth
43