• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef WIFICOND_OFFLOAD_SCAN_UTILS_H_
17 #define WIFICOND_OFFLOAD_SCAN_UTILS_H_
18 
19 #include <android/hardware/wifi/offload/1.0/IOffload.h>
20 #include "wificond/scanning/offload/offload_callback.h"
21 
22 #include <vector>
23 
24 namespace com {
25 namespace android {
26 namespace server {
27 namespace wifi {
28 namespace wificond {
29 
30 class NativeScanResult;
31 class NativeScanStats;
32 
33 }  // namespace wificond
34 }  // namespace wifi
35 }  // namespace server
36 }  // namespace android
37 }  // namespace com
38 
39 namespace android {
40 namespace wificond {
41 
42 // Provides utility methods for Offload Scan Manager
43 class OffloadScanUtils {
44  public:
45   static bool convertToNativeScanResults(
46       const std::vector<android::hardware::wifi::offload::V1_0::ScanResult>&,
47       std::vector<::com::android::server::wifi::wificond::NativeScanResult>*);
48   static android::hardware::wifi::offload::V1_0::ScanParam createScanParam(
49       const std::vector<std::vector<uint8_t>>& ssid_list,
50       const std::vector<uint32_t>& frequency_list, uint32_t scan_interval_ms);
51   /* Creates ScanFilter using ssids, security flags and rssi_threshold
52    * The caller must ensure that the number of ssids match the number of
53    * security flags, also there must be ordering maintained among the two lists.
54    * For eg: (ssid[0], flags[0]) describe the SSID and security settings of one
55    * network
56    */
57   static android::hardware::wifi::offload::V1_0::ScanFilter createScanFilter(
58       const std::vector<std::vector<uint8_t>>& ssids,
59       const std::vector<uint8_t>& flags, int8_t rssi_threshold);
60   static ::com::android::server::wifi::wificond::NativeScanStats
61       convertToNativeScanStats(
62           const android::hardware::wifi::offload::V1_0::ScanStats& /* scanStats */);
63 };
64 
65 }  // namespace wificond
66 }  // namespace android
67 
68 #endif  // WIFICOND_OFFLOAD_SCAN_UTILS_H_
69