diff options
author | Vinit Deshpande <vinitd@google.com> | 2014-05-22 18:11:12 -0700 |
---|---|---|
committer | Vinit Deshpande <vinitd@google.com> | 2014-06-10 12:43:02 -0700 |
commit | 424a9d0ac7615ca32990bdf49eafa68b2e052e20 (patch) | |
tree | e37ee622e5ad7d3026f7999e90505c456e63235c | |
parent | 1d9576d015768f1f04567efd562ed17570f4c256 (diff) | |
download | hardware_libhardware_legacy-424a9d0ac7615ca32990bdf49eafa68b2e052e20.zip hardware_libhardware_legacy-424a9d0ac7615ca32990bdf49eafa68b2e052e20.tar.gz hardware_libhardware_legacy-424a9d0ac7615ca32990bdf49eafa68b2e052e20.tar.bz2 |
RTT API Update
This version introduces channel parameters and channel masks.
Change-Id: Ieab4e965de77a3c70826842e98f4da14cf09b03d
-rw-r--r-- | include/hardware_legacy/rtt.h | 171 |
1 files changed, 126 insertions, 45 deletions
diff --git a/include/hardware_legacy/rtt.h b/include/hardware_legacy/rtt.h index 143b2dd..b9d6299 100644 --- a/include/hardware_legacy/rtt.h +++ b/include/hardware_legacy/rtt.h @@ -4,61 +4,142 @@ #ifndef __WIFI_HAL_RTT_H__ #define __WIFI_HAL_RTT_H__ -/* RTT */ - -/* Type */ - -#define RTT_TYPE_RTS_CTS 1 -#define RTT_TYPE_NULL_ACK 2 -#define RTT_TYPE_3 3 // This is required for D2D RTT - +/* channel operating width */ +typedef enum { + WIFI_CHAN_WIDTH_INVALID = 0, + WIFI_CHAN_WIDTH_20 = 1, + WIFI_CHAN_WIDTH_40 = 2, + WIFI_CHAN_WIDTH_80 = 3, + WIFI_CHAN_WIDTH_160 = 4, + WIFI_CHAN_WIDTH_80_80 = 5, + WIFI_CHAN_WIDTH_5 = 6, + WIFI_CHAN_WIDTH_10 = 7 +} wifi_channel_width; + +/* Ranging status */ +typedef enum { + RTT_STATUS_SUCCESS, + RTT_STATUS_FAILURE, + RTT_STATUS_FAIL_NO_RSP, + RTT_STATUS_FAIL_REJECTED, + RTT_STATUS_FAIL_NOT_SCHEDULED_YET, + RTT_STATUS_FAIL_TM_TIMEOUT, + RTT_STATUS_FAIL_AP_ON_DIFF_CHANNEL, + RTT_STATUS_FAIL_NO_CAPABILITY, + RTT_STATUS_ABORTED +} wifi_rtt_status; + +/* channel information */ typedef struct { - int type; // One of RTT_TYPE_ values - byte token[16]; // Local token to be published in rtt service info - wifi_channel primary; // Use primary when it doesn't conflict with infra - wifi_channel secondary; // Use secondary when primary conflicts with infra - wifi_timespan offset_from_dw_timestamp; // Time offset to go to primary or secondary channel - char rtt_service_name[32]; // Service name to use - byte rtt_servic_info[256]; // Blob to publish in service info -} RttConfig; + wifi_channel_width width; // channel width (20, 40, 80, 80+80, 160) + wifi_channel center_freq; // primary 20 MHz channel + wifi_channel center_freq1; // center frequency (MHz) first segment + wifi_channel center_freq2; // center frequency (MHz) second segment, valid for 80+80 +} wifi_channel_info; +/* wifi rate */ typedef struct { - void (*on_device_ranged)(wifi_request_id id, mac_addr addr, byte token[16], wifi_timespan ts); - void (*on_failed)(wifi_request_id id, wifi_error reason); -} wifi_rtt_event_handler; - -/* Enable rtt - publishes a service advertising RTT; and starts playing - * two phase nXn RTT protocol. To stop it, use wifi_disable_rtt */ - -wifi_error wifi_enable_rtt(wifi_request_id id, wifi_interface_handle iface, RttConfig config, - wifi_rtt_event_handler handler); -wifi_error wifi_disable_rtt(wifi_request_id id); - -/* RTT Hotlist */ - + u32 preamble :3; // 0: OFDM, 1:CCK, 2:HT 3:VHT 4..7 reserved + u32 nss :2; // 0:1x1, 1:2x2, 3:3x3, 4:4x4 + u32 bw :3; // 0:20MHz, 1:40Mhz, 2:80Mhz, 3:160Mhz + u32 rateMcsIdx :8; // OFDM/CCK rate code would be as per ieee std in the units of 0.5mbps + // HT/VHT it would be mcs index + u32 reserved :16; // reserved + u32 bitrate; // units of 100 Kbps +} wifi_rate; + +/* RTT Type */ +typedef enum { + RTT_TYPE_INVALID, + RTT_TYPE_1_SIDED, + RTT_TYPE_2_SIDED, + RTT_TYPE_AUTO, // Two sided if remote supports; one sided otherwise +} wifi_rtt_type; + +/* wifi peer device */ +typedef enum +{ + WIFI_PEER_STA, + WIFI_PEER_AP, + WIFI_PEER_P2P, + WIFI_PEER_NBD, + WIFI_PEER_INVALID, +} wifi_peer_type; + +/* RTT configuration */ typedef struct { - byte token[16]; - int64_t max_rtt_timespan; -} wifi_rtt_hotlist_criterion; - + mac_addr addr; // peer device mac address + wifi_rtt_type type; // optional - rtt type hint. RTT_TYPE_INVALID implies best effort + wifi_peer_type peer; // optional - peer device hint (STA, P2P, AP) + wifi_channel_info channel; // Required for STA-AP mode, optional for P2P, NBD etc. + byte continuous; // 0 = single shot or 1 = continuous ranging + unsigned interval; // interval of RTT measurement (unit ms) when continuous = true + unsigned num_measurements; // total number of RTT measurements when continuous = true + unsigned num_samples_per_measurement; // num of packets in each RTT measurement + unsigned num_retries_per_measurement; // num of retries if sampling fails +} wifi_rtt_config; + +/* RTT results */ typedef struct { - void (*on_token_found)(wifi_request_id id, byte token[16], wifi_timespan ts); -} wifi_rtt_hotlist_event_handler; + mac_addr addr; // device mac address + unsigned measurement_num; // measurement number in case of continuous ranging + wifi_rtt_status status; // ranging status + wifi_rtt_type type; // RTT type + wifi_peer_type peer; // peer device type (P2P, AP) + wifi_channel_info channel; // channel information + wifi_rssi rssi; // rssi in 0.5 dB steps e.g. 143 implies -71.5 dB + wifi_rssi rssi_spread; // rssi spread in 0.5 dB steps e.g. 5 implies 2.5 dB spread (optional) + wifi_rate tx_rate; // TX rate + wifi_timespan rtt; // round trip time in nanoseconds + wifi_timespan rtt_sd; // rtt standard deviation in nanoseconds + wifi_timespan rtt_spread; // difference between max and min rtt times recorded + int distance; // distance in cm (optional) + int distance_sd; // standard deviation in cm (optional) + int distance_spread; // difference between max and min distance recorded (optional) + wifi_timestamp ts; // time of the measurement (in microseconds since boot) +} wifi_rtt_result; + +/* RTT result callback */ +typedef struct { + void (*on_rtt_results) (wifi_request_id id, unsigned num_results, wifi_rtt_result rtt_result[]); +} wifi_rtt_event_handler; -wifi_error wifi_set_rtt_hotlist(wifi_request_id id, wifi_interface_handle iface, int num_criteria, - wifi_rtt_hotlist_criterion *criteria, wifi_rtt_hotlist_event_handler handler); -wifi_error wifi_reset_rtt_hotlist(wifi_request_id id); +/* API to request RTT measurement */ +wifi_error wifi_rtt_range_request(wifi_request_id id, wifi_interface_handle iface, + unsigned num_rtt_config, wifi_rtt_config rtt_config[], wifi_rtt_event_handler handler); -/* single shot RTT (Device to AP??) */ +/* API to cancel RTT measurements */ +wifi_error wifi_rtt_range_cancel(wifi_request_id id, unsigned num_devices, mac_addr addr[]); +/* NBD ranging channel map */ +typedef struct { + wifi_channel availablity[32]; // specifies the channel map for each of the 16 TU windows + // frequency of 0 => unspecified; which means firmware is + // free to do whatever it wants in this window. +} wifi_channel_map; + +/* API to start publishing the channel map on responder device in a NBD cluster. + Responder device will take this request and schedule broadcasting the channel map + in a NBD ranging attribute in a SDF. DE will automatically remove the ranging + attribute from the OTA queue after number of DW specified by num_dw + where Each DW is 512 TUs apart */ +wifi_error wifi_rtt_channel_map_set(wifi_request_id id, + wifi_interface_handle iface, wifi_channel_map *params, unsigned num_dw); + +/* API to clear the channel map on the responder device in a NBD cluster. + Responder device will cancel future ranging channel request, starting from next + DW interval and will also stop broadcasting NBD ranging attribute in SDF */ +wifi_error wifi_rtt_channel_map_clear(wifi_request_id id, wifi_interface_handle iface); + +/* RTT Capabilities */ typedef struct { - void (*on_succeeded) (wifi_request_id id, wifi_timestamp ts); - void (*on_failed) (wifi_request_id id, wifi_error reason); -} IRttEventHandler; + byte rtt_one_sided_supported; // if 1-sided rtt data collection is supported + byte rtt_11v_supported; // if 11v rtt data collection is supported + byte rtt_ftm_supported; // if ftm rtt data collection is supported +} wifi_rtt_capabilities; -wifi_error wifi_rtt_request_range(wifi_request_id id, wifi_interface_handle iface, mac_addr addr, - RttConfig config, int continuous, IRttEventHandler *handler); -void wifi_rtt_cancel_range_request(wifi_request_id id); +/* RTT capabilities of the device */ +wifi_error wifi_get_rtt_capabilities(wifi_interface_handle iface, wifi_rtt_capabilities *capabilities); #endif |