summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkensun <kensun@google.com>2022-10-31 13:41:09 +0000
committerkensun <kensun@google.com>2022-11-10 02:30:49 +0000
commit31684a15c2655716632fd15d6469fe8831ab604d (patch)
tree4f64cf3be0c3b923a1a0f4658378da19ae693552
parent047d12b20a15b862991e578d2c3e6734366b589e (diff)
downloadlibhardware_legacy-31684a15c2655716632fd15d6469fe8831ab604d.tar.gz
Add HAL APIs to query cached scan results
Add HAL API to retrieve the on-chip scan results. Bug: 232030878 Test: New API works fine Change-Id: I0487d010078f4e33fef76a951cc87647746ac867
-rw-r--r--include/hardware_legacy/wifi_cached_scan_results.h92
-rw-r--r--include/hardware_legacy/wifi_hal.h10
2 files changed, 101 insertions, 1 deletions
diff --git a/include/hardware_legacy/wifi_cached_scan_results.h b/include/hardware_legacy/wifi_cached_scan_results.h
new file mode 100644
index 0000000..a2a23fe
--- /dev/null
+++ b/include/hardware_legacy/wifi_cached_scan_results.h
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __WIFI_CACHED_SCAN_RESULTS_H__
+#define __WIFI_CACHED_SCAN_RESULTS_H__
+
+#include "wifi_hal.h"
+
+#define WIFI_CACHED_SCAN_RESULT_FLAGS_NONE (0)
+/* Element ID 61 (HT Operation) is present (see HT 7.3.2) */
+#define WIFI_CACHED_SCAN_RESULT_FLAGS_HT_OPS_PRESENT (1 << 0)
+/* Element ID 192 (VHT Operation) is present (see VHT 8.4.2) */
+#define WIFI_CACHED_SCAN_RESULT_FLAGS_VHT_OPS_PRESENT (1 << 1)
+/* Element ID 255 + Extension 36 (HE Operation) is present
+ * (see 802.11ax 9.4.2.1)
+ */
+#define WIFI_CACHED_SCAN_RESULT_FLAGS_HE_OPS_PRESENT (1 << 2)
+/* Element ID 255 + Extension 106 (HE Operation) is present
+ * (see 802.11be D1.5 9.4.2.1)
+ */
+#define WIFI_CACHED_SCAN_RESULT_FLAGS_EHT_OPS_PRESENT (1 << 3)
+/* Element ID 127 (Extended Capabilities) is present, and bit 70
+ * (Fine Timing Measurement Responder) is set to 1
+ * (see IEEE Std 802.11-2016 9.4.2.27)
+ */
+#define WIFI_CACHED_SCAN_RESULT_FLAGS_IS_FTM_RESPONDER (1 << 4)
+
+/**
+ * Provides information about a single access point (AP) detected in a scan.
+ */
+typedef struct {
+ /* Number of milliseconds prior to ts in the enclosing
+ * wifi_cached_scan_result_report struct when
+ * the probe response or beacon frame that
+ * was used to populate this structure was received.
+ */
+ u32 age_ms;
+ /* The Capability Information field */
+ u16 capability;
+ /* null terminated */
+ u8 ssid[33];
+ u8 ssid_len;
+ u8 bssid[6];
+ /* A set of flags from WIFI_CACHED_SCAN_RESULT_FLAGS_* */
+ u8 flags;
+ s8 rssi;
+ wifi_channel_spec chanspec;
+}wifi_cached_scan_result;
+
+/*
+ * Data structure sent with events of type WifiCachedScanResult.
+ */
+typedef struct {
+ /* time since boot (in microsecond) when the result was retrieved */
+ wifi_timestamp ts;
+ /* If 0, indicates that all frequencies in current regulation were
+ * scanned. Otherwise, indicates the number of frequencies scanned, as
+ * specified in scanned_freq_list.
+ */
+ u16 scanned_freq_num;
+ /* Pointer to an array containing scanned_freq_num values comprising the
+ * set of frequencies that were scanned. Frequencies are specified as
+ * channel center frequencies in MHz. May be NULL if scannedFreqListLen is
+ * 0.
+ */
+ const u32 *scanned_freq_list;
+ /* The total number of cached results returned. */
+ u8 result_cnt;
+ /* Pointer to an array containing result_cnt entries. May be NULL if
+ * result_cnt is 0.
+ */
+ const wifi_cached_scan_result *results;
+} wifi_cached_scan_report;
+
+/* callback for reporting cached scan report */
+typedef struct {
+ void (*on_cached_scan_results) (wifi_cached_scan_report *cache_report);
+} wifi_cached_scan_result_handler;
+#endif
diff --git a/include/hardware_legacy/wifi_hal.h b/include/hardware_legacy/wifi_hal.h
index 952e894..6ffd2d1 100644
--- a/include/hardware_legacy/wifi_hal.h
+++ b/include/hardware_legacy/wifi_hal.h
@@ -578,6 +578,7 @@ typedef struct {
#include "gscan.h"
#include "link_layer_stats.h"
+#include "wifi_cached_scan_results.h"
#include "rtt.h"
#include "tdls.h"
#include "wifi_logger.h"
@@ -1025,7 +1026,14 @@ typedef struct {
wifi_error (*wifi_enable_tx_power_limits) (wifi_interface_handle iface,
bool isEnable);
-
+ /**@brief wifi_get_cached_scan_results
+ * Retrieve scan results cached in wifi firmware
+ * @param wifi_interface_handle
+ * @param wifi_cached_scan_result_handler : callback function pointer
+ * @return Synchronous wifi_error
+ */
+ wifi_error (*wifi_get_cached_scan_results)(wifi_interface_handle iface,
+ wifi_cached_scan_result_handler handler);
/*
* when adding new functions make sure to add stubs in
* hal_tool.cpp::init_wifi_stub_hal_func_table