blob: e4104e27f3d800bb565af18795918493b05e4e69 [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);
Roshan Pius881d1f72016-12-05 15:37:00 -080057bool convertLegacyGscanCapabilitiesToHidl(
Roshan Piusf72df2e2016-12-04 10:49:38 -080058 const legacy_hal::wifi_gscan_capabilities& legacy_caps,
59 StaBackgroundScanCapabilities* hidl_caps);
Roshan Pius881d1f72016-12-05 15:37:00 -080060legacy_hal::wifi_band convertHidlGscanBandToLegacy(StaBackgroundScanBand band);
61bool convertHidlGscanParamsToLegacy(
Roshan Piuse65edb12016-11-22 13:02:01 -080062 const StaBackgroundScanParameters& hidl_scan_params,
63 legacy_hal::wifi_scan_cmd_params* legacy_scan_params);
Roshan Piuse65edb12016-11-22 13:02:01 -080064// |has_ie_data| indicates whether or not the wifi_scan_result includes 802.11
65// Information Elements (IEs)
Roshan Pius881d1f72016-12-05 15:37:00 -080066bool convertLegacyGscanResultToHidl(
Roshan Piuse65edb12016-11-22 13:02:01 -080067 const legacy_hal::wifi_scan_result& legacy_scan_result,
68 bool has_ie_data,
69 StaScanResult* hidl_scan_result);
70// |cached_results| is assumed to not include IEs.
Roshan Pius881d1f72016-12-05 15:37:00 -080071bool convertLegacyVectorOfCachedGscanResultsToHidl(
Roshan Piuse65edb12016-11-22 13:02:01 -080072 const std::vector<legacy_hal::wifi_cached_scan_results>&
73 legacy_cached_scan_results,
74 std::vector<StaScanData>* hidl_scan_datas);
75bool convertLegacyLinkLayerStatsToHidl(
76 const legacy_hal::LinkLayerStats& legacy_stats,
77 StaLinkLayerStats* hidl_stats);
Roshan Pius26801cb2016-12-13 14:25:45 -080078bool convertLegacyRoamingCapabilitiesToHidl(
79 const legacy_hal::wifi_roaming_capabilities& legacy_caps,
80 StaRoamingCapabilities* hidl_caps);
81bool convertHidlRoamingConfigToLegacy(
82 const StaRoamingConfig& hidl_config,
83 legacy_hal::wifi_roaming_config* legacy_config);
84legacy_hal::fw_roaming_state_t convertHidlRoamingStateToLegacy(
85 StaRoamingState state);
Roshan Piusf72df2e2016-12-04 10:49:38 -080086bool convertLegacyVectorOfDebugTxPacketFateToHidl(
87 const std::vector<legacy_hal::wifi_tx_report>& legacy_fates,
88 std::vector<WifiDebugTxPacketFateReport>* hidl_fates);
89bool convertLegacyVectorOfDebugRxPacketFateToHidl(
90 const std::vector<legacy_hal::wifi_rx_report>& legacy_fates,
91 std::vector<WifiDebugRxPacketFateReport>* hidl_fates);
Roshan Piusf5f51fd2016-12-01 13:54:24 -080092
93// NAN iface conversion methods.
94bool convertHidlNanEnableRequestToLegacy(
95 const NanEnableRequest& hidl_request,
96 legacy_hal::NanEnableRequest* legacy_request);
97bool convertHidlNanPublishRequestToLegacy(
98 const NanPublishRequest& hidl_request,
99 legacy_hal::NanPublishRequest* legacy_request);
100bool convertHidlNanPublishCancelRequestToLegacy(
101 const NanPublishCancelRequest& hidl_request,
102 legacy_hal::NanPublishCancelRequest* legacy_request);
103bool convertHidlNanSubscribeRequestToLegacy(
104 const NanSubscribeRequest& hidl_request,
105 legacy_hal::NanSubscribeRequest* legacy_request);
106bool convertHidlNanSubscribeCancelRequestToLegacy(
107 const NanSubscribeCancelRequest& hidl_request,
108 legacy_hal::NanSubscribeCancelRequest* legacy_request);
109bool convertHidlNanTransmitFollowupRequestToLegacy(
110 const NanTransmitFollowupRequest& hidl_request,
111 legacy_hal::NanTransmitFollowupRequest* legacy_request);
112bool convertHidlNanConfigRequestToLegacy(
113 const NanConfigRequest& hidl_request,
114 legacy_hal::NanConfigRequest* legacy_request);
115bool convertHidlNanBeaconSdfPayloadRequestToLegacy(
116 const NanBeaconSdfPayloadRequest& hidl_request,
117 legacy_hal::NanBeaconSdfPayloadRequest* legacy_request);
118bool convertHidlNanDataPathInitiatorRequestToLegacy(
119 const NanDataPathInitiatorRequest& hidl_request,
120 legacy_hal::NanDataPathInitiatorRequest* legacy_request);
121bool convertHidlNanDataPathIndicationResponseToLegacy(
122 const NanDataPathIndicationResponse& hidl_response,
123 legacy_hal::NanDataPathIndicationResponse* legacy_response);
124bool convertHidlNanDataPathEndRequestToLegacy(
125 const NanDataPathEndRequest& hidl_request,
126 legacy_hal::NanDataPathEndRequest* legacy_request);
127bool convertLegacyNanResponseHeaderToHidl(
128 const legacy_hal::NanResponseMsg& legacy_response,
129 NanResponseMsgHeader* hidl_response);
130bool convertLegacyNanPublishResponseToHidl(
131 const legacy_hal::NanPublishResponse& legacy_response,
132 NanPublishResponse* hidl_response);
133bool convertLegacyNanSubscribeResponseToHidl(
134 const legacy_hal::NanSubscribeResponse& legacy_response,
135 NanSubscribeResponse* hidl_response);
136bool convertLegacyNanDataPathResponseToHidl(
137 const legacy_hal::NanDataPathRequestResponse& legacy_response,
138 NanDataPathResponse* hidl_response);
139bool convertLegacyNanCapabilitiesResponseToHidl(
140 const legacy_hal::NanCapabilities& legacy_response,
141 NanCapabilitiesResponse* hidl_response);
142bool convertLegacyNanPublishTerminatedIndToHidl(
143 const legacy_hal::NanPublishTerminatedInd& legacy_ind,
144 NanPublishTerminatedInd* hidl_ind);
145bool convertLegacyNanMatchIndToHidl(const legacy_hal::NanMatchInd& legacy_ind,
146 NanMatchInd* hidl_ind);
147bool convertLegacyNanMatchExpiredIndToHidl(
148 const legacy_hal::NanMatchExpiredInd& legacy_ind,
149 NanMatchExpiredInd* hidl_ind);
150bool convertLegacyNanSubscribeTerminatedIndToHidl(
151 const legacy_hal::NanSubscribeTerminatedInd& legacy_ind,
152 NanSubscribeTerminatedInd* hidl_ind);
153bool convertLegacyNanFollowupIndToHidl(
154 const legacy_hal::NanFollowupInd& legacy_ind, NanFollowupInd* hidl_ind);
155bool convertLegacyNanDiscEngEventIndToHidl(
156 const legacy_hal::NanDiscEngEventInd& legacy_ind,
157 NanDiscEngEventInd* hidl_ind);
158bool convertLegacyNanDisabledIndToHidl(
159 const legacy_hal::NanDisabledInd& legacy_ind, NanDisabledInd* hidl_ind);
160bool convertLegacyNanBeaconSdfPayloadIndToHidl(
161 const legacy_hal::NanBeaconSdfPayloadInd& legacy_ind,
162 NanBeaconSdfPayloadInd* hidl_ind);
163bool convertLegacyNanDataPathRequestIndToHidl(
164 const legacy_hal::NanDataPathRequestInd& legacy_ind,
165 NanDataPathRequestInd* hidl_ind);
166bool convertLegacyNanDataPathConfirmIndToHidl(
167 const legacy_hal::NanDataPathConfirmInd& legacy_ind,
168 NanDataPathConfirmInd* hidl_ind);
169bool convertLegacyNanDataPathEndIndToHidl(
170 const legacy_hal::NanDataPathEndInd& legacy_ind,
171 NanDataPathEndInd* hidl_ind);
172bool convertLegacyNanTransmitFollowupIndToHidl(
173 const legacy_hal::NanTransmitFollowupInd& legacy_ind,
174 NanTransmitFollowupInd* hidl_ind);
Roshan Pius3fae9c82016-12-02 14:49:41 -0800175
176// RTT controller conversion methods.
Roshan Piuse3f72ff2016-12-05 16:18:43 -0800177bool convertHidlVectorOfRttConfigToLegacy(
178 const std::vector<RttConfig>& hidl_configs,
179 std::vector<legacy_hal::wifi_rtt_config>* legacy_configs);
Roshan Pius3fae9c82016-12-02 14:49:41 -0800180bool convertHidlRttLciInformationToLegacy(
181 const RttLciInformation& hidl_info,
182 legacy_hal::wifi_lci_information* legacy_info);
183bool convertHidlRttLcrInformationToLegacy(
184 const RttLcrInformation& hidl_info,
185 legacy_hal::wifi_lcr_information* legacy_info);
186bool convertHidlRttResponderToLegacy(
187 const RttResponder& hidl_responder,
188 legacy_hal::wifi_rtt_responder* legacy_responder);
Roshan Piuse3f72ff2016-12-05 16:18:43 -0800189bool convertHidlWifiChannelInfoToLegacy(
190 const WifiChannelInfo& hidl_info,
191 legacy_hal::wifi_channel_info* legacy_info);
Roshan Pius3fae9c82016-12-02 14:49:41 -0800192bool convertLegacyRttResponderToHidl(
193 const legacy_hal::wifi_rtt_responder& legacy_responder,
194 RttResponder* hidl_responder);
195bool convertLegacyRttCapabilitiesToHidl(
196 const legacy_hal::wifi_rtt_capabilities& legacy_capabilities,
197 RttCapabilities* hidl_capabilities);
Roshan Piuse3f72ff2016-12-05 16:18:43 -0800198bool convertLegacyVectorOfRttResultToHidl(
199 const std::vector<const legacy_hal::wifi_rtt_result*>& legacy_results,
200 std::vector<RttResult>* hidl_results);
Roshan Piuse65edb12016-11-22 13:02:01 -0800201} // namespace hidl_struct_util
202} // namespace implementation
203} // namespace V1_0
204} // namespace wifi
205} // namespace hardware
206} // namespace android
207
208#endif // HIDL_STRUCT_UTIL_H_