• 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 #include "chre/apps/wifi_offload/scan_record.h"
18 
19 namespace wifi_offload {
20 
ScanRecord()21 ScanRecord::ScanRecord()
22     : time_spent_scanning_ms_(0),
23       num_channels_scanned_(0),
24       num_entries_aggregated_(0) {}
25 
operator ==(const ScanRecord & other) const26 bool ScanRecord::operator==(const ScanRecord &other) const {
27   if (this == &other) {
28     return true;
29   }
30   return time_spent_scanning_ms_ == other.time_spent_scanning_ms_ &&
31          num_channels_scanned_ == other.num_channels_scanned_ &&
32          num_entries_aggregated_ == other.num_entries_aggregated_;
33 }
34 
Serialize(flatbuffers::FlatBufferBuilder * builder) const35 flatbuffers::Offset<ScanRecord::FbsType> ScanRecord::Serialize(
36     flatbuffers::FlatBufferBuilder *builder) const {
37   return fbs::CreateScanRecord(*builder, time_spent_scanning_ms_,
38                                num_channels_scanned_, num_entries_aggregated_);
39 }
40 
Deserialize(const ScanRecord::FbsType & fbs_record)41 bool ScanRecord::Deserialize(const ScanRecord::FbsType &fbs_record) {
42   time_spent_scanning_ms_ = fbs_record.time_spent_scanning_ms();
43   num_channels_scanned_ = fbs_record.num_channels_scanned();
44   num_entries_aggregated_ = fbs_record.num_entries_aggregated();
45   return true;
46 }
47 
48 }  // namespace wifi_offload
49