Roshan Pius | aabe575 | 2016-09-29 09:03:59 -0700 | [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 | |
Roshan Pius | e73a506 | 2016-12-12 08:53:34 -0800 | [diff] [blame] | 17 | #ifndef WIFI_LEGACY_HAL_H_ |
| 18 | #define WIFI_LEGACY_HAL_H_ |
Roshan Pius | aabe575 | 2016-09-29 09:03:59 -0700 | [diff] [blame] | 19 | |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 20 | #include <condition_variable> |
Roshan Pius | aabe575 | 2016-09-29 09:03:59 -0700 | [diff] [blame] | 21 | #include <functional> |
Roshan Pius | acededb | 2017-10-06 14:59:26 -0700 | [diff] [blame] | 22 | #include <map> |
Roshan Pius | aabe575 | 2016-09-29 09:03:59 -0700 | [diff] [blame] | 23 | #include <thread> |
Roshan Pius | 734fea0 | 2016-10-11 08:30:28 -0700 | [diff] [blame] | 24 | #include <vector> |
Roshan Pius | aabe575 | 2016-09-29 09:03:59 -0700 | [diff] [blame] | 25 | |
Peter Collingbourne | 78471d9 | 2020-12-30 17:12:41 -0800 | [diff] [blame] | 26 | #include <hardware_legacy/wifi_hal.h> |
Roshan Pius | 9733411 | 2016-11-18 14:07:54 -0800 | [diff] [blame] | 27 | #include <wifi_system/interface_tool.h> |
| 28 | |
Roshan Pius | aabe575 | 2016-09-29 09:03:59 -0700 | [diff] [blame] | 29 | namespace android { |
| 30 | namespace hardware { |
| 31 | namespace wifi { |
Ahmed ElArabawy | 687ce13 | 2022-01-11 16:42:48 -0800 | [diff] [blame] | 32 | namespace V1_6 { |
Roshan Pius | aabe575 | 2016-09-29 09:03:59 -0700 | [diff] [blame] | 33 | namespace implementation { |
Roshan Pius | 955542e | 2016-10-28 09:42:44 -0700 | [diff] [blame] | 34 | // This is in a separate namespace to prevent typename conflicts between |
| 35 | // the legacy HAL types and the HIDL interface types. |
| 36 | namespace legacy_hal { |
Peter Collingbourne | 78471d9 | 2020-12-30 17:12:41 -0800 | [diff] [blame] | 37 | // Import all the types defined inside the legacy HAL header files into this |
Roshan Pius | 955542e | 2016-10-28 09:42:44 -0700 | [diff] [blame] | 38 | // namespace. |
Kumar Anand | 2a630a3 | 2021-01-21 14:09:14 -0800 | [diff] [blame] | 39 | using ::frame_info; |
| 40 | using ::frame_type; |
Peter Collingbourne | 78471d9 | 2020-12-30 17:12:41 -0800 | [diff] [blame] | 41 | using ::FRAME_TYPE_80211_MGMT; |
| 42 | using ::FRAME_TYPE_ETHERNET_II; |
| 43 | using ::FRAME_TYPE_UNKNOWN; |
Kumar Anand | 2a630a3 | 2021-01-21 14:09:14 -0800 | [diff] [blame] | 44 | using ::fw_roaming_state_t; |
| 45 | using ::mac_addr; |
Peter Collingbourne | 78471d9 | 2020-12-30 17:12:41 -0800 | [diff] [blame] | 46 | using ::NAN_CHANNEL_24G_BAND; |
| 47 | using ::NAN_CHANNEL_5G_BAND_HIGH; |
| 48 | using ::NAN_CHANNEL_5G_BAND_LOW; |
| 49 | using ::NAN_DISABLE_RANGE_REPORT; |
| 50 | using ::NAN_DO_NOT_USE_SRF; |
| 51 | using ::NAN_DP_CHANNEL_NOT_REQUESTED; |
| 52 | using ::NAN_DP_CONFIG_NO_SECURITY; |
| 53 | using ::NAN_DP_CONFIG_SECURITY; |
| 54 | using ::NAN_DP_END; |
| 55 | using ::NAN_DP_FORCE_CHANNEL_SETUP; |
| 56 | using ::NAN_DP_INITIATOR_RESPONSE; |
| 57 | using ::NAN_DP_INTERFACE_CREATE; |
| 58 | using ::NAN_DP_INTERFACE_DELETE; |
| 59 | using ::NAN_DP_REQUEST_ACCEPT; |
| 60 | using ::NAN_DP_REQUEST_CHANNEL_SETUP; |
| 61 | using ::NAN_DP_REQUEST_REJECT; |
| 62 | using ::NAN_DP_RESPONDER_RESPONSE; |
| 63 | using ::NAN_GET_CAPABILITIES; |
| 64 | using ::NAN_MATCH_ALG_MATCH_CONTINUOUS; |
| 65 | using ::NAN_MATCH_ALG_MATCH_NEVER; |
| 66 | using ::NAN_MATCH_ALG_MATCH_ONCE; |
| 67 | using ::NAN_PUBLISH_TYPE_SOLICITED; |
| 68 | using ::NAN_PUBLISH_TYPE_UNSOLICITED; |
| 69 | using ::NAN_PUBLISH_TYPE_UNSOLICITED_SOLICITED; |
| 70 | using ::NAN_RANGING_AUTO_RESPONSE_DISABLE; |
| 71 | using ::NAN_RANGING_AUTO_RESPONSE_ENABLE; |
| 72 | using ::NAN_RANGING_DISABLE; |
| 73 | using ::NAN_RANGING_ENABLE; |
| 74 | using ::NAN_RESPONSE_BEACON_SDF_PAYLOAD; |
| 75 | using ::NAN_RESPONSE_CONFIG; |
| 76 | using ::NAN_RESPONSE_DISABLED; |
| 77 | using ::NAN_RESPONSE_ENABLED; |
| 78 | using ::NAN_RESPONSE_ERROR; |
| 79 | using ::NAN_RESPONSE_PUBLISH; |
| 80 | using ::NAN_RESPONSE_PUBLISH_CANCEL; |
| 81 | using ::NAN_RESPONSE_STATS; |
| 82 | using ::NAN_RESPONSE_SUBSCRIBE; |
| 83 | using ::NAN_RESPONSE_SUBSCRIBE_CANCEL; |
| 84 | using ::NAN_RESPONSE_TCA; |
| 85 | using ::NAN_RESPONSE_TRANSMIT_FOLLOWUP; |
| 86 | using ::NAN_SECURITY_KEY_INPUT_PASSPHRASE; |
Peter Collingbourne | 78471d9 | 2020-12-30 17:12:41 -0800 | [diff] [blame] | 87 | using ::NAN_SECURITY_KEY_INPUT_PMK; |
| 88 | using ::NAN_SERVICE_ACCEPT_POLICY_ALL; |
| 89 | using ::NAN_SERVICE_ACCEPT_POLICY_NONE; |
| 90 | using ::NAN_SRF_ATTR_BLOOM_FILTER; |
| 91 | using ::NAN_SRF_ATTR_PARTIAL_MAC_ADDR; |
| 92 | using ::NAN_SRF_INCLUDE_DO_NOT_RESPOND; |
| 93 | using ::NAN_SRF_INCLUDE_RESPOND; |
| 94 | using ::NAN_SSI_NOT_REQUIRED_IN_MATCH_IND; |
| 95 | using ::NAN_SSI_REQUIRED_IN_MATCH_IND; |
| 96 | using ::NAN_STATUS_ALREADY_ENABLED; |
| 97 | using ::NAN_STATUS_FOLLOWUP_QUEUE_FULL; |
| 98 | using ::NAN_STATUS_INTERNAL_FAILURE; |
| 99 | using ::NAN_STATUS_INVALID_NDP_ID; |
| 100 | using ::NAN_STATUS_INVALID_PARAM; |
| 101 | using ::NAN_STATUS_INVALID_PUBLISH_SUBSCRIBE_ID; |
| 102 | using ::NAN_STATUS_INVALID_REQUESTOR_INSTANCE_ID; |
| 103 | using ::NAN_STATUS_NAN_NOT_ALLOWED; |
| 104 | using ::NAN_STATUS_NO_OTA_ACK; |
| 105 | using ::NAN_STATUS_NO_RESOURCE_AVAILABLE; |
| 106 | using ::NAN_STATUS_PROTOCOL_FAILURE; |
| 107 | using ::NAN_STATUS_SUCCESS; |
| 108 | using ::NAN_STATUS_UNSUPPORTED_CONCURRENCY_NAN_DISABLED; |
| 109 | using ::NAN_SUBSCRIBE_TYPE_ACTIVE; |
| 110 | using ::NAN_SUBSCRIBE_TYPE_PASSIVE; |
| 111 | using ::NAN_TRANSMIT_IN_DW; |
| 112 | using ::NAN_TRANSMIT_IN_FAW; |
| 113 | using ::NAN_TX_PRIORITY_HIGH; |
| 114 | using ::NAN_TX_PRIORITY_NORMAL; |
| 115 | using ::NAN_TX_TYPE_BROADCAST; |
| 116 | using ::NAN_TX_TYPE_UNICAST; |
| 117 | using ::NAN_USE_SRF; |
| 118 | using ::NanBeaconSdfPayloadInd; |
| 119 | using ::NanCapabilities; |
| 120 | using ::NanChannelInfo; |
| 121 | using ::NanConfigRequest; |
| 122 | using ::NanDataPathChannelCfg; |
| 123 | using ::NanDataPathConfirmInd; |
| 124 | using ::NanDataPathEndInd; |
| 125 | using ::NanDataPathIndicationResponse; |
| 126 | using ::NanDataPathInitiatorRequest; |
| 127 | using ::NanDataPathRequestInd; |
| 128 | using ::NanDataPathScheduleUpdateInd; |
| 129 | using ::NanDisabledInd; |
| 130 | using ::NanDiscEngEventInd; |
| 131 | using ::NanEnableRequest; |
| 132 | using ::NanFollowupInd; |
| 133 | using ::NanMatchAlg; |
| 134 | using ::NanMatchExpiredInd; |
| 135 | using ::NanMatchInd; |
| 136 | using ::NanPublishCancelRequest; |
| 137 | using ::NanPublishRequest; |
| 138 | using ::NanPublishTerminatedInd; |
| 139 | using ::NanPublishType; |
| 140 | using ::NanRangeReportInd; |
| 141 | using ::NanRangeRequestInd; |
| 142 | using ::NanResponseMsg; |
| 143 | using ::NanSRFType; |
| 144 | using ::NanStatusType; |
| 145 | using ::NanSubscribeCancelRequest; |
| 146 | using ::NanSubscribeRequest; |
| 147 | using ::NanSubscribeTerminatedInd; |
| 148 | using ::NanSubscribeType; |
| 149 | using ::NanTransmitFollowupInd; |
| 150 | using ::NanTransmitFollowupRequest; |
| 151 | using ::NanTxType; |
| 152 | using ::ROAMING_DISABLE; |
| 153 | using ::ROAMING_ENABLE; |
| 154 | using ::RTT_PEER_AP; |
| 155 | using ::RTT_PEER_NAN; |
| 156 | using ::RTT_PEER_P2P_CLIENT; |
| 157 | using ::RTT_PEER_P2P_GO; |
| 158 | using ::RTT_PEER_STA; |
Kumar Anand | 2a630a3 | 2021-01-21 14:09:14 -0800 | [diff] [blame] | 159 | using ::rtt_peer_type; |
Peter Collingbourne | 78471d9 | 2020-12-30 17:12:41 -0800 | [diff] [blame] | 160 | using ::RTT_STATUS_ABORTED; |
Peter Collingbourne | 78471d9 | 2020-12-30 17:12:41 -0800 | [diff] [blame] | 161 | using ::RTT_STATUS_FAIL_AP_ON_DIFF_CHANNEL; |
| 162 | using ::RTT_STATUS_FAIL_BUSY_TRY_LATER; |
| 163 | using ::RTT_STATUS_FAIL_FTM_PARAM_OVERRIDE; |
| 164 | using ::RTT_STATUS_FAIL_INVALID_TS; |
Peter Collingbourne | 78471d9 | 2020-12-30 17:12:41 -0800 | [diff] [blame] | 165 | using ::RTT_STATUS_FAIL_NO_CAPABILITY; |
| 166 | using ::RTT_STATUS_FAIL_NO_RSP; |
Kumar Anand | 2a630a3 | 2021-01-21 14:09:14 -0800 | [diff] [blame] | 167 | using ::RTT_STATUS_FAIL_NOT_SCHEDULED_YET; |
Peter Collingbourne | 78471d9 | 2020-12-30 17:12:41 -0800 | [diff] [blame] | 168 | using ::RTT_STATUS_FAIL_PROTOCOL; |
| 169 | using ::RTT_STATUS_FAIL_REJECTED; |
| 170 | using ::RTT_STATUS_FAIL_SCHEDULE; |
| 171 | using ::RTT_STATUS_FAIL_TM_TIMEOUT; |
Kumar Anand | 2a630a3 | 2021-01-21 14:09:14 -0800 | [diff] [blame] | 172 | using ::RTT_STATUS_FAILURE; |
Peter Collingbourne | 78471d9 | 2020-12-30 17:12:41 -0800 | [diff] [blame] | 173 | using ::RTT_STATUS_INVALID_REQ; |
| 174 | using ::RTT_STATUS_NAN_RANGING_CONCURRENCY_NOT_SUPPORTED; |
| 175 | using ::RTT_STATUS_NAN_RANGING_PROTOCOL_FAILURE; |
| 176 | using ::RTT_STATUS_NO_WIFI; |
| 177 | using ::RTT_STATUS_SUCCESS; |
| 178 | using ::RTT_TYPE_1_SIDED; |
| 179 | using ::RTT_TYPE_2_SIDED; |
| 180 | using ::RX_PKT_FATE_DRV_DROP_FILTER; |
| 181 | using ::RX_PKT_FATE_DRV_DROP_INVALID; |
| 182 | using ::RX_PKT_FATE_DRV_DROP_NOBUFS; |
| 183 | using ::RX_PKT_FATE_DRV_DROP_OTHER; |
| 184 | using ::RX_PKT_FATE_DRV_QUEUED; |
| 185 | using ::RX_PKT_FATE_FW_DROP_FILTER; |
| 186 | using ::RX_PKT_FATE_FW_DROP_INVALID; |
| 187 | using ::RX_PKT_FATE_FW_DROP_NOBUFS; |
| 188 | using ::RX_PKT_FATE_FW_DROP_OTHER; |
| 189 | using ::RX_PKT_FATE_FW_QUEUED; |
| 190 | using ::RX_PKT_FATE_SUCCESS; |
Kumar Anand | 2a630a3 | 2021-01-21 14:09:14 -0800 | [diff] [blame] | 191 | using ::ssid_t; |
| 192 | using ::transaction_id; |
Peter Collingbourne | 78471d9 | 2020-12-30 17:12:41 -0800 | [diff] [blame] | 193 | using ::TX_PKT_FATE_ACKED; |
| 194 | using ::TX_PKT_FATE_DRV_DROP_INVALID; |
| 195 | using ::TX_PKT_FATE_DRV_DROP_NOBUFS; |
| 196 | using ::TX_PKT_FATE_DRV_DROP_OTHER; |
| 197 | using ::TX_PKT_FATE_DRV_QUEUED; |
| 198 | using ::TX_PKT_FATE_FW_DROP_INVALID; |
| 199 | using ::TX_PKT_FATE_FW_DROP_NOBUFS; |
| 200 | using ::TX_PKT_FATE_FW_DROP_OTHER; |
| 201 | using ::TX_PKT_FATE_FW_QUEUED; |
| 202 | using ::TX_PKT_FATE_SENT; |
| 203 | using ::WIFI_AC_BE; |
| 204 | using ::WIFI_AC_BK; |
| 205 | using ::WIFI_AC_VI; |
| 206 | using ::WIFI_AC_VO; |
Kumar Anand | 2a630a3 | 2021-01-21 14:09:14 -0800 | [diff] [blame] | 207 | using ::wifi_band; |
Peter Collingbourne | 78471d9 | 2020-12-30 17:12:41 -0800 | [diff] [blame] | 208 | using ::WIFI_BAND_A; |
Peter Collingbourne | 78471d9 | 2020-12-30 17:12:41 -0800 | [diff] [blame] | 209 | using ::WIFI_BAND_A_DFS; |
| 210 | using ::WIFI_BAND_A_WITH_DFS; |
Kumar Anand | 2a630a3 | 2021-01-21 14:09:14 -0800 | [diff] [blame] | 211 | using ::WIFI_BAND_ABG; |
| 212 | using ::WIFI_BAND_ABG_WITH_DFS; |
Peter Collingbourne | 78471d9 | 2020-12-30 17:12:41 -0800 | [diff] [blame] | 213 | using ::WIFI_BAND_BG; |
| 214 | using ::WIFI_BAND_UNSPECIFIED; |
Kumar Anand | 2a630a3 | 2021-01-21 14:09:14 -0800 | [diff] [blame] | 215 | using ::wifi_cached_scan_results; |
Peter Collingbourne | 78471d9 | 2020-12-30 17:12:41 -0800 | [diff] [blame] | 216 | using ::WIFI_CHAN_WIDTH_10; |
| 217 | using ::WIFI_CHAN_WIDTH_160; |
| 218 | using ::WIFI_CHAN_WIDTH_20; |
| 219 | using ::WIFI_CHAN_WIDTH_40; |
| 220 | using ::WIFI_CHAN_WIDTH_5; |
Peter Collingbourne | 78471d9 | 2020-12-30 17:12:41 -0800 | [diff] [blame] | 221 | using ::WIFI_CHAN_WIDTH_80; |
| 222 | using ::WIFI_CHAN_WIDTH_80P80; |
| 223 | using ::WIFI_CHAN_WIDTH_INVALID; |
Kumar Anand | 2a630a3 | 2021-01-21 14:09:14 -0800 | [diff] [blame] | 224 | using ::wifi_channel_info; |
| 225 | using ::wifi_channel_stat; |
| 226 | using ::wifi_channel_width; |
| 227 | using ::wifi_coex_restriction; |
| 228 | using ::wifi_coex_unsafe_channel; |
Peter Collingbourne | 78471d9 | 2020-12-30 17:12:41 -0800 | [diff] [blame] | 229 | using ::WIFI_DUAL_STA_NON_TRANSIENT_UNBIASED; |
| 230 | using ::WIFI_DUAL_STA_TRANSIENT_PREFER_PRIMARY; |
Kumar Anand | 2a630a3 | 2021-01-21 14:09:14 -0800 | [diff] [blame] | 231 | using ::wifi_error; |
Peter Collingbourne | 78471d9 | 2020-12-30 17:12:41 -0800 | [diff] [blame] | 232 | using ::WIFI_ERROR_BUSY; |
| 233 | using ::WIFI_ERROR_INVALID_ARGS; |
| 234 | using ::WIFI_ERROR_INVALID_REQUEST_ID; |
| 235 | using ::WIFI_ERROR_NONE; |
| 236 | using ::WIFI_ERROR_NOT_AVAILABLE; |
| 237 | using ::WIFI_ERROR_NOT_SUPPORTED; |
| 238 | using ::WIFI_ERROR_OUT_OF_MEMORY; |
| 239 | using ::WIFI_ERROR_TIMED_OUT; |
| 240 | using ::WIFI_ERROR_TOO_MANY_REQUESTS; |
| 241 | using ::WIFI_ERROR_UNINITIALIZED; |
| 242 | using ::WIFI_ERROR_UNKNOWN; |
Kumar Anand | 2a630a3 | 2021-01-21 14:09:14 -0800 | [diff] [blame] | 243 | using ::wifi_gscan_capabilities; |
| 244 | using ::wifi_hal_fn; |
| 245 | using ::wifi_information_element; |
| 246 | using ::WIFI_INTERFACE_IBSS; |
| 247 | using ::WIFI_INTERFACE_MESH; |
| 248 | using ::wifi_interface_mode; |
| 249 | using ::WIFI_INTERFACE_NAN; |
| 250 | using ::WIFI_INTERFACE_P2P_CLIENT; |
| 251 | using ::WIFI_INTERFACE_P2P_GO; |
| 252 | using ::WIFI_INTERFACE_SOFTAP; |
| 253 | using ::WIFI_INTERFACE_STA; |
| 254 | using ::WIFI_INTERFACE_TDLS; |
| 255 | using ::wifi_interface_type; |
Peter Collingbourne | 78471d9 | 2020-12-30 17:12:41 -0800 | [diff] [blame] | 256 | using ::WIFI_INTERFACE_TYPE_AP; |
| 257 | using ::WIFI_INTERFACE_TYPE_NAN; |
| 258 | using ::WIFI_INTERFACE_TYPE_P2P; |
| 259 | using ::WIFI_INTERFACE_TYPE_STA; |
Kumar Anand | 2a630a3 | 2021-01-21 14:09:14 -0800 | [diff] [blame] | 260 | using ::WIFI_INTERFACE_UNKNOWN; |
| 261 | using ::wifi_latency_mode; |
Peter Collingbourne | 78471d9 | 2020-12-30 17:12:41 -0800 | [diff] [blame] | 262 | using ::WIFI_LATENCY_MODE_LOW; |
| 263 | using ::WIFI_LATENCY_MODE_NORMAL; |
Kumar Anand | 2a630a3 | 2021-01-21 14:09:14 -0800 | [diff] [blame] | 264 | using ::wifi_lci_information; |
| 265 | using ::wifi_lcr_information; |
Peter Collingbourne | 78471d9 | 2020-12-30 17:12:41 -0800 | [diff] [blame] | 266 | using ::WIFI_LOGGER_CONNECT_EVENT_SUPPORTED; |
| 267 | using ::WIFI_LOGGER_DRIVER_DUMP_SUPPORTED; |
| 268 | using ::WIFI_LOGGER_MEMORY_DUMP_SUPPORTED; |
| 269 | using ::WIFI_LOGGER_PACKET_FATE_SUPPORTED; |
| 270 | using ::WIFI_LOGGER_POWER_EVENT_SUPPORTED; |
| 271 | using ::WIFI_LOGGER_WAKE_LOCK_SUPPORTED; |
| 272 | using ::WIFI_MOTION_EXPECTED; |
| 273 | using ::WIFI_MOTION_NOT_EXPECTED; |
Kumar Anand | 2a630a3 | 2021-01-21 14:09:14 -0800 | [diff] [blame] | 274 | using ::wifi_motion_pattern; |
Peter Collingbourne | 78471d9 | 2020-12-30 17:12:41 -0800 | [diff] [blame] | 275 | using ::WIFI_MOTION_UNKNOWN; |
Kumar Anand | 2a630a3 | 2021-01-21 14:09:14 -0800 | [diff] [blame] | 276 | using ::wifi_multi_sta_use_case; |
| 277 | using ::wifi_power_scenario; |
Peter Collingbourne | 78471d9 | 2020-12-30 17:12:41 -0800 | [diff] [blame] | 278 | using ::WIFI_POWER_SCENARIO_ON_BODY_CELL_OFF; |
| 279 | using ::WIFI_POWER_SCENARIO_ON_BODY_CELL_ON; |
| 280 | using ::WIFI_POWER_SCENARIO_ON_HEAD_CELL_OFF; |
| 281 | using ::WIFI_POWER_SCENARIO_ON_HEAD_CELL_ON; |
| 282 | using ::WIFI_POWER_SCENARIO_VOICE_CALL; |
Peter Collingbourne | 78471d9 | 2020-12-30 17:12:41 -0800 | [diff] [blame] | 283 | using ::wifi_rate; |
| 284 | using ::wifi_request_id; |
| 285 | using ::wifi_ring_buffer_status; |
| 286 | using ::wifi_roaming_capabilities; |
| 287 | using ::wifi_roaming_config; |
| 288 | using ::wifi_rtt_bw; |
Kumar Anand | 2a630a3 | 2021-01-21 14:09:14 -0800 | [diff] [blame] | 289 | using ::WIFI_RTT_BW_10; |
| 290 | using ::WIFI_RTT_BW_160; |
| 291 | using ::WIFI_RTT_BW_20; |
| 292 | using ::WIFI_RTT_BW_40; |
| 293 | using ::WIFI_RTT_BW_5; |
| 294 | using ::WIFI_RTT_BW_80; |
Peter Collingbourne | 78471d9 | 2020-12-30 17:12:41 -0800 | [diff] [blame] | 295 | using ::wifi_rtt_capabilities; |
| 296 | using ::wifi_rtt_config; |
| 297 | using ::wifi_rtt_preamble; |
Kumar Anand | 2a630a3 | 2021-01-21 14:09:14 -0800 | [diff] [blame] | 298 | using ::WIFI_RTT_PREAMBLE_HE; |
| 299 | using ::WIFI_RTT_PREAMBLE_HT; |
| 300 | using ::WIFI_RTT_PREAMBLE_LEGACY; |
| 301 | using ::WIFI_RTT_PREAMBLE_VHT; |
Peter Collingbourne | 78471d9 | 2020-12-30 17:12:41 -0800 | [diff] [blame] | 302 | using ::wifi_rtt_responder; |
| 303 | using ::wifi_rtt_result; |
| 304 | using ::wifi_rtt_status; |
| 305 | using ::wifi_rtt_type; |
| 306 | using ::wifi_rx_packet_fate; |
| 307 | using ::wifi_rx_report; |
| 308 | using ::wifi_scan_bucket_spec; |
| 309 | using ::wifi_scan_cmd_params; |
Kumar Anand | 2a630a3 | 2021-01-21 14:09:14 -0800 | [diff] [blame] | 310 | using ::WIFI_SCAN_FLAG_INTERRUPTED; |
Peter Collingbourne | 78471d9 | 2020-12-30 17:12:41 -0800 | [diff] [blame] | 311 | using ::wifi_scan_result; |
Kumar Anand | 2a630a3 | 2021-01-21 14:09:14 -0800 | [diff] [blame] | 312 | using ::WIFI_SUCCESS; |
Peter Collingbourne | 78471d9 | 2020-12-30 17:12:41 -0800 | [diff] [blame] | 313 | using ::wifi_tx_packet_fate; |
| 314 | using ::wifi_tx_report; |
Kumar Anand | 2a630a3 | 2021-01-21 14:09:14 -0800 | [diff] [blame] | 315 | using ::wifi_usable_channel; |
Kumar Anand | aea86e0 | 2021-02-10 16:22:31 -0800 | [diff] [blame] | 316 | using ::WIFI_USABLE_CHANNEL_FILTER_CELLULAR_COEXISTENCE; |
| 317 | using ::WIFI_USABLE_CHANNEL_FILTER_CONCURRENCY; |
Kumar Anand | 2a630a3 | 2021-01-21 14:09:14 -0800 | [diff] [blame] | 318 | using ::WLAN_MAC_2_4_BAND; |
| 319 | using ::WLAN_MAC_5_0_BAND; |
| 320 | using ::WLAN_MAC_60_0_BAND; |
| 321 | using ::WLAN_MAC_6_0_BAND; |
Roshan Pius | aabe575 | 2016-09-29 09:03:59 -0700 | [diff] [blame] | 322 | |
Roshan Pius | 0a47c18 | 2016-10-28 10:23:00 -0700 | [diff] [blame] | 323 | // APF capabilities supported by the iface. |
| 324 | struct PacketFilterCapabilities { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 325 | uint32_t version; |
| 326 | uint32_t max_len; |
Roshan Pius | 0a47c18 | 2016-10-28 10:23:00 -0700 | [diff] [blame] | 327 | }; |
| 328 | |
Roshan Pius | 7cece41 | 2016-10-28 10:38:21 -0700 | [diff] [blame] | 329 | // WARNING: We don't care about the variable sized members of either |
| 330 | // |wifi_iface_stat|, |wifi_radio_stat| structures. So, using the pragma |
| 331 | // to escape the compiler warnings regarding this. |
| 332 | #pragma GCC diagnostic push |
| 333 | #pragma GCC diagnostic ignored "-Wgnu-variable-sized-type-not-at-end" |
| 334 | // The |wifi_radio_stat.tx_time_per_levels| stats is provided as a pointer in |
| 335 | // |wifi_radio_stat| structure in the legacy HAL API. Separate that out |
| 336 | // into a separate return element to avoid passing pointers around. |
Roshan Pius | e42ace2 | 2017-03-13 10:44:20 -0700 | [diff] [blame] | 337 | struct LinkLayerRadioStats { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 338 | wifi_radio_stat stats; |
| 339 | std::vector<uint32_t> tx_time_per_levels; |
Sunil Ravi | b0343e7 | 2018-11-13 15:52:00 -0800 | [diff] [blame] | 340 | std::vector<wifi_channel_stat> channel_stats; |
Roshan Pius | e42ace2 | 2017-03-13 10:44:20 -0700 | [diff] [blame] | 341 | }; |
| 342 | |
Mingguang Xu | 41242be | 2021-02-19 18:16:01 -0800 | [diff] [blame] | 343 | struct WifiPeerInfo { |
| 344 | wifi_peer_info peer_info; |
| 345 | std::vector<wifi_rate_stat> rate_stats; |
| 346 | }; |
| 347 | |
Roshan Pius | 7cece41 | 2016-10-28 10:38:21 -0700 | [diff] [blame] | 348 | struct LinkLayerStats { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 349 | wifi_iface_stat iface; |
| 350 | std::vector<LinkLayerRadioStats> radios; |
Mingguang Xu | 41242be | 2021-02-19 18:16:01 -0800 | [diff] [blame] | 351 | std::vector<WifiPeerInfo> peers; |
Roshan Pius | 7cece41 | 2016-10-28 10:38:21 -0700 | [diff] [blame] | 352 | }; |
| 353 | #pragma GCC diagnostic pop |
| 354 | |
Roshan Pius | 8714a3e | 2016-10-28 10:43:51 -0700 | [diff] [blame] | 355 | // The |WLAN_DRIVER_WAKE_REASON_CNT.cmd_event_wake_cnt| and |
| 356 | // |WLAN_DRIVER_WAKE_REASON_CNT.driver_fw_local_wake_cnt| stats is provided |
| 357 | // as a pointer in |WLAN_DRIVER_WAKE_REASON_CNT| structure in the legacy HAL |
| 358 | // API. Separate that out into a separate return elements to avoid passing |
| 359 | // pointers around. |
| 360 | struct WakeReasonStats { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 361 | WLAN_DRIVER_WAKE_REASON_CNT wake_reason_cnt; |
| 362 | std::vector<uint32_t> cmd_event_wake_cnt; |
| 363 | std::vector<uint32_t> driver_fw_local_wake_cnt; |
Roshan Pius | 8714a3e | 2016-10-28 10:43:51 -0700 | [diff] [blame] | 364 | }; |
| 365 | |
Roshan Pius | 2301209 | 2016-10-28 11:27:40 -0700 | [diff] [blame] | 366 | // NAN response and event callbacks struct. |
| 367 | struct NanCallbackHandlers { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 368 | // NotifyResponse invoked to notify the status of the Request. |
Ahmed ElArabawy | 687ce13 | 2022-01-11 16:42:48 -0800 | [diff] [blame] | 369 | std::function<void(transaction_id, const NanResponseMsg&)> on_notify_response; |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 370 | // Various event callbacks. |
Ahmed ElArabawy | 687ce13 | 2022-01-11 16:42:48 -0800 | [diff] [blame] | 371 | std::function<void(const NanPublishTerminatedInd&)> on_event_publish_terminated; |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 372 | std::function<void(const NanMatchInd&)> on_event_match; |
| 373 | std::function<void(const NanMatchExpiredInd&)> on_event_match_expired; |
Ahmed ElArabawy | 687ce13 | 2022-01-11 16:42:48 -0800 | [diff] [blame] | 374 | std::function<void(const NanSubscribeTerminatedInd&)> on_event_subscribe_terminated; |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 375 | std::function<void(const NanFollowupInd&)> on_event_followup; |
| 376 | std::function<void(const NanDiscEngEventInd&)> on_event_disc_eng_event; |
| 377 | std::function<void(const NanDisabledInd&)> on_event_disabled; |
| 378 | std::function<void(const NanTCAInd&)> on_event_tca; |
Ahmed ElArabawy | 687ce13 | 2022-01-11 16:42:48 -0800 | [diff] [blame] | 379 | std::function<void(const NanBeaconSdfPayloadInd&)> on_event_beacon_sdf_payload; |
| 380 | std::function<void(const NanDataPathRequestInd&)> on_event_data_path_request; |
| 381 | std::function<void(const NanDataPathConfirmInd&)> on_event_data_path_confirm; |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 382 | std::function<void(const NanDataPathEndInd&)> on_event_data_path_end; |
Ahmed ElArabawy | 687ce13 | 2022-01-11 16:42:48 -0800 | [diff] [blame] | 383 | std::function<void(const NanTransmitFollowupInd&)> on_event_transmit_follow_up; |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 384 | std::function<void(const NanRangeRequestInd&)> on_event_range_request; |
| 385 | std::function<void(const NanRangeReportInd&)> on_event_range_report; |
Ahmed ElArabawy | 687ce13 | 2022-01-11 16:42:48 -0800 | [diff] [blame] | 386 | std::function<void(const NanDataPathScheduleUpdateInd&)> on_event_schedule_update; |
Roshan Pius | 2301209 | 2016-10-28 11:27:40 -0700 | [diff] [blame] | 387 | }; |
| 388 | |
Roshan Pius | 76ff302 | 2016-10-28 10:33:34 -0700 | [diff] [blame] | 389 | // Full scan results contain IE info and are hence passed by reference, to |
| 390 | // preserve the variable length array member |ie_data|. Callee must not retain |
| 391 | // the pointer. |
| 392 | using on_gscan_full_result_callback = |
Ahmed ElArabawy | 687ce13 | 2022-01-11 16:42:48 -0800 | [diff] [blame] | 393 | std::function<void(wifi_request_id, const wifi_scan_result*, uint32_t)>; |
Roshan Pius | 76ff302 | 2016-10-28 10:33:34 -0700 | [diff] [blame] | 394 | // These scan results don't contain any IE info, so no need to pass by |
| 395 | // reference. |
Ahmed ElArabawy | 687ce13 | 2022-01-11 16:42:48 -0800 | [diff] [blame] | 396 | using on_gscan_results_callback = |
| 397 | std::function<void(wifi_request_id, const std::vector<wifi_cached_scan_results>&)>; |
Roshan Pius | 76ff302 | 2016-10-28 10:33:34 -0700 | [diff] [blame] | 398 | |
Roshan Pius | d476754 | 2016-12-06 10:04:05 -0800 | [diff] [blame] | 399 | // Invoked when the rssi value breaches the thresholds set. |
| 400 | using on_rssi_threshold_breached_callback = |
Ahmed ElArabawy | 687ce13 | 2022-01-11 16:42:48 -0800 | [diff] [blame] | 401 | std::function<void(wifi_request_id, std::array<uint8_t, 6>, int8_t)>; |
Roshan Pius | d476754 | 2016-12-06 10:04:05 -0800 | [diff] [blame] | 402 | |
Roshan Pius | d8e915a | 2016-10-28 11:23:11 -0700 | [diff] [blame] | 403 | // Callback for RTT range request results. |
| 404 | // Rtt results contain IE info and are hence passed by reference, to |
| 405 | // preserve the |LCI| and |LCR| pointers. Callee must not retain |
| 406 | // the pointer. |
Ahmed ElArabawy | 687ce13 | 2022-01-11 16:42:48 -0800 | [diff] [blame] | 407 | using on_rtt_results_callback = |
| 408 | std::function<void(wifi_request_id, const std::vector<const wifi_rtt_result*>&)>; |
Roshan Pius | d8e915a | 2016-10-28 11:23:11 -0700 | [diff] [blame] | 409 | |
Roshan Pius | 8714a3e | 2016-10-28 10:43:51 -0700 | [diff] [blame] | 410 | // Callback for ring buffer data. |
Ahmed ElArabawy | 687ce13 | 2022-01-11 16:42:48 -0800 | [diff] [blame] | 411 | using on_ring_buffer_data_callback = std::function<void( |
| 412 | const std::string&, const std::vector<uint8_t>&, const wifi_ring_buffer_status&)>; |
Roshan Pius | 8714a3e | 2016-10-28 10:43:51 -0700 | [diff] [blame] | 413 | |
Roshan Pius | 203cb03 | 2016-12-14 17:41:20 -0800 | [diff] [blame] | 414 | // Callback for alerts. |
Ahmed ElArabawy | 687ce13 | 2022-01-11 16:42:48 -0800 | [diff] [blame] | 415 | using on_error_alert_callback = std::function<void(int32_t, const std::vector<uint8_t>&)>; |
Roshan Pius | 01f0877 | 2018-01-22 17:56:06 -0800 | [diff] [blame] | 416 | |
Ahmed ElArabawy | 2134bf7 | 2020-06-18 15:07:12 -0700 | [diff] [blame] | 417 | // Callback for subsystem restart |
| 418 | using on_subsystem_restart_callback = std::function<void(const std::string&)>; |
| 419 | |
Roshan Pius | 01f0877 | 2018-01-22 17:56:06 -0800 | [diff] [blame] | 420 | // Struct for the mac info from the legacy HAL. This is a cleaner version |
| 421 | // of the |wifi_mac_info| & |wifi_iface_info|. |
| 422 | typedef struct { |
| 423 | std::string name; |
| 424 | wifi_channel channel; |
| 425 | } WifiIfaceInfo; |
| 426 | |
| 427 | typedef struct { |
| 428 | uint32_t wlan_mac_id; |
| 429 | /* BIT MASK of BIT(WLAN_MAC*) as represented by wlan_mac_band */ |
| 430 | uint32_t mac_band; |
| 431 | /* Represents the connected Wi-Fi interfaces associated with each MAC */ |
| 432 | std::vector<WifiIfaceInfo> iface_infos; |
| 433 | } WifiMacInfo; |
| 434 | |
| 435 | // Callback for radio mode change |
Ahmed ElArabawy | 687ce13 | 2022-01-11 16:42:48 -0800 | [diff] [blame] | 436 | using on_radio_mode_change_callback = std::function<void(const std::vector<WifiMacInfo>&)>; |
Roshan Pius | 01f0877 | 2018-01-22 17:56:06 -0800 | [diff] [blame] | 437 | |
Kai Shi | 2ca7a11 | 2020-12-15 19:51:28 -0800 | [diff] [blame] | 438 | // TWT response and event callbacks struct. |
| 439 | struct TwtCallbackHandlers { |
| 440 | // Callback for TWT setup response |
| 441 | std::function<void(const TwtSetupResponse&)> on_setup_response; |
| 442 | // Callback for TWT teardown completion |
| 443 | std::function<void(const TwtTeardownCompletion&)> on_teardown_completion; |
| 444 | // Callback for TWT info frame received event |
| 445 | std::function<void(const TwtInfoFrameReceived&)> on_info_frame_received; |
| 446 | // Callback for TWT notification from the device |
| 447 | std::function<void(const TwtDeviceNotify&)> on_device_notify; |
| 448 | }; |
| 449 | |
Roshan Pius | aabe575 | 2016-09-29 09:03:59 -0700 | [diff] [blame] | 450 | /** |
| 451 | * Class that encapsulates all legacy HAL interactions. |
| 452 | * This class manages the lifetime of the event loop thread used by legacy HAL. |
Roshan Pius | 742bb97 | 2017-02-02 09:54:27 -0800 | [diff] [blame] | 453 | * |
Bernie Innocenti | efbb9c3 | 2018-03-07 00:17:50 +0900 | [diff] [blame] | 454 | * Note: There will only be a single instance of this class created in the Wifi |
Roshan Pius | 742bb97 | 2017-02-02 09:54:27 -0800 | [diff] [blame] | 455 | * object and will be valid for the lifetime of the process. |
Roshan Pius | aabe575 | 2016-09-29 09:03:59 -0700 | [diff] [blame] | 456 | */ |
| 457 | class WifiLegacyHal { |
Ahmed ElArabawy | 687ce13 | 2022-01-11 16:42:48 -0800 | [diff] [blame] | 458 | public: |
| 459 | WifiLegacyHal(const std::weak_ptr<wifi_system::InterfaceTool> iface_tool, const wifi_hal_fn& fn, |
| 460 | bool is_primary); |
Roshan Pius | 200a17d | 2017-11-01 13:03:35 -0700 | [diff] [blame] | 461 | virtual ~WifiLegacyHal() = default; |
Roshan Pius | ab5c471 | 2016-10-06 14:37:15 -0700 | [diff] [blame] | 462 | |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 463 | // Initialize the legacy HAL function table. |
Roshan Pius | 200a17d | 2017-11-01 13:03:35 -0700 | [diff] [blame] | 464 | virtual wifi_error initialize(); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 465 | // Start the legacy HAL and the event looper thread. |
Roshan Pius | 200a17d | 2017-11-01 13:03:35 -0700 | [diff] [blame] | 466 | virtual wifi_error start(); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 467 | // Deinitialize the legacy HAL and wait for the event loop thread to exit |
| 468 | // using a predefined timeout. |
Roshan Pius | 200a17d | 2017-11-01 13:03:35 -0700 | [diff] [blame] | 469 | virtual wifi_error stop(std::unique_lock<std::recursive_mutex>* lock, |
| 470 | const std::function<void()>& on_complete_callback); |
Roshan Pius | 8c1a67b | 2021-03-02 10:00:23 -0800 | [diff] [blame] | 471 | virtual wifi_error waitForDriverReady(); |
Ahmed ElArabawy | 4822938 | 2019-02-07 22:04:53 -0800 | [diff] [blame] | 472 | // Checks if legacy HAL has successfully started |
| 473 | bool isStarted(); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 474 | // Wrappers for all the functions in the legacy HAL function table. |
Ahmed ElArabawy | 687ce13 | 2022-01-11 16:42:48 -0800 | [diff] [blame] | 475 | virtual std::pair<wifi_error, std::string> getDriverVersion(const std::string& iface_name); |
| 476 | virtual std::pair<wifi_error, std::string> getFirmwareVersion(const std::string& iface_name); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 477 | std::pair<wifi_error, std::vector<uint8_t>> requestDriverMemoryDump( |
Ahmed ElArabawy | 687ce13 | 2022-01-11 16:42:48 -0800 | [diff] [blame] | 478 | const std::string& iface_name); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 479 | std::pair<wifi_error, std::vector<uint8_t>> requestFirmwareMemoryDump( |
Ahmed ElArabawy | 687ce13 | 2022-01-11 16:42:48 -0800 | [diff] [blame] | 480 | const std::string& iface_name); |
| 481 | std::pair<wifi_error, uint64_t> getSupportedFeatureSet(const std::string& iface_name); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 482 | // APF functions. |
| 483 | std::pair<wifi_error, PacketFilterCapabilities> getPacketFilterCapabilities( |
Ahmed ElArabawy | 687ce13 | 2022-01-11 16:42:48 -0800 | [diff] [blame] | 484 | const std::string& iface_name); |
| 485 | wifi_error setPacketFilter(const std::string& iface_name, const std::vector<uint8_t>& program); |
Bernie Innocenti | efbb9c3 | 2018-03-07 00:17:50 +0900 | [diff] [blame] | 486 | std::pair<wifi_error, std::vector<uint8_t>> readApfPacketFilterData( |
Ahmed ElArabawy | 687ce13 | 2022-01-11 16:42:48 -0800 | [diff] [blame] | 487 | const std::string& iface_name); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 488 | // Gscan functions. |
| 489 | std::pair<wifi_error, wifi_gscan_capabilities> getGscanCapabilities( |
Ahmed ElArabawy | 687ce13 | 2022-01-11 16:42:48 -0800 | [diff] [blame] | 490 | const std::string& iface_name); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 491 | // These API's provides a simplified interface over the legacy Gscan API's: |
| 492 | // a) All scan events from the legacy HAL API other than the |
| 493 | // |WIFI_SCAN_FAILED| are treated as notification of results. |
| 494 | // This method then retrieves the cached scan results from the legacy |
| 495 | // HAL API and triggers the externally provided |
| 496 | // |on_results_user_callback| on success. |
| 497 | // b) |WIFI_SCAN_FAILED| scan event or failure to retrieve cached scan |
| 498 | // results |
| 499 | // triggers the externally provided |on_failure_user_callback|. |
| 500 | // c) Full scan result event triggers the externally provided |
| 501 | // |on_full_result_user_callback|. |
Ahmed ElArabawy | 687ce13 | 2022-01-11 16:42:48 -0800 | [diff] [blame] | 502 | wifi_error startGscan(const std::string& iface_name, wifi_request_id id, |
| 503 | const wifi_scan_cmd_params& params, |
| 504 | const std::function<void(wifi_request_id)>& on_failure_callback, |
| 505 | const on_gscan_results_callback& on_results_callback, |
| 506 | const on_gscan_full_result_callback& on_full_result_callback); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 507 | wifi_error stopGscan(const std::string& iface_name, wifi_request_id id); |
| 508 | std::pair<wifi_error, std::vector<uint32_t>> getValidFrequenciesForBand( |
Ahmed ElArabawy | 687ce13 | 2022-01-11 16:42:48 -0800 | [diff] [blame] | 509 | const std::string& iface_name, wifi_band band); |
Roshan Pius | 200a17d | 2017-11-01 13:03:35 -0700 | [diff] [blame] | 510 | virtual wifi_error setDfsFlag(const std::string& iface_name, bool dfs_on); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 511 | // Link layer stats functions. |
| 512 | wifi_error enableLinkLayerStats(const std::string& iface_name, bool debug); |
| 513 | wifi_error disableLinkLayerStats(const std::string& iface_name); |
Ahmed ElArabawy | 687ce13 | 2022-01-11 16:42:48 -0800 | [diff] [blame] | 514 | std::pair<wifi_error, LinkLayerStats> getLinkLayerStats(const std::string& iface_name); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 515 | // RSSI monitor functions. |
Ahmed ElArabawy | 687ce13 | 2022-01-11 16:42:48 -0800 | [diff] [blame] | 516 | wifi_error startRssiMonitoring( |
| 517 | const std::string& iface_name, wifi_request_id id, int8_t max_rssi, int8_t min_rssi, |
| 518 | const on_rssi_threshold_breached_callback& on_threshold_breached_callback); |
| 519 | wifi_error stopRssiMonitoring(const std::string& iface_name, wifi_request_id id); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 520 | std::pair<wifi_error, wifi_roaming_capabilities> getRoamingCapabilities( |
Ahmed ElArabawy | 687ce13 | 2022-01-11 16:42:48 -0800 | [diff] [blame] | 521 | const std::string& iface_name); |
| 522 | wifi_error configureRoaming(const std::string& iface_name, const wifi_roaming_config& config); |
| 523 | wifi_error enableFirmwareRoaming(const std::string& iface_name, fw_roaming_state_t state); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 524 | wifi_error configureNdOffload(const std::string& iface_name, bool enable); |
Ahmed ElArabawy | 687ce13 | 2022-01-11 16:42:48 -0800 | [diff] [blame] | 525 | wifi_error startSendingOffloadedPacket(const std::string& iface_name, uint32_t cmd_id, |
| 526 | uint16_t ether_type, |
| 527 | const std::vector<uint8_t>& ip_packet_data, |
| 528 | const std::array<uint8_t, 6>& src_address, |
| 529 | const std::array<uint8_t, 6>& dst_address, |
| 530 | uint32_t period_in_ms); |
| 531 | wifi_error stopSendingOffloadedPacket(const std::string& iface_name, uint32_t cmd_id); |
Roshan Pius | 6036c02 | 2019-03-27 10:41:58 -0700 | [diff] [blame] | 532 | virtual wifi_error selectTxPowerScenario(const std::string& iface_name, |
| 533 | wifi_power_scenario scenario); |
| 534 | virtual wifi_error resetTxPowerScenario(const std::string& iface_name); |
Ahmed ElArabawy | 687ce13 | 2022-01-11 16:42:48 -0800 | [diff] [blame] | 535 | wifi_error setLatencyMode(const std::string& iface_name, wifi_latency_mode mode); |
| 536 | wifi_error setThermalMitigationMode(wifi_thermal_mode mode, uint32_t completion_window); |
Ahmed ElArabawy | a1d1365 | 2020-01-29 09:22:28 -0800 | [diff] [blame] | 537 | wifi_error setDscpToAccessCategoryMapping(uint32_t start, uint32_t end, |
| 538 | uint32_t access_category); |
| 539 | wifi_error resetDscpToAccessCategoryMapping(); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 540 | // Logger/debug functions. |
Ahmed ElArabawy | 687ce13 | 2022-01-11 16:42:48 -0800 | [diff] [blame] | 541 | std::pair<wifi_error, uint32_t> getLoggerSupportedFeatureSet(const std::string& iface_name); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 542 | wifi_error startPktFateMonitoring(const std::string& iface_name); |
Ahmed ElArabawy | 687ce13 | 2022-01-11 16:42:48 -0800 | [diff] [blame] | 543 | std::pair<wifi_error, std::vector<wifi_tx_report>> getTxPktFates(const std::string& iface_name); |
| 544 | std::pair<wifi_error, std::vector<wifi_rx_report>> getRxPktFates(const std::string& iface_name); |
| 545 | std::pair<wifi_error, WakeReasonStats> getWakeReasonStats(const std::string& iface_name); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 546 | wifi_error registerRingBufferCallbackHandler( |
Ahmed ElArabawy | 687ce13 | 2022-01-11 16:42:48 -0800 | [diff] [blame] | 547 | const std::string& iface_name, const on_ring_buffer_data_callback& on_data_callback); |
| 548 | wifi_error deregisterRingBufferCallbackHandler(const std::string& iface_name); |
Ahmed ElArabawy | 2134bf7 | 2020-06-18 15:07:12 -0700 | [diff] [blame] | 549 | wifi_error registerSubsystemRestartCallbackHandler( |
Ahmed ElArabawy | 687ce13 | 2022-01-11 16:42:48 -0800 | [diff] [blame] | 550 | const on_subsystem_restart_callback& on_restart_callback); |
| 551 | std::pair<wifi_error, std::vector<wifi_ring_buffer_status>> getRingBuffersStatus( |
| 552 | const std::string& iface_name); |
| 553 | wifi_error startRingBufferLogging(const std::string& iface_name, const std::string& ring_name, |
| 554 | uint32_t verbose_level, uint32_t max_interval_sec, |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 555 | uint32_t min_data_size); |
Ahmed ElArabawy | 687ce13 | 2022-01-11 16:42:48 -0800 | [diff] [blame] | 556 | wifi_error getRingBufferData(const std::string& iface_name, const std::string& ring_name); |
| 557 | wifi_error registerErrorAlertCallbackHandler(const std::string& iface_name, |
| 558 | const on_error_alert_callback& on_alert_callback); |
| 559 | wifi_error deregisterErrorAlertCallbackHandler(const std::string& iface_name); |
Roshan Pius | 01f0877 | 2018-01-22 17:56:06 -0800 | [diff] [blame] | 560 | // Radio mode functions. |
Roshan Pius | aceecb0 | 2018-03-01 14:54:26 -0800 | [diff] [blame] | 561 | virtual wifi_error registerRadioModeChangeCallbackHandler( |
Ahmed ElArabawy | 687ce13 | 2022-01-11 16:42:48 -0800 | [diff] [blame] | 562 | const std::string& iface_name, |
| 563 | const on_radio_mode_change_callback& on_user_change_callback); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 564 | // RTT functions. |
Ahmed ElArabawy | 687ce13 | 2022-01-11 16:42:48 -0800 | [diff] [blame] | 565 | wifi_error startRttRangeRequest(const std::string& iface_name, wifi_request_id id, |
| 566 | const std::vector<wifi_rtt_config>& rtt_configs, |
| 567 | const on_rtt_results_callback& on_results_callback); |
| 568 | wifi_error cancelRttRangeRequest(const std::string& iface_name, wifi_request_id id, |
| 569 | const std::vector<std::array<uint8_t, 6>>& mac_addrs); |
| 570 | std::pair<wifi_error, wifi_rtt_capabilities> getRttCapabilities(const std::string& iface_name); |
| 571 | std::pair<wifi_error, wifi_rtt_responder> getRttResponderInfo(const std::string& iface_name); |
| 572 | wifi_error enableRttResponder(const std::string& iface_name, wifi_request_id id, |
| 573 | const wifi_channel_info& channel_hint, uint32_t max_duration_secs, |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 574 | const wifi_rtt_responder& info); |
Ahmed ElArabawy | 687ce13 | 2022-01-11 16:42:48 -0800 | [diff] [blame] | 575 | wifi_error disableRttResponder(const std::string& iface_name, wifi_request_id id); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 576 | wifi_error setRttLci(const std::string& iface_name, wifi_request_id id, |
| 577 | const wifi_lci_information& info); |
| 578 | wifi_error setRttLcr(const std::string& iface_name, wifi_request_id id, |
| 579 | const wifi_lcr_information& info); |
| 580 | // NAN functions. |
Ahmed ElArabawy | 687ce13 | 2022-01-11 16:42:48 -0800 | [diff] [blame] | 581 | virtual wifi_error nanRegisterCallbackHandlers(const std::string& iface_name, |
| 582 | const NanCallbackHandlers& callbacks); |
| 583 | wifi_error nanEnableRequest(const std::string& iface_name, transaction_id id, |
| 584 | const NanEnableRequest& msg); |
| 585 | virtual wifi_error nanDisableRequest(const std::string& iface_name, transaction_id id); |
| 586 | wifi_error nanPublishRequest(const std::string& iface_name, transaction_id id, |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 587 | const NanPublishRequest& msg); |
Ahmed ElArabawy | 687ce13 | 2022-01-11 16:42:48 -0800 | [diff] [blame] | 588 | wifi_error nanPublishCancelRequest(const std::string& iface_name, transaction_id id, |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 589 | const NanPublishCancelRequest& msg); |
Ahmed ElArabawy | 687ce13 | 2022-01-11 16:42:48 -0800 | [diff] [blame] | 590 | wifi_error nanSubscribeRequest(const std::string& iface_name, transaction_id id, |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 591 | const NanSubscribeRequest& msg); |
Ahmed ElArabawy | 687ce13 | 2022-01-11 16:42:48 -0800 | [diff] [blame] | 592 | wifi_error nanSubscribeCancelRequest(const std::string& iface_name, transaction_id id, |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 593 | const NanSubscribeCancelRequest& msg); |
Ahmed ElArabawy | 687ce13 | 2022-01-11 16:42:48 -0800 | [diff] [blame] | 594 | wifi_error nanTransmitFollowupRequest(const std::string& iface_name, transaction_id id, |
| 595 | const NanTransmitFollowupRequest& msg); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 596 | wifi_error nanStatsRequest(const std::string& iface_name, transaction_id id, |
| 597 | const NanStatsRequest& msg); |
Ahmed ElArabawy | 687ce13 | 2022-01-11 16:42:48 -0800 | [diff] [blame] | 598 | wifi_error nanConfigRequest(const std::string& iface_name, transaction_id id, |
| 599 | const NanConfigRequest& msg); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 600 | wifi_error nanTcaRequest(const std::string& iface_name, transaction_id id, |
| 601 | const NanTCARequest& msg); |
Ahmed ElArabawy | 687ce13 | 2022-01-11 16:42:48 -0800 | [diff] [blame] | 602 | wifi_error nanBeaconSdfPayloadRequest(const std::string& iface_name, transaction_id id, |
| 603 | const NanBeaconSdfPayloadRequest& msg); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 604 | std::pair<wifi_error, NanVersion> nanGetVersion(); |
Ahmed ElArabawy | 687ce13 | 2022-01-11 16:42:48 -0800 | [diff] [blame] | 605 | wifi_error nanGetCapabilities(const std::string& iface_name, transaction_id id); |
| 606 | wifi_error nanDataInterfaceCreate(const std::string& iface_name, transaction_id id, |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 607 | const std::string& data_iface_name); |
Ahmed ElArabawy | 687ce13 | 2022-01-11 16:42:48 -0800 | [diff] [blame] | 608 | virtual wifi_error nanDataInterfaceDelete(const std::string& iface_name, transaction_id id, |
| 609 | const std::string& data_iface_name); |
| 610 | wifi_error nanDataRequestInitiator(const std::string& iface_name, transaction_id id, |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 611 | const NanDataPathInitiatorRequest& msg); |
Ahmed ElArabawy | 687ce13 | 2022-01-11 16:42:48 -0800 | [diff] [blame] | 612 | wifi_error nanDataIndicationResponse(const std::string& iface_name, transaction_id id, |
| 613 | const NanDataPathIndicationResponse& msg); |
| 614 | wifi_error nanDataEnd(const std::string& iface_name, transaction_id id, uint32_t ndpInstanceId); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 615 | // AP functions. |
Ahmed ElArabawy | 687ce13 | 2022-01-11 16:42:48 -0800 | [diff] [blame] | 616 | wifi_error setCountryCode(const std::string& iface_name, std::array<int8_t, 2> code); |
Roshan Pius | aabe575 | 2016-09-29 09:03:59 -0700 | [diff] [blame] | 617 | |
Sunil Ravi | ddab4bb | 2020-02-03 22:45:19 -0800 | [diff] [blame] | 618 | // interface functions. |
Roshan Pius | 5ba0a90 | 2020-04-14 11:55:42 -0700 | [diff] [blame] | 619 | virtual wifi_error createVirtualInterface(const std::string& ifname, |
| 620 | wifi_interface_type iftype); |
| 621 | virtual wifi_error deleteVirtualInterface(const std::string& ifname); |
Jimmy Chen | 2dddd79 | 2019-12-23 17:50:39 +0200 | [diff] [blame] | 622 | wifi_error getSupportedIfaceName(uint32_t iface_type, std::string& ifname); |
Sunil Ravi | ddab4bb | 2020-02-03 22:45:19 -0800 | [diff] [blame] | 623 | |
Roshan Pius | e9d1e7d | 2020-11-04 11:44:16 -0800 | [diff] [blame] | 624 | // STA + STA functions |
| 625 | virtual wifi_error multiStaSetPrimaryConnection(const std::string& ifname); |
| 626 | virtual wifi_error multiStaSetUseCase(wifi_multi_sta_use_case use_case); |
| 627 | |
Quang Luong | 94bcce5 | 2020-11-25 17:52:19 -0800 | [diff] [blame] | 628 | // Coex functions. |
Ahmed ElArabawy | 687ce13 | 2022-01-11 16:42:48 -0800 | [diff] [blame] | 629 | virtual wifi_error setCoexUnsafeChannels(std::vector<wifi_coex_unsafe_channel> unsafe_channels, |
| 630 | uint32_t restrictions); |
Quang Luong | 94bcce5 | 2020-11-25 17:52:19 -0800 | [diff] [blame] | 631 | |
Kai Shi | 2ca7a11 | 2020-12-15 19:51:28 -0800 | [diff] [blame] | 632 | wifi_error setVoipMode(const std::string& iface_name, wifi_voip_mode mode); |
| 633 | |
| 634 | wifi_error twtRegisterHandler(const std::string& iface_name, |
| 635 | const TwtCallbackHandlers& handler); |
| 636 | |
Ahmed ElArabawy | 687ce13 | 2022-01-11 16:42:48 -0800 | [diff] [blame] | 637 | std::pair<wifi_error, TwtCapabilitySet> twtGetCapability(const std::string& iface_name); |
Kai Shi | 2ca7a11 | 2020-12-15 19:51:28 -0800 | [diff] [blame] | 638 | |
Ahmed ElArabawy | 687ce13 | 2022-01-11 16:42:48 -0800 | [diff] [blame] | 639 | wifi_error twtSetupRequest(const std::string& iface_name, const TwtSetupRequest& msg); |
Kai Shi | 2ca7a11 | 2020-12-15 19:51:28 -0800 | [diff] [blame] | 640 | |
Ahmed ElArabawy | 687ce13 | 2022-01-11 16:42:48 -0800 | [diff] [blame] | 641 | wifi_error twtTearDownRequest(const std::string& iface_name, const TwtTeardownRequest& msg); |
Kai Shi | 2ca7a11 | 2020-12-15 19:51:28 -0800 | [diff] [blame] | 642 | |
Ahmed ElArabawy | 687ce13 | 2022-01-11 16:42:48 -0800 | [diff] [blame] | 643 | wifi_error twtInfoFrameRequest(const std::string& iface_name, const TwtInfoFrameRequest& msg); |
Kai Shi | 2ca7a11 | 2020-12-15 19:51:28 -0800 | [diff] [blame] | 644 | |
Ahmed ElArabawy | 687ce13 | 2022-01-11 16:42:48 -0800 | [diff] [blame] | 645 | std::pair<wifi_error, TwtStats> twtGetStats(const std::string& iface_name, uint8_t configId); |
Kai Shi | 2ca7a11 | 2020-12-15 19:51:28 -0800 | [diff] [blame] | 646 | |
| 647 | wifi_error twtClearStats(const std::string& iface_name, uint8_t configId); |
| 648 | |
Ahmed ElArabawy | 687ce13 | 2022-01-11 16:42:48 -0800 | [diff] [blame] | 649 | wifi_error setDtimConfig(const std::string& iface_name, uint32_t multiplier); |
Kai Shi | 0b6341c | 2021-01-11 20:22:59 -0800 | [diff] [blame] | 650 | |
Kumar Anand | 2a630a3 | 2021-01-21 14:09:14 -0800 | [diff] [blame] | 651 | // Retrieve the list of usable channels in the requested bands |
| 652 | // for the requested modes |
| 653 | std::pair<wifi_error, std::vector<wifi_usable_channel>> getUsableChannels( |
Ahmed ElArabawy | 687ce13 | 2022-01-11 16:42:48 -0800 | [diff] [blame] | 654 | uint32_t band_mask, uint32_t iface_mode_mask, uint32_t filter_mask); |
Kumar Anand | 2a630a3 | 2021-01-21 14:09:14 -0800 | [diff] [blame] | 655 | |
chenpaul | c6f5703 | 2021-03-05 17:06:50 +0800 | [diff] [blame] | 656 | wifi_error triggerSubsystemRestart(); |
| 657 | |
Ahmed ElArabawy | 687ce13 | 2022-01-11 16:42:48 -0800 | [diff] [blame] | 658 | private: |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 659 | // Retrieve interface handles for all the available interfaces. |
| 660 | wifi_error retrieveIfaceHandles(); |
| 661 | wifi_interface_handle getIfaceHandle(const std::string& iface_name); |
| 662 | // Run the legacy HAL event loop thread. |
| 663 | void runEventLoop(); |
| 664 | // Retrieve the cached gscan results to pass the results back to the |
| 665 | // external callbacks. |
Ahmed ElArabawy | 687ce13 | 2022-01-11 16:42:48 -0800 | [diff] [blame] | 666 | std::pair<wifi_error, std::vector<wifi_cached_scan_results>> getGscanCachedResults( |
| 667 | const std::string& iface_name); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 668 | void invalidate(); |
Sunil Ravi | ddab4bb | 2020-02-03 22:45:19 -0800 | [diff] [blame] | 669 | // Handles wifi (error) status of Virtual interface create/delete |
Ahmed ElArabawy | 687ce13 | 2022-01-11 16:42:48 -0800 | [diff] [blame] | 670 | wifi_error handleVirtualInterfaceCreateOrDeleteStatus(const std::string& ifname, |
| 671 | wifi_error status); |
Roshan Pius | aabe575 | 2016-09-29 09:03:59 -0700 | [diff] [blame] | 672 | |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 673 | // Global function table of legacy HAL. |
| 674 | wifi_hal_fn global_func_table_; |
| 675 | // Opaque handle to be used for all global operations. |
| 676 | wifi_handle global_handle_; |
| 677 | // Map of interface name to handle that is to be used for all interface |
| 678 | // specific operations. |
| 679 | std::map<std::string, wifi_interface_handle> iface_name_to_handle_; |
| 680 | // Flag to indicate if we have initiated the cleanup of legacy HAL. |
| 681 | std::atomic<bool> awaiting_event_loop_termination_; |
| 682 | std::condition_variable_any stop_wait_cv_; |
| 683 | // Flag to indicate if the legacy HAL has been started. |
| 684 | bool is_started_; |
Roshan Pius | c885df0 | 2019-05-21 14:49:05 -0700 | [diff] [blame] | 685 | std::weak_ptr<wifi_system::InterfaceTool> iface_tool_; |
Jimmy Chen | 2dddd79 | 2019-12-23 17:50:39 +0200 | [diff] [blame] | 686 | // flag to indicate if this HAL is for the primary chip. This is used |
| 687 | // in order to avoid some hard-coded behavior used with older HALs, |
| 688 | // such as bring wlan0 interface up/down on start/stop HAL. |
| 689 | // it may be removed once vendor HALs are updated. |
| 690 | bool is_primary_; |
Roshan Pius | aabe575 | 2016-09-29 09:03:59 -0700 | [diff] [blame] | 691 | }; |
| 692 | |
Roshan Pius | 955542e | 2016-10-28 09:42:44 -0700 | [diff] [blame] | 693 | } // namespace legacy_hal |
Roshan Pius | aabe575 | 2016-09-29 09:03:59 -0700 | [diff] [blame] | 694 | } // namespace implementation |
Ahmed ElArabawy | 687ce13 | 2022-01-11 16:42:48 -0800 | [diff] [blame] | 695 | } // namespace V1_6 |
Roshan Pius | aabe575 | 2016-09-29 09:03:59 -0700 | [diff] [blame] | 696 | } // namespace wifi |
| 697 | } // namespace hardware |
| 698 | } // namespace android |
| 699 | |
Roshan Pius | e73a506 | 2016-12-12 08:53:34 -0800 | [diff] [blame] | 700 | #endif // WIFI_LEGACY_HAL_H_ |