blob: 6c91e038bb1072ee1f42d3b7ecdbb65579bf7b62 [file] [log] [blame]
Roshan Piuse65edb12016-11-22 13:02:01 -08001/*
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
17#ifndef HIDL_STRUCT_UTIL_H_
18#define HIDL_STRUCT_UTIL_H_
19
20#include <vector>
21
22#include <android/hardware/wifi/1.0/IWifi.h>
23
24#include "wifi_legacy_hal.h"
25
26/**
27 * This file contains a bunch of functions to convert structs from the legacy
28 * HAL to HIDL and vice versa.
29 * TODO(b/32093047): Add unit tests for these conversion methods in the VTS test
30 * suite.
31 */
32namespace android {
33namespace hardware {
34namespace wifi {
35namespace V1_0 {
36namespace implementation {
37namespace hidl_struct_util {
38
39// Convert hidl gscan params to legacy gscan params.
40bool convertHidlScanParamsToLegacy(
41 const StaBackgroundScanParameters& hidl_scan_params,
42 legacy_hal::wifi_scan_cmd_params* legacy_scan_params);
43// Convert the blob of packed IE elements to vector of
44// |WifiInformationElement| structures.
45bool convertLegacyIeBlobToHidl(const uint8_t* ie_blob,
46 uint32_t ie_blob_len,
47 std::vector<WifiInformationElement>* hidl_ies);
48// |has_ie_data| indicates whether or not the wifi_scan_result includes 802.11
49// Information Elements (IEs)
50bool convertLegacyScanResultToHidl(
51 const legacy_hal::wifi_scan_result& legacy_scan_result,
52 bool has_ie_data,
53 StaScanResult* hidl_scan_result);
54// |cached_results| is assumed to not include IEs.
55bool convertLegacyVectorOfCachedScanResultsToHidl(
56 const std::vector<legacy_hal::wifi_cached_scan_results>&
57 legacy_cached_scan_results,
58 std::vector<StaScanData>* hidl_scan_datas);
59bool convertLegacyLinkLayerStatsToHidl(
60 const legacy_hal::LinkLayerStats& legacy_stats,
61 StaLinkLayerStats* hidl_stats);
62} // namespace hidl_struct_util
63} // namespace implementation
64} // namespace V1_0
65} // namespace wifi
66} // namespace hardware
67} // namespace android
68
69#endif // HIDL_STRUCT_UTIL_H_