• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2017 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 CHRE_WIFI_OFFLOAD_SCAN_FILTER_H_
18 #define CHRE_WIFI_OFFLOAD_SCAN_FILTER_H_
19 
20 #include "chre/apps/wifi_offload/wifi_offload.h"
21 
22 #include "chre/apps/wifi_offload/generated/flatbuffers_types_generated.h"
23 #include "chre/apps/wifi_offload/preferred_network.h"
24 
25 namespace wifi_offload {
26 
27 /**
28  * Instruction on how to filter scan results before waking up the applications
29  * processor.
30  */
31 class ScanFilter {
32  public:
33   /* Corresponding flatbuffers-generated data-type used to serialize and
34    * deserialize instances of this class */
35   using FbsType = fbs::ScanFilter;
36 
37   ScanFilter();
38 
39   ~ScanFilter() = default;
40 
41   bool operator==(const ScanFilter &other) const;
42 
43   flatbuffers::Offset<ScanFilter::FbsType> Serialize(
44       flatbuffers::FlatBufferBuilder *builder) const;
45 
46   bool Deserialize(const ScanFilter::FbsType &fbs_filter);
47 
48   void Log() const;
49 
50   Vector<PreferredNetwork> networks_to_match_;  // empty means match all
51   int8_t min_rssi_threshold_dbm_;
52 };
53 
54 }  // namespace wifi_offload
55 
56 #endif  // CHRE_WIFI_OFFLOAD_SCAN_FILTER_H_
57