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 | |
Roshan Pius | 9733411 | 2016-11-18 14:07:54 -0800 | [diff] [blame] | 26 | #include <wifi_system/interface_tool.h> |
| 27 | |
Roshan Pius | aabe575 | 2016-09-29 09:03:59 -0700 | [diff] [blame] | 28 | namespace android { |
| 29 | namespace hardware { |
| 30 | namespace wifi { |
Etan Cohen | 6ce5090 | 2017-09-14 07:30:57 -0700 | [diff] [blame] | 31 | namespace V1_2 { |
Roshan Pius | aabe575 | 2016-09-29 09:03:59 -0700 | [diff] [blame] | 32 | namespace implementation { |
Roshan Pius | 955542e | 2016-10-28 09:42:44 -0700 | [diff] [blame] | 33 | // This is in a separate namespace to prevent typename conflicts between |
| 34 | // the legacy HAL types and the HIDL interface types. |
| 35 | namespace legacy_hal { |
| 36 | // Wrap all the types defined inside the legacy HAL header files inside this |
| 37 | // namespace. |
| 38 | #include <hardware_legacy/wifi_hal.h> |
Roshan Pius | aabe575 | 2016-09-29 09:03:59 -0700 | [diff] [blame] | 39 | |
Roshan Pius | 0a47c18 | 2016-10-28 10:23:00 -0700 | [diff] [blame] | 40 | // APF capabilities supported by the iface. |
| 41 | struct PacketFilterCapabilities { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 42 | uint32_t version; |
| 43 | uint32_t max_len; |
Roshan Pius | 0a47c18 | 2016-10-28 10:23:00 -0700 | [diff] [blame] | 44 | }; |
| 45 | |
Roshan Pius | 7cece41 | 2016-10-28 10:38:21 -0700 | [diff] [blame] | 46 | // WARNING: We don't care about the variable sized members of either |
| 47 | // |wifi_iface_stat|, |wifi_radio_stat| structures. So, using the pragma |
| 48 | // to escape the compiler warnings regarding this. |
| 49 | #pragma GCC diagnostic push |
| 50 | #pragma GCC diagnostic ignored "-Wgnu-variable-sized-type-not-at-end" |
| 51 | // The |wifi_radio_stat.tx_time_per_levels| stats is provided as a pointer in |
| 52 | // |wifi_radio_stat| structure in the legacy HAL API. Separate that out |
| 53 | // into a separate return element to avoid passing pointers around. |
Roshan Pius | e42ace2 | 2017-03-13 10:44:20 -0700 | [diff] [blame] | 54 | struct LinkLayerRadioStats { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 55 | wifi_radio_stat stats; |
| 56 | std::vector<uint32_t> tx_time_per_levels; |
Roshan Pius | e42ace2 | 2017-03-13 10:44:20 -0700 | [diff] [blame] | 57 | }; |
| 58 | |
Roshan Pius | 7cece41 | 2016-10-28 10:38:21 -0700 | [diff] [blame] | 59 | struct LinkLayerStats { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 60 | wifi_iface_stat iface; |
| 61 | std::vector<LinkLayerRadioStats> radios; |
Roshan Pius | 7cece41 | 2016-10-28 10:38:21 -0700 | [diff] [blame] | 62 | }; |
| 63 | #pragma GCC diagnostic pop |
| 64 | |
Roshan Pius | 8714a3e | 2016-10-28 10:43:51 -0700 | [diff] [blame] | 65 | // The |WLAN_DRIVER_WAKE_REASON_CNT.cmd_event_wake_cnt| and |
| 66 | // |WLAN_DRIVER_WAKE_REASON_CNT.driver_fw_local_wake_cnt| stats is provided |
| 67 | // as a pointer in |WLAN_DRIVER_WAKE_REASON_CNT| structure in the legacy HAL |
| 68 | // API. Separate that out into a separate return elements to avoid passing |
| 69 | // pointers around. |
| 70 | struct WakeReasonStats { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 71 | WLAN_DRIVER_WAKE_REASON_CNT wake_reason_cnt; |
| 72 | std::vector<uint32_t> cmd_event_wake_cnt; |
| 73 | std::vector<uint32_t> driver_fw_local_wake_cnt; |
Roshan Pius | 8714a3e | 2016-10-28 10:43:51 -0700 | [diff] [blame] | 74 | }; |
| 75 | |
Roshan Pius | 2301209 | 2016-10-28 11:27:40 -0700 | [diff] [blame] | 76 | // NAN response and event callbacks struct. |
| 77 | struct NanCallbackHandlers { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 78 | // NotifyResponse invoked to notify the status of the Request. |
| 79 | std::function<void(transaction_id, const NanResponseMsg&)> |
| 80 | on_notify_response; |
| 81 | // Various event callbacks. |
| 82 | std::function<void(const NanPublishTerminatedInd&)> |
| 83 | on_event_publish_terminated; |
| 84 | std::function<void(const NanMatchInd&)> on_event_match; |
| 85 | std::function<void(const NanMatchExpiredInd&)> on_event_match_expired; |
| 86 | std::function<void(const NanSubscribeTerminatedInd&)> |
| 87 | on_event_subscribe_terminated; |
| 88 | std::function<void(const NanFollowupInd&)> on_event_followup; |
| 89 | std::function<void(const NanDiscEngEventInd&)> on_event_disc_eng_event; |
| 90 | std::function<void(const NanDisabledInd&)> on_event_disabled; |
| 91 | std::function<void(const NanTCAInd&)> on_event_tca; |
| 92 | std::function<void(const NanBeaconSdfPayloadInd&)> |
| 93 | on_event_beacon_sdf_payload; |
| 94 | std::function<void(const NanDataPathRequestInd&)> |
| 95 | on_event_data_path_request; |
| 96 | std::function<void(const NanDataPathConfirmInd&)> |
| 97 | on_event_data_path_confirm; |
| 98 | std::function<void(const NanDataPathEndInd&)> on_event_data_path_end; |
| 99 | std::function<void(const NanTransmitFollowupInd&)> |
| 100 | on_event_transmit_follow_up; |
| 101 | std::function<void(const NanRangeRequestInd&)> on_event_range_request; |
| 102 | std::function<void(const NanRangeReportInd&)> on_event_range_report; |
Roshan Pius | 2301209 | 2016-10-28 11:27:40 -0700 | [diff] [blame] | 103 | }; |
| 104 | |
Roshan Pius | 76ff302 | 2016-10-28 10:33:34 -0700 | [diff] [blame] | 105 | // Full scan results contain IE info and are hence passed by reference, to |
| 106 | // preserve the variable length array member |ie_data|. Callee must not retain |
| 107 | // the pointer. |
| 108 | using on_gscan_full_result_callback = |
| 109 | std::function<void(wifi_request_id, const wifi_scan_result*, uint32_t)>; |
| 110 | // These scan results don't contain any IE info, so no need to pass by |
| 111 | // reference. |
| 112 | using on_gscan_results_callback = std::function<void( |
| 113 | wifi_request_id, const std::vector<wifi_cached_scan_results>&)>; |
| 114 | |
Roshan Pius | d476754 | 2016-12-06 10:04:05 -0800 | [diff] [blame] | 115 | // Invoked when the rssi value breaches the thresholds set. |
| 116 | using on_rssi_threshold_breached_callback = |
| 117 | std::function<void(wifi_request_id, std::array<uint8_t, 6>, int8_t)>; |
| 118 | |
Roshan Pius | d8e915a | 2016-10-28 11:23:11 -0700 | [diff] [blame] | 119 | // Callback for RTT range request results. |
| 120 | // Rtt results contain IE info and are hence passed by reference, to |
| 121 | // preserve the |LCI| and |LCR| pointers. Callee must not retain |
| 122 | // the pointer. |
| 123 | using on_rtt_results_callback = std::function<void( |
| 124 | wifi_request_id, const std::vector<const wifi_rtt_result*>&)>; |
| 125 | |
Roshan Pius | 8714a3e | 2016-10-28 10:43:51 -0700 | [diff] [blame] | 126 | // Callback for ring buffer data. |
| 127 | using on_ring_buffer_data_callback = |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 128 | std::function<void(const std::string&, const std::vector<uint8_t>&, |
Roshan Pius | 8714a3e | 2016-10-28 10:43:51 -0700 | [diff] [blame] | 129 | const wifi_ring_buffer_status&)>; |
| 130 | |
Roshan Pius | 203cb03 | 2016-12-14 17:41:20 -0800 | [diff] [blame] | 131 | // Callback for alerts. |
| 132 | using on_error_alert_callback = |
| 133 | std::function<void(int32_t, const std::vector<uint8_t>&)>; |
Roshan Pius | aabe575 | 2016-09-29 09:03:59 -0700 | [diff] [blame] | 134 | /** |
| 135 | * Class that encapsulates all legacy HAL interactions. |
| 136 | * 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] | 137 | * |
| 138 | * Note: aThere will only be a single instance of this class created in the Wifi |
| 139 | * object and will be valid for the lifetime of the process. |
Roshan Pius | aabe575 | 2016-09-29 09:03:59 -0700 | [diff] [blame] | 140 | */ |
| 141 | class WifiLegacyHal { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 142 | public: |
| 143 | WifiLegacyHal(); |
Roshan Pius | 200a17d | 2017-11-01 13:03:35 -0700 | [diff] [blame^] | 144 | virtual ~WifiLegacyHal() = default; |
Roshan Pius | ab5c471 | 2016-10-06 14:37:15 -0700 | [diff] [blame] | 145 | |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 146 | // Initialize the legacy HAL function table. |
Roshan Pius | 200a17d | 2017-11-01 13:03:35 -0700 | [diff] [blame^] | 147 | virtual wifi_error initialize(); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 148 | // Start the legacy HAL and the event looper thread. |
Roshan Pius | 200a17d | 2017-11-01 13:03:35 -0700 | [diff] [blame^] | 149 | virtual wifi_error start(); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 150 | // Deinitialize the legacy HAL and wait for the event loop thread to exit |
| 151 | // using a predefined timeout. |
Roshan Pius | 200a17d | 2017-11-01 13:03:35 -0700 | [diff] [blame^] | 152 | virtual wifi_error stop(std::unique_lock<std::recursive_mutex>* lock, |
| 153 | const std::function<void()>& on_complete_callback); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 154 | // Wrappers for all the functions in the legacy HAL function table. |
| 155 | std::pair<wifi_error, std::string> getDriverVersion( |
| 156 | const std::string& iface_name); |
| 157 | std::pair<wifi_error, std::string> getFirmwareVersion( |
| 158 | const std::string& iface_name); |
| 159 | std::pair<wifi_error, std::vector<uint8_t>> requestDriverMemoryDump( |
| 160 | const std::string& iface_name); |
| 161 | std::pair<wifi_error, std::vector<uint8_t>> requestFirmwareMemoryDump( |
| 162 | const std::string& iface_name); |
| 163 | std::pair<wifi_error, uint32_t> getSupportedFeatureSet( |
| 164 | const std::string& iface_name); |
| 165 | // APF functions. |
| 166 | std::pair<wifi_error, PacketFilterCapabilities> getPacketFilterCapabilities( |
| 167 | const std::string& iface_name); |
| 168 | wifi_error setPacketFilter(const std::string& iface_name, |
| 169 | const std::vector<uint8_t>& program); |
| 170 | // Gscan functions. |
| 171 | std::pair<wifi_error, wifi_gscan_capabilities> getGscanCapabilities( |
| 172 | const std::string& iface_name); |
| 173 | // These API's provides a simplified interface over the legacy Gscan API's: |
| 174 | // a) All scan events from the legacy HAL API other than the |
| 175 | // |WIFI_SCAN_FAILED| are treated as notification of results. |
| 176 | // This method then retrieves the cached scan results from the legacy |
| 177 | // HAL API and triggers the externally provided |
| 178 | // |on_results_user_callback| on success. |
| 179 | // b) |WIFI_SCAN_FAILED| scan event or failure to retrieve cached scan |
| 180 | // results |
| 181 | // triggers the externally provided |on_failure_user_callback|. |
| 182 | // c) Full scan result event triggers the externally provided |
| 183 | // |on_full_result_user_callback|. |
| 184 | wifi_error startGscan( |
| 185 | const std::string& iface_name, wifi_request_id id, |
| 186 | const wifi_scan_cmd_params& params, |
| 187 | const std::function<void(wifi_request_id)>& on_failure_callback, |
| 188 | const on_gscan_results_callback& on_results_callback, |
| 189 | const on_gscan_full_result_callback& on_full_result_callback); |
| 190 | wifi_error stopGscan(const std::string& iface_name, wifi_request_id id); |
| 191 | std::pair<wifi_error, std::vector<uint32_t>> getValidFrequenciesForBand( |
| 192 | const std::string& iface_name, wifi_band band); |
Roshan Pius | 200a17d | 2017-11-01 13:03:35 -0700 | [diff] [blame^] | 193 | virtual wifi_error setDfsFlag(const std::string& iface_name, bool dfs_on); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 194 | // Link layer stats functions. |
| 195 | wifi_error enableLinkLayerStats(const std::string& iface_name, bool debug); |
| 196 | wifi_error disableLinkLayerStats(const std::string& iface_name); |
| 197 | std::pair<wifi_error, LinkLayerStats> getLinkLayerStats( |
| 198 | const std::string& iface_name); |
| 199 | // RSSI monitor functions. |
| 200 | wifi_error startRssiMonitoring(const std::string& iface_name, |
| 201 | wifi_request_id id, int8_t max_rssi, |
| 202 | int8_t min_rssi, |
| 203 | const on_rssi_threshold_breached_callback& |
| 204 | on_threshold_breached_callback); |
| 205 | wifi_error stopRssiMonitoring(const std::string& iface_name, |
| 206 | wifi_request_id id); |
| 207 | std::pair<wifi_error, wifi_roaming_capabilities> getRoamingCapabilities( |
| 208 | const std::string& iface_name); |
| 209 | wifi_error configureRoaming(const std::string& iface_name, |
| 210 | const wifi_roaming_config& config); |
| 211 | wifi_error enableFirmwareRoaming(const std::string& iface_name, |
| 212 | fw_roaming_state_t state); |
| 213 | wifi_error configureNdOffload(const std::string& iface_name, bool enable); |
| 214 | wifi_error startSendingOffloadedPacket( |
| 215 | const std::string& iface_name, uint32_t cmd_id, |
| 216 | const std::vector<uint8_t>& ip_packet_data, |
| 217 | const std::array<uint8_t, 6>& src_address, |
| 218 | const std::array<uint8_t, 6>& dst_address, uint32_t period_in_ms); |
| 219 | wifi_error stopSendingOffloadedPacket(const std::string& iface_name, |
| 220 | uint32_t cmd_id); |
| 221 | wifi_error setScanningMacOui(const std::string& iface_name, |
| 222 | const std::array<uint8_t, 3>& oui); |
| 223 | wifi_error selectTxPowerScenario(const std::string& iface_name, |
| 224 | wifi_power_scenario scenario); |
| 225 | wifi_error resetTxPowerScenario(const std::string& iface_name); |
| 226 | // Logger/debug functions. |
| 227 | std::pair<wifi_error, uint32_t> getLoggerSupportedFeatureSet( |
| 228 | const std::string& iface_name); |
| 229 | wifi_error startPktFateMonitoring(const std::string& iface_name); |
| 230 | std::pair<wifi_error, std::vector<wifi_tx_report>> getTxPktFates( |
| 231 | const std::string& iface_name); |
| 232 | std::pair<wifi_error, std::vector<wifi_rx_report>> getRxPktFates( |
| 233 | const std::string& iface_name); |
| 234 | std::pair<wifi_error, WakeReasonStats> getWakeReasonStats( |
| 235 | const std::string& iface_name); |
| 236 | wifi_error registerRingBufferCallbackHandler( |
| 237 | const std::string& iface_name, |
| 238 | const on_ring_buffer_data_callback& on_data_callback); |
| 239 | wifi_error deregisterRingBufferCallbackHandler( |
| 240 | const std::string& iface_name); |
| 241 | std::pair<wifi_error, std::vector<wifi_ring_buffer_status>> |
| 242 | getRingBuffersStatus(const std::string& iface_name); |
| 243 | wifi_error startRingBufferLogging(const std::string& iface_name, |
| 244 | const std::string& ring_name, |
| 245 | uint32_t verbose_level, |
| 246 | uint32_t max_interval_sec, |
| 247 | uint32_t min_data_size); |
| 248 | wifi_error getRingBufferData(const std::string& iface_name, |
| 249 | const std::string& ring_name); |
| 250 | wifi_error registerErrorAlertCallbackHandler( |
| 251 | const std::string& iface_name, |
| 252 | const on_error_alert_callback& on_alert_callback); |
| 253 | wifi_error deregisterErrorAlertCallbackHandler( |
| 254 | const std::string& iface_name); |
| 255 | // RTT functions. |
| 256 | wifi_error startRttRangeRequest( |
| 257 | const std::string& iface_name, wifi_request_id id, |
| 258 | const std::vector<wifi_rtt_config>& rtt_configs, |
| 259 | const on_rtt_results_callback& on_results_callback); |
| 260 | wifi_error cancelRttRangeRequest( |
| 261 | const std::string& iface_name, wifi_request_id id, |
| 262 | const std::vector<std::array<uint8_t, 6>>& mac_addrs); |
| 263 | std::pair<wifi_error, wifi_rtt_capabilities> getRttCapabilities( |
| 264 | const std::string& iface_name); |
| 265 | std::pair<wifi_error, wifi_rtt_responder> getRttResponderInfo( |
| 266 | const std::string& iface_name); |
| 267 | wifi_error enableRttResponder(const std::string& iface_name, |
| 268 | wifi_request_id id, |
| 269 | const wifi_channel_info& channel_hint, |
| 270 | uint32_t max_duration_secs, |
| 271 | const wifi_rtt_responder& info); |
| 272 | wifi_error disableRttResponder(const std::string& iface_name, |
| 273 | wifi_request_id id); |
| 274 | wifi_error setRttLci(const std::string& iface_name, wifi_request_id id, |
| 275 | const wifi_lci_information& info); |
| 276 | wifi_error setRttLcr(const std::string& iface_name, wifi_request_id id, |
| 277 | const wifi_lcr_information& info); |
| 278 | // NAN functions. |
Roshan Pius | 200a17d | 2017-11-01 13:03:35 -0700 | [diff] [blame^] | 279 | virtual wifi_error nanRegisterCallbackHandlers( |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 280 | const std::string& iface_name, const NanCallbackHandlers& callbacks); |
| 281 | wifi_error nanEnableRequest(const std::string& iface_name, |
| 282 | transaction_id id, const NanEnableRequest& msg); |
Roshan Pius | 200a17d | 2017-11-01 13:03:35 -0700 | [diff] [blame^] | 283 | virtual wifi_error nanDisableRequest(const std::string& iface_name, |
| 284 | transaction_id id); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 285 | wifi_error nanPublishRequest(const std::string& iface_name, |
| 286 | transaction_id id, |
| 287 | const NanPublishRequest& msg); |
| 288 | wifi_error nanPublishCancelRequest(const std::string& iface_name, |
| 289 | transaction_id id, |
| 290 | const NanPublishCancelRequest& msg); |
| 291 | wifi_error nanSubscribeRequest(const std::string& iface_name, |
| 292 | transaction_id id, |
| 293 | const NanSubscribeRequest& msg); |
| 294 | wifi_error nanSubscribeCancelRequest(const std::string& iface_name, |
| 295 | transaction_id id, |
| 296 | const NanSubscribeCancelRequest& msg); |
| 297 | wifi_error nanTransmitFollowupRequest( |
| 298 | const std::string& iface_name, transaction_id id, |
| 299 | const NanTransmitFollowupRequest& msg); |
| 300 | wifi_error nanStatsRequest(const std::string& iface_name, transaction_id id, |
| 301 | const NanStatsRequest& msg); |
| 302 | wifi_error nanConfigRequest(const std::string& iface_name, |
| 303 | transaction_id id, const NanConfigRequest& msg); |
| 304 | wifi_error nanTcaRequest(const std::string& iface_name, transaction_id id, |
| 305 | const NanTCARequest& msg); |
| 306 | wifi_error nanBeaconSdfPayloadRequest( |
| 307 | const std::string& iface_name, transaction_id id, |
| 308 | const NanBeaconSdfPayloadRequest& msg); |
| 309 | std::pair<wifi_error, NanVersion> nanGetVersion(); |
| 310 | wifi_error nanGetCapabilities(const std::string& iface_name, |
| 311 | transaction_id id); |
| 312 | wifi_error nanDataInterfaceCreate(const std::string& iface_name, |
| 313 | transaction_id id, |
| 314 | const std::string& data_iface_name); |
Roshan Pius | 200a17d | 2017-11-01 13:03:35 -0700 | [diff] [blame^] | 315 | virtual wifi_error nanDataInterfaceDelete( |
| 316 | const std::string& iface_name, transaction_id id, |
| 317 | const std::string& data_iface_name); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 318 | wifi_error nanDataRequestInitiator(const std::string& iface_name, |
| 319 | transaction_id id, |
| 320 | const NanDataPathInitiatorRequest& msg); |
| 321 | wifi_error nanDataIndicationResponse( |
| 322 | const std::string& iface_name, transaction_id id, |
| 323 | const NanDataPathIndicationResponse& msg); |
| 324 | wifi_error nanDataEnd(const std::string& iface_name, transaction_id id, |
| 325 | uint32_t ndpInstanceId); |
| 326 | // AP functions. |
| 327 | wifi_error setCountryCode(const std::string& iface_name, |
| 328 | std::array<int8_t, 2> code); |
Roshan Pius | aabe575 | 2016-09-29 09:03:59 -0700 | [diff] [blame] | 329 | |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 330 | private: |
| 331 | // Retrieve interface handles for all the available interfaces. |
| 332 | wifi_error retrieveIfaceHandles(); |
| 333 | wifi_interface_handle getIfaceHandle(const std::string& iface_name); |
| 334 | // Run the legacy HAL event loop thread. |
| 335 | void runEventLoop(); |
| 336 | // Retrieve the cached gscan results to pass the results back to the |
| 337 | // external callbacks. |
| 338 | std::pair<wifi_error, std::vector<wifi_cached_scan_results>> |
| 339 | getGscanCachedResults(const std::string& iface_name); |
| 340 | void invalidate(); |
Roshan Pius | aabe575 | 2016-09-29 09:03:59 -0700 | [diff] [blame] | 341 | |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 342 | // Global function table of legacy HAL. |
| 343 | wifi_hal_fn global_func_table_; |
| 344 | // Opaque handle to be used for all global operations. |
| 345 | wifi_handle global_handle_; |
| 346 | // Map of interface name to handle that is to be used for all interface |
| 347 | // specific operations. |
| 348 | std::map<std::string, wifi_interface_handle> iface_name_to_handle_; |
| 349 | // Flag to indicate if we have initiated the cleanup of legacy HAL. |
| 350 | std::atomic<bool> awaiting_event_loop_termination_; |
| 351 | std::condition_variable_any stop_wait_cv_; |
| 352 | // Flag to indicate if the legacy HAL has been started. |
| 353 | bool is_started_; |
| 354 | wifi_system::InterfaceTool iface_tool_; |
Roshan Pius | aabe575 | 2016-09-29 09:03:59 -0700 | [diff] [blame] | 355 | }; |
| 356 | |
Roshan Pius | 955542e | 2016-10-28 09:42:44 -0700 | [diff] [blame] | 357 | } // namespace legacy_hal |
Roshan Pius | aabe575 | 2016-09-29 09:03:59 -0700 | [diff] [blame] | 358 | } // namespace implementation |
Etan Cohen | 6ce5090 | 2017-09-14 07:30:57 -0700 | [diff] [blame] | 359 | } // namespace V1_2 |
Roshan Pius | aabe575 | 2016-09-29 09:03:59 -0700 | [diff] [blame] | 360 | } // namespace wifi |
| 361 | } // namespace hardware |
| 362 | } // namespace android |
| 363 | |
Roshan Pius | e73a506 | 2016-12-12 08:53:34 -0800 | [diff] [blame] | 364 | #endif // WIFI_LEGACY_HAL_H_ |