blob: 8729265f71c8f4f040958c2a14500c60a92cafd9 [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
Roshan Piusf72df2e2016-12-04 10:49:38 -080039// Chip conversion methods.
40bool convertLegacyFeaturesToHidlChipCapabilities(
41 uint32_t legacy_logger_feature_set, uint32_t* hidl_caps);
42bool convertLegacyVectorOfDebugRingBufferStatusToHidl(
43 const std::vector<legacy_hal::wifi_ring_buffer_status>& legacy_status_vec,
44 std::vector<WifiDebugRingBufferStatus>* hidl_status_vec);
45bool convertLegacyWakeReasonStatsToHidl(
46 const legacy_hal::WakeReasonStats& legacy_stats,
47 WifiDebugHostWakeReasonStats* hidl_stats);
48
Roshan Piusf5f51fd2016-12-01 13:54:24 -080049// STA iface conversion methods.
Roshan Piusf72df2e2016-12-04 10:49:38 -080050bool convertLegacyFeaturesToHidlStaCapabilities(
51 uint32_t legacy_feature_set,
52 uint32_t legacy_logger_feature_set,
53 uint32_t* hidl_caps);
54bool convertLegacyApfCapabilitiesToHidl(
55 const legacy_hal::PacketFilterCapabilities& legacy_caps,
56 StaApfPacketFilterCapabilities* hidl_caps);
57bool convertLegacyScanCapabilitiesToHidl(
58 const legacy_hal::wifi_gscan_capabilities& legacy_caps,
59 StaBackgroundScanCapabilities* hidl_caps);
Roshan Piuse65edb12016-11-22 13:02:01 -080060bool convertHidlScanParamsToLegacy(
61 const StaBackgroundScanParameters& hidl_scan_params,
62 legacy_hal::wifi_scan_cmd_params* legacy_scan_params);
Roshan Piuse65edb12016-11-22 13:02:01 -080063// |has_ie_data| indicates whether or not the wifi_scan_result includes 802.11
64// Information Elements (IEs)
65bool convertLegacyScanResultToHidl(
66 const legacy_hal::wifi_scan_result& legacy_scan_result,
67 bool has_ie_data,
68 StaScanResult* hidl_scan_result);
69// |cached_results| is assumed to not include IEs.
70bool convertLegacyVectorOfCachedScanResultsToHidl(
71 const std::vector<legacy_hal::wifi_cached_scan_results>&
72 legacy_cached_scan_results,
73 std::vector<StaScanData>* hidl_scan_datas);
74bool convertLegacyLinkLayerStatsToHidl(
75 const legacy_hal::LinkLayerStats& legacy_stats,
76 StaLinkLayerStats* hidl_stats);
Roshan Piusf72df2e2016-12-04 10:49:38 -080077bool convertLegacyVectorOfDebugTxPacketFateToHidl(
78 const std::vector<legacy_hal::wifi_tx_report>& legacy_fates,
79 std::vector<WifiDebugTxPacketFateReport>* hidl_fates);
80bool convertLegacyVectorOfDebugRxPacketFateToHidl(
81 const std::vector<legacy_hal::wifi_rx_report>& legacy_fates,
82 std::vector<WifiDebugRxPacketFateReport>* hidl_fates);
Roshan Piusf5f51fd2016-12-01 13:54:24 -080083
84// NAN iface conversion methods.
85bool convertHidlNanEnableRequestToLegacy(
86 const NanEnableRequest& hidl_request,
87 legacy_hal::NanEnableRequest* legacy_request);
88bool convertHidlNanPublishRequestToLegacy(
89 const NanPublishRequest& hidl_request,
90 legacy_hal::NanPublishRequest* legacy_request);
91bool convertHidlNanPublishCancelRequestToLegacy(
92 const NanPublishCancelRequest& hidl_request,
93 legacy_hal::NanPublishCancelRequest* legacy_request);
94bool convertHidlNanSubscribeRequestToLegacy(
95 const NanSubscribeRequest& hidl_request,
96 legacy_hal::NanSubscribeRequest* legacy_request);
97bool convertHidlNanSubscribeCancelRequestToLegacy(
98 const NanSubscribeCancelRequest& hidl_request,
99 legacy_hal::NanSubscribeCancelRequest* legacy_request);
100bool convertHidlNanTransmitFollowupRequestToLegacy(
101 const NanTransmitFollowupRequest& hidl_request,
102 legacy_hal::NanTransmitFollowupRequest* legacy_request);
103bool convertHidlNanConfigRequestToLegacy(
104 const NanConfigRequest& hidl_request,
105 legacy_hal::NanConfigRequest* legacy_request);
106bool convertHidlNanBeaconSdfPayloadRequestToLegacy(
107 const NanBeaconSdfPayloadRequest& hidl_request,
108 legacy_hal::NanBeaconSdfPayloadRequest* legacy_request);
109bool convertHidlNanDataPathInitiatorRequestToLegacy(
110 const NanDataPathInitiatorRequest& hidl_request,
111 legacy_hal::NanDataPathInitiatorRequest* legacy_request);
112bool convertHidlNanDataPathIndicationResponseToLegacy(
113 const NanDataPathIndicationResponse& hidl_response,
114 legacy_hal::NanDataPathIndicationResponse* legacy_response);
115bool convertHidlNanDataPathEndRequestToLegacy(
116 const NanDataPathEndRequest& hidl_request,
117 legacy_hal::NanDataPathEndRequest* legacy_request);
118bool convertLegacyNanResponseHeaderToHidl(
119 const legacy_hal::NanResponseMsg& legacy_response,
120 NanResponseMsgHeader* hidl_response);
121bool convertLegacyNanPublishResponseToHidl(
122 const legacy_hal::NanPublishResponse& legacy_response,
123 NanPublishResponse* hidl_response);
124bool convertLegacyNanSubscribeResponseToHidl(
125 const legacy_hal::NanSubscribeResponse& legacy_response,
126 NanSubscribeResponse* hidl_response);
127bool convertLegacyNanDataPathResponseToHidl(
128 const legacy_hal::NanDataPathRequestResponse& legacy_response,
129 NanDataPathResponse* hidl_response);
130bool convertLegacyNanCapabilitiesResponseToHidl(
131 const legacy_hal::NanCapabilities& legacy_response,
132 NanCapabilitiesResponse* hidl_response);
133bool convertLegacyNanPublishTerminatedIndToHidl(
134 const legacy_hal::NanPublishTerminatedInd& legacy_ind,
135 NanPublishTerminatedInd* hidl_ind);
136bool convertLegacyNanMatchIndToHidl(const legacy_hal::NanMatchInd& legacy_ind,
137 NanMatchInd* hidl_ind);
138bool convertLegacyNanMatchExpiredIndToHidl(
139 const legacy_hal::NanMatchExpiredInd& legacy_ind,
140 NanMatchExpiredInd* hidl_ind);
141bool convertLegacyNanSubscribeTerminatedIndToHidl(
142 const legacy_hal::NanSubscribeTerminatedInd& legacy_ind,
143 NanSubscribeTerminatedInd* hidl_ind);
144bool convertLegacyNanFollowupIndToHidl(
145 const legacy_hal::NanFollowupInd& legacy_ind, NanFollowupInd* hidl_ind);
146bool convertLegacyNanDiscEngEventIndToHidl(
147 const legacy_hal::NanDiscEngEventInd& legacy_ind,
148 NanDiscEngEventInd* hidl_ind);
149bool convertLegacyNanDisabledIndToHidl(
150 const legacy_hal::NanDisabledInd& legacy_ind, NanDisabledInd* hidl_ind);
151bool convertLegacyNanBeaconSdfPayloadIndToHidl(
152 const legacy_hal::NanBeaconSdfPayloadInd& legacy_ind,
153 NanBeaconSdfPayloadInd* hidl_ind);
154bool convertLegacyNanDataPathRequestIndToHidl(
155 const legacy_hal::NanDataPathRequestInd& legacy_ind,
156 NanDataPathRequestInd* hidl_ind);
157bool convertLegacyNanDataPathConfirmIndToHidl(
158 const legacy_hal::NanDataPathConfirmInd& legacy_ind,
159 NanDataPathConfirmInd* hidl_ind);
160bool convertLegacyNanDataPathEndIndToHidl(
161 const legacy_hal::NanDataPathEndInd& legacy_ind,
162 NanDataPathEndInd* hidl_ind);
163bool convertLegacyNanTransmitFollowupIndToHidl(
164 const legacy_hal::NanTransmitFollowupInd& legacy_ind,
165 NanTransmitFollowupInd* hidl_ind);
Roshan Pius3fae9c82016-12-02 14:49:41 -0800166
167// RTT controller conversion methods.
168bool convertHidlRttConfigToLegacy(const RttConfig& hidl_config,
169 legacy_hal::wifi_rtt_config* legacy_config);
Roshan Pius3fae9c82016-12-02 14:49:41 -0800170bool convertHidlRttLciInformationToLegacy(
171 const RttLciInformation& hidl_info,
172 legacy_hal::wifi_lci_information* legacy_info);
173bool convertHidlRttLcrInformationToLegacy(
174 const RttLcrInformation& hidl_info,
175 legacy_hal::wifi_lcr_information* legacy_info);
176bool convertHidlRttResponderToLegacy(
177 const RttResponder& hidl_responder,
178 legacy_hal::wifi_rtt_responder* legacy_responder);
179bool convertLegacyRttResponderToHidl(
180 const legacy_hal::wifi_rtt_responder& legacy_responder,
181 RttResponder* hidl_responder);
182bool convertLegacyRttCapabilitiesToHidl(
183 const legacy_hal::wifi_rtt_capabilities& legacy_capabilities,
184 RttCapabilities* hidl_capabilities);
185bool convertLegacyRttResultToHidl(
186 const legacy_hal::wifi_rtt_result& legacy_result, RttResult* hidl_result);
Roshan Piuse65edb12016-11-22 13:02:01 -0800187} // namespace hidl_struct_util
188} // namespace implementation
189} // namespace V1_0
190} // namespace wifi
191} // namespace hardware
192} // namespace android
193
194#endif // HIDL_STRUCT_UTIL_H_