• 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_STATS_H_
18 #define CHRE_WIFI_OFFLOAD_SCAN_STATS_H_
19 
20 #include "chre/apps/wifi_offload/wifi_offload.h"
21 
22 #include "chre/apps/wifi_offload/channel_histogram.h"
23 #include "chre/apps/wifi_offload/flatbuffers_types_generated.h"
24 #include "chre/apps/wifi_offload/rpc_log_record.h"
25 #include "chre/apps/wifi_offload/scan_record.h"
26 
27 namespace wifi_offload {
28 
29 /**
30  * Defines the scan statistics to be returned to the framework
31  */
32 class ScanStats {
33  public:
34   /* Corresponding flatbuffers-generated data-type used to serialize and
35    * deserialize instances of this class */
36   using FbsType = fbs::ScanStats;
37 
38   ScanStats();
39   ~ScanStats() = default;
40 
41   bool operator==(const ScanStats &other) const;
42 
43   flatbuffers::Offset<ScanStats::FbsType> Serialize(
44       flatbuffers::FlatBufferBuilder *builder) const;
45 
46   bool Deserialize(const ScanStats::FbsType &fbs_stats);
47 
48   uint32_t num_scans_requested_by_nanoapp_;
49   uint32_t num_scans_serviced_by_hardware_;
50   uint32_t num_scans_serviced_by_cache_;
51   uint32_t updated_at_chre_ms_;
52   uint32_t sent_at_chre_ms_;
53   /* The duration between when the framework subscribed for scan results to min
54    * of time when the framework unsubscribed vs. current time */
55   uint32_t last_subscription_duration_ms_;
56 
57   ChannelHistogram channel_histogram_;
58 
59   Vector<ScanRecord> scan_records_;
60   Vector<RpcLogRecord> rpc_log_records_;
61 };
62 
63 }  // namespace wifi_offload
64 
65 #endif  // CHRE_WIFI_OFFLOAD_SCAN_STATS_H_
66