summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSunil Ravi <sunilravi@google.com>2022-11-10 18:36:00 +0000
committerSunil Ravi <sunilravi@google.com>2022-12-16 21:57:16 +0000
commit6fb46c645eb14fe1aca90a64e365b1fcb027b4ee (patch)
tree4ab2ce561ad34e75456537141688d3730e0a77a6
parent2832940b56f03db12d883536bae7f581e78a3fc8 (diff)
downloadlibhardware_legacy-6fb46c645eb14fe1aca90a64e365b1fcb027b4ee.tar.gz
Add frequency/Bandwidth to RttResults
Added frequency and RTT packet bandwidth in rtt results data structure. Also added new rtt result callback function. The newer vendor implementations which supports sending frequency and bandwidth should call rtt result callback version 2. Bug: 222186547 Test: hardware/interfaces/wifi/aidl/default/tests/runtests.sh Test: RTT test using wifi rtt scan app from playstore. Change-Id: I3265baa477b73cddaff49cd4d9ee88692878365c
-rw-r--r--include/hardware_legacy/rtt.h32
-rw-r--r--include/hardware_legacy/wifi_hal.h1
2 files changed, 25 insertions, 8 deletions
diff --git a/include/hardware_legacy/rtt.h b/include/hardware_legacy/rtt.h
index 4ef7770..ce17443 100644
--- a/include/hardware_legacy/rtt.h
+++ b/include/hardware_legacy/rtt.h
@@ -38,13 +38,14 @@ typedef enum {
/* RTT Measurement Bandwidth */
typedef enum {
- WIFI_RTT_BW_5 = 0x01,
- WIFI_RTT_BW_10 = 0x02,
- WIFI_RTT_BW_20 = 0x04,
- WIFI_RTT_BW_40 = 0x08,
- WIFI_RTT_BW_80 = 0x10,
- WIFI_RTT_BW_160 = 0x20,
- WIFI_RTT_BW_320 = 0x40
+ WIFI_RTT_BW_UNSPECIFIED = 0x00,
+ WIFI_RTT_BW_5 = 0x01,
+ WIFI_RTT_BW_10 = 0x02,
+ WIFI_RTT_BW_20 = 0x04,
+ WIFI_RTT_BW_40 = 0x08,
+ WIFI_RTT_BW_80 = 0x10,
+ WIFI_RTT_BW_160 = 0x20,
+ WIFI_RTT_BW_320 = 0x40
} wifi_rtt_bw;
/* RTT Measurement Preamble */
@@ -150,9 +151,24 @@ typedef struct {
wifi_information_element *LCR; // for 11mc only
} wifi_rtt_result;
-/* RTT result callback */
+/* RTT results version 2 */
typedef struct {
+ wifi_rtt_result rtt_result; // Legacy wifi rtt result structure
+ wifi_channel frequency; // primary channel frequency (MHz) used for ranging measurements
+ // If frequency is unknown, this will be set to |UNSPECIFIED(-1)|
+ wifi_rtt_bw packet_bw; // RTT packet bandwidth is an average BW of the BWs of RTT frames.
+ // Cap the average close to a specific valid RttBw.
+} wifi_rtt_result_v2;
+
+/* RTT result callbacks */
+typedef struct {
+ /*
+ * This callback is deprecated on Android 14 and onwards.
+ * Newer implementations should support on_rtt_results_v2 callback
+ */
void (*on_rtt_results) (wifi_request_id id, unsigned num_results, wifi_rtt_result *rtt_result[]);
+ /* Called when vendor implementation supports sending RTT results version 2 */
+ void (*on_rtt_results_v2) (wifi_request_id id, unsigned num_results, wifi_rtt_result_v2 *rtt_result_v2[]);
} wifi_rtt_event_handler;
/* API to request RTT measurement */
diff --git a/include/hardware_legacy/wifi_hal.h b/include/hardware_legacy/wifi_hal.h
index 7cd17af..011694f 100644
--- a/include/hardware_legacy/wifi_hal.h
+++ b/include/hardware_legacy/wifi_hal.h
@@ -24,6 +24,7 @@ extern "C"
#include <stdint.h>
#define IFNAMSIZ 16
+#define UNSPECIFIED -1 // wifi HAL common definition for unspecified value
/* typedefs */
typedef unsigned char byte;