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