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
24 namespace bluetooth {
25
ScanResult(const std::string & device_address,const std::vector<uint8_t> scan_record,int rssi)26 ScanResult::ScanResult(const std::string& device_address,
27 const std::vector<uint8_t> scan_record,
28 int rssi)
29 : device_address_(device_address),
30 scan_record_(scan_record),
31 rssi_(rssi) {
32 CHECK(util::IsAddressValid(device_address)) << "Invalid BD_ADDR given: "
33 << device_address;
34 }
35
operator ==(const ScanResult & rhs) const36 bool ScanResult::operator==(const ScanResult& rhs) const {
37 if (device_address_ != rhs.device_address_)
38 return false;
39
40 if (scan_record_ != rhs.scan_record_)
41 return false;
42
43 if (rssi_ != rhs.rssi_)
44 return false;
45
46 return true;
47 }
48
49 } // namespace bluetooth
50