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 | |
| 17 | #include <array> |
Roshan Pius | 155344b | 2017-08-11 15:47:42 -0700 | [diff] [blame] | 18 | #include <chrono> |
Roshan Pius | aabe575 | 2016-09-29 09:03:59 -0700 | [diff] [blame] | 19 | |
Roshan Pius | aabe575 | 2016-09-29 09:03:59 -0700 | [diff] [blame] | 20 | #include <android-base/logging.h> |
Ahmed ElArabawy | 7153e81 | 2018-06-05 11:09:39 -0700 | [diff] [blame] | 21 | #include <cutils/properties.h> |
Roshan Pius | aabe575 | 2016-09-29 09:03:59 -0700 | [diff] [blame] | 22 | |
Roshan Pius | 091e1c1 | 2017-01-30 16:40:50 -0800 | [diff] [blame] | 23 | #include "hidl_sync_util.h" |
Roshan Pius | 955542e | 2016-10-28 09:42:44 -0700 | [diff] [blame] | 24 | #include "wifi_legacy_hal.h" |
Roshan Pius | e73a506 | 2016-12-12 08:53:34 -0800 | [diff] [blame] | 25 | #include "wifi_legacy_hal_stubs.h" |
Roshan Pius | 9733411 | 2016-11-18 14:07:54 -0800 | [diff] [blame] | 26 | |
Roshan Pius | 32fc12e | 2017-01-25 17:44:42 -0800 | [diff] [blame] | 27 | namespace { |
Roshan Pius | 76ff302 | 2016-10-28 10:33:34 -0700 | [diff] [blame] | 28 | // Constants ported over from the legacy HAL calling code |
| 29 | // (com_android_server_wifi_WifiNative.cpp). This will all be thrown |
| 30 | // away when this shim layer is replaced by the real vendor |
| 31 | // implementation. |
Roshan Pius | 511cc49 | 2016-10-28 09:54:26 -0700 | [diff] [blame] | 32 | static constexpr uint32_t kMaxVersionStringLength = 256; |
Roshan Pius | 76ff302 | 2016-10-28 10:33:34 -0700 | [diff] [blame] | 33 | static constexpr uint32_t kMaxCachedGscanResults = 64; |
| 34 | static constexpr uint32_t kMaxGscanFrequenciesForBand = 64; |
Roshan Pius | 7cece41 | 2016-10-28 10:38:21 -0700 | [diff] [blame] | 35 | static constexpr uint32_t kLinkLayerStatsDataMpduSizeThreshold = 128; |
Roshan Pius | 8714a3e | 2016-10-28 10:43:51 -0700 | [diff] [blame] | 36 | static constexpr uint32_t kMaxWakeReasonStatsArraySize = 32; |
| 37 | static constexpr uint32_t kMaxRingBuffers = 10; |
Roshan Pius | 9bd4e6b | 2017-09-29 15:04:33 -0700 | [diff] [blame] | 38 | static constexpr uint32_t kMaxStopCompleteWaitMs = 100; |
Ahmed ElArabawy | 7153e81 | 2018-06-05 11:09:39 -0700 | [diff] [blame] | 39 | static constexpr char kDriverPropName[] = "wlan.driver.status"; |
Roshan Pius | 511cc49 | 2016-10-28 09:54:26 -0700 | [diff] [blame] | 40 | |
Roshan Pius | 32fc12e | 2017-01-25 17:44:42 -0800 | [diff] [blame] | 41 | // Helper function to create a non-const char* for legacy Hal API's. |
| 42 | std::vector<char> makeCharVec(const std::string& str) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 43 | std::vector<char> vec(str.size() + 1); |
| 44 | vec.assign(str.begin(), str.end()); |
| 45 | vec.push_back('\0'); |
| 46 | return vec; |
Roshan Pius | 32fc12e | 2017-01-25 17:44:42 -0800 | [diff] [blame] | 47 | } |
| 48 | } // namespace |
| 49 | |
| 50 | namespace android { |
| 51 | namespace hardware { |
| 52 | namespace wifi { |
Jong Wook Kim | da830c9 | 2018-07-23 15:29:38 -0700 | [diff] [blame] | 53 | namespace V1_3 { |
Roshan Pius | 32fc12e | 2017-01-25 17:44:42 -0800 | [diff] [blame] | 54 | namespace implementation { |
| 55 | namespace legacy_hal { |
Roshan Pius | aabe575 | 2016-09-29 09:03:59 -0700 | [diff] [blame] | 56 | // Legacy HAL functions accept "C" style function pointers, so use global |
| 57 | // functions to pass to the legacy HAL function and store the corresponding |
| 58 | // std::function methods to be invoked. |
Roshan Pius | 155344b | 2017-08-11 15:47:42 -0700 | [diff] [blame] | 59 | // |
| 60 | // Callback to be invoked once |stop| is complete |
Roshan Pius | aabe575 | 2016-09-29 09:03:59 -0700 | [diff] [blame] | 61 | std::function<void(wifi_handle handle)> on_stop_complete_internal_callback; |
Roshan Pius | 091e1c1 | 2017-01-30 16:40:50 -0800 | [diff] [blame] | 62 | void onAsyncStopComplete(wifi_handle handle) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 63 | const auto lock = hidl_sync_util::acquireGlobalLock(); |
| 64 | if (on_stop_complete_internal_callback) { |
| 65 | on_stop_complete_internal_callback(handle); |
| 66 | // Invalidate this callback since we don't want this firing again. |
| 67 | on_stop_complete_internal_callback = nullptr; |
| 68 | } |
Roshan Pius | aabe575 | 2016-09-29 09:03:59 -0700 | [diff] [blame] | 69 | } |
Roshan Pius | cdb77f3 | 2016-10-03 14:09:57 -0700 | [diff] [blame] | 70 | |
| 71 | // Callback to be invoked for driver dump. |
| 72 | std::function<void(char*, int)> on_driver_memory_dump_internal_callback; |
Roshan Pius | 091e1c1 | 2017-01-30 16:40:50 -0800 | [diff] [blame] | 73 | void onSyncDriverMemoryDump(char* buffer, int buffer_size) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 74 | if (on_driver_memory_dump_internal_callback) { |
| 75 | on_driver_memory_dump_internal_callback(buffer, buffer_size); |
| 76 | } |
Roshan Pius | cdb77f3 | 2016-10-03 14:09:57 -0700 | [diff] [blame] | 77 | } |
| 78 | |
| 79 | // Callback to be invoked for firmware dump. |
| 80 | std::function<void(char*, int)> on_firmware_memory_dump_internal_callback; |
Roshan Pius | 091e1c1 | 2017-01-30 16:40:50 -0800 | [diff] [blame] | 81 | void onSyncFirmwareMemoryDump(char* buffer, int buffer_size) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 82 | if (on_firmware_memory_dump_internal_callback) { |
| 83 | on_firmware_memory_dump_internal_callback(buffer, buffer_size); |
| 84 | } |
Roshan Pius | cdb77f3 | 2016-10-03 14:09:57 -0700 | [diff] [blame] | 85 | } |
Roshan Pius | 76ff302 | 2016-10-28 10:33:34 -0700 | [diff] [blame] | 86 | |
| 87 | // Callback to be invoked for Gscan events. |
| 88 | std::function<void(wifi_request_id, wifi_scan_event)> |
| 89 | on_gscan_event_internal_callback; |
Roshan Pius | 091e1c1 | 2017-01-30 16:40:50 -0800 | [diff] [blame] | 90 | void onAsyncGscanEvent(wifi_request_id id, wifi_scan_event event) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 91 | const auto lock = hidl_sync_util::acquireGlobalLock(); |
| 92 | if (on_gscan_event_internal_callback) { |
| 93 | on_gscan_event_internal_callback(id, event); |
| 94 | } |
Roshan Pius | 76ff302 | 2016-10-28 10:33:34 -0700 | [diff] [blame] | 95 | } |
| 96 | |
| 97 | // Callback to be invoked for Gscan full results. |
| 98 | std::function<void(wifi_request_id, wifi_scan_result*, uint32_t)> |
| 99 | on_gscan_full_result_internal_callback; |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 100 | void onAsyncGscanFullResult(wifi_request_id id, wifi_scan_result* result, |
Roshan Pius | 091e1c1 | 2017-01-30 16:40:50 -0800 | [diff] [blame] | 101 | uint32_t buckets_scanned) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 102 | const auto lock = hidl_sync_util::acquireGlobalLock(); |
| 103 | if (on_gscan_full_result_internal_callback) { |
| 104 | on_gscan_full_result_internal_callback(id, result, buckets_scanned); |
| 105 | } |
Roshan Pius | 76ff302 | 2016-10-28 10:33:34 -0700 | [diff] [blame] | 106 | } |
| 107 | |
Roshan Pius | 7cece41 | 2016-10-28 10:38:21 -0700 | [diff] [blame] | 108 | // Callback to be invoked for link layer stats results. |
| 109 | std::function<void((wifi_request_id, wifi_iface_stat*, int, wifi_radio_stat*))> |
| 110 | on_link_layer_stats_result_internal_callback; |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 111 | void onSyncLinkLayerStatsResult(wifi_request_id id, wifi_iface_stat* iface_stat, |
| 112 | int num_radios, wifi_radio_stat* radio_stat) { |
| 113 | if (on_link_layer_stats_result_internal_callback) { |
| 114 | on_link_layer_stats_result_internal_callback(id, iface_stat, num_radios, |
| 115 | radio_stat); |
| 116 | } |
Roshan Pius | 7cece41 | 2016-10-28 10:38:21 -0700 | [diff] [blame] | 117 | } |
| 118 | |
Roshan Pius | d476754 | 2016-12-06 10:04:05 -0800 | [diff] [blame] | 119 | // Callback to be invoked for rssi threshold breach. |
| 120 | std::function<void((wifi_request_id, uint8_t*, int8_t))> |
| 121 | on_rssi_threshold_breached_internal_callback; |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 122 | void onAsyncRssiThresholdBreached(wifi_request_id id, uint8_t* bssid, |
Roshan Pius | 091e1c1 | 2017-01-30 16:40:50 -0800 | [diff] [blame] | 123 | int8_t rssi) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 124 | const auto lock = hidl_sync_util::acquireGlobalLock(); |
| 125 | if (on_rssi_threshold_breached_internal_callback) { |
| 126 | on_rssi_threshold_breached_internal_callback(id, bssid, rssi); |
| 127 | } |
Roshan Pius | d476754 | 2016-12-06 10:04:05 -0800 | [diff] [blame] | 128 | } |
| 129 | |
Roshan Pius | 8714a3e | 2016-10-28 10:43:51 -0700 | [diff] [blame] | 130 | // Callback to be invoked for ring buffer data indication. |
| 131 | std::function<void(char*, char*, int, wifi_ring_buffer_status*)> |
| 132 | on_ring_buffer_data_internal_callback; |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 133 | void onAsyncRingBufferData(char* ring_name, char* buffer, int buffer_size, |
Roshan Pius | 091e1c1 | 2017-01-30 16:40:50 -0800 | [diff] [blame] | 134 | wifi_ring_buffer_status* status) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 135 | const auto lock = hidl_sync_util::acquireGlobalLock(); |
| 136 | if (on_ring_buffer_data_internal_callback) { |
| 137 | on_ring_buffer_data_internal_callback(ring_name, buffer, buffer_size, |
| 138 | status); |
| 139 | } |
Roshan Pius | 8714a3e | 2016-10-28 10:43:51 -0700 | [diff] [blame] | 140 | } |
| 141 | |
Roshan Pius | 203cb03 | 2016-12-14 17:41:20 -0800 | [diff] [blame] | 142 | // Callback to be invoked for error alert indication. |
| 143 | std::function<void(wifi_request_id, char*, int, int)> |
| 144 | on_error_alert_internal_callback; |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 145 | void onAsyncErrorAlert(wifi_request_id id, char* buffer, int buffer_size, |
Roshan Pius | 091e1c1 | 2017-01-30 16:40:50 -0800 | [diff] [blame] | 146 | int err_code) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 147 | const auto lock = hidl_sync_util::acquireGlobalLock(); |
| 148 | if (on_error_alert_internal_callback) { |
| 149 | on_error_alert_internal_callback(id, buffer, buffer_size, err_code); |
| 150 | } |
Roshan Pius | 203cb03 | 2016-12-14 17:41:20 -0800 | [diff] [blame] | 151 | } |
| 152 | |
Roshan Pius | 01f0877 | 2018-01-22 17:56:06 -0800 | [diff] [blame] | 153 | // Callback to be invoked for radio mode change indication. |
| 154 | std::function<void(wifi_request_id, uint32_t, wifi_mac_info*)> |
| 155 | on_radio_mode_change_internal_callback; |
| 156 | void onAsyncRadioModeChange(wifi_request_id id, uint32_t num_macs, |
| 157 | wifi_mac_info* mac_infos) { |
| 158 | const auto lock = hidl_sync_util::acquireGlobalLock(); |
| 159 | if (on_radio_mode_change_internal_callback) { |
| 160 | on_radio_mode_change_internal_callback(id, num_macs, mac_infos); |
| 161 | } |
| 162 | } |
| 163 | |
Roshan Pius | d8e915a | 2016-10-28 11:23:11 -0700 | [diff] [blame] | 164 | // Callback to be invoked for rtt results results. |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 165 | std::function<void(wifi_request_id, unsigned num_results, |
| 166 | wifi_rtt_result* rtt_results[])> |
Roshan Pius | d8e915a | 2016-10-28 11:23:11 -0700 | [diff] [blame] | 167 | on_rtt_results_internal_callback; |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 168 | void onAsyncRttResults(wifi_request_id id, unsigned num_results, |
Roshan Pius | 091e1c1 | 2017-01-30 16:40:50 -0800 | [diff] [blame] | 169 | wifi_rtt_result* rtt_results[]) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 170 | const auto lock = hidl_sync_util::acquireGlobalLock(); |
| 171 | if (on_rtt_results_internal_callback) { |
| 172 | on_rtt_results_internal_callback(id, num_results, rtt_results); |
| 173 | on_rtt_results_internal_callback = nullptr; |
| 174 | } |
Roshan Pius | d8e915a | 2016-10-28 11:23:11 -0700 | [diff] [blame] | 175 | } |
| 176 | |
Roshan Pius | 2301209 | 2016-10-28 11:27:40 -0700 | [diff] [blame] | 177 | // Callbacks for the various NAN operations. |
| 178 | // NOTE: These have very little conversions to perform before invoking the user |
| 179 | // callbacks. |
| 180 | // So, handle all of them here directly to avoid adding an unnecessary layer. |
| 181 | std::function<void(transaction_id, const NanResponseMsg&)> |
| 182 | on_nan_notify_response_user_callback; |
Roshan Pius | 091e1c1 | 2017-01-30 16:40:50 -0800 | [diff] [blame] | 183 | void onAysncNanNotifyResponse(transaction_id id, NanResponseMsg* msg) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 184 | const auto lock = hidl_sync_util::acquireGlobalLock(); |
| 185 | if (on_nan_notify_response_user_callback && msg) { |
| 186 | on_nan_notify_response_user_callback(id, *msg); |
| 187 | } |
Roshan Pius | 2301209 | 2016-10-28 11:27:40 -0700 | [diff] [blame] | 188 | } |
| 189 | |
Etan Cohen | 20925b0 | 2017-04-04 13:00:14 -0700 | [diff] [blame] | 190 | std::function<void(const NanPublishRepliedInd&)> |
| 191 | on_nan_event_publish_replied_user_callback; |
| 192 | void onAysncNanEventPublishReplied(NanPublishRepliedInd* /* event */) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 193 | LOG(ERROR) << "onAysncNanEventPublishReplied triggered"; |
Etan Cohen | 20925b0 | 2017-04-04 13:00:14 -0700 | [diff] [blame] | 194 | } |
| 195 | |
Roshan Pius | 2301209 | 2016-10-28 11:27:40 -0700 | [diff] [blame] | 196 | std::function<void(const NanPublishTerminatedInd&)> |
| 197 | on_nan_event_publish_terminated_user_callback; |
Roshan Pius | 091e1c1 | 2017-01-30 16:40:50 -0800 | [diff] [blame] | 198 | void onAysncNanEventPublishTerminated(NanPublishTerminatedInd* event) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 199 | const auto lock = hidl_sync_util::acquireGlobalLock(); |
| 200 | if (on_nan_event_publish_terminated_user_callback && event) { |
| 201 | on_nan_event_publish_terminated_user_callback(*event); |
| 202 | } |
Roshan Pius | 2301209 | 2016-10-28 11:27:40 -0700 | [diff] [blame] | 203 | } |
| 204 | |
| 205 | std::function<void(const NanMatchInd&)> on_nan_event_match_user_callback; |
Roshan Pius | 091e1c1 | 2017-01-30 16:40:50 -0800 | [diff] [blame] | 206 | void onAysncNanEventMatch(NanMatchInd* event) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 207 | const auto lock = hidl_sync_util::acquireGlobalLock(); |
| 208 | if (on_nan_event_match_user_callback && event) { |
| 209 | on_nan_event_match_user_callback(*event); |
| 210 | } |
Roshan Pius | 2301209 | 2016-10-28 11:27:40 -0700 | [diff] [blame] | 211 | } |
| 212 | |
| 213 | std::function<void(const NanMatchExpiredInd&)> |
| 214 | on_nan_event_match_expired_user_callback; |
Roshan Pius | 091e1c1 | 2017-01-30 16:40:50 -0800 | [diff] [blame] | 215 | void onAysncNanEventMatchExpired(NanMatchExpiredInd* event) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 216 | const auto lock = hidl_sync_util::acquireGlobalLock(); |
| 217 | if (on_nan_event_match_expired_user_callback && event) { |
| 218 | on_nan_event_match_expired_user_callback(*event); |
| 219 | } |
Roshan Pius | 2301209 | 2016-10-28 11:27:40 -0700 | [diff] [blame] | 220 | } |
| 221 | |
| 222 | std::function<void(const NanSubscribeTerminatedInd&)> |
| 223 | on_nan_event_subscribe_terminated_user_callback; |
Roshan Pius | 091e1c1 | 2017-01-30 16:40:50 -0800 | [diff] [blame] | 224 | void onAysncNanEventSubscribeTerminated(NanSubscribeTerminatedInd* event) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 225 | const auto lock = hidl_sync_util::acquireGlobalLock(); |
| 226 | if (on_nan_event_subscribe_terminated_user_callback && event) { |
| 227 | on_nan_event_subscribe_terminated_user_callback(*event); |
| 228 | } |
Roshan Pius | 2301209 | 2016-10-28 11:27:40 -0700 | [diff] [blame] | 229 | } |
| 230 | |
| 231 | std::function<void(const NanFollowupInd&)> on_nan_event_followup_user_callback; |
Roshan Pius | 091e1c1 | 2017-01-30 16:40:50 -0800 | [diff] [blame] | 232 | void onAysncNanEventFollowup(NanFollowupInd* event) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 233 | const auto lock = hidl_sync_util::acquireGlobalLock(); |
| 234 | if (on_nan_event_followup_user_callback && event) { |
| 235 | on_nan_event_followup_user_callback(*event); |
| 236 | } |
Roshan Pius | 2301209 | 2016-10-28 11:27:40 -0700 | [diff] [blame] | 237 | } |
| 238 | |
| 239 | std::function<void(const NanDiscEngEventInd&)> |
| 240 | on_nan_event_disc_eng_event_user_callback; |
Roshan Pius | 091e1c1 | 2017-01-30 16:40:50 -0800 | [diff] [blame] | 241 | void onAysncNanEventDiscEngEvent(NanDiscEngEventInd* event) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 242 | const auto lock = hidl_sync_util::acquireGlobalLock(); |
| 243 | if (on_nan_event_disc_eng_event_user_callback && event) { |
| 244 | on_nan_event_disc_eng_event_user_callback(*event); |
| 245 | } |
Roshan Pius | 2301209 | 2016-10-28 11:27:40 -0700 | [diff] [blame] | 246 | } |
| 247 | |
| 248 | std::function<void(const NanDisabledInd&)> on_nan_event_disabled_user_callback; |
Roshan Pius | 091e1c1 | 2017-01-30 16:40:50 -0800 | [diff] [blame] | 249 | void onAysncNanEventDisabled(NanDisabledInd* event) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 250 | const auto lock = hidl_sync_util::acquireGlobalLock(); |
| 251 | if (on_nan_event_disabled_user_callback && event) { |
| 252 | on_nan_event_disabled_user_callback(*event); |
| 253 | } |
Roshan Pius | 2301209 | 2016-10-28 11:27:40 -0700 | [diff] [blame] | 254 | } |
| 255 | |
| 256 | std::function<void(const NanTCAInd&)> on_nan_event_tca_user_callback; |
Roshan Pius | 091e1c1 | 2017-01-30 16:40:50 -0800 | [diff] [blame] | 257 | void onAysncNanEventTca(NanTCAInd* event) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 258 | const auto lock = hidl_sync_util::acquireGlobalLock(); |
| 259 | if (on_nan_event_tca_user_callback && event) { |
| 260 | on_nan_event_tca_user_callback(*event); |
| 261 | } |
Roshan Pius | 2301209 | 2016-10-28 11:27:40 -0700 | [diff] [blame] | 262 | } |
| 263 | |
| 264 | std::function<void(const NanBeaconSdfPayloadInd&)> |
| 265 | on_nan_event_beacon_sdf_payload_user_callback; |
Roshan Pius | 091e1c1 | 2017-01-30 16:40:50 -0800 | [diff] [blame] | 266 | void onAysncNanEventBeaconSdfPayload(NanBeaconSdfPayloadInd* event) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 267 | const auto lock = hidl_sync_util::acquireGlobalLock(); |
| 268 | if (on_nan_event_beacon_sdf_payload_user_callback && event) { |
| 269 | on_nan_event_beacon_sdf_payload_user_callback(*event); |
| 270 | } |
Roshan Pius | 2301209 | 2016-10-28 11:27:40 -0700 | [diff] [blame] | 271 | } |
| 272 | |
| 273 | std::function<void(const NanDataPathRequestInd&)> |
| 274 | on_nan_event_data_path_request_user_callback; |
Roshan Pius | 091e1c1 | 2017-01-30 16:40:50 -0800 | [diff] [blame] | 275 | void onAysncNanEventDataPathRequest(NanDataPathRequestInd* event) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 276 | const auto lock = hidl_sync_util::acquireGlobalLock(); |
| 277 | if (on_nan_event_data_path_request_user_callback && event) { |
| 278 | on_nan_event_data_path_request_user_callback(*event); |
| 279 | } |
Roshan Pius | 2301209 | 2016-10-28 11:27:40 -0700 | [diff] [blame] | 280 | } |
| 281 | std::function<void(const NanDataPathConfirmInd&)> |
| 282 | on_nan_event_data_path_confirm_user_callback; |
Roshan Pius | 091e1c1 | 2017-01-30 16:40:50 -0800 | [diff] [blame] | 283 | void onAysncNanEventDataPathConfirm(NanDataPathConfirmInd* event) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 284 | const auto lock = hidl_sync_util::acquireGlobalLock(); |
| 285 | if (on_nan_event_data_path_confirm_user_callback && event) { |
| 286 | on_nan_event_data_path_confirm_user_callback(*event); |
| 287 | } |
Roshan Pius | 2301209 | 2016-10-28 11:27:40 -0700 | [diff] [blame] | 288 | } |
| 289 | |
| 290 | std::function<void(const NanDataPathEndInd&)> |
| 291 | on_nan_event_data_path_end_user_callback; |
Roshan Pius | 091e1c1 | 2017-01-30 16:40:50 -0800 | [diff] [blame] | 292 | void onAysncNanEventDataPathEnd(NanDataPathEndInd* event) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 293 | const auto lock = hidl_sync_util::acquireGlobalLock(); |
| 294 | if (on_nan_event_data_path_end_user_callback && event) { |
| 295 | on_nan_event_data_path_end_user_callback(*event); |
| 296 | } |
Roshan Pius | 2301209 | 2016-10-28 11:27:40 -0700 | [diff] [blame] | 297 | } |
| 298 | |
| 299 | std::function<void(const NanTransmitFollowupInd&)> |
| 300 | on_nan_event_transmit_follow_up_user_callback; |
Roshan Pius | 091e1c1 | 2017-01-30 16:40:50 -0800 | [diff] [blame] | 301 | void onAysncNanEventTransmitFollowUp(NanTransmitFollowupInd* event) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 302 | const auto lock = hidl_sync_util::acquireGlobalLock(); |
| 303 | if (on_nan_event_transmit_follow_up_user_callback && event) { |
| 304 | on_nan_event_transmit_follow_up_user_callback(*event); |
| 305 | } |
Roshan Pius | 2301209 | 2016-10-28 11:27:40 -0700 | [diff] [blame] | 306 | } |
Etan Cohen | c190f93 | 2017-02-17 13:06:55 -0800 | [diff] [blame] | 307 | |
| 308 | std::function<void(const NanRangeRequestInd&)> |
| 309 | on_nan_event_range_request_user_callback; |
| 310 | void onAysncNanEventRangeRequest(NanRangeRequestInd* event) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 311 | const auto lock = hidl_sync_util::acquireGlobalLock(); |
| 312 | if (on_nan_event_range_request_user_callback && event) { |
| 313 | on_nan_event_range_request_user_callback(*event); |
| 314 | } |
Etan Cohen | c190f93 | 2017-02-17 13:06:55 -0800 | [diff] [blame] | 315 | } |
| 316 | |
| 317 | std::function<void(const NanRangeReportInd&)> |
| 318 | on_nan_event_range_report_user_callback; |
| 319 | void onAysncNanEventRangeReport(NanRangeReportInd* event) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 320 | const auto lock = hidl_sync_util::acquireGlobalLock(); |
| 321 | if (on_nan_event_range_report_user_callback && event) { |
| 322 | on_nan_event_range_report_user_callback(*event); |
| 323 | } |
Etan Cohen | c190f93 | 2017-02-17 13:06:55 -0800 | [diff] [blame] | 324 | } |
Etan Cohen | 1bf15f1 | 2017-12-12 16:15:16 -0800 | [diff] [blame] | 325 | |
| 326 | std::function<void(const NanDataPathScheduleUpdateInd&)> |
| 327 | on_nan_event_schedule_update_user_callback; |
| 328 | void onAsyncNanEventScheduleUpdate(NanDataPathScheduleUpdateInd* event) { |
| 329 | const auto lock = hidl_sync_util::acquireGlobalLock(); |
| 330 | if (on_nan_event_schedule_update_user_callback && event) { |
| 331 | on_nan_event_schedule_update_user_callback(*event); |
| 332 | } |
| 333 | } |
Roshan Pius | 955542e | 2016-10-28 09:42:44 -0700 | [diff] [blame] | 334 | // End of the free-standing "C" style callbacks. |
Roshan Pius | aabe575 | 2016-09-29 09:03:59 -0700 | [diff] [blame] | 335 | |
Roshan Pius | aabe575 | 2016-09-29 09:03:59 -0700 | [diff] [blame] | 336 | WifiLegacyHal::WifiLegacyHal() |
| 337 | : global_handle_(nullptr), |
Roshan Pius | 11f9303 | 2016-12-09 10:26:17 -0800 | [diff] [blame] | 338 | awaiting_event_loop_termination_(false), |
| 339 | is_started_(false) {} |
Roshan Pius | aabe575 | 2016-09-29 09:03:59 -0700 | [diff] [blame] | 340 | |
Roshan Pius | 9733411 | 2016-11-18 14:07:54 -0800 | [diff] [blame] | 341 | wifi_error WifiLegacyHal::initialize() { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 342 | LOG(DEBUG) << "Initialize legacy HAL"; |
| 343 | // TODO: Add back the HAL Tool if we need to. All we need from the HAL tool |
| 344 | // for now is this function call which we can directly call. |
| 345 | if (!initHalFuncTableWithStubs(&global_func_table_)) { |
| 346 | LOG(ERROR) |
| 347 | << "Failed to initialize legacy hal function table with stubs"; |
| 348 | return WIFI_ERROR_UNKNOWN; |
| 349 | } |
| 350 | wifi_error status = init_wifi_vendor_hal_func_table(&global_func_table_); |
| 351 | if (status != WIFI_SUCCESS) { |
| 352 | LOG(ERROR) << "Failed to initialize legacy hal function table"; |
| 353 | } |
| 354 | return status; |
Roshan Pius | 9733411 | 2016-11-18 14:07:54 -0800 | [diff] [blame] | 355 | } |
| 356 | |
| 357 | wifi_error WifiLegacyHal::start() { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 358 | // Ensure that we're starting in a good state. |
| 359 | CHECK(global_func_table_.wifi_initialize && !global_handle_ && |
| 360 | iface_name_to_handle_.empty() && !awaiting_event_loop_termination_); |
| 361 | if (is_started_) { |
| 362 | LOG(DEBUG) << "Legacy HAL already started"; |
| 363 | return WIFI_SUCCESS; |
| 364 | } |
Ahmed ElArabawy | c101815 | 2018-03-02 14:35:04 -0800 | [diff] [blame] | 365 | LOG(DEBUG) << "Waiting for the driver ready"; |
| 366 | wifi_error status = global_func_table_.wifi_wait_for_driver_ready(); |
| 367 | if (status == WIFI_ERROR_TIMED_OUT) { |
| 368 | LOG(ERROR) << "Timed out awaiting driver ready"; |
| 369 | return status; |
| 370 | } |
Ahmed ElArabawy | 7153e81 | 2018-06-05 11:09:39 -0700 | [diff] [blame] | 371 | property_set(kDriverPropName, "ok"); |
| 372 | |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 373 | LOG(DEBUG) << "Starting legacy HAL"; |
| 374 | if (!iface_tool_.SetWifiUpState(true)) { |
| 375 | LOG(ERROR) << "Failed to set WiFi interface up"; |
| 376 | return WIFI_ERROR_UNKNOWN; |
| 377 | } |
Ahmed ElArabawy | c101815 | 2018-03-02 14:35:04 -0800 | [diff] [blame] | 378 | status = global_func_table_.wifi_initialize(&global_handle_); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 379 | if (status != WIFI_SUCCESS || !global_handle_) { |
| 380 | LOG(ERROR) << "Failed to retrieve global handle"; |
| 381 | return status; |
| 382 | } |
| 383 | std::thread(&WifiLegacyHal::runEventLoop, this).detach(); |
| 384 | status = retrieveIfaceHandles(); |
| 385 | if (status != WIFI_SUCCESS || iface_name_to_handle_.empty()) { |
| 386 | LOG(ERROR) << "Failed to retrieve wlan interface handle"; |
| 387 | return status; |
| 388 | } |
| 389 | LOG(DEBUG) << "Legacy HAL start complete"; |
| 390 | is_started_ = true; |
Roshan Pius | 11f9303 | 2016-12-09 10:26:17 -0800 | [diff] [blame] | 391 | return WIFI_SUCCESS; |
Roshan Pius | aabe575 | 2016-09-29 09:03:59 -0700 | [diff] [blame] | 392 | } |
| 393 | |
| 394 | wifi_error WifiLegacyHal::stop( |
Roshan Pius | 155344b | 2017-08-11 15:47:42 -0700 | [diff] [blame] | 395 | /* NONNULL */ std::unique_lock<std::recursive_mutex>* lock, |
Roshan Pius | aabe575 | 2016-09-29 09:03:59 -0700 | [diff] [blame] | 396 | const std::function<void()>& on_stop_complete_user_callback) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 397 | if (!is_started_) { |
| 398 | LOG(DEBUG) << "Legacy HAL already stopped"; |
| 399 | on_stop_complete_user_callback(); |
| 400 | return WIFI_SUCCESS; |
| 401 | } |
| 402 | LOG(DEBUG) << "Stopping legacy HAL"; |
| 403 | on_stop_complete_internal_callback = [on_stop_complete_user_callback, |
| 404 | this](wifi_handle handle) { |
| 405 | CHECK_EQ(global_handle_, handle) << "Handle mismatch"; |
| 406 | LOG(INFO) << "Legacy HAL stop complete callback received"; |
| 407 | // Invalidate all the internal pointers now that the HAL is |
| 408 | // stopped. |
| 409 | invalidate(); |
| 410 | iface_tool_.SetWifiUpState(false); |
| 411 | on_stop_complete_user_callback(); |
| 412 | is_started_ = false; |
| 413 | }; |
| 414 | awaiting_event_loop_termination_ = true; |
| 415 | global_func_table_.wifi_cleanup(global_handle_, onAsyncStopComplete); |
| 416 | const auto status = stop_wait_cv_.wait_for( |
| 417 | *lock, std::chrono::milliseconds(kMaxStopCompleteWaitMs), |
| 418 | [this] { return !awaiting_event_loop_termination_; }); |
| 419 | if (!status) { |
| 420 | LOG(ERROR) << "Legacy HAL stop failed or timed out"; |
| 421 | return WIFI_ERROR_UNKNOWN; |
| 422 | } |
| 423 | LOG(DEBUG) << "Legacy HAL stop complete"; |
Roshan Pius | 11f9303 | 2016-12-09 10:26:17 -0800 | [diff] [blame] | 424 | return WIFI_SUCCESS; |
Roshan Pius | aabe575 | 2016-09-29 09:03:59 -0700 | [diff] [blame] | 425 | } |
| 426 | |
Roshan Pius | acededb | 2017-10-06 14:59:26 -0700 | [diff] [blame] | 427 | std::pair<wifi_error, std::string> WifiLegacyHal::getDriverVersion( |
| 428 | const std::string& iface_name) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 429 | std::array<char, kMaxVersionStringLength> buffer; |
| 430 | buffer.fill(0); |
| 431 | wifi_error status = global_func_table_.wifi_get_driver_version( |
| 432 | getIfaceHandle(iface_name), buffer.data(), buffer.size()); |
| 433 | return {status, buffer.data()}; |
Roshan Pius | 4b26c83 | 2016-10-03 12:49:58 -0700 | [diff] [blame] | 434 | } |
| 435 | |
Roshan Pius | acededb | 2017-10-06 14:59:26 -0700 | [diff] [blame] | 436 | std::pair<wifi_error, std::string> WifiLegacyHal::getFirmwareVersion( |
| 437 | const std::string& iface_name) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 438 | std::array<char, kMaxVersionStringLength> buffer; |
| 439 | buffer.fill(0); |
| 440 | wifi_error status = global_func_table_.wifi_get_firmware_version( |
| 441 | getIfaceHandle(iface_name), buffer.data(), buffer.size()); |
| 442 | return {status, buffer.data()}; |
Roshan Pius | 4b26c83 | 2016-10-03 12:49:58 -0700 | [diff] [blame] | 443 | } |
| 444 | |
Roshan Pius | 3c86852 | 2016-10-27 12:43:49 -0700 | [diff] [blame] | 445 | std::pair<wifi_error, std::vector<uint8_t>> |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 446 | WifiLegacyHal::requestDriverMemoryDump(const std::string& iface_name) { |
| 447 | std::vector<uint8_t> driver_dump; |
| 448 | on_driver_memory_dump_internal_callback = [&driver_dump](char* buffer, |
| 449 | int buffer_size) { |
| 450 | driver_dump.insert(driver_dump.end(), |
| 451 | reinterpret_cast<uint8_t*>(buffer), |
| 452 | reinterpret_cast<uint8_t*>(buffer) + buffer_size); |
| 453 | }; |
| 454 | wifi_error status = global_func_table_.wifi_get_driver_memory_dump( |
| 455 | getIfaceHandle(iface_name), {onSyncDriverMemoryDump}); |
| 456 | on_driver_memory_dump_internal_callback = nullptr; |
| 457 | return {status, std::move(driver_dump)}; |
Roshan Pius | cdb77f3 | 2016-10-03 14:09:57 -0700 | [diff] [blame] | 458 | } |
| 459 | |
Roshan Pius | 3c86852 | 2016-10-27 12:43:49 -0700 | [diff] [blame] | 460 | std::pair<wifi_error, std::vector<uint8_t>> |
Roshan Pius | acededb | 2017-10-06 14:59:26 -0700 | [diff] [blame] | 461 | WifiLegacyHal::requestFirmwareMemoryDump(const std::string& iface_name) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 462 | std::vector<uint8_t> firmware_dump; |
| 463 | on_firmware_memory_dump_internal_callback = |
| 464 | [&firmware_dump](char* buffer, int buffer_size) { |
| 465 | firmware_dump.insert( |
| 466 | firmware_dump.end(), reinterpret_cast<uint8_t*>(buffer), |
| 467 | reinterpret_cast<uint8_t*>(buffer) + buffer_size); |
| 468 | }; |
| 469 | wifi_error status = global_func_table_.wifi_get_firmware_memory_dump( |
| 470 | getIfaceHandle(iface_name), {onSyncFirmwareMemoryDump}); |
| 471 | on_firmware_memory_dump_internal_callback = nullptr; |
| 472 | return {status, std::move(firmware_dump)}; |
Roshan Pius | 0a47c18 | 2016-10-28 10:23:00 -0700 | [diff] [blame] | 473 | } |
| 474 | |
Roshan Pius | acededb | 2017-10-06 14:59:26 -0700 | [diff] [blame] | 475 | std::pair<wifi_error, uint32_t> WifiLegacyHal::getSupportedFeatureSet( |
| 476 | const std::string& iface_name) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 477 | feature_set set; |
| 478 | static_assert(sizeof(set) == sizeof(uint32_t), |
Roshan Pius | 200a17d | 2017-11-01 13:03:35 -0700 | [diff] [blame] | 479 | "Some feature_flags can not be represented in output"); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 480 | wifi_error status = global_func_table_.wifi_get_supported_feature_set( |
| 481 | getIfaceHandle(iface_name), &set); |
| 482 | return {status, static_cast<uint32_t>(set)}; |
Roshan Pius | 0a47c18 | 2016-10-28 10:23:00 -0700 | [diff] [blame] | 483 | } |
| 484 | |
| 485 | std::pair<wifi_error, PacketFilterCapabilities> |
Roshan Pius | acededb | 2017-10-06 14:59:26 -0700 | [diff] [blame] | 486 | WifiLegacyHal::getPacketFilterCapabilities(const std::string& iface_name) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 487 | PacketFilterCapabilities caps; |
| 488 | wifi_error status = global_func_table_.wifi_get_packet_filter_capabilities( |
| 489 | getIfaceHandle(iface_name), &caps.version, &caps.max_len); |
| 490 | return {status, caps}; |
Roshan Pius | 0a47c18 | 2016-10-28 10:23:00 -0700 | [diff] [blame] | 491 | } |
| 492 | |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 493 | wifi_error WifiLegacyHal::setPacketFilter(const std::string& iface_name, |
| 494 | const std::vector<uint8_t>& program) { |
| 495 | return global_func_table_.wifi_set_packet_filter( |
| 496 | getIfaceHandle(iface_name), program.data(), program.size()); |
Roshan Pius | cdb77f3 | 2016-10-03 14:09:57 -0700 | [diff] [blame] | 497 | } |
| 498 | |
Bernie Innocenti | 7e6f71a | 2018-03-07 00:17:50 +0900 | [diff] [blame] | 499 | std::pair<wifi_error, std::vector<uint8_t>> |
| 500 | WifiLegacyHal::readApfPacketFilterData(const std::string& iface_name) { |
Bernie Innocenti | 7e6f71a | 2018-03-07 00:17:50 +0900 | [diff] [blame] | 501 | PacketFilterCapabilities caps; |
| 502 | wifi_error status = global_func_table_.wifi_get_packet_filter_capabilities( |
| 503 | getIfaceHandle(iface_name), &caps.version, &caps.max_len); |
| 504 | if (status != WIFI_SUCCESS) { |
| 505 | return {status, {}}; |
| 506 | } |
| 507 | |
| 508 | // Size the buffer to read the entire program & work memory. |
| 509 | std::vector<uint8_t> buffer(caps.max_len); |
| 510 | |
| 511 | status = global_func_table_.wifi_read_packet_filter( |
| 512 | getIfaceHandle(iface_name), /*src_offset=*/0, buffer.data(), |
| 513 | buffer.size()); |
| 514 | return {status, move(buffer)}; |
| 515 | } |
| 516 | |
Roshan Pius | 76ff302 | 2016-10-28 10:33:34 -0700 | [diff] [blame] | 517 | std::pair<wifi_error, wifi_gscan_capabilities> |
Roshan Pius | acededb | 2017-10-06 14:59:26 -0700 | [diff] [blame] | 518 | WifiLegacyHal::getGscanCapabilities(const std::string& iface_name) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 519 | wifi_gscan_capabilities caps; |
| 520 | wifi_error status = global_func_table_.wifi_get_gscan_capabilities( |
| 521 | getIfaceHandle(iface_name), &caps); |
| 522 | return {status, caps}; |
Roshan Pius | 76ff302 | 2016-10-28 10:33:34 -0700 | [diff] [blame] | 523 | } |
| 524 | |
| 525 | wifi_error WifiLegacyHal::startGscan( |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 526 | const std::string& iface_name, wifi_request_id id, |
Roshan Pius | 76ff302 | 2016-10-28 10:33:34 -0700 | [diff] [blame] | 527 | const wifi_scan_cmd_params& params, |
| 528 | const std::function<void(wifi_request_id)>& on_failure_user_callback, |
| 529 | const on_gscan_results_callback& on_results_user_callback, |
| 530 | const on_gscan_full_result_callback& on_full_result_user_callback) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 531 | // If there is already an ongoing background scan, reject new scan requests. |
| 532 | if (on_gscan_event_internal_callback || |
| 533 | on_gscan_full_result_internal_callback) { |
| 534 | return WIFI_ERROR_NOT_AVAILABLE; |
Roshan Pius | 76ff302 | 2016-10-28 10:33:34 -0700 | [diff] [blame] | 535 | } |
Roshan Pius | 76ff302 | 2016-10-28 10:33:34 -0700 | [diff] [blame] | 536 | |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 537 | // This callback will be used to either trigger |on_results_user_callback| |
| 538 | // or |on_failure_user_callback|. |
| 539 | on_gscan_event_internal_callback = |
| 540 | [iface_name, on_failure_user_callback, on_results_user_callback, this]( |
| 541 | wifi_request_id id, wifi_scan_event event) { |
| 542 | switch (event) { |
| 543 | case WIFI_SCAN_RESULTS_AVAILABLE: |
| 544 | case WIFI_SCAN_THRESHOLD_NUM_SCANS: |
| 545 | case WIFI_SCAN_THRESHOLD_PERCENT: { |
| 546 | wifi_error status; |
| 547 | std::vector<wifi_cached_scan_results> cached_scan_results; |
| 548 | std::tie(status, cached_scan_results) = |
| 549 | getGscanCachedResults(iface_name); |
| 550 | if (status == WIFI_SUCCESS) { |
| 551 | on_results_user_callback(id, cached_scan_results); |
| 552 | return; |
| 553 | } |
Tomasz Wasilczyk | b424da7 | 2018-11-15 11:52:57 -0800 | [diff] [blame^] | 554 | FALLTHROUGH_INTENDED; |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 555 | } |
| 556 | // Fall through if failed. Failure to retrieve cached scan |
| 557 | // results should trigger a background scan failure. |
| 558 | case WIFI_SCAN_FAILED: |
| 559 | on_failure_user_callback(id); |
| 560 | on_gscan_event_internal_callback = nullptr; |
| 561 | on_gscan_full_result_internal_callback = nullptr; |
| 562 | return; |
| 563 | } |
| 564 | LOG(FATAL) << "Unexpected gscan event received: " << event; |
| 565 | }; |
| 566 | |
| 567 | on_gscan_full_result_internal_callback = [on_full_result_user_callback]( |
| 568 | wifi_request_id id, |
| 569 | wifi_scan_result* result, |
| 570 | uint32_t buckets_scanned) { |
| 571 | if (result) { |
| 572 | on_full_result_user_callback(id, result, buckets_scanned); |
| 573 | } |
| 574 | }; |
| 575 | |
| 576 | wifi_scan_result_handler handler = {onAsyncGscanFullResult, |
| 577 | onAsyncGscanEvent}; |
| 578 | wifi_error status = global_func_table_.wifi_start_gscan( |
| 579 | id, getIfaceHandle(iface_name), params, handler); |
| 580 | if (status != WIFI_SUCCESS) { |
| 581 | on_gscan_event_internal_callback = nullptr; |
| 582 | on_gscan_full_result_internal_callback = nullptr; |
| 583 | } |
| 584 | return status; |
Roshan Pius | 76ff302 | 2016-10-28 10:33:34 -0700 | [diff] [blame] | 585 | } |
| 586 | |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 587 | wifi_error WifiLegacyHal::stopGscan(const std::string& iface_name, |
| 588 | wifi_request_id id) { |
| 589 | // If there is no an ongoing background scan, reject stop requests. |
| 590 | // TODO(b/32337212): This needs to be handled by the HIDL object because we |
| 591 | // need to return the NOT_STARTED error code. |
| 592 | if (!on_gscan_event_internal_callback && |
| 593 | !on_gscan_full_result_internal_callback) { |
| 594 | return WIFI_ERROR_NOT_AVAILABLE; |
| 595 | } |
| 596 | wifi_error status = |
| 597 | global_func_table_.wifi_stop_gscan(id, getIfaceHandle(iface_name)); |
| 598 | // If the request Id is wrong, don't stop the ongoing background scan. Any |
| 599 | // other error should be treated as the end of background scan. |
| 600 | if (status != WIFI_ERROR_INVALID_REQUEST_ID) { |
| 601 | on_gscan_event_internal_callback = nullptr; |
| 602 | on_gscan_full_result_internal_callback = nullptr; |
| 603 | } |
| 604 | return status; |
Roshan Pius | 76ff302 | 2016-10-28 10:33:34 -0700 | [diff] [blame] | 605 | } |
| 606 | |
| 607 | std::pair<wifi_error, std::vector<uint32_t>> |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 608 | WifiLegacyHal::getValidFrequenciesForBand(const std::string& iface_name, |
| 609 | wifi_band band) { |
| 610 | static_assert(sizeof(uint32_t) >= sizeof(wifi_channel), |
| 611 | "Wifi Channel cannot be represented in output"); |
| 612 | std::vector<uint32_t> freqs; |
| 613 | freqs.resize(kMaxGscanFrequenciesForBand); |
| 614 | int32_t num_freqs = 0; |
| 615 | wifi_error status = global_func_table_.wifi_get_valid_channels( |
| 616 | getIfaceHandle(iface_name), band, freqs.size(), |
| 617 | reinterpret_cast<wifi_channel*>(freqs.data()), &num_freqs); |
| 618 | CHECK(num_freqs >= 0 && |
| 619 | static_cast<uint32_t>(num_freqs) <= kMaxGscanFrequenciesForBand); |
| 620 | freqs.resize(num_freqs); |
| 621 | return {status, std::move(freqs)}; |
Roshan Pius | 76ff302 | 2016-10-28 10:33:34 -0700 | [diff] [blame] | 622 | } |
| 623 | |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 624 | wifi_error WifiLegacyHal::setDfsFlag(const std::string& iface_name, |
| 625 | bool dfs_on) { |
| 626 | return global_func_table_.wifi_set_nodfs_flag(getIfaceHandle(iface_name), |
| 627 | dfs_on ? 0 : 1); |
Roshan Pius | 08d1df4 | 2017-04-19 23:11:07 -0700 | [diff] [blame] | 628 | } |
| 629 | |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 630 | wifi_error WifiLegacyHal::enableLinkLayerStats(const std::string& iface_name, |
| 631 | bool debug) { |
| 632 | wifi_link_layer_params params; |
| 633 | params.mpdu_size_threshold = kLinkLayerStatsDataMpduSizeThreshold; |
| 634 | params.aggressive_statistics_gathering = debug; |
| 635 | return global_func_table_.wifi_set_link_stats(getIfaceHandle(iface_name), |
| 636 | params); |
Roshan Pius | 7cece41 | 2016-10-28 10:38:21 -0700 | [diff] [blame] | 637 | } |
| 638 | |
Roshan Pius | acededb | 2017-10-06 14:59:26 -0700 | [diff] [blame] | 639 | wifi_error WifiLegacyHal::disableLinkLayerStats(const std::string& iface_name) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 640 | // TODO: Do we care about these responses? |
| 641 | uint32_t clear_mask_rsp; |
| 642 | uint8_t stop_rsp; |
| 643 | return global_func_table_.wifi_clear_link_stats( |
| 644 | getIfaceHandle(iface_name), 0xFFFFFFFF, &clear_mask_rsp, 1, &stop_rsp); |
Roshan Pius | 7cece41 | 2016-10-28 10:38:21 -0700 | [diff] [blame] | 645 | } |
| 646 | |
Roshan Pius | acededb | 2017-10-06 14:59:26 -0700 | [diff] [blame] | 647 | std::pair<wifi_error, LinkLayerStats> WifiLegacyHal::getLinkLayerStats( |
| 648 | const std::string& iface_name) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 649 | LinkLayerStats link_stats{}; |
| 650 | LinkLayerStats* link_stats_ptr = &link_stats; |
Roshan Pius | 7cece41 | 2016-10-28 10:38:21 -0700 | [diff] [blame] | 651 | |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 652 | on_link_layer_stats_result_internal_callback = |
| 653 | [&link_stats_ptr](wifi_request_id /* id */, |
| 654 | wifi_iface_stat* iface_stats_ptr, int num_radios, |
| 655 | wifi_radio_stat* radio_stats_ptr) { |
Sunil Ravi | b0343e7 | 2018-11-13 15:52:00 -0800 | [diff] [blame] | 656 | wifi_radio_stat* l_radio_stats_ptr; |
| 657 | |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 658 | if (iface_stats_ptr != nullptr) { |
| 659 | link_stats_ptr->iface = *iface_stats_ptr; |
| 660 | link_stats_ptr->iface.num_peers = 0; |
| 661 | } else { |
| 662 | LOG(ERROR) << "Invalid iface stats in link layer stats"; |
| 663 | } |
| 664 | if (num_radios <= 0 || radio_stats_ptr == nullptr) { |
| 665 | LOG(ERROR) << "Invalid radio stats in link layer stats"; |
| 666 | return; |
| 667 | } |
Sunil Ravi | b0343e7 | 2018-11-13 15:52:00 -0800 | [diff] [blame] | 668 | l_radio_stats_ptr = radio_stats_ptr; |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 669 | for (int i = 0; i < num_radios; i++) { |
| 670 | LinkLayerRadioStats radio; |
Sunil Ravi | b0343e7 | 2018-11-13 15:52:00 -0800 | [diff] [blame] | 671 | |
| 672 | radio.stats = *l_radio_stats_ptr; |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 673 | // Copy over the tx level array to the separate vector. |
Sunil Ravi | b0343e7 | 2018-11-13 15:52:00 -0800 | [diff] [blame] | 674 | if (l_radio_stats_ptr->num_tx_levels > 0 && |
| 675 | l_radio_stats_ptr->tx_time_per_levels != nullptr) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 676 | radio.tx_time_per_levels.assign( |
Sunil Ravi | b0343e7 | 2018-11-13 15:52:00 -0800 | [diff] [blame] | 677 | l_radio_stats_ptr->tx_time_per_levels, |
| 678 | l_radio_stats_ptr->tx_time_per_levels + |
| 679 | l_radio_stats_ptr->num_tx_levels); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 680 | } |
| 681 | radio.stats.num_tx_levels = 0; |
| 682 | radio.stats.tx_time_per_levels = nullptr; |
Sunil Ravi | b0343e7 | 2018-11-13 15:52:00 -0800 | [diff] [blame] | 683 | /* Copy over the channel stat to separate vector */ |
| 684 | if (l_radio_stats_ptr->num_channels > 0) { |
| 685 | /* Copy the channel stats */ |
| 686 | radio.channel_stats.assign( |
| 687 | l_radio_stats_ptr->channels, |
| 688 | l_radio_stats_ptr->channels + |
| 689 | l_radio_stats_ptr->num_channels); |
| 690 | } |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 691 | link_stats_ptr->radios.push_back(radio); |
Sunil Ravi | b0343e7 | 2018-11-13 15:52:00 -0800 | [diff] [blame] | 692 | l_radio_stats_ptr = |
| 693 | (wifi_radio_stat*)((u8*)l_radio_stats_ptr + |
| 694 | sizeof(wifi_radio_stat) + |
| 695 | (sizeof(wifi_channel_stat) * |
| 696 | l_radio_stats_ptr->num_channels)); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 697 | } |
| 698 | }; |
Roshan Pius | 7cece41 | 2016-10-28 10:38:21 -0700 | [diff] [blame] | 699 | |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 700 | wifi_error status = global_func_table_.wifi_get_link_stats( |
| 701 | 0, getIfaceHandle(iface_name), {onSyncLinkLayerStatsResult}); |
| 702 | on_link_layer_stats_result_internal_callback = nullptr; |
| 703 | return {status, link_stats}; |
Roshan Pius | 7cece41 | 2016-10-28 10:38:21 -0700 | [diff] [blame] | 704 | } |
| 705 | |
Roshan Pius | d476754 | 2016-12-06 10:04:05 -0800 | [diff] [blame] | 706 | wifi_error WifiLegacyHal::startRssiMonitoring( |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 707 | const std::string& iface_name, wifi_request_id id, int8_t max_rssi, |
Roshan Pius | d476754 | 2016-12-06 10:04:05 -0800 | [diff] [blame] | 708 | int8_t min_rssi, |
| 709 | const on_rssi_threshold_breached_callback& |
| 710 | on_threshold_breached_user_callback) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 711 | if (on_rssi_threshold_breached_internal_callback) { |
| 712 | return WIFI_ERROR_NOT_AVAILABLE; |
| 713 | } |
| 714 | on_rssi_threshold_breached_internal_callback = |
| 715 | [on_threshold_breached_user_callback](wifi_request_id id, |
| 716 | uint8_t* bssid_ptr, int8_t rssi) { |
| 717 | if (!bssid_ptr) { |
| 718 | return; |
| 719 | } |
| 720 | std::array<uint8_t, 6> bssid_arr; |
| 721 | // |bssid_ptr| pointer is assumed to have 6 bytes for the mac |
| 722 | // address. |
| 723 | std::copy(bssid_ptr, bssid_ptr + 6, std::begin(bssid_arr)); |
| 724 | on_threshold_breached_user_callback(id, bssid_arr, rssi); |
| 725 | }; |
| 726 | wifi_error status = global_func_table_.wifi_start_rssi_monitoring( |
| 727 | id, getIfaceHandle(iface_name), max_rssi, min_rssi, |
| 728 | {onAsyncRssiThresholdBreached}); |
| 729 | if (status != WIFI_SUCCESS) { |
| 730 | on_rssi_threshold_breached_internal_callback = nullptr; |
| 731 | } |
| 732 | return status; |
Roshan Pius | d476754 | 2016-12-06 10:04:05 -0800 | [diff] [blame] | 733 | } |
| 734 | |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 735 | wifi_error WifiLegacyHal::stopRssiMonitoring(const std::string& iface_name, |
| 736 | wifi_request_id id) { |
| 737 | if (!on_rssi_threshold_breached_internal_callback) { |
| 738 | return WIFI_ERROR_NOT_AVAILABLE; |
| 739 | } |
| 740 | wifi_error status = global_func_table_.wifi_stop_rssi_monitoring( |
| 741 | id, getIfaceHandle(iface_name)); |
| 742 | // If the request Id is wrong, don't stop the ongoing rssi monitoring. Any |
| 743 | // other error should be treated as the end of background scan. |
| 744 | if (status != WIFI_ERROR_INVALID_REQUEST_ID) { |
| 745 | on_rssi_threshold_breached_internal_callback = nullptr; |
| 746 | } |
| 747 | return status; |
Roshan Pius | d476754 | 2016-12-06 10:04:05 -0800 | [diff] [blame] | 748 | } |
| 749 | |
Roshan Pius | 26801cb | 2016-12-13 14:25:45 -0800 | [diff] [blame] | 750 | std::pair<wifi_error, wifi_roaming_capabilities> |
Roshan Pius | acededb | 2017-10-06 14:59:26 -0700 | [diff] [blame] | 751 | WifiLegacyHal::getRoamingCapabilities(const std::string& iface_name) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 752 | wifi_roaming_capabilities caps; |
| 753 | wifi_error status = global_func_table_.wifi_get_roaming_capabilities( |
| 754 | getIfaceHandle(iface_name), &caps); |
| 755 | return {status, caps}; |
Roshan Pius | 26801cb | 2016-12-13 14:25:45 -0800 | [diff] [blame] | 756 | } |
| 757 | |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 758 | wifi_error WifiLegacyHal::configureRoaming(const std::string& iface_name, |
| 759 | const wifi_roaming_config& config) { |
| 760 | wifi_roaming_config config_internal = config; |
| 761 | return global_func_table_.wifi_configure_roaming(getIfaceHandle(iface_name), |
| 762 | &config_internal); |
Roshan Pius | af727c0 | 2017-01-11 15:37:25 -0800 | [diff] [blame] | 763 | } |
| 764 | |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 765 | wifi_error WifiLegacyHal::enableFirmwareRoaming(const std::string& iface_name, |
| 766 | fw_roaming_state_t state) { |
| 767 | return global_func_table_.wifi_enable_firmware_roaming( |
| 768 | getIfaceHandle(iface_name), state); |
Roshan Pius | 26801cb | 2016-12-13 14:25:45 -0800 | [diff] [blame] | 769 | } |
| 770 | |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 771 | wifi_error WifiLegacyHal::configureNdOffload(const std::string& iface_name, |
| 772 | bool enable) { |
| 773 | return global_func_table_.wifi_configure_nd_offload( |
| 774 | getIfaceHandle(iface_name), enable); |
Roshan Pius | 26801cb | 2016-12-13 14:25:45 -0800 | [diff] [blame] | 775 | } |
| 776 | |
Roshan Pius | 9a9869a | 2017-01-11 16:42:16 -0800 | [diff] [blame] | 777 | wifi_error WifiLegacyHal::startSendingOffloadedPacket( |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 778 | const std::string& iface_name, uint32_t cmd_id, |
Roshan Pius | 9a9869a | 2017-01-11 16:42:16 -0800 | [diff] [blame] | 779 | const std::vector<uint8_t>& ip_packet_data, |
| 780 | const std::array<uint8_t, 6>& src_address, |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 781 | const std::array<uint8_t, 6>& dst_address, uint32_t period_in_ms) { |
| 782 | std::vector<uint8_t> ip_packet_data_internal(ip_packet_data); |
| 783 | std::vector<uint8_t> src_address_internal( |
| 784 | src_address.data(), src_address.data() + src_address.size()); |
| 785 | std::vector<uint8_t> dst_address_internal( |
| 786 | dst_address.data(), dst_address.data() + dst_address.size()); |
| 787 | return global_func_table_.wifi_start_sending_offloaded_packet( |
| 788 | cmd_id, getIfaceHandle(iface_name), ip_packet_data_internal.data(), |
| 789 | ip_packet_data_internal.size(), src_address_internal.data(), |
| 790 | dst_address_internal.data(), period_in_ms); |
Roshan Pius | 9a9869a | 2017-01-11 16:42:16 -0800 | [diff] [blame] | 791 | } |
| 792 | |
Roshan Pius | acededb | 2017-10-06 14:59:26 -0700 | [diff] [blame] | 793 | wifi_error WifiLegacyHal::stopSendingOffloadedPacket( |
| 794 | const std::string& iface_name, uint32_t cmd_id) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 795 | return global_func_table_.wifi_stop_sending_offloaded_packet( |
| 796 | cmd_id, getIfaceHandle(iface_name)); |
Roshan Pius | 9a9869a | 2017-01-11 16:42:16 -0800 | [diff] [blame] | 797 | } |
| 798 | |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 799 | wifi_error WifiLegacyHal::setScanningMacOui(const std::string& iface_name, |
| 800 | const std::array<uint8_t, 3>& oui) { |
| 801 | std::vector<uint8_t> oui_internal(oui.data(), oui.data() + oui.size()); |
| 802 | return global_func_table_.wifi_set_scanning_mac_oui( |
| 803 | getIfaceHandle(iface_name), oui_internal.data()); |
Roshan Pius | 795bb81 | 2017-02-01 13:09:08 -0800 | [diff] [blame] | 804 | } |
| 805 | |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 806 | wifi_error WifiLegacyHal::selectTxPowerScenario(const std::string& iface_name, |
| 807 | wifi_power_scenario scenario) { |
| 808 | return global_func_table_.wifi_select_tx_power_scenario( |
| 809 | getIfaceHandle(iface_name), scenario); |
Roshan Pius | 8184d21 | 2017-07-11 08:59:29 -0700 | [diff] [blame] | 810 | } |
| 811 | |
Roshan Pius | acededb | 2017-10-06 14:59:26 -0700 | [diff] [blame] | 812 | wifi_error WifiLegacyHal::resetTxPowerScenario(const std::string& iface_name) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 813 | return global_func_table_.wifi_reset_tx_power_scenario( |
| 814 | getIfaceHandle(iface_name)); |
Roshan Pius | 8184d21 | 2017-07-11 08:59:29 -0700 | [diff] [blame] | 815 | } |
| 816 | |
Ahmed ElArabawy | eaf8240 | 2018-10-26 09:46:04 -0700 | [diff] [blame] | 817 | wifi_error WifiLegacyHal::setLatencyMode(const std::string& iface_name, |
| 818 | wifi_latency_mode mode) { |
| 819 | return global_func_table_.wifi_set_latency_mode(getIfaceHandle(iface_name), |
| 820 | mode); |
| 821 | } |
| 822 | |
Roshan Pius | acededb | 2017-10-06 14:59:26 -0700 | [diff] [blame] | 823 | std::pair<wifi_error, uint32_t> WifiLegacyHal::getLoggerSupportedFeatureSet( |
| 824 | const std::string& iface_name) { |
Roshan Pius | 200a17d | 2017-11-01 13:03:35 -0700 | [diff] [blame] | 825 | uint32_t supported_feature_flags; |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 826 | wifi_error status = |
| 827 | global_func_table_.wifi_get_logger_supported_feature_set( |
Roshan Pius | 200a17d | 2017-11-01 13:03:35 -0700 | [diff] [blame] | 828 | getIfaceHandle(iface_name), &supported_feature_flags); |
| 829 | return {status, supported_feature_flags}; |
Roshan Pius | 8714a3e | 2016-10-28 10:43:51 -0700 | [diff] [blame] | 830 | } |
| 831 | |
Roshan Pius | acededb | 2017-10-06 14:59:26 -0700 | [diff] [blame] | 832 | wifi_error WifiLegacyHal::startPktFateMonitoring( |
| 833 | const std::string& iface_name) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 834 | return global_func_table_.wifi_start_pkt_fate_monitoring( |
| 835 | getIfaceHandle(iface_name)); |
Roshan Pius | 8714a3e | 2016-10-28 10:43:51 -0700 | [diff] [blame] | 836 | } |
| 837 | |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 838 | std::pair<wifi_error, std::vector<wifi_tx_report>> WifiLegacyHal::getTxPktFates( |
| 839 | const std::string& iface_name) { |
| 840 | std::vector<wifi_tx_report> tx_pkt_fates; |
| 841 | tx_pkt_fates.resize(MAX_FATE_LOG_LEN); |
| 842 | size_t num_fates = 0; |
| 843 | wifi_error status = global_func_table_.wifi_get_tx_pkt_fates( |
| 844 | getIfaceHandle(iface_name), tx_pkt_fates.data(), tx_pkt_fates.size(), |
| 845 | &num_fates); |
| 846 | CHECK(num_fates <= MAX_FATE_LOG_LEN); |
| 847 | tx_pkt_fates.resize(num_fates); |
| 848 | return {status, std::move(tx_pkt_fates)}; |
Roshan Pius | 8714a3e | 2016-10-28 10:43:51 -0700 | [diff] [blame] | 849 | } |
| 850 | |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 851 | std::pair<wifi_error, std::vector<wifi_rx_report>> WifiLegacyHal::getRxPktFates( |
| 852 | const std::string& iface_name) { |
| 853 | std::vector<wifi_rx_report> rx_pkt_fates; |
| 854 | rx_pkt_fates.resize(MAX_FATE_LOG_LEN); |
| 855 | size_t num_fates = 0; |
| 856 | wifi_error status = global_func_table_.wifi_get_rx_pkt_fates( |
| 857 | getIfaceHandle(iface_name), rx_pkt_fates.data(), rx_pkt_fates.size(), |
| 858 | &num_fates); |
| 859 | CHECK(num_fates <= MAX_FATE_LOG_LEN); |
| 860 | rx_pkt_fates.resize(num_fates); |
| 861 | return {status, std::move(rx_pkt_fates)}; |
Roshan Pius | 8714a3e | 2016-10-28 10:43:51 -0700 | [diff] [blame] | 862 | } |
| 863 | |
Roshan Pius | acededb | 2017-10-06 14:59:26 -0700 | [diff] [blame] | 864 | std::pair<wifi_error, WakeReasonStats> WifiLegacyHal::getWakeReasonStats( |
| 865 | const std::string& iface_name) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 866 | WakeReasonStats stats; |
| 867 | stats.cmd_event_wake_cnt.resize(kMaxWakeReasonStatsArraySize); |
| 868 | stats.driver_fw_local_wake_cnt.resize(kMaxWakeReasonStatsArraySize); |
Roshan Pius | 8714a3e | 2016-10-28 10:43:51 -0700 | [diff] [blame] | 869 | |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 870 | // This legacy struct needs separate memory to store the variable sized wake |
| 871 | // reason types. |
| 872 | stats.wake_reason_cnt.cmd_event_wake_cnt = |
| 873 | reinterpret_cast<int32_t*>(stats.cmd_event_wake_cnt.data()); |
| 874 | stats.wake_reason_cnt.cmd_event_wake_cnt_sz = |
| 875 | stats.cmd_event_wake_cnt.size(); |
| 876 | stats.wake_reason_cnt.cmd_event_wake_cnt_used = 0; |
| 877 | stats.wake_reason_cnt.driver_fw_local_wake_cnt = |
| 878 | reinterpret_cast<int32_t*>(stats.driver_fw_local_wake_cnt.data()); |
| 879 | stats.wake_reason_cnt.driver_fw_local_wake_cnt_sz = |
| 880 | stats.driver_fw_local_wake_cnt.size(); |
| 881 | stats.wake_reason_cnt.driver_fw_local_wake_cnt_used = 0; |
Roshan Pius | 8714a3e | 2016-10-28 10:43:51 -0700 | [diff] [blame] | 882 | |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 883 | wifi_error status = global_func_table_.wifi_get_wake_reason_stats( |
| 884 | getIfaceHandle(iface_name), &stats.wake_reason_cnt); |
Roshan Pius | 8714a3e | 2016-10-28 10:43:51 -0700 | [diff] [blame] | 885 | |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 886 | CHECK( |
| 887 | stats.wake_reason_cnt.cmd_event_wake_cnt_used >= 0 && |
Roshan Pius | 8714a3e | 2016-10-28 10:43:51 -0700 | [diff] [blame] | 888 | static_cast<uint32_t>(stats.wake_reason_cnt.cmd_event_wake_cnt_used) <= |
| 889 | kMaxWakeReasonStatsArraySize); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 890 | stats.cmd_event_wake_cnt.resize( |
| 891 | stats.wake_reason_cnt.cmd_event_wake_cnt_used); |
| 892 | stats.wake_reason_cnt.cmd_event_wake_cnt = nullptr; |
Roshan Pius | 8714a3e | 2016-10-28 10:43:51 -0700 | [diff] [blame] | 893 | |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 894 | CHECK(stats.wake_reason_cnt.driver_fw_local_wake_cnt_used >= 0 && |
| 895 | static_cast<uint32_t>( |
| 896 | stats.wake_reason_cnt.driver_fw_local_wake_cnt_used) <= |
| 897 | kMaxWakeReasonStatsArraySize); |
| 898 | stats.driver_fw_local_wake_cnt.resize( |
| 899 | stats.wake_reason_cnt.driver_fw_local_wake_cnt_used); |
| 900 | stats.wake_reason_cnt.driver_fw_local_wake_cnt = nullptr; |
Roshan Pius | 8714a3e | 2016-10-28 10:43:51 -0700 | [diff] [blame] | 901 | |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 902 | return {status, stats}; |
Roshan Pius | 8714a3e | 2016-10-28 10:43:51 -0700 | [diff] [blame] | 903 | } |
| 904 | |
| 905 | wifi_error WifiLegacyHal::registerRingBufferCallbackHandler( |
Roshan Pius | acededb | 2017-10-06 14:59:26 -0700 | [diff] [blame] | 906 | const std::string& iface_name, |
Roshan Pius | 8714a3e | 2016-10-28 10:43:51 -0700 | [diff] [blame] | 907 | const on_ring_buffer_data_callback& on_user_data_callback) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 908 | if (on_ring_buffer_data_internal_callback) { |
| 909 | return WIFI_ERROR_NOT_AVAILABLE; |
Roshan Pius | 8714a3e | 2016-10-28 10:43:51 -0700 | [diff] [blame] | 910 | } |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 911 | on_ring_buffer_data_internal_callback = |
| 912 | [on_user_data_callback](char* ring_name, char* buffer, int buffer_size, |
| 913 | wifi_ring_buffer_status* status) { |
| 914 | if (status && buffer) { |
| 915 | std::vector<uint8_t> buffer_vector( |
| 916 | reinterpret_cast<uint8_t*>(buffer), |
| 917 | reinterpret_cast<uint8_t*>(buffer) + buffer_size); |
| 918 | on_user_data_callback(ring_name, buffer_vector, *status); |
| 919 | } |
| 920 | }; |
| 921 | wifi_error status = global_func_table_.wifi_set_log_handler( |
| 922 | 0, getIfaceHandle(iface_name), {onAsyncRingBufferData}); |
| 923 | if (status != WIFI_SUCCESS) { |
| 924 | on_ring_buffer_data_internal_callback = nullptr; |
| 925 | } |
| 926 | return status; |
Roshan Pius | adc87cb | 2016-12-14 18:02:56 -0800 | [diff] [blame] | 927 | } |
| 928 | |
Roshan Pius | acededb | 2017-10-06 14:59:26 -0700 | [diff] [blame] | 929 | wifi_error WifiLegacyHal::deregisterRingBufferCallbackHandler( |
| 930 | const std::string& iface_name) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 931 | if (!on_ring_buffer_data_internal_callback) { |
| 932 | return WIFI_ERROR_NOT_AVAILABLE; |
| 933 | } |
| 934 | on_ring_buffer_data_internal_callback = nullptr; |
| 935 | return global_func_table_.wifi_reset_log_handler( |
| 936 | 0, getIfaceHandle(iface_name)); |
Roshan Pius | 8714a3e | 2016-10-28 10:43:51 -0700 | [diff] [blame] | 937 | } |
| 938 | |
| 939 | std::pair<wifi_error, std::vector<wifi_ring_buffer_status>> |
Roshan Pius | acededb | 2017-10-06 14:59:26 -0700 | [diff] [blame] | 940 | WifiLegacyHal::getRingBuffersStatus(const std::string& iface_name) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 941 | std::vector<wifi_ring_buffer_status> ring_buffers_status; |
| 942 | ring_buffers_status.resize(kMaxRingBuffers); |
| 943 | uint32_t num_rings = kMaxRingBuffers; |
| 944 | wifi_error status = global_func_table_.wifi_get_ring_buffers_status( |
| 945 | getIfaceHandle(iface_name), &num_rings, ring_buffers_status.data()); |
| 946 | CHECK(num_rings <= kMaxRingBuffers); |
| 947 | ring_buffers_status.resize(num_rings); |
| 948 | return {status, std::move(ring_buffers_status)}; |
Roshan Pius | 8714a3e | 2016-10-28 10:43:51 -0700 | [diff] [blame] | 949 | } |
| 950 | |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 951 | wifi_error WifiLegacyHal::startRingBufferLogging(const std::string& iface_name, |
| 952 | const std::string& ring_name, |
| 953 | uint32_t verbose_level, |
| 954 | uint32_t max_interval_sec, |
| 955 | uint32_t min_data_size) { |
| 956 | return global_func_table_.wifi_start_logging( |
| 957 | getIfaceHandle(iface_name), verbose_level, 0, max_interval_sec, |
| 958 | min_data_size, makeCharVec(ring_name).data()); |
Roshan Pius | 8714a3e | 2016-10-28 10:43:51 -0700 | [diff] [blame] | 959 | } |
| 960 | |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 961 | wifi_error WifiLegacyHal::getRingBufferData(const std::string& iface_name, |
| 962 | const std::string& ring_name) { |
| 963 | return global_func_table_.wifi_get_ring_data(getIfaceHandle(iface_name), |
| 964 | makeCharVec(ring_name).data()); |
Roshan Pius | 8714a3e | 2016-10-28 10:43:51 -0700 | [diff] [blame] | 965 | } |
| 966 | |
Roshan Pius | 203cb03 | 2016-12-14 17:41:20 -0800 | [diff] [blame] | 967 | wifi_error WifiLegacyHal::registerErrorAlertCallbackHandler( |
Roshan Pius | acededb | 2017-10-06 14:59:26 -0700 | [diff] [blame] | 968 | const std::string& iface_name, |
Roshan Pius | 203cb03 | 2016-12-14 17:41:20 -0800 | [diff] [blame] | 969 | const on_error_alert_callback& on_user_alert_callback) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 970 | if (on_error_alert_internal_callback) { |
| 971 | return WIFI_ERROR_NOT_AVAILABLE; |
Roshan Pius | 203cb03 | 2016-12-14 17:41:20 -0800 | [diff] [blame] | 972 | } |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 973 | on_error_alert_internal_callback = [on_user_alert_callback]( |
| 974 | wifi_request_id id, char* buffer, |
| 975 | int buffer_size, int err_code) { |
| 976 | if (buffer) { |
| 977 | CHECK(id == 0); |
| 978 | on_user_alert_callback( |
| 979 | err_code, |
| 980 | std::vector<uint8_t>( |
| 981 | reinterpret_cast<uint8_t*>(buffer), |
| 982 | reinterpret_cast<uint8_t*>(buffer) + buffer_size)); |
| 983 | } |
| 984 | }; |
| 985 | wifi_error status = global_func_table_.wifi_set_alert_handler( |
| 986 | 0, getIfaceHandle(iface_name), {onAsyncErrorAlert}); |
| 987 | if (status != WIFI_SUCCESS) { |
| 988 | on_error_alert_internal_callback = nullptr; |
| 989 | } |
| 990 | return status; |
Roshan Pius | 203cb03 | 2016-12-14 17:41:20 -0800 | [diff] [blame] | 991 | } |
| 992 | |
Roshan Pius | acededb | 2017-10-06 14:59:26 -0700 | [diff] [blame] | 993 | wifi_error WifiLegacyHal::deregisterErrorAlertCallbackHandler( |
| 994 | const std::string& iface_name) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 995 | if (!on_error_alert_internal_callback) { |
| 996 | return WIFI_ERROR_NOT_AVAILABLE; |
| 997 | } |
| 998 | on_error_alert_internal_callback = nullptr; |
| 999 | return global_func_table_.wifi_reset_alert_handler( |
| 1000 | 0, getIfaceHandle(iface_name)); |
Roshan Pius | 203cb03 | 2016-12-14 17:41:20 -0800 | [diff] [blame] | 1001 | } |
| 1002 | |
Roshan Pius | 01f0877 | 2018-01-22 17:56:06 -0800 | [diff] [blame] | 1003 | wifi_error WifiLegacyHal::registerRadioModeChangeCallbackHandler( |
| 1004 | const std::string& iface_name, |
| 1005 | const on_radio_mode_change_callback& on_user_change_callback) { |
| 1006 | if (on_radio_mode_change_internal_callback) { |
| 1007 | return WIFI_ERROR_NOT_AVAILABLE; |
| 1008 | } |
| 1009 | on_radio_mode_change_internal_callback = [on_user_change_callback]( |
| 1010 | wifi_request_id /* id */, |
| 1011 | uint32_t num_macs, |
| 1012 | wifi_mac_info* mac_infos_arr) { |
| 1013 | if (num_macs > 0 && mac_infos_arr) { |
| 1014 | std::vector<WifiMacInfo> mac_infos_vec; |
| 1015 | for (uint32_t i = 0; i < num_macs; i++) { |
| 1016 | WifiMacInfo mac_info; |
| 1017 | mac_info.wlan_mac_id = mac_infos_arr[i].wlan_mac_id; |
| 1018 | mac_info.mac_band = mac_infos_arr[i].mac_band; |
| 1019 | for (int32_t j = 0; j < mac_infos_arr[i].num_iface; j++) { |
| 1020 | WifiIfaceInfo iface_info; |
| 1021 | iface_info.name = mac_infos_arr[i].iface_info[j].iface_name; |
| 1022 | iface_info.channel = mac_infos_arr[i].iface_info[j].channel; |
| 1023 | mac_info.iface_infos.push_back(iface_info); |
| 1024 | } |
| 1025 | mac_infos_vec.push_back(mac_info); |
| 1026 | } |
| 1027 | on_user_change_callback(mac_infos_vec); |
| 1028 | } |
| 1029 | }; |
| 1030 | wifi_error status = global_func_table_.wifi_set_radio_mode_change_handler( |
| 1031 | 0, getIfaceHandle(iface_name), {onAsyncRadioModeChange}); |
| 1032 | if (status != WIFI_SUCCESS) { |
| 1033 | on_radio_mode_change_internal_callback = nullptr; |
| 1034 | } |
| 1035 | return status; |
| 1036 | } |
| 1037 | |
Roshan Pius | d8e915a | 2016-10-28 11:23:11 -0700 | [diff] [blame] | 1038 | wifi_error WifiLegacyHal::startRttRangeRequest( |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1039 | const std::string& iface_name, wifi_request_id id, |
Roshan Pius | d8e915a | 2016-10-28 11:23:11 -0700 | [diff] [blame] | 1040 | const std::vector<wifi_rtt_config>& rtt_configs, |
| 1041 | const on_rtt_results_callback& on_results_user_callback) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1042 | if (on_rtt_results_internal_callback) { |
| 1043 | return WIFI_ERROR_NOT_AVAILABLE; |
Roshan Pius | d8e915a | 2016-10-28 11:23:11 -0700 | [diff] [blame] | 1044 | } |
Roshan Pius | d8e915a | 2016-10-28 11:23:11 -0700 | [diff] [blame] | 1045 | |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1046 | on_rtt_results_internal_callback = |
| 1047 | [on_results_user_callback](wifi_request_id id, unsigned num_results, |
| 1048 | wifi_rtt_result* rtt_results[]) { |
| 1049 | if (num_results > 0 && !rtt_results) { |
| 1050 | LOG(ERROR) << "Unexpected nullptr in RTT results"; |
| 1051 | return; |
| 1052 | } |
| 1053 | std::vector<const wifi_rtt_result*> rtt_results_vec; |
| 1054 | std::copy_if(rtt_results, rtt_results + num_results, |
| 1055 | back_inserter(rtt_results_vec), |
| 1056 | [](wifi_rtt_result* rtt_result) { |
| 1057 | return rtt_result != nullptr; |
| 1058 | }); |
| 1059 | on_results_user_callback(id, rtt_results_vec); |
| 1060 | }; |
| 1061 | |
| 1062 | std::vector<wifi_rtt_config> rtt_configs_internal(rtt_configs); |
| 1063 | wifi_error status = global_func_table_.wifi_rtt_range_request( |
| 1064 | id, getIfaceHandle(iface_name), rtt_configs.size(), |
| 1065 | rtt_configs_internal.data(), {onAsyncRttResults}); |
| 1066 | if (status != WIFI_SUCCESS) { |
| 1067 | on_rtt_results_internal_callback = nullptr; |
| 1068 | } |
| 1069 | return status; |
Roshan Pius | d8e915a | 2016-10-28 11:23:11 -0700 | [diff] [blame] | 1070 | } |
| 1071 | |
| 1072 | wifi_error WifiLegacyHal::cancelRttRangeRequest( |
Roshan Pius | acededb | 2017-10-06 14:59:26 -0700 | [diff] [blame] | 1073 | const std::string& iface_name, wifi_request_id id, |
| 1074 | const std::vector<std::array<uint8_t, 6>>& mac_addrs) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1075 | if (!on_rtt_results_internal_callback) { |
| 1076 | return WIFI_ERROR_NOT_AVAILABLE; |
| 1077 | } |
| 1078 | static_assert(sizeof(mac_addr) == sizeof(std::array<uint8_t, 6>), |
| 1079 | "MAC address size mismatch"); |
| 1080 | // TODO: How do we handle partial cancels (i.e only a subset of enabled mac |
| 1081 | // addressed are cancelled). |
| 1082 | std::vector<std::array<uint8_t, 6>> mac_addrs_internal(mac_addrs); |
| 1083 | wifi_error status = global_func_table_.wifi_rtt_range_cancel( |
| 1084 | id, getIfaceHandle(iface_name), mac_addrs.size(), |
| 1085 | reinterpret_cast<mac_addr*>(mac_addrs_internal.data())); |
| 1086 | // If the request Id is wrong, don't stop the ongoing range request. Any |
| 1087 | // other error should be treated as the end of rtt ranging. |
| 1088 | if (status != WIFI_ERROR_INVALID_REQUEST_ID) { |
| 1089 | on_rtt_results_internal_callback = nullptr; |
| 1090 | } |
| 1091 | return status; |
Roshan Pius | d8e915a | 2016-10-28 11:23:11 -0700 | [diff] [blame] | 1092 | } |
| 1093 | |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1094 | std::pair<wifi_error, wifi_rtt_capabilities> WifiLegacyHal::getRttCapabilities( |
| 1095 | const std::string& iface_name) { |
| 1096 | wifi_rtt_capabilities rtt_caps; |
| 1097 | wifi_error status = global_func_table_.wifi_get_rtt_capabilities( |
| 1098 | getIfaceHandle(iface_name), &rtt_caps); |
| 1099 | return {status, rtt_caps}; |
Roshan Pius | d8e915a | 2016-10-28 11:23:11 -0700 | [diff] [blame] | 1100 | } |
| 1101 | |
Roshan Pius | acededb | 2017-10-06 14:59:26 -0700 | [diff] [blame] | 1102 | std::pair<wifi_error, wifi_rtt_responder> WifiLegacyHal::getRttResponderInfo( |
| 1103 | const std::string& iface_name) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1104 | wifi_rtt_responder rtt_responder; |
| 1105 | wifi_error status = global_func_table_.wifi_rtt_get_responder_info( |
| 1106 | getIfaceHandle(iface_name), &rtt_responder); |
| 1107 | return {status, rtt_responder}; |
Roshan Pius | d8e915a | 2016-10-28 11:23:11 -0700 | [diff] [blame] | 1108 | } |
| 1109 | |
| 1110 | wifi_error WifiLegacyHal::enableRttResponder( |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1111 | const std::string& iface_name, wifi_request_id id, |
| 1112 | const wifi_channel_info& channel_hint, uint32_t max_duration_secs, |
Roshan Pius | d8e915a | 2016-10-28 11:23:11 -0700 | [diff] [blame] | 1113 | const wifi_rtt_responder& info) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1114 | wifi_rtt_responder info_internal(info); |
| 1115 | return global_func_table_.wifi_enable_responder( |
| 1116 | id, getIfaceHandle(iface_name), channel_hint, max_duration_secs, |
| 1117 | &info_internal); |
Roshan Pius | d8e915a | 2016-10-28 11:23:11 -0700 | [diff] [blame] | 1118 | } |
| 1119 | |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1120 | wifi_error WifiLegacyHal::disableRttResponder(const std::string& iface_name, |
| 1121 | wifi_request_id id) { |
| 1122 | return global_func_table_.wifi_disable_responder( |
| 1123 | id, getIfaceHandle(iface_name)); |
Roshan Pius | d8e915a | 2016-10-28 11:23:11 -0700 | [diff] [blame] | 1124 | } |
| 1125 | |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1126 | wifi_error WifiLegacyHal::setRttLci(const std::string& iface_name, |
| 1127 | wifi_request_id id, |
| 1128 | const wifi_lci_information& info) { |
| 1129 | wifi_lci_information info_internal(info); |
| 1130 | return global_func_table_.wifi_set_lci(id, getIfaceHandle(iface_name), |
| 1131 | &info_internal); |
Roshan Pius | d8e915a | 2016-10-28 11:23:11 -0700 | [diff] [blame] | 1132 | } |
| 1133 | |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1134 | wifi_error WifiLegacyHal::setRttLcr(const std::string& iface_name, |
| 1135 | wifi_request_id id, |
| 1136 | const wifi_lcr_information& info) { |
| 1137 | wifi_lcr_information info_internal(info); |
| 1138 | return global_func_table_.wifi_set_lcr(id, getIfaceHandle(iface_name), |
| 1139 | &info_internal); |
Roshan Pius | d8e915a | 2016-10-28 11:23:11 -0700 | [diff] [blame] | 1140 | } |
| 1141 | |
Roshan Pius | 2301209 | 2016-10-28 11:27:40 -0700 | [diff] [blame] | 1142 | wifi_error WifiLegacyHal::nanRegisterCallbackHandlers( |
Roshan Pius | acededb | 2017-10-06 14:59:26 -0700 | [diff] [blame] | 1143 | const std::string& iface_name, const NanCallbackHandlers& user_callbacks) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1144 | on_nan_notify_response_user_callback = user_callbacks.on_notify_response; |
| 1145 | on_nan_event_publish_terminated_user_callback = |
| 1146 | user_callbacks.on_event_publish_terminated; |
| 1147 | on_nan_event_match_user_callback = user_callbacks.on_event_match; |
| 1148 | on_nan_event_match_expired_user_callback = |
| 1149 | user_callbacks.on_event_match_expired; |
| 1150 | on_nan_event_subscribe_terminated_user_callback = |
| 1151 | user_callbacks.on_event_subscribe_terminated; |
| 1152 | on_nan_event_followup_user_callback = user_callbacks.on_event_followup; |
| 1153 | on_nan_event_disc_eng_event_user_callback = |
| 1154 | user_callbacks.on_event_disc_eng_event; |
| 1155 | on_nan_event_disabled_user_callback = user_callbacks.on_event_disabled; |
| 1156 | on_nan_event_tca_user_callback = user_callbacks.on_event_tca; |
| 1157 | on_nan_event_beacon_sdf_payload_user_callback = |
| 1158 | user_callbacks.on_event_beacon_sdf_payload; |
| 1159 | on_nan_event_data_path_request_user_callback = |
| 1160 | user_callbacks.on_event_data_path_request; |
| 1161 | on_nan_event_data_path_confirm_user_callback = |
| 1162 | user_callbacks.on_event_data_path_confirm; |
| 1163 | on_nan_event_data_path_end_user_callback = |
| 1164 | user_callbacks.on_event_data_path_end; |
| 1165 | on_nan_event_transmit_follow_up_user_callback = |
| 1166 | user_callbacks.on_event_transmit_follow_up; |
| 1167 | on_nan_event_range_request_user_callback = |
| 1168 | user_callbacks.on_event_range_request; |
| 1169 | on_nan_event_range_report_user_callback = |
| 1170 | user_callbacks.on_event_range_report; |
Etan Cohen | 1bf15f1 | 2017-12-12 16:15:16 -0800 | [diff] [blame] | 1171 | on_nan_event_schedule_update_user_callback = |
| 1172 | user_callbacks.on_event_schedule_update; |
Roshan Pius | 2301209 | 2016-10-28 11:27:40 -0700 | [diff] [blame] | 1173 | |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1174 | return global_func_table_.wifi_nan_register_handler( |
| 1175 | getIfaceHandle(iface_name), |
| 1176 | {onAysncNanNotifyResponse, onAysncNanEventPublishReplied, |
| 1177 | onAysncNanEventPublishTerminated, onAysncNanEventMatch, |
| 1178 | onAysncNanEventMatchExpired, onAysncNanEventSubscribeTerminated, |
| 1179 | onAysncNanEventFollowup, onAysncNanEventDiscEngEvent, |
| 1180 | onAysncNanEventDisabled, onAysncNanEventTca, |
| 1181 | onAysncNanEventBeaconSdfPayload, onAysncNanEventDataPathRequest, |
| 1182 | onAysncNanEventDataPathConfirm, onAysncNanEventDataPathEnd, |
| 1183 | onAysncNanEventTransmitFollowUp, onAysncNanEventRangeRequest, |
Etan Cohen | 1bf15f1 | 2017-12-12 16:15:16 -0800 | [diff] [blame] | 1184 | onAysncNanEventRangeReport, onAsyncNanEventScheduleUpdate}); |
Roshan Pius | 2301209 | 2016-10-28 11:27:40 -0700 | [diff] [blame] | 1185 | } |
| 1186 | |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1187 | wifi_error WifiLegacyHal::nanEnableRequest(const std::string& iface_name, |
| 1188 | transaction_id id, |
| 1189 | const NanEnableRequest& msg) { |
| 1190 | NanEnableRequest msg_internal(msg); |
| 1191 | return global_func_table_.wifi_nan_enable_request( |
| 1192 | id, getIfaceHandle(iface_name), &msg_internal); |
Roshan Pius | 2301209 | 2016-10-28 11:27:40 -0700 | [diff] [blame] | 1193 | } |
| 1194 | |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1195 | wifi_error WifiLegacyHal::nanDisableRequest(const std::string& iface_name, |
| 1196 | transaction_id id) { |
| 1197 | return global_func_table_.wifi_nan_disable_request( |
| 1198 | id, getIfaceHandle(iface_name)); |
Roshan Pius | 2301209 | 2016-10-28 11:27:40 -0700 | [diff] [blame] | 1199 | } |
| 1200 | |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1201 | wifi_error WifiLegacyHal::nanPublishRequest(const std::string& iface_name, |
| 1202 | transaction_id id, |
| 1203 | const NanPublishRequest& msg) { |
| 1204 | NanPublishRequest msg_internal(msg); |
| 1205 | return global_func_table_.wifi_nan_publish_request( |
| 1206 | id, getIfaceHandle(iface_name), &msg_internal); |
Roshan Pius | 2301209 | 2016-10-28 11:27:40 -0700 | [diff] [blame] | 1207 | } |
| 1208 | |
| 1209 | wifi_error WifiLegacyHal::nanPublishCancelRequest( |
Roshan Pius | acededb | 2017-10-06 14:59:26 -0700 | [diff] [blame] | 1210 | const std::string& iface_name, transaction_id id, |
| 1211 | const NanPublishCancelRequest& msg) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1212 | NanPublishCancelRequest msg_internal(msg); |
| 1213 | return global_func_table_.wifi_nan_publish_cancel_request( |
| 1214 | id, getIfaceHandle(iface_name), &msg_internal); |
Roshan Pius | 2301209 | 2016-10-28 11:27:40 -0700 | [diff] [blame] | 1215 | } |
| 1216 | |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1217 | wifi_error WifiLegacyHal::nanSubscribeRequest(const std::string& iface_name, |
| 1218 | transaction_id id, |
| 1219 | const NanSubscribeRequest& msg) { |
| 1220 | NanSubscribeRequest msg_internal(msg); |
| 1221 | return global_func_table_.wifi_nan_subscribe_request( |
| 1222 | id, getIfaceHandle(iface_name), &msg_internal); |
Roshan Pius | 2301209 | 2016-10-28 11:27:40 -0700 | [diff] [blame] | 1223 | } |
| 1224 | |
| 1225 | wifi_error WifiLegacyHal::nanSubscribeCancelRequest( |
Roshan Pius | acededb | 2017-10-06 14:59:26 -0700 | [diff] [blame] | 1226 | const std::string& iface_name, transaction_id id, |
| 1227 | const NanSubscribeCancelRequest& msg) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1228 | NanSubscribeCancelRequest msg_internal(msg); |
| 1229 | return global_func_table_.wifi_nan_subscribe_cancel_request( |
| 1230 | id, getIfaceHandle(iface_name), &msg_internal); |
Roshan Pius | 2301209 | 2016-10-28 11:27:40 -0700 | [diff] [blame] | 1231 | } |
| 1232 | |
| 1233 | wifi_error WifiLegacyHal::nanTransmitFollowupRequest( |
Roshan Pius | acededb | 2017-10-06 14:59:26 -0700 | [diff] [blame] | 1234 | const std::string& iface_name, transaction_id id, |
| 1235 | const NanTransmitFollowupRequest& msg) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1236 | NanTransmitFollowupRequest msg_internal(msg); |
| 1237 | return global_func_table_.wifi_nan_transmit_followup_request( |
| 1238 | id, getIfaceHandle(iface_name), &msg_internal); |
Roshan Pius | 2301209 | 2016-10-28 11:27:40 -0700 | [diff] [blame] | 1239 | } |
| 1240 | |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1241 | wifi_error WifiLegacyHal::nanStatsRequest(const std::string& iface_name, |
| 1242 | transaction_id id, |
| 1243 | const NanStatsRequest& msg) { |
| 1244 | NanStatsRequest msg_internal(msg); |
| 1245 | return global_func_table_.wifi_nan_stats_request( |
| 1246 | id, getIfaceHandle(iface_name), &msg_internal); |
Roshan Pius | 2301209 | 2016-10-28 11:27:40 -0700 | [diff] [blame] | 1247 | } |
| 1248 | |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1249 | wifi_error WifiLegacyHal::nanConfigRequest(const std::string& iface_name, |
| 1250 | transaction_id id, |
| 1251 | const NanConfigRequest& msg) { |
| 1252 | NanConfigRequest msg_internal(msg); |
| 1253 | return global_func_table_.wifi_nan_config_request( |
| 1254 | id, getIfaceHandle(iface_name), &msg_internal); |
Roshan Pius | 2301209 | 2016-10-28 11:27:40 -0700 | [diff] [blame] | 1255 | } |
| 1256 | |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1257 | wifi_error WifiLegacyHal::nanTcaRequest(const std::string& iface_name, |
| 1258 | transaction_id id, |
| 1259 | const NanTCARequest& msg) { |
| 1260 | NanTCARequest msg_internal(msg); |
| 1261 | return global_func_table_.wifi_nan_tca_request( |
| 1262 | id, getIfaceHandle(iface_name), &msg_internal); |
Roshan Pius | 2301209 | 2016-10-28 11:27:40 -0700 | [diff] [blame] | 1263 | } |
| 1264 | |
| 1265 | wifi_error WifiLegacyHal::nanBeaconSdfPayloadRequest( |
Roshan Pius | acededb | 2017-10-06 14:59:26 -0700 | [diff] [blame] | 1266 | const std::string& iface_name, transaction_id id, |
| 1267 | const NanBeaconSdfPayloadRequest& msg) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1268 | NanBeaconSdfPayloadRequest msg_internal(msg); |
| 1269 | return global_func_table_.wifi_nan_beacon_sdf_payload_request( |
| 1270 | id, getIfaceHandle(iface_name), &msg_internal); |
Roshan Pius | 2301209 | 2016-10-28 11:27:40 -0700 | [diff] [blame] | 1271 | } |
| 1272 | |
| 1273 | std::pair<wifi_error, NanVersion> WifiLegacyHal::nanGetVersion() { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1274 | NanVersion version; |
| 1275 | wifi_error status = |
| 1276 | global_func_table_.wifi_nan_get_version(global_handle_, &version); |
| 1277 | return {status, version}; |
Roshan Pius | 2301209 | 2016-10-28 11:27:40 -0700 | [diff] [blame] | 1278 | } |
| 1279 | |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1280 | wifi_error WifiLegacyHal::nanGetCapabilities(const std::string& iface_name, |
| 1281 | transaction_id id) { |
| 1282 | return global_func_table_.wifi_nan_get_capabilities( |
| 1283 | id, getIfaceHandle(iface_name)); |
Roshan Pius | 2301209 | 2016-10-28 11:27:40 -0700 | [diff] [blame] | 1284 | } |
| 1285 | |
| 1286 | wifi_error WifiLegacyHal::nanDataInterfaceCreate( |
Roshan Pius | acededb | 2017-10-06 14:59:26 -0700 | [diff] [blame] | 1287 | const std::string& iface_name, transaction_id id, |
| 1288 | const std::string& data_iface_name) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1289 | return global_func_table_.wifi_nan_data_interface_create( |
| 1290 | id, getIfaceHandle(iface_name), makeCharVec(data_iface_name).data()); |
Roshan Pius | 2301209 | 2016-10-28 11:27:40 -0700 | [diff] [blame] | 1291 | } |
| 1292 | |
| 1293 | wifi_error WifiLegacyHal::nanDataInterfaceDelete( |
Roshan Pius | acededb | 2017-10-06 14:59:26 -0700 | [diff] [blame] | 1294 | const std::string& iface_name, transaction_id id, |
| 1295 | const std::string& data_iface_name) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1296 | return global_func_table_.wifi_nan_data_interface_delete( |
| 1297 | id, getIfaceHandle(iface_name), makeCharVec(data_iface_name).data()); |
Roshan Pius | 2301209 | 2016-10-28 11:27:40 -0700 | [diff] [blame] | 1298 | } |
| 1299 | |
| 1300 | wifi_error WifiLegacyHal::nanDataRequestInitiator( |
Roshan Pius | acededb | 2017-10-06 14:59:26 -0700 | [diff] [blame] | 1301 | const std::string& iface_name, transaction_id id, |
| 1302 | const NanDataPathInitiatorRequest& msg) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1303 | NanDataPathInitiatorRequest msg_internal(msg); |
| 1304 | return global_func_table_.wifi_nan_data_request_initiator( |
| 1305 | id, getIfaceHandle(iface_name), &msg_internal); |
Roshan Pius | 2301209 | 2016-10-28 11:27:40 -0700 | [diff] [blame] | 1306 | } |
| 1307 | |
| 1308 | wifi_error WifiLegacyHal::nanDataIndicationResponse( |
Roshan Pius | acededb | 2017-10-06 14:59:26 -0700 | [diff] [blame] | 1309 | const std::string& iface_name, transaction_id id, |
| 1310 | const NanDataPathIndicationResponse& msg) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1311 | NanDataPathIndicationResponse msg_internal(msg); |
| 1312 | return global_func_table_.wifi_nan_data_indication_response( |
| 1313 | id, getIfaceHandle(iface_name), &msg_internal); |
Roshan Pius | 2301209 | 2016-10-28 11:27:40 -0700 | [diff] [blame] | 1314 | } |
| 1315 | |
Etan Cohen | c9836f9 | 2017-06-30 13:55:21 -0700 | [diff] [blame] | 1316 | typedef struct { |
| 1317 | u8 num_ndp_instances; |
| 1318 | NanDataPathId ndp_instance_id; |
| 1319 | } NanDataPathEndSingleNdpIdRequest; |
| 1320 | |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1321 | wifi_error WifiLegacyHal::nanDataEnd(const std::string& iface_name, |
| 1322 | transaction_id id, |
| 1323 | uint32_t ndpInstanceId) { |
| 1324 | NanDataPathEndSingleNdpIdRequest msg; |
| 1325 | msg.num_ndp_instances = 1; |
| 1326 | msg.ndp_instance_id = ndpInstanceId; |
| 1327 | wifi_error status = global_func_table_.wifi_nan_data_end( |
| 1328 | id, getIfaceHandle(iface_name), (NanDataPathEndRequest*)&msg); |
| 1329 | return status; |
Roshan Pius | 2301209 | 2016-10-28 11:27:40 -0700 | [diff] [blame] | 1330 | } |
| 1331 | |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1332 | wifi_error WifiLegacyHal::setCountryCode(const std::string& iface_name, |
| 1333 | std::array<int8_t, 2> code) { |
| 1334 | std::string code_str(code.data(), code.data() + code.size()); |
| 1335 | return global_func_table_.wifi_set_country_code(getIfaceHandle(iface_name), |
| 1336 | code_str.c_str()); |
Roshan Pius | 32fc12e | 2017-01-25 17:44:42 -0800 | [diff] [blame] | 1337 | } |
| 1338 | |
Roshan Pius | acededb | 2017-10-06 14:59:26 -0700 | [diff] [blame] | 1339 | wifi_error WifiLegacyHal::retrieveIfaceHandles() { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1340 | wifi_interface_handle* iface_handles = nullptr; |
| 1341 | int num_iface_handles = 0; |
| 1342 | wifi_error status = global_func_table_.wifi_get_ifaces( |
| 1343 | global_handle_, &num_iface_handles, &iface_handles); |
Roshan Pius | aabe575 | 2016-09-29 09:03:59 -0700 | [diff] [blame] | 1344 | if (status != WIFI_SUCCESS) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1345 | LOG(ERROR) << "Failed to enumerate interface handles"; |
| 1346 | return status; |
Roshan Pius | aabe575 | 2016-09-29 09:03:59 -0700 | [diff] [blame] | 1347 | } |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1348 | for (int i = 0; i < num_iface_handles; ++i) { |
| 1349 | std::array<char, IFNAMSIZ> iface_name_arr = {}; |
| 1350 | status = global_func_table_.wifi_get_iface_name( |
| 1351 | iface_handles[i], iface_name_arr.data(), iface_name_arr.size()); |
| 1352 | if (status != WIFI_SUCCESS) { |
| 1353 | LOG(WARNING) << "Failed to get interface handle name"; |
| 1354 | continue; |
| 1355 | } |
| 1356 | // Assuming the interface name is null terminated since the legacy HAL |
| 1357 | // API does not return a size. |
| 1358 | std::string iface_name(iface_name_arr.data()); |
| 1359 | LOG(INFO) << "Adding interface handle for " << iface_name; |
| 1360 | iface_name_to_handle_[iface_name] = iface_handles[i]; |
| 1361 | } |
| 1362 | return WIFI_SUCCESS; |
Roshan Pius | acededb | 2017-10-06 14:59:26 -0700 | [diff] [blame] | 1363 | } |
| 1364 | |
| 1365 | wifi_interface_handle WifiLegacyHal::getIfaceHandle( |
| 1366 | const std::string& iface_name) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1367 | const auto iface_handle_iter = iface_name_to_handle_.find(iface_name); |
| 1368 | if (iface_handle_iter == iface_name_to_handle_.end()) { |
| 1369 | LOG(ERROR) << "Unknown iface name: " << iface_name; |
| 1370 | return nullptr; |
| 1371 | } |
| 1372 | return iface_handle_iter->second; |
Roshan Pius | aabe575 | 2016-09-29 09:03:59 -0700 | [diff] [blame] | 1373 | } |
| 1374 | |
| 1375 | void WifiLegacyHal::runEventLoop() { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1376 | LOG(DEBUG) << "Starting legacy HAL event loop"; |
| 1377 | global_func_table_.wifi_event_loop(global_handle_); |
| 1378 | const auto lock = hidl_sync_util::acquireGlobalLock(); |
| 1379 | if (!awaiting_event_loop_termination_) { |
| 1380 | LOG(FATAL) |
| 1381 | << "Legacy HAL event loop terminated, but HAL was not stopping"; |
| 1382 | } |
| 1383 | LOG(DEBUG) << "Legacy HAL event loop terminated"; |
| 1384 | awaiting_event_loop_termination_ = false; |
| 1385 | stop_wait_cv_.notify_one(); |
Roshan Pius | aabe575 | 2016-09-29 09:03:59 -0700 | [diff] [blame] | 1386 | } |
| 1387 | |
Roshan Pius | 76ff302 | 2016-10-28 10:33:34 -0700 | [diff] [blame] | 1388 | std::pair<wifi_error, std::vector<wifi_cached_scan_results>> |
Roshan Pius | acededb | 2017-10-06 14:59:26 -0700 | [diff] [blame] | 1389 | WifiLegacyHal::getGscanCachedResults(const std::string& iface_name) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1390 | std::vector<wifi_cached_scan_results> cached_scan_results; |
| 1391 | cached_scan_results.resize(kMaxCachedGscanResults); |
| 1392 | int32_t num_results = 0; |
| 1393 | wifi_error status = global_func_table_.wifi_get_cached_gscan_results( |
| 1394 | getIfaceHandle(iface_name), true /* always flush */, |
| 1395 | cached_scan_results.size(), cached_scan_results.data(), &num_results); |
| 1396 | CHECK(num_results >= 0 && |
| 1397 | static_cast<uint32_t>(num_results) <= kMaxCachedGscanResults); |
| 1398 | cached_scan_results.resize(num_results); |
| 1399 | // Check for invalid IE lengths in these cached scan results and correct it. |
| 1400 | for (auto& cached_scan_result : cached_scan_results) { |
| 1401 | int num_scan_results = cached_scan_result.num_results; |
| 1402 | for (int i = 0; i < num_scan_results; i++) { |
| 1403 | auto& scan_result = cached_scan_result.results[i]; |
| 1404 | if (scan_result.ie_length > 0) { |
| 1405 | LOG(DEBUG) << "Cached scan result has non-zero IE length " |
| 1406 | << scan_result.ie_length; |
| 1407 | scan_result.ie_length = 0; |
| 1408 | } |
| 1409 | } |
Roshan Pius | 76ff302 | 2016-10-28 10:33:34 -0700 | [diff] [blame] | 1410 | } |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1411 | return {status, std::move(cached_scan_results)}; |
Roshan Pius | 76ff302 | 2016-10-28 10:33:34 -0700 | [diff] [blame] | 1412 | } |
| 1413 | |
Roshan Pius | 511cc49 | 2016-10-28 09:54:26 -0700 | [diff] [blame] | 1414 | void WifiLegacyHal::invalidate() { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1415 | global_handle_ = nullptr; |
| 1416 | iface_name_to_handle_.clear(); |
| 1417 | on_driver_memory_dump_internal_callback = nullptr; |
| 1418 | on_firmware_memory_dump_internal_callback = nullptr; |
| 1419 | on_gscan_event_internal_callback = nullptr; |
| 1420 | on_gscan_full_result_internal_callback = nullptr; |
| 1421 | on_link_layer_stats_result_internal_callback = nullptr; |
| 1422 | on_rssi_threshold_breached_internal_callback = nullptr; |
| 1423 | on_ring_buffer_data_internal_callback = nullptr; |
| 1424 | on_error_alert_internal_callback = nullptr; |
Roshan Pius | 01f0877 | 2018-01-22 17:56:06 -0800 | [diff] [blame] | 1425 | on_radio_mode_change_internal_callback = nullptr; |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1426 | on_rtt_results_internal_callback = nullptr; |
| 1427 | on_nan_notify_response_user_callback = nullptr; |
| 1428 | on_nan_event_publish_terminated_user_callback = nullptr; |
| 1429 | on_nan_event_match_user_callback = nullptr; |
| 1430 | on_nan_event_match_expired_user_callback = nullptr; |
| 1431 | on_nan_event_subscribe_terminated_user_callback = nullptr; |
| 1432 | on_nan_event_followup_user_callback = nullptr; |
| 1433 | on_nan_event_disc_eng_event_user_callback = nullptr; |
| 1434 | on_nan_event_disabled_user_callback = nullptr; |
| 1435 | on_nan_event_tca_user_callback = nullptr; |
| 1436 | on_nan_event_beacon_sdf_payload_user_callback = nullptr; |
| 1437 | on_nan_event_data_path_request_user_callback = nullptr; |
| 1438 | on_nan_event_data_path_confirm_user_callback = nullptr; |
| 1439 | on_nan_event_data_path_end_user_callback = nullptr; |
| 1440 | on_nan_event_transmit_follow_up_user_callback = nullptr; |
| 1441 | on_nan_event_range_request_user_callback = nullptr; |
| 1442 | on_nan_event_range_report_user_callback = nullptr; |
Etan Cohen | 1bf15f1 | 2017-12-12 16:15:16 -0800 | [diff] [blame] | 1443 | on_nan_event_schedule_update_user_callback = nullptr; |
Roshan Pius | 511cc49 | 2016-10-28 09:54:26 -0700 | [diff] [blame] | 1444 | } |
Roshan Pius | 955542e | 2016-10-28 09:42:44 -0700 | [diff] [blame] | 1445 | |
| 1446 | } // namespace legacy_hal |
Roshan Pius | aabe575 | 2016-09-29 09:03:59 -0700 | [diff] [blame] | 1447 | } // namespace implementation |
Jong Wook Kim | da830c9 | 2018-07-23 15:29:38 -0700 | [diff] [blame] | 1448 | } // namespace V1_3 |
Roshan Pius | aabe575 | 2016-09-29 09:03:59 -0700 | [diff] [blame] | 1449 | } // namespace wifi |
| 1450 | } // namespace hardware |
| 1451 | } // namespace android |