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 #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, int rssi);
32   ScanResult() = default;
33   virtual ~ScanResult() = default;
34 
35   // Returns the remote BD_ADDR associated with this scan result.
device_address()36   const std::string& device_address() const { return device_address_; }
37 
38   // Returns the scan record (advertising +scan-response data) associated with
39   // this scan result.
scan_record()40   const std::vector<uint8_t>& scan_record() const { return scan_record_; }
41 
42   // Returns the RSSI associated with this scan result.
rssi()43   int rssi() const { return rssi_; }
44 
45   // Comparison operator.
46   bool operator==(const ScanResult& rhs) const;
47 
48  protected:
49   std::string device_address_;
50   std::vector<uint8_t> scan_record_;
51   int rssi_;
52 };
53 
54 }  // namespace bluetooth
55