blob: f90590b0cbc12530c421a4003e23cd288c4c0d51 [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 Piusf72df2e2016-12-04 10:49:38 -080078bool convertLegacyVectorOfDebugTxPacketFateToHidl(
79 const std::vector<legacy_hal::wifi_tx_report>& legacy_fates,
80 std::vector<WifiDebugTxPacketFateReport>* hidl_fates);
81bool convertLegacyVectorOfDebugRxPacketFateToHidl(
82 const std::vector<legacy_hal::wifi_rx_report>& legacy_fates,
83 std::vector<WifiDebugRxPacketFateReport>* hidl_fates);
Roshan Piusf5f51fd2016-12-01 13:54:24 -080084
85// NAN iface conversion methods.
86bool convertHidlNanEnableRequestToLegacy(
87 const NanEnableRequest& hidl_request,
88 legacy_hal::NanEnableRequest* legacy_request);
89bool convertHidlNanPublishRequestToLegacy(
90 const NanPublishRequest& hidl_request,
91 legacy_hal::NanPublishRequest* legacy_request);
92bool convertHidlNanPublishCancelRequestToLegacy(
93 const NanPublishCancelRequest& hidl_request,
94 legacy_hal::NanPublishCancelRequest* legacy_request);
95bool convertHidlNanSubscribeRequestToLegacy(
96 const NanSubscribeRequest& hidl_request,
97 legacy_hal::NanSubscribeRequest* legacy_request);
98bool convertHidlNanSubscribeCancelRequestToLegacy(
99 const NanSubscribeCancelRequest& hidl_request,
100 legacy_hal::NanSubscribeCancelRequest* legacy_request);
101bool convertHidlNanTransmitFollowupRequestToLegacy(
102 const NanTransmitFollowupRequest& hidl_request,
103 legacy_hal::NanTransmitFollowupRequest* legacy_request);
104bool convertHidlNanConfigRequestToLegacy(
105 const NanConfigRequest& hidl_request,
106 legacy_hal::NanConfigRequest* legacy_request);
107bool convertHidlNanBeaconSdfPayloadRequestToLegacy(
108 const NanBeaconSdfPayloadRequest& hidl_request,
109 legacy_hal::NanBeaconSdfPayloadRequest* legacy_request);
110bool convertHidlNanDataPathInitiatorRequestToLegacy(
111 const NanDataPathInitiatorRequest& hidl_request,
112 legacy_hal::NanDataPathInitiatorRequest* legacy_request);
113bool convertHidlNanDataPathIndicationResponseToLegacy(
114 const NanDataPathIndicationResponse& hidl_response,
115 legacy_hal::NanDataPathIndicationResponse* legacy_response);
116bool convertHidlNanDataPathEndRequestToLegacy(
117 const NanDataPathEndRequest& hidl_request,
118 legacy_hal::NanDataPathEndRequest* legacy_request);
119bool convertLegacyNanResponseHeaderToHidl(
120 const legacy_hal::NanResponseMsg& legacy_response,
121 NanResponseMsgHeader* hidl_response);
122bool convertLegacyNanPublishResponseToHidl(
123 const legacy_hal::NanPublishResponse& legacy_response,
124 NanPublishResponse* hidl_response);
125bool convertLegacyNanSubscribeResponseToHidl(
126 const legacy_hal::NanSubscribeResponse& legacy_response,
127 NanSubscribeResponse* hidl_response);
128bool convertLegacyNanDataPathResponseToHidl(
129 const legacy_hal::NanDataPathRequestResponse& legacy_response,
130 NanDataPathResponse* hidl_response);
131bool convertLegacyNanCapabilitiesResponseToHidl(
132 const legacy_hal::NanCapabilities& legacy_response,
133 NanCapabilitiesResponse* hidl_response);
134bool convertLegacyNanPublishTerminatedIndToHidl(
135 const legacy_hal::NanPublishTerminatedInd& legacy_ind,
136 NanPublishTerminatedInd* hidl_ind);
137bool convertLegacyNanMatchIndToHidl(const legacy_hal::NanMatchInd& legacy_ind,
138 NanMatchInd* hidl_ind);
139bool convertLegacyNanMatchExpiredIndToHidl(
140 const legacy_hal::NanMatchExpiredInd& legacy_ind,
141 NanMatchExpiredInd* hidl_ind);
142bool convertLegacyNanSubscribeTerminatedIndToHidl(
143 const legacy_hal::NanSubscribeTerminatedInd& legacy_ind,
144 NanSubscribeTerminatedInd* hidl_ind);
145bool convertLegacyNanFollowupIndToHidl(
146 const legacy_hal::NanFollowupInd& legacy_ind, NanFollowupInd* hidl_ind);
147bool convertLegacyNanDiscEngEventIndToHidl(
148 const legacy_hal::NanDiscEngEventInd& legacy_ind,
149 NanDiscEngEventInd* hidl_ind);
150bool convertLegacyNanDisabledIndToHidl(
151 const legacy_hal::NanDisabledInd& legacy_ind, NanDisabledInd* hidl_ind);
152bool convertLegacyNanBeaconSdfPayloadIndToHidl(
153 const legacy_hal::NanBeaconSdfPayloadInd& legacy_ind,
154 NanBeaconSdfPayloadInd* hidl_ind);
155bool convertLegacyNanDataPathRequestIndToHidl(
156 const legacy_hal::NanDataPathRequestInd& legacy_ind,
157 NanDataPathRequestInd* hidl_ind);
158bool convertLegacyNanDataPathConfirmIndToHidl(
159 const legacy_hal::NanDataPathConfirmInd& legacy_ind,
160 NanDataPathConfirmInd* hidl_ind);
161bool convertLegacyNanDataPathEndIndToHidl(
162 const legacy_hal::NanDataPathEndInd& legacy_ind,
163 NanDataPathEndInd* hidl_ind);
164bool convertLegacyNanTransmitFollowupIndToHidl(
165 const legacy_hal::NanTransmitFollowupInd& legacy_ind,
166 NanTransmitFollowupInd* hidl_ind);
Roshan Pius3fae9c82016-12-02 14:49:41 -0800167
168// RTT controller conversion methods.
169bool convertHidlRttConfigToLegacy(const RttConfig& hidl_config,
170 legacy_hal::wifi_rtt_config* legacy_config);
Roshan Pius3fae9c82016-12-02 14:49:41 -0800171bool convertHidlRttLciInformationToLegacy(
172 const RttLciInformation& hidl_info,
173 legacy_hal::wifi_lci_information* legacy_info);
174bool convertHidlRttLcrInformationToLegacy(
175 const RttLcrInformation& hidl_info,
176 legacy_hal::wifi_lcr_information* legacy_info);
177bool convertHidlRttResponderToLegacy(
178 const RttResponder& hidl_responder,
179 legacy_hal::wifi_rtt_responder* legacy_responder);
180bool convertLegacyRttResponderToHidl(
181 const legacy_hal::wifi_rtt_responder& legacy_responder,
182 RttResponder* hidl_responder);
183bool convertLegacyRttCapabilitiesToHidl(
184 const legacy_hal::wifi_rtt_capabilities& legacy_capabilities,
185 RttCapabilities* hidl_capabilities);
186bool convertLegacyRttResultToHidl(
187 const legacy_hal::wifi_rtt_result& legacy_result, RttResult* hidl_result);
Roshan Piuse65edb12016-11-22 13:02:01 -0800188} // namespace hidl_struct_util
189} // namespace implementation
190} // namespace V1_0
191} // namespace wifi
192} // namespace hardware
193} // namespace android
194
195#endif // HIDL_STRUCT_UTIL_H_