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