mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 16:50:18 +00:00
Merge "Add HAL APIs to query cached scan results"
This commit is contained in:
committed by
Android (Google) Code Review
commit
4591dbb57d
@@ -366,6 +366,14 @@ void onAsyncChreNanRttState(chre_nan_rtt_state state) {
|
||||
}
|
||||
}
|
||||
|
||||
// Callback to report cached scan results
|
||||
std::function<void(wifi_cached_scan_report*)> on_cached_scan_results_internal_callback;
|
||||
void onSyncCachedScanResults(wifi_cached_scan_report* cache_report) {
|
||||
if (on_cached_scan_results_internal_callback) {
|
||||
on_cached_scan_results_internal_callback(cache_report);
|
||||
}
|
||||
}
|
||||
|
||||
// End of the free-standing "C" style callbacks.
|
||||
|
||||
WifiLegacyHal::WifiLegacyHal(const std::weak_ptr<wifi_system::InterfaceTool> iface_tool,
|
||||
@@ -1589,6 +1597,17 @@ wifi_error WifiLegacyHal::enableWifiTxPowerLimits(const std::string& iface_name,
|
||||
return global_func_table_.wifi_enable_tx_power_limits(getIfaceHandle(iface_name), enable);
|
||||
}
|
||||
|
||||
wifi_error WifiLegacyHal::getWifiCachedScanResults(
|
||||
const std::string& iface_name, const CachedScanResultsCallbackHandlers& handler) {
|
||||
on_cached_scan_results_internal_callback = handler.on_cached_scan_results;
|
||||
|
||||
wifi_error status = global_func_table_.wifi_get_cached_scan_results(getIfaceHandle(iface_name),
|
||||
{onSyncCachedScanResults});
|
||||
|
||||
on_cached_scan_results_internal_callback = nullptr;
|
||||
return status;
|
||||
}
|
||||
|
||||
void WifiLegacyHal::invalidate() {
|
||||
global_handle_ = nullptr;
|
||||
iface_name_to_handle_.clear();
|
||||
|
||||
@@ -218,6 +218,7 @@ using ::WIFI_BAND_ABG;
|
||||
using ::WIFI_BAND_ABG_WITH_DFS;
|
||||
using ::WIFI_BAND_BG;
|
||||
using ::WIFI_BAND_UNSPECIFIED;
|
||||
using ::wifi_cached_scan_report;
|
||||
using ::wifi_cached_scan_results;
|
||||
using ::WIFI_CHAN_WIDTH_10;
|
||||
using ::WIFI_CHAN_WIDTH_160;
|
||||
@@ -465,6 +466,12 @@ struct ChreCallbackHandlers {
|
||||
std::function<void(chre_nan_rtt_state)> on_wifi_chre_nan_rtt_state;
|
||||
};
|
||||
|
||||
// Cached Scan Results response and event callbacks struct.
|
||||
struct CachedScanResultsCallbackHandlers {
|
||||
// Callback for Cached Scan Results
|
||||
std::function<void(wifi_cached_scan_report*)> on_cached_scan_results;
|
||||
};
|
||||
|
||||
/**
|
||||
* Class that encapsulates all legacy HAL interactions.
|
||||
* This class manages the lifetime of the event loop thread used by legacy HAL.
|
||||
@@ -684,6 +691,8 @@ class WifiLegacyHal {
|
||||
const ChreCallbackHandlers& handler);
|
||||
|
||||
wifi_error enableWifiTxPowerLimits(const std::string& iface_name, bool enable);
|
||||
wifi_error getWifiCachedScanResults(const std::string& iface_name,
|
||||
const CachedScanResultsCallbackHandlers& handler);
|
||||
|
||||
private:
|
||||
// Retrieve interface handles for all the available interfaces.
|
||||
|
||||
@@ -167,6 +167,7 @@ bool initHalFuncTableWithStubs(wifi_hal_fn* hal_fn) {
|
||||
populateStubFor(&hal_fn->wifi_nan_rtt_chre_disable_request);
|
||||
populateStubFor(&hal_fn->wifi_chre_register_handler);
|
||||
populateStubFor(&hal_fn->wifi_enable_tx_power_limits);
|
||||
populateStubFor(&hal_fn->wifi_get_cached_scan_results);
|
||||
return true;
|
||||
}
|
||||
} // namespace legacy_hal
|
||||
|
||||
Reference in New Issue
Block a user