blob: ed096f7e80fd6579bd39230b3ad015a6e4c254af [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);
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);
Roshan Pius32d0ca92016-12-02 11:21:19 -080062bool convertLegacyDebugTxPacketFateToHidl(
63 const legacy_hal::wifi_tx_report& legacy_fate,
64 WifiDebugTxPacketFateReport* hidl_fate);
65bool convertLegacyDebugRxPacketFateToHidl(
66 const legacy_hal::wifi_rx_report& legacy_fate,
67 WifiDebugRxPacketFateReport* hidl_fate);
Roshan Piusf5f51fd2016-12-01 13:54:24 -080068
69// NAN iface conversion methods.
70bool convertHidlNanEnableRequestToLegacy(
71 const NanEnableRequest& hidl_request,
72 legacy_hal::NanEnableRequest* legacy_request);
73bool convertHidlNanPublishRequestToLegacy(
74 const NanPublishRequest& hidl_request,
75 legacy_hal::NanPublishRequest* legacy_request);
76bool convertHidlNanPublishCancelRequestToLegacy(
77 const NanPublishCancelRequest& hidl_request,
78 legacy_hal::NanPublishCancelRequest* legacy_request);
79bool convertHidlNanSubscribeRequestToLegacy(
80 const NanSubscribeRequest& hidl_request,
81 legacy_hal::NanSubscribeRequest* legacy_request);
82bool convertHidlNanSubscribeCancelRequestToLegacy(
83 const NanSubscribeCancelRequest& hidl_request,
84 legacy_hal::NanSubscribeCancelRequest* legacy_request);
85bool convertHidlNanTransmitFollowupRequestToLegacy(
86 const NanTransmitFollowupRequest& hidl_request,
87 legacy_hal::NanTransmitFollowupRequest* legacy_request);
88bool convertHidlNanConfigRequestToLegacy(
89 const NanConfigRequest& hidl_request,
90 legacy_hal::NanConfigRequest* legacy_request);
91bool convertHidlNanBeaconSdfPayloadRequestToLegacy(
92 const NanBeaconSdfPayloadRequest& hidl_request,
93 legacy_hal::NanBeaconSdfPayloadRequest* legacy_request);
94bool convertHidlNanDataPathInitiatorRequestToLegacy(
95 const NanDataPathInitiatorRequest& hidl_request,
96 legacy_hal::NanDataPathInitiatorRequest* legacy_request);
97bool convertHidlNanDataPathIndicationResponseToLegacy(
98 const NanDataPathIndicationResponse& hidl_response,
99 legacy_hal::NanDataPathIndicationResponse* legacy_response);
100bool convertHidlNanDataPathEndRequestToLegacy(
101 const NanDataPathEndRequest& hidl_request,
102 legacy_hal::NanDataPathEndRequest* legacy_request);
103bool convertLegacyNanResponseHeaderToHidl(
104 const legacy_hal::NanResponseMsg& legacy_response,
105 NanResponseMsgHeader* hidl_response);
106bool convertLegacyNanPublishResponseToHidl(
107 const legacy_hal::NanPublishResponse& legacy_response,
108 NanPublishResponse* hidl_response);
109bool convertLegacyNanSubscribeResponseToHidl(
110 const legacy_hal::NanSubscribeResponse& legacy_response,
111 NanSubscribeResponse* hidl_response);
112bool convertLegacyNanDataPathResponseToHidl(
113 const legacy_hal::NanDataPathRequestResponse& legacy_response,
114 NanDataPathResponse* hidl_response);
115bool convertLegacyNanCapabilitiesResponseToHidl(
116 const legacy_hal::NanCapabilities& legacy_response,
117 NanCapabilitiesResponse* hidl_response);
118bool convertLegacyNanPublishTerminatedIndToHidl(
119 const legacy_hal::NanPublishTerminatedInd& legacy_ind,
120 NanPublishTerminatedInd* hidl_ind);
121bool convertLegacyNanMatchIndToHidl(const legacy_hal::NanMatchInd& legacy_ind,
122 NanMatchInd* hidl_ind);
123bool convertLegacyNanMatchExpiredIndToHidl(
124 const legacy_hal::NanMatchExpiredInd& legacy_ind,
125 NanMatchExpiredInd* hidl_ind);
126bool convertLegacyNanSubscribeTerminatedIndToHidl(
127 const legacy_hal::NanSubscribeTerminatedInd& legacy_ind,
128 NanSubscribeTerminatedInd* hidl_ind);
129bool convertLegacyNanFollowupIndToHidl(
130 const legacy_hal::NanFollowupInd& legacy_ind, NanFollowupInd* hidl_ind);
131bool convertLegacyNanDiscEngEventIndToHidl(
132 const legacy_hal::NanDiscEngEventInd& legacy_ind,
133 NanDiscEngEventInd* hidl_ind);
134bool convertLegacyNanDisabledIndToHidl(
135 const legacy_hal::NanDisabledInd& legacy_ind, NanDisabledInd* hidl_ind);
136bool convertLegacyNanBeaconSdfPayloadIndToHidl(
137 const legacy_hal::NanBeaconSdfPayloadInd& legacy_ind,
138 NanBeaconSdfPayloadInd* hidl_ind);
139bool convertLegacyNanDataPathRequestIndToHidl(
140 const legacy_hal::NanDataPathRequestInd& legacy_ind,
141 NanDataPathRequestInd* hidl_ind);
142bool convertLegacyNanDataPathConfirmIndToHidl(
143 const legacy_hal::NanDataPathConfirmInd& legacy_ind,
144 NanDataPathConfirmInd* hidl_ind);
145bool convertLegacyNanDataPathEndIndToHidl(
146 const legacy_hal::NanDataPathEndInd& legacy_ind,
147 NanDataPathEndInd* hidl_ind);
148bool convertLegacyNanTransmitFollowupIndToHidl(
149 const legacy_hal::NanTransmitFollowupInd& legacy_ind,
150 NanTransmitFollowupInd* hidl_ind);
Roshan Piuse65edb12016-11-22 13:02:01 -0800151} // namespace hidl_struct_util
152} // namespace implementation
153} // namespace V1_0
154} // namespace wifi
155} // namespace hardware
156} // namespace android
157
158#endif // HIDL_STRUCT_UTIL_H_