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_RESULT_MESSAGE_H_ 18 #define CHRE_WIFI_OFFLOAD_SCAN_RESULT_MESSAGE_H_ 19 20 #include "chre/apps/wifi_offload/wifi_offload.h" 21 22 #include "chre/apps/wifi_offload/scan_result.h" 23 24 namespace wifi_offload { 25 26 /** 27 * Container for vector of scan results that provides serialization methods 28 */ 29 class ScanResultMessage { 30 public: 31 /* Corresponding flatbuffers-generated data-type used to serialize and 32 * deserialize instances of this class */ 33 using FbsType = fbs::ScanResultMessage; 34 35 ScanResultMessage() = default; 36 ~ScanResultMessage() = default; 37 38 void SetScanResults(const Vector<ScanResult> &results); 39 void GetScanResults(Vector<ScanResult> *results); 40 41 flatbuffers::Offset<ScanResultMessage::FbsType> Serialize( 42 flatbuffers::FlatBufferBuilder *builder) const; 43 44 bool Deserialize(const ScanResultMessage::FbsType &fbs_result_message); 45 46 private: 47 Vector<ScanResult> scan_results_; 48 }; 49 50 } // namespace wifi_offload 51 52 #endif // CHRE_WIFI_OFFLOAD_SCAN_RESULT_MESSAGE_H_ 53