blob: 1e5a9ff252b4f7d72e56555ca1a6c308c3aa05cd [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 Piusf5f51fd2016-12-01 13:54:24 -080039// STA iface conversion methods.
Roshan Piuse65edb12016-11-22 13:02:01 -080040bool convertHidlScanParamsToLegacy(
41 const StaBackgroundScanParameters& hidl_scan_params,
42 legacy_hal::wifi_scan_cmd_params* legacy_scan_params);
Roshan Piuse65edb12016-11-22 13:02:01 -080043// |has_ie_data| indicates whether or not the wifi_scan_result includes 802.11
44// Information Elements (IEs)
45bool convertLegacyScanResultToHidl(
46 const legacy_hal::wifi_scan_result& legacy_scan_result,
47 bool has_ie_data,
48 StaScanResult* hidl_scan_result);
49// |cached_results| is assumed to not include IEs.
50bool convertLegacyVectorOfCachedScanResultsToHidl(
51 const std::vector<legacy_hal::wifi_cached_scan_results>&
52 legacy_cached_scan_results,
53 std::vector<StaScanData>* hidl_scan_datas);
54bool convertLegacyLinkLayerStatsToHidl(
55 const legacy_hal::LinkLayerStats& legacy_stats,
56 StaLinkLayerStats* hidl_stats);
Roshan Pius32d0ca92016-12-02 11:21:19 -080057bool convertLegacyDebugTxPacketFateToHidl(
58 const legacy_hal::wifi_tx_report& legacy_fate,
59 WifiDebugTxPacketFateReport* hidl_fate);
60bool convertLegacyDebugRxPacketFateToHidl(
61 const legacy_hal::wifi_rx_report& legacy_fate,
62 WifiDebugRxPacketFateReport* hidl_fate);
Roshan Piusf5f51fd2016-12-01 13:54:24 -080063
64// NAN iface conversion methods.
65bool convertHidlNanEnableRequestToLegacy(
66 const NanEnableRequest& hidl_request,
67 legacy_hal::NanEnableRequest* legacy_request);
68bool convertHidlNanPublishRequestToLegacy(
69 const NanPublishRequest& hidl_request,
70 legacy_hal::NanPublishRequest* legacy_request);
71bool convertHidlNanPublishCancelRequestToLegacy(
72 const NanPublishCancelRequest& hidl_request,
73 legacy_hal::NanPublishCancelRequest* legacy_request);
74bool convertHidlNanSubscribeRequestToLegacy(
75 const NanSubscribeRequest& hidl_request,
76 legacy_hal::NanSubscribeRequest* legacy_request);
77bool convertHidlNanSubscribeCancelRequestToLegacy(
78 const NanSubscribeCancelRequest& hidl_request,
79 legacy_hal::NanSubscribeCancelRequest* legacy_request);
80bool convertHidlNanTransmitFollowupRequestToLegacy(
81 const NanTransmitFollowupRequest& hidl_request,
82 legacy_hal::NanTransmitFollowupRequest* legacy_request);
83bool convertHidlNanConfigRequestToLegacy(
84 const NanConfigRequest& hidl_request,
85 legacy_hal::NanConfigRequest* legacy_request);
86bool convertHidlNanBeaconSdfPayloadRequestToLegacy(
87 const NanBeaconSdfPayloadRequest& hidl_request,
88 legacy_hal::NanBeaconSdfPayloadRequest* legacy_request);
89bool convertHidlNanDataPathInitiatorRequestToLegacy(
90 const NanDataPathInitiatorRequest& hidl_request,
91 legacy_hal::NanDataPathInitiatorRequest* legacy_request);
92bool convertHidlNanDataPathIndicationResponseToLegacy(
93 const NanDataPathIndicationResponse& hidl_response,
94 legacy_hal::NanDataPathIndicationResponse* legacy_response);
95bool convertHidlNanDataPathEndRequestToLegacy(
96 const NanDataPathEndRequest& hidl_request,
97 legacy_hal::NanDataPathEndRequest* legacy_request);
98bool convertLegacyNanResponseHeaderToHidl(
99 const legacy_hal::NanResponseMsg& legacy_response,
100 NanResponseMsgHeader* hidl_response);
101bool convertLegacyNanPublishResponseToHidl(
102 const legacy_hal::NanPublishResponse& legacy_response,
103 NanPublishResponse* hidl_response);
104bool convertLegacyNanSubscribeResponseToHidl(
105 const legacy_hal::NanSubscribeResponse& legacy_response,
106 NanSubscribeResponse* hidl_response);
107bool convertLegacyNanDataPathResponseToHidl(
108 const legacy_hal::NanDataPathRequestResponse& legacy_response,
109 NanDataPathResponse* hidl_response);
110bool convertLegacyNanCapabilitiesResponseToHidl(
111 const legacy_hal::NanCapabilities& legacy_response,
112 NanCapabilitiesResponse* hidl_response);
113bool convertLegacyNanPublishTerminatedIndToHidl(
114 const legacy_hal::NanPublishTerminatedInd& legacy_ind,
115 NanPublishTerminatedInd* hidl_ind);
116bool convertLegacyNanMatchIndToHidl(const legacy_hal::NanMatchInd& legacy_ind,
117 NanMatchInd* hidl_ind);
118bool convertLegacyNanMatchExpiredIndToHidl(
119 const legacy_hal::NanMatchExpiredInd& legacy_ind,
120 NanMatchExpiredInd* hidl_ind);
121bool convertLegacyNanSubscribeTerminatedIndToHidl(
122 const legacy_hal::NanSubscribeTerminatedInd& legacy_ind,
123 NanSubscribeTerminatedInd* hidl_ind);
124bool convertLegacyNanFollowupIndToHidl(
125 const legacy_hal::NanFollowupInd& legacy_ind, NanFollowupInd* hidl_ind);
126bool convertLegacyNanDiscEngEventIndToHidl(
127 const legacy_hal::NanDiscEngEventInd& legacy_ind,
128 NanDiscEngEventInd* hidl_ind);
129bool convertLegacyNanDisabledIndToHidl(
130 const legacy_hal::NanDisabledInd& legacy_ind, NanDisabledInd* hidl_ind);
131bool convertLegacyNanBeaconSdfPayloadIndToHidl(
132 const legacy_hal::NanBeaconSdfPayloadInd& legacy_ind,
133 NanBeaconSdfPayloadInd* hidl_ind);
134bool convertLegacyNanDataPathRequestIndToHidl(
135 const legacy_hal::NanDataPathRequestInd& legacy_ind,
136 NanDataPathRequestInd* hidl_ind);
137bool convertLegacyNanDataPathConfirmIndToHidl(
138 const legacy_hal::NanDataPathConfirmInd& legacy_ind,
139 NanDataPathConfirmInd* hidl_ind);
140bool convertLegacyNanDataPathEndIndToHidl(
141 const legacy_hal::NanDataPathEndInd& legacy_ind,
142 NanDataPathEndInd* hidl_ind);
143bool convertLegacyNanTransmitFollowupIndToHidl(
144 const legacy_hal::NanTransmitFollowupInd& legacy_ind,
145 NanTransmitFollowupInd* hidl_ind);
Roshan Pius3fae9c82016-12-02 14:49:41 -0800146
147// RTT controller conversion methods.
148bool convertHidlRttConfigToLegacy(const RttConfig& hidl_config,
149 legacy_hal::wifi_rtt_config* legacy_config);
150bool convertHidlRttChannelMapToLegacy(const RttChannelMap& hidl_map,
151 legacy_hal::wifi_channel_map* legacy_map);
152bool convertHidlRttLciInformationToLegacy(
153 const RttLciInformation& hidl_info,
154 legacy_hal::wifi_lci_information* legacy_info);
155bool convertHidlRttLcrInformationToLegacy(
156 const RttLcrInformation& hidl_info,
157 legacy_hal::wifi_lcr_information* legacy_info);
158bool convertHidlRttResponderToLegacy(
159 const RttResponder& hidl_responder,
160 legacy_hal::wifi_rtt_responder* legacy_responder);
161bool convertLegacyRttResponderToHidl(
162 const legacy_hal::wifi_rtt_responder& legacy_responder,
163 RttResponder* hidl_responder);
164bool convertLegacyRttCapabilitiesToHidl(
165 const legacy_hal::wifi_rtt_capabilities& legacy_capabilities,
166 RttCapabilities* hidl_capabilities);
167bool convertLegacyRttResultToHidl(
168 const legacy_hal::wifi_rtt_result& legacy_result, RttResult* hidl_result);
Roshan Piuse65edb12016-11-22 13:02:01 -0800169} // namespace hidl_struct_util
170} // namespace implementation
171} // namespace V1_0
172} // namespace wifi
173} // namespace hardware
174} // namespace android
175
176#endif // HIDL_STRUCT_UTIL_H_