1 /*
2  * Copyright (C) 2016 The Android Open Source Project
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 #ifndef WIFICOND_SCANNING_SCAN_RESULT_H_
18 #define WIFICOND_SCANNING_SCAN_RESULT_H_
19 
20 #include <vector>
21 
22 #include <binder/Parcel.h>
23 #include <binder/Parcelable.h>
24 
25 namespace com {
26 namespace android {
27 namespace server {
28 namespace wifi {
29 namespace wificond {
30 
31 // This is the class to represent a scan result for wificond internal use.
32 class NativeScanResult : public ::android::Parcelable {
33  public:
34   NativeScanResult() = default;
35   NativeScanResult(std::vector<uint8_t>& ssid,
36                    std::vector<uint8_t>& bssid,
37                    std::vector<uint8_t>& info_element,
38                    uint32_t frequency,
39                    int32_t signal_mbm,
40                    uint64_t tsf,
41                    uint16_t capability,
42                    bool associated);
43   ::android::status_t writeToParcel(::android::Parcel* parcel) const override;
44   ::android::status_t readFromParcel(const ::android::Parcel* parcel) override;
45 
46   void DebugLog();
47 
48   // SSID of the BSS.
49   std::vector<uint8_t> ssid;
50   // BSSID of the BSS.
51   std::vector<uint8_t> bssid;
52   // Binary array containing the raw information elements from the probe
53   // response/beacon.
54   std::vector<uint8_t> info_element;
55   // Frequency in MHz.
56   uint32_t frequency;
57   // Signal strength of probe response/beacon in (100 * dBm).
58   int32_t signal_mbm;
59   // TSF of the received probe response/beacon.
60   uint64_t tsf;
61   // This is a bit mask describing the capabilities of a BSS.
62   // See IEEE Std 802.11: 8.4.1.4
63   // Bit 0 - ESS
64   // Bit 1 - IBSS
65   // Bit 2 - CF Pollable
66   // Bit 3 - CF-Poll Request
67   // Bit 4 - Privacy
68   // Bit 5 - Short Preamble
69   // Bit 6 - PBCC
70   // Bit 7 - Channel Agility
71   // Bit 8 - Spectrum Mgmt
72   // Bit 9 - QoS
73   // Bit 10 - Short Slot Time
74   // Bit 11 - APSD
75   // Bit 12 - Radio Measurement
76   // Bit 13 - DSSS-OFDM
77   // Bit 14 - Delayed Block Ack
78   // Bit 15 - Immediate Block Ack
79   uint16_t capability;
80   bool associated;
81 };
82 
83 }  // namespace wificond
84 }  // namespace wifi
85 }  // namespace server
86 }  // namespace android
87 }  // namespace com
88 
89 #endif  // WIFICOND_SCANNING_SCAN_RESULT_H_
90