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 #pragma once
18 
19 #include <stdint.h>
20 
21 #include <string>
22 #include <vector>
23 
24 namespace bluetooth {
25 
26 // ScanResult represents a single Bluetooth LE device scan result. It
27 // encapsulates information about discovered LE devices.
28 class ScanResult {
29  public:
30   ScanResult(const std::string& device_address,
31              const std::vector<uint8_t> scan_record,
32              int rssi);
33   ScanResult() = default;
34   ~ScanResult() = default;
35 
36   // Returns the remote BD_ADDR associated with this scan result.
device_address()37   const std::string& device_address() const { return device_address_; }
38 
39   // Returns the scan record (advertising +scan-response data) associated with
40   // this scan result.
scan_record()41   const std::vector<uint8_t>& scan_record() const { return scan_record_; }
42 
43   // Returns the RSSI associated with this scan result.
rssi()44   int rssi() const { return rssi_; }
45 
46   // Comparison operator.
47   bool operator==(const ScanResult& rhs) const;
48 
49  private:
50   std::string device_address_;
51   std::vector<uint8_t> scan_record_;
52   int rssi_;
53 };
54 
55 }  // namespace bluetooth
56