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