RTT framework interface update
Bug:19917983 Change-Id: I1c89c4c583923137983243814e35c8981f6db54a
This commit is contained in:
@ -19271,21 +19271,25 @@ package android.net.wifi {
|
|||||||
field public static final int RTT_BW_40_SUPPORT = 8; // 0x8
|
field public static final int RTT_BW_40_SUPPORT = 8; // 0x8
|
||||||
field public static final int RTT_BW_5_SUPPORT = 1; // 0x1
|
field public static final int RTT_BW_5_SUPPORT = 1; // 0x1
|
||||||
field public static final int RTT_BW_80_SUPPORT = 16; // 0x10
|
field public static final int RTT_BW_80_SUPPORT = 16; // 0x10
|
||||||
field public static final int RTT_CHANNEL_WIDTH_10 = 6; // 0x6
|
field public static final deprecated int RTT_CHANNEL_WIDTH_10 = 6; // 0x6
|
||||||
field public static final int RTT_CHANNEL_WIDTH_160 = 3; // 0x3
|
field public static final deprecated int RTT_CHANNEL_WIDTH_160 = 3; // 0x3
|
||||||
field public static final int RTT_CHANNEL_WIDTH_20 = 0; // 0x0
|
field public static final deprecated int RTT_CHANNEL_WIDTH_20 = 0; // 0x0
|
||||||
field public static final int RTT_CHANNEL_WIDTH_40 = 1; // 0x1
|
field public static final deprecated int RTT_CHANNEL_WIDTH_40 = 1; // 0x1
|
||||||
field public static final int RTT_CHANNEL_WIDTH_5 = 5; // 0x5
|
field public static final deprecated int RTT_CHANNEL_WIDTH_5 = 5; // 0x5
|
||||||
field public static final int RTT_CHANNEL_WIDTH_80 = 2; // 0x2
|
field public static final deprecated int RTT_CHANNEL_WIDTH_80 = 2; // 0x2
|
||||||
field public static final int RTT_CHANNEL_WIDTH_80P80 = 4; // 0x4
|
field public static final deprecated int RTT_CHANNEL_WIDTH_80P80 = 4; // 0x4
|
||||||
field public static final deprecated int RTT_CHANNEL_WIDTH_UNSPECIFIED = -1; // 0xffffffff
|
field public static final deprecated int RTT_CHANNEL_WIDTH_UNSPECIFIED = -1; // 0xffffffff
|
||||||
|
field public static final int RTT_PEER_NAN = 5; // 0x5
|
||||||
|
field public static final int RTT_PEER_P2P_CLIENT = 4; // 0x4
|
||||||
|
field public static final int RTT_PEER_P2P_GO = 3; // 0x3
|
||||||
field public static final int RTT_PEER_TYPE_AP = 1; // 0x1
|
field public static final int RTT_PEER_TYPE_AP = 1; // 0x1
|
||||||
field public static final int RTT_PEER_TYPE_STA = 2; // 0x2
|
field public static final int RTT_PEER_TYPE_STA = 2; // 0x2
|
||||||
field public static final int RTT_PEER_TYPE_UNSPECIFIED = 0; // 0x0
|
field public static final deprecated int RTT_PEER_TYPE_UNSPECIFIED = 0; // 0x0
|
||||||
field public static final int RTT_STATUS_ABORTED = 8; // 0x8
|
field public static final int RTT_STATUS_ABORTED = 8; // 0x8
|
||||||
field public static final int RTT_STATUS_FAILURE = 1; // 0x1
|
field public static final int RTT_STATUS_FAILURE = 1; // 0x1
|
||||||
field public static final int RTT_STATUS_FAIL_AP_ON_DIFF_CHANNEL = 6; // 0x6
|
field public static final int RTT_STATUS_FAIL_AP_ON_DIFF_CHANNEL = 6; // 0x6
|
||||||
field public static final int RTT_STATUS_FAIL_BUSY_TRY_LATER = 12; // 0xc
|
field public static final int RTT_STATUS_FAIL_BUSY_TRY_LATER = 12; // 0xc
|
||||||
|
field public static final int RTT_STATUS_FAIL_FTM_PARAM_OVERRIDE = 15; // 0xf
|
||||||
field public static final int RTT_STATUS_FAIL_INVALID_TS = 9; // 0x9
|
field public static final int RTT_STATUS_FAIL_INVALID_TS = 9; // 0x9
|
||||||
field public static final int RTT_STATUS_FAIL_NOT_SCHEDULED_YET = 4; // 0x4
|
field public static final int RTT_STATUS_FAIL_NOT_SCHEDULED_YET = 4; // 0x4
|
||||||
field public static final int RTT_STATUS_FAIL_NO_CAPABILITY = 7; // 0x7
|
field public static final int RTT_STATUS_FAIL_NO_CAPABILITY = 7; // 0x7
|
||||||
@ -19294,11 +19298,13 @@ package android.net.wifi {
|
|||||||
field public static final int RTT_STATUS_FAIL_REJECTED = 3; // 0x3
|
field public static final int RTT_STATUS_FAIL_REJECTED = 3; // 0x3
|
||||||
field public static final int RTT_STATUS_FAIL_SCHEDULE = 11; // 0xb
|
field public static final int RTT_STATUS_FAIL_SCHEDULE = 11; // 0xb
|
||||||
field public static final int RTT_STATUS_FAIL_TM_TIMEOUT = 5; // 0x5
|
field public static final int RTT_STATUS_FAIL_TM_TIMEOUT = 5; // 0x5
|
||||||
|
field public static final int RTT_STATUS_INVALID_REQ = 13; // 0xd
|
||||||
|
field public static final int RTT_STATUS_NO_WIFI = 14; // 0xe
|
||||||
field public static final int RTT_STATUS_SUCCESS = 0; // 0x0
|
field public static final int RTT_STATUS_SUCCESS = 0; // 0x0
|
||||||
field public static final deprecated int RTT_TYPE_11_MC = 4; // 0x4
|
field public static final deprecated int RTT_TYPE_11_MC = 4; // 0x4
|
||||||
field public static final deprecated int RTT_TYPE_11_V = 2; // 0x2
|
field public static final deprecated int RTT_TYPE_11_V = 2; // 0x2
|
||||||
field public static final int RTT_TYPE_ONE_SIDED = 1; // 0x1
|
field public static final int RTT_TYPE_ONE_SIDED = 1; // 0x1
|
||||||
field public static final int RTT_TYPE_TWO_SIDED = 4; // 0x4
|
field public static final int RTT_TYPE_TWO_SIDED = 2; // 0x2
|
||||||
field public static final deprecated int RTT_TYPE_UNSPECIFIED = 0; // 0x0
|
field public static final deprecated int RTT_TYPE_UNSPECIFIED = 0; // 0x0
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -19366,6 +19372,8 @@ package android.net.wifi {
|
|||||||
|
|
||||||
public static class RttManager.RttResult {
|
public static class RttManager.RttResult {
|
||||||
ctor public RttManager.RttResult();
|
ctor public RttManager.RttResult();
|
||||||
|
field public android.net.wifi.RttManager.WifiInformationElement LCI;
|
||||||
|
field public android.net.wifi.RttManager.WifiInformationElement LCR;
|
||||||
field public java.lang.String bssid;
|
field public java.lang.String bssid;
|
||||||
field public int burstDuration;
|
field public int burstDuration;
|
||||||
field public int burstNumber;
|
field public int burstNumber;
|
||||||
@ -19378,6 +19386,7 @@ package android.net.wifi {
|
|||||||
field public int frameNumberPerBurstPeer;
|
field public int frameNumberPerBurstPeer;
|
||||||
field public int measurementFrameNumber;
|
field public int measurementFrameNumber;
|
||||||
field public int measurementType;
|
field public int measurementType;
|
||||||
|
field public int negotiatedBurstNum;
|
||||||
field public deprecated int requestType;
|
field public deprecated int requestType;
|
||||||
field public int retryAfterDuration;
|
field public int retryAfterDuration;
|
||||||
field public int rssi;
|
field public int rssi;
|
||||||
@ -19397,10 +19406,10 @@ package android.net.wifi {
|
|||||||
field public deprecated int tx_rate;
|
field public deprecated int tx_rate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class RttManager.wifiInformationElement {
|
public static class RttManager.WifiInformationElement {
|
||||||
ctor public RttManager.wifiInformationElement();
|
ctor public RttManager.WifiInformationElement();
|
||||||
field public java.lang.String data;
|
field public byte[] data;
|
||||||
field public int id;
|
field public byte id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ScanResult implements android.os.Parcelable {
|
public class ScanResult implements android.os.Parcelable {
|
||||||
|
@ -26,51 +26,109 @@ public class RttManager {
|
|||||||
private static final boolean DBG = true;
|
private static final boolean DBG = true;
|
||||||
private static final String TAG = "RttManager";
|
private static final String TAG = "RttManager";
|
||||||
|
|
||||||
/** @deprecated Type must be specified*/
|
/** @deprecated It is Not supported anymore. */
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static final int RTT_TYPE_UNSPECIFIED = 0;
|
public static final int RTT_TYPE_UNSPECIFIED = 0;
|
||||||
public static final int RTT_TYPE_ONE_SIDED = 1;
|
|
||||||
|
|
||||||
/** @deprecated It is not supported*/
|
public static final int RTT_TYPE_ONE_SIDED = 1;
|
||||||
|
public static final int RTT_TYPE_TWO_SIDED = 2;
|
||||||
|
|
||||||
|
/** @deprecated It is not supported anymore. */
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static final int RTT_TYPE_11_V = 2;
|
public static final int RTT_TYPE_11_V = 2;
|
||||||
public static final int RTT_TYPE_TWO_SIDED = 4;
|
|
||||||
|
|
||||||
/** @deprecated It is not supported*/
|
/** @deprecated It is not supported anymore. */
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static final int RTT_TYPE_11_MC = 4;
|
public static final int RTT_TYPE_11_MC = 4;
|
||||||
|
|
||||||
|
/** @deprecated It is not supported anymore. */
|
||||||
|
@Deprecated
|
||||||
public static final int RTT_PEER_TYPE_UNSPECIFIED = 0;
|
public static final int RTT_PEER_TYPE_UNSPECIFIED = 0;
|
||||||
|
|
||||||
public static final int RTT_PEER_TYPE_AP = 1;
|
public static final int RTT_PEER_TYPE_AP = 1;
|
||||||
public static final int RTT_PEER_TYPE_STA = 2; /* requires NAN */
|
public static final int RTT_PEER_TYPE_STA = 2; /* requires NAN */
|
||||||
|
public static final int RTT_PEER_P2P_GO = 3;
|
||||||
|
public static final int RTT_PEER_P2P_CLIENT = 4;
|
||||||
|
public static final int RTT_PEER_NAN = 5;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated It is not supported anymore.
|
||||||
|
* Use {@link android.net.wifi.RttManager#RTT_BW_20_SUPPORT} API.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public static final int RTT_CHANNEL_WIDTH_20 = 0;
|
public static final int RTT_CHANNEL_WIDTH_20 = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated It is not supported anymore.
|
||||||
|
* Use {@link android.net.wifi.RttManager#RTT_BW_40_SUPPORT} API.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public static final int RTT_CHANNEL_WIDTH_40 = 1;
|
public static final int RTT_CHANNEL_WIDTH_40 = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated It is not supported anymore.
|
||||||
|
* Use {@link android.net.wifi.RttManager#RTT_BW_80_SUPPORT} API.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public static final int RTT_CHANNEL_WIDTH_80 = 2;
|
public static final int RTT_CHANNEL_WIDTH_80 = 2;
|
||||||
|
|
||||||
|
/**@deprecated It is not supported anymore.
|
||||||
|
* Use {@link android.net.wifi.RttManager#RTT_BW_160_SUPPORT} API.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public static final int RTT_CHANNEL_WIDTH_160 = 3;
|
public static final int RTT_CHANNEL_WIDTH_160 = 3;
|
||||||
|
|
||||||
|
/**@deprecated not supported anymore*/
|
||||||
|
@Deprecated
|
||||||
public static final int RTT_CHANNEL_WIDTH_80P80 = 4;
|
public static final int RTT_CHANNEL_WIDTH_80P80 = 4;
|
||||||
|
|
||||||
|
/**@deprecated It is not supported anymore.
|
||||||
|
* Use {@link android.net.wifi.RttManager#RTT_BW_5_SUPPORT} API.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public static final int RTT_CHANNEL_WIDTH_5 = 5;
|
public static final int RTT_CHANNEL_WIDTH_5 = 5;
|
||||||
|
|
||||||
|
/**@deprecated It is not supported anymore.
|
||||||
|
* Use {@link android.net.wifi.RttManager#RTT_BW_10_SUPPORT} API.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public static final int RTT_CHANNEL_WIDTH_10 = 6;
|
public static final int RTT_CHANNEL_WIDTH_10 = 6;
|
||||||
|
|
||||||
/** @deprecated channel info must be specified*/
|
/** @deprecated channel info must be specified. */
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static final int RTT_CHANNEL_WIDTH_UNSPECIFIED = -1;
|
public static final int RTT_CHANNEL_WIDTH_UNSPECIFIED = -1;
|
||||||
|
|
||||||
public static final int RTT_STATUS_SUCCESS = 0;
|
public static final int RTT_STATUS_SUCCESS = 0;
|
||||||
|
/** General failure*/
|
||||||
public static final int RTT_STATUS_FAILURE = 1;
|
public static final int RTT_STATUS_FAILURE = 1;
|
||||||
|
/** Destination does not respond to RTT request*/
|
||||||
public static final int RTT_STATUS_FAIL_NO_RSP = 2;
|
public static final int RTT_STATUS_FAIL_NO_RSP = 2;
|
||||||
|
/** RTT request is rejected by the destination. Double side RTT only*/
|
||||||
public static final int RTT_STATUS_FAIL_REJECTED = 3;
|
public static final int RTT_STATUS_FAIL_REJECTED = 3;
|
||||||
|
/** */
|
||||||
public static final int RTT_STATUS_FAIL_NOT_SCHEDULED_YET = 4;
|
public static final int RTT_STATUS_FAIL_NOT_SCHEDULED_YET = 4;
|
||||||
|
/** Timing measurement timeout*/
|
||||||
public static final int RTT_STATUS_FAIL_TM_TIMEOUT = 5;
|
public static final int RTT_STATUS_FAIL_TM_TIMEOUT = 5;
|
||||||
|
/** Destination is on a different channel from the RTT Request*/
|
||||||
public static final int RTT_STATUS_FAIL_AP_ON_DIFF_CHANNEL = 6;
|
public static final int RTT_STATUS_FAIL_AP_ON_DIFF_CHANNEL = 6;
|
||||||
|
/** This type of Ranging is not support by Hardware*/
|
||||||
public static final int RTT_STATUS_FAIL_NO_CAPABILITY = 7;
|
public static final int RTT_STATUS_FAIL_NO_CAPABILITY = 7;
|
||||||
|
/** Request abort fro uncertain reason*/
|
||||||
public static final int RTT_STATUS_ABORTED = 8;
|
public static final int RTT_STATUS_ABORTED = 8;
|
||||||
//if the T1-T4 or TOD/TOA Timestamp is illegal
|
/** The T1-T4 or TOD/TOA Timestamp is illegal*/
|
||||||
public static final int RTT_STATUS_FAIL_INVALID_TS = 9;
|
public static final int RTT_STATUS_FAIL_INVALID_TS = 9;
|
||||||
//11mc protocol failed, eg, unrecognized FTMR/FTM
|
/** 11mc protocol level failed, eg, unrecognized FTMR/FTM frame*/
|
||||||
public static final int RTT_STATUS_FAIL_PROTOCOL = 10;
|
public static final int RTT_STATUS_FAIL_PROTOCOL = 10;
|
||||||
|
/** Request can not be scheduled by hardware*/
|
||||||
public static final int RTT_STATUS_FAIL_SCHEDULE = 11;
|
public static final int RTT_STATUS_FAIL_SCHEDULE = 11;
|
||||||
|
/** destination is busy now, you can try after a specified time from destination*/
|
||||||
public static final int RTT_STATUS_FAIL_BUSY_TRY_LATER = 12;
|
public static final int RTT_STATUS_FAIL_BUSY_TRY_LATER = 12;
|
||||||
|
/** Bad Request argument*/
|
||||||
|
public static final int RTT_STATUS_INVALID_REQ = 13;
|
||||||
|
/** Wifi is not enabled*/
|
||||||
|
public static final int RTT_STATUS_NO_WIFI = 14;
|
||||||
|
/** Responder overrides param info, cannot range with new params 2-side RTT only*/
|
||||||
|
public static final int RTT_STATUS_FAIL_FTM_PARAM_OVERRIDE = 15;
|
||||||
|
|
||||||
public static final int REASON_UNSPECIFIED = -1;
|
public static final int REASON_UNSPECIFIED = -1;
|
||||||
public static final int REASON_NOT_AVAILABLE = -2;
|
public static final int REASON_NOT_AVAILABLE = -2;
|
||||||
@ -80,30 +138,30 @@ public class RttManager {
|
|||||||
public static final String DESCRIPTION_KEY = "android.net.wifi.RttManager.Description";
|
public static final String DESCRIPTION_KEY = "android.net.wifi.RttManager.Description";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RTT BW supported bit mask
|
* RTT BW supported bit mask, used as RTT param bandWidth too
|
||||||
*/
|
*/
|
||||||
public static final int RTT_BW_5_SUPPORT = 0x1;
|
public static final int RTT_BW_5_SUPPORT = 0x01;
|
||||||
public static final int RTT_BW_10_SUPPORT = 0x2;
|
public static final int RTT_BW_10_SUPPORT = 0x02;
|
||||||
public static final int RTT_BW_20_SUPPORT = 0x4;
|
public static final int RTT_BW_20_SUPPORT = 0x04;
|
||||||
public static final int RTT_BW_40_SUPPORT = 0x8;
|
public static final int RTT_BW_40_SUPPORT = 0x08;
|
||||||
public static final int RTT_BW_80_SUPPORT = 0x10;
|
public static final int RTT_BW_80_SUPPORT = 0x10;
|
||||||
public static final int RTT_BW_160_SUPPORT = 0x20;
|
public static final int RTT_BW_160_SUPPORT = 0x20;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RTT Preamble Support bit mask
|
* RTT Preamble Support bit mask
|
||||||
*/
|
*/
|
||||||
public static final int PREAMBLE_LEGACY = 0x1;
|
public static final int PREAMBLE_LEGACY = 0x01;
|
||||||
public static final int PREAMBLE_HT = 0x2;
|
public static final int PREAMBLE_HT = 0x02;
|
||||||
public static final int PREAMBLE_VHT = 0x4;
|
public static final int PREAMBLE_VHT = 0x04;
|
||||||
|
|
||||||
/** @deprecated It has been replaced by RttCapabilities*/
|
/** @deprecated Use the new {@link android.net.wifi.RttManager.RttCapabilities} API */
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public class Capabilities {
|
public class Capabilities {
|
||||||
public int supportedType;
|
public int supportedType;
|
||||||
public int supportedPeerType;
|
public int supportedPeerType;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated It has been replaced by getRttCapabilities*/
|
/** @deprecated Use the new {@link android.net.wifi.RttManager#getRttCapabilities()} API.*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public Capabilities getCapabilities() {
|
public Capabilities getCapabilities() {
|
||||||
return new Capabilities();
|
return new Capabilities();
|
||||||
@ -241,28 +299,35 @@ public class RttManager {
|
|||||||
/** specifies parameters for RTT request */
|
/** specifies parameters for RTT request */
|
||||||
public static class RttParams {
|
public static class RttParams {
|
||||||
/**
|
/**
|
||||||
* type of destination device being ranged; one of RTT_PEER_TYPE_AP or RTT_PEER_TYPE_STA
|
* type of destination device being ranged
|
||||||
|
* currently only support RTT_PEER_TYPE_AP
|
||||||
|
* Range:RTT_PEER_TYPE_xxxx Default value:RTT_PEER_TYPE_AP
|
||||||
*/
|
*/
|
||||||
public int deviceType;
|
public int deviceType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* type of RTT measurement method; one of RTT_TYPE_ONE_SIDED or RTT_TYPE_TWO_SIDED.
|
* type of RTT measurement method. Need check scan result and RttCapabilities first
|
||||||
|
* Range: RTT_TYPE_ONE_SIDED or RTT_TYPE_TWO_SIDED
|
||||||
|
* Default value: RTT_TYPE_ONE_SIDED
|
||||||
*/
|
*/
|
||||||
public int requestType;
|
public int requestType;
|
||||||
|
|
||||||
/** mac address of the device being ranged */
|
/**
|
||||||
|
* mac address of the device being ranged
|
||||||
|
* Default value: null
|
||||||
|
*/
|
||||||
public String bssid;
|
public String bssid;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The primary 20 MHz frequency (in MHz) of the channel over which the client is
|
* The primary control channel over which the client is
|
||||||
* communicating with the access point.Similar as ScanResult.frequency
|
* communicating with the AP.Same as ScanResult.frequency
|
||||||
|
* Default value: 0
|
||||||
*/
|
*/
|
||||||
public int frequency;
|
public int frequency;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* channel width used for RTT measurement. User need verify the highest BW the destination
|
* channel width of the destination AP. Same as ScanResult.channelWidth
|
||||||
* support (from scan result etc) before set this value. Wider channels result usually give
|
* Default value: 0
|
||||||
* better accuracy. However, the frame loss can increase. Similar as ScanResult.channelWidth
|
|
||||||
*/
|
*/
|
||||||
public int channelWidth;
|
public int channelWidth;
|
||||||
|
|
||||||
@ -270,77 +335,113 @@ public class RttManager {
|
|||||||
* Not used if the AP bandwidth is 20 MHz
|
* Not used if the AP bandwidth is 20 MHz
|
||||||
* If the AP use 40, 80 or 160 MHz, this is the center frequency
|
* If the AP use 40, 80 or 160 MHz, this is the center frequency
|
||||||
* if the AP use 80 + 80 MHz, this is the center frequency of the first segment
|
* if the AP use 80 + 80 MHz, this is the center frequency of the first segment
|
||||||
* similar as ScanResult.centerFreq0
|
* same as ScanResult.centerFreq0
|
||||||
|
* Default value: 0
|
||||||
*/
|
*/
|
||||||
public int centerFreq0;
|
public int centerFreq0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Only used if the AP bandwidth is 80 + 80 MHz
|
* Only used if the AP bandwidth is 80 + 80 MHz
|
||||||
* if the AP use 80 + 80 MHz, this is the center frequency of the second segment
|
* if the AP use 80 + 80 MHz, this is the center frequency of the second segment
|
||||||
* similar as ScanResult.centerFreq1
|
* same as ScanResult.centerFreq1
|
||||||
|
* Default value: 0
|
||||||
*/
|
*/
|
||||||
public int centerFreq1;
|
public int centerFreq1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* number of samples to be taken
|
* number of samples to be taken
|
||||||
* @deprecated It has been replaced by numSamplesPerBurst
|
* @deprecated Use the new {@link android.net.wifi.RttManager.RttParams#numSamplesPerBurst}
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public int num_samples;
|
public int num_samples;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* number of retries if a sample fails
|
* number of retries if a sample fails
|
||||||
* @deprecated It has been replaced by numRetriesPerMeasurementFrame
|
* @deprecated
|
||||||
|
* Use {@link android.net.wifi.RttManager.RttParams#numRetriesPerMeasurementFrame} API.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public int num_retries;
|
public int num_retries;
|
||||||
|
|
||||||
/** Number of burst. fixed to 1 for single side RTT*/
|
/** Number of burst in exp , 2^x. 0 means single shot measurement, range 0-15
|
||||||
|
* Currently only single shot is supported
|
||||||
|
* Default value: 0
|
||||||
|
*/
|
||||||
public int numberBurst;
|
public int numberBurst;
|
||||||
|
|
||||||
/** valid only if numberBurst > 1, interval between burst(ms). Not used by singe side RTT */
|
/**
|
||||||
|
* valid only if numberBurst > 1, interval between burst(100ms).
|
||||||
|
* Range : 0-31, 0--means no specific
|
||||||
|
* Default value: 0
|
||||||
|
*/
|
||||||
public int interval;
|
public int interval;
|
||||||
|
|
||||||
/** number of samples to be taken in one burst*/
|
/**
|
||||||
|
* number of samples to be taken in one burst
|
||||||
|
* Range: 1-31
|
||||||
|
* Default value: 8
|
||||||
|
*/
|
||||||
public int numSamplesPerBurst;
|
public int numSamplesPerBurst;
|
||||||
|
|
||||||
/** number of retries for each measurement frame if a sample fails
|
/** number of retries for each measurement frame if a sample fails
|
||||||
* Only used by single side RTT
|
* Only used by single side RTT,
|
||||||
|
* Range 0 - 3 Default value: 0
|
||||||
*/
|
*/
|
||||||
public int numRetriesPerMeasurementFrame;
|
public int numRetriesPerMeasurementFrame;
|
||||||
|
|
||||||
/** number of retries for FTMR frame if fails Only used by 80211MC double side RTT */
|
/**
|
||||||
|
* number of retries for FTMR frame (control frame) if it fails.
|
||||||
|
* Only used by 80211MC double side RTT
|
||||||
|
* Range: 0-3 Default Value : 0
|
||||||
|
*/
|
||||||
public int numRetriesPerFTMR;
|
public int numRetriesPerFTMR;
|
||||||
|
|
||||||
/** Request LCI information */
|
/**
|
||||||
|
* Request LCI information, only available when choose double side RTT measurement
|
||||||
|
* need check RttCapabilties first.
|
||||||
|
* Default value: false
|
||||||
|
* */
|
||||||
public boolean LCIRequest;
|
public boolean LCIRequest;
|
||||||
|
|
||||||
/** Request LCR information */
|
/**
|
||||||
|
* Request LCR information, only available when choose double side RTT measurement
|
||||||
|
* need check RttCapabilties first.
|
||||||
|
* Default value: false
|
||||||
|
* */
|
||||||
public boolean LCRRequest;
|
public boolean LCRRequest;
|
||||||
|
|
||||||
/** Timeout for each burst, unit of 250 us*/
|
/**
|
||||||
|
* Timeout for each burst, (250 * 2^x) us,
|
||||||
|
* Range 1-11 and 15. 15 means no control Default value: 15
|
||||||
|
* */
|
||||||
public int burstTimeout;
|
public int burstTimeout;
|
||||||
|
|
||||||
/** preamble used for RTT measurement
|
/** preamble used for RTT measurement
|
||||||
* should be one of PREAMBLE_LEGACY, PREAMBLE_HT, PREAMBLE_VHT
|
* Range: PREAMBLE_LEGACY, PREAMBLE_HT, PREAMBLE_VHT
|
||||||
|
* Default value: PREAMBLE_HT
|
||||||
*/
|
*/
|
||||||
public int preamble;
|
public int preamble;
|
||||||
|
|
||||||
/** bandWidth used for RTT measurement.User need verify the highest BW the destination
|
/** bandWidth used for RTT measurement.User need verify the highest BW the destination
|
||||||
* support (from scan result etc) before set this value. Wider channels result usually give
|
* support (from scan result etc) before set this value. Wider channels result usually give
|
||||||
* better accuracy. However, the frame loss can increase too.
|
* better accuracy. However, the frame loss can increase too.
|
||||||
* should be one of RTT_CHANNEL_WIDTH_20 to RTT_CHANNEL_WIDTH_80
|
* should be one of RTT_BW_5_SUPPORT to RTT_BW_160_SUPPORT. However, need check
|
||||||
|
* RttCapabilities firstto verify HW support this bandwidth.
|
||||||
|
* Default value:RTT_BW_20_SUPPORT
|
||||||
*/
|
*/
|
||||||
public int bandwidth;
|
public int bandwidth;
|
||||||
|
|
||||||
public RttParams() {
|
public RttParams() {
|
||||||
//provide initial value for RttParams
|
//provide initial value for RttParams
|
||||||
deviceType = RTT_PEER_TYPE_AP;
|
deviceType = RTT_PEER_TYPE_AP;
|
||||||
numberBurst = 1;
|
requestType = RTT_TYPE_ONE_SIDED;
|
||||||
|
numberBurst = 0;
|
||||||
numSamplesPerBurst = 8;
|
numSamplesPerBurst = 8;
|
||||||
numRetriesPerMeasurementFrame = 0;
|
numRetriesPerMeasurementFrame = 0;
|
||||||
burstTimeout = 40 + numSamplesPerBurst *4;
|
numRetriesPerFTMR = 0;
|
||||||
preamble = PREAMBLE_LEGACY;
|
burstTimeout = 15;
|
||||||
bandwidth = RTT_CHANNEL_WIDTH_20;
|
preamble = PREAMBLE_HT;
|
||||||
|
bandwidth = RTT_BW_20_SUPPORT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -430,26 +531,29 @@ public class RttManager {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public class wifiInformationElement {
|
public static class WifiInformationElement {
|
||||||
/** Information Element ID*/
|
/** Information Element ID 0xFF means element is invalid. */
|
||||||
public int id;
|
public byte id;
|
||||||
public String data;
|
public byte[] data;
|
||||||
}
|
}
|
||||||
/** specifies RTT results */
|
/** specifies RTT results */
|
||||||
public static class RttResult {
|
public static class RttResult {
|
||||||
/** mac address of the device being ranged */
|
/** mac address of the device being ranged. */
|
||||||
public String bssid;
|
public String bssid;
|
||||||
|
|
||||||
/** # of burst for this measurement*/
|
/** # of burst for this measurement. */
|
||||||
public int burstNumber;
|
public int burstNumber;
|
||||||
|
|
||||||
/** total number of measurement frames in this measurement*/
|
/** total number of measurement frames attempted in this measurement. */
|
||||||
public int measurementFrameNumber;
|
public int measurementFrameNumber;
|
||||||
|
|
||||||
/** total successful number of measurement frames in this measurement*/
|
/** total successful number of measurement frames in this measurement. */
|
||||||
public int successMeasurementFrameNumber;
|
public int successMeasurementFrameNumber;
|
||||||
|
|
||||||
/** Maximum number of frames per burst supported by peer */
|
/**
|
||||||
|
* Maximum number of frames per burst supported by peer. Two side RTT only
|
||||||
|
* Valid only if less than request
|
||||||
|
*/
|
||||||
public int frameNumberPerBurstPeer;
|
public int frameNumberPerBurstPeer;
|
||||||
|
|
||||||
/** status of the request */
|
/** status of the request */
|
||||||
@ -457,120 +561,128 @@ public class RttManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* type of the request used
|
* type of the request used
|
||||||
* @deprecated It has been replaced by measurementType
|
* @deprecated Use {@link android.net.wifi.RttManager.RttResult#measurementType}
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public int requestType;
|
public int requestType;
|
||||||
|
|
||||||
/** RTT measurement method type used, shoudl be one of RTT_TYPE_ONE_SIDED or
|
/** RTT measurement method type used, should be one of RTT_TYPE_ONE_SIDED or
|
||||||
* RTT_TYPE_TWO_SIDED.
|
* RTT_TYPE_TWO_SIDED.
|
||||||
*/
|
*/
|
||||||
public int measurementType;
|
public int measurementType;
|
||||||
|
|
||||||
/** please retry RTT measurement after this S since peer indicate busy at ths moment*/
|
/**
|
||||||
|
* only valid when status == RTT_STATUS_FAIL_BUSY_TRY_LATER
|
||||||
|
* please retry RTT measurement after this duration since peer indicate busy at ths moment
|
||||||
|
* Unit S Range:1-31
|
||||||
|
*/
|
||||||
public int retryAfterDuration;
|
public int retryAfterDuration;
|
||||||
|
|
||||||
/** timestamp of completion, in microsecond since boot */
|
/** timestamp of completion, in microsecond since boot. */
|
||||||
public long ts;
|
public long ts;
|
||||||
|
|
||||||
/** average RSSI observed, unit of 0.5 dB */
|
/** average RSSI observed, unit of 0.5 dB. */
|
||||||
public int rssi;
|
public int rssi;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RSSI spread (i.e. max - min)
|
* RSSI spread (i.e. max - min)
|
||||||
* @deprecated It has been replaced by rssi_spread
|
* @deprecated Use {@link android.net.wifi.RttManager.RttResult#rssiSpread} API.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public int rssi_spread;
|
public int rssi_spread;
|
||||||
|
|
||||||
/**RSSI spread (i.e. max - min), unit of 0.5 dB */
|
/**RSSI spread (i.e. max - min), unit of 0.5 dB. */
|
||||||
public int rssiSpread;
|
public int rssiSpread;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* average transmit rate
|
* average transmit rate
|
||||||
* @deprecated It has been replaced by txRate
|
* @deprecated Use {@link android.net.wifi.RttManager.RttResult#txRate} API.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public int tx_rate;
|
public int tx_rate;
|
||||||
|
|
||||||
/** average transmit rate */
|
/** average transmit rate. Unit (100kbps). */
|
||||||
public int txRate;
|
public int txRate;
|
||||||
|
|
||||||
/** average receiving rate */
|
/** average receiving rate Unit (100kbps). */
|
||||||
public int rxRate;
|
public int rxRate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* average round trip time in nano second
|
* average round trip time in nano second
|
||||||
* @deprecated It has been replaced by rtt
|
* @deprecated Use {@link android.net.wifi.RttManager.RttResult#rtt} API.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public long rtt_ns;
|
public long rtt_ns;
|
||||||
|
|
||||||
/** average round trip time in 0.1 nano second */
|
/** average round trip time in 0.1 nano second. */
|
||||||
public long rtt;
|
public long rtt;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* standard deviation observed in round trip time
|
* standard deviation observed in round trip time
|
||||||
* @deprecated It has been replaced by rttStandardDeviation
|
* @deprecated Use {@link android.net.wifi.RttManager.RttResult#rttStandardDeviation} API.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public long rtt_sd_ns;
|
public long rtt_sd_ns;
|
||||||
|
|
||||||
/** standard deviation of RTT in 0.1 ns */
|
/** standard deviation of RTT in 0.1 ns. */
|
||||||
public long rttStandardDeviation;
|
public long rttStandardDeviation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* spread (i.e. max - min) round trip time
|
* spread (i.e. max - min) round trip time
|
||||||
* @deprecated It has been replaced by rttSpread
|
* @deprecated Use {@link android.net.wifi.RttManager.RttResult#rttSpread} API.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public long rtt_spread_ns;
|
public long rtt_spread_ns;
|
||||||
|
|
||||||
/** spread (i.e. max - min) RTT in 0.1 ns */
|
/** spread (i.e. max - min) RTT in 0.1 ns. */
|
||||||
public long rttSpread;
|
public long rttSpread;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* average distance in centimeter, computed based on rtt_ns
|
* average distance in centimeter, computed based on rtt_ns
|
||||||
* @deprecated It has been replaced by distance
|
* @deprecated use {@link android.net.wifi.RttManager.RttResult#distance} API.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public int distance_cm;
|
public int distance_cm;
|
||||||
|
|
||||||
/** average distance in cm, computed based on rtt */
|
/** average distance in cm, computed based on rtt. */
|
||||||
public int distance;
|
public int distance;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* standard deviation observed in distance
|
* standard deviation observed in distance
|
||||||
* @deprecated It has been replaced with distanceStandardDeviation
|
* @deprecated
|
||||||
|
* Use {@link .android.net.wifi.RttManager.RttResult#distanceStandardDeviation} API.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public int distance_sd_cm;
|
public int distance_sd_cm;
|
||||||
|
|
||||||
/** standard deviation observed in distance in cm*/
|
/** standard deviation observed in distance in cm. */
|
||||||
public int distanceStandardDeviation;
|
public int distanceStandardDeviation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* spread (i.e. max - min) distance
|
* spread (i.e. max - min) distance
|
||||||
* @deprecated It has been replaced by distanceSpread
|
* @deprecate Use {@link android.net.wifi.RttManager.RttResult#distanceSpread} API.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public int distance_spread_cm;
|
public int distance_spread_cm;
|
||||||
|
|
||||||
/** spread (i.e. max - min) distance in cm */
|
/** spread (i.e. max - min) distance in cm. */
|
||||||
public int distanceSpread;
|
public int distanceSpread;
|
||||||
|
|
||||||
/** the duration of this measurement burst*/
|
/** the duration of this measurement burst, unit ms. */
|
||||||
public int burstDuration;
|
public int burstDuration;
|
||||||
|
|
||||||
/** LCI information Element*/
|
/** Burst number supported by peer after negotiation, 2side RTT only*/
|
||||||
wifiInformationElement LCI;
|
public int negotiatedBurstNum;
|
||||||
|
|
||||||
/** LCR information Element*/
|
/** LCI information Element, only available for double side RTT. */
|
||||||
wifiInformationElement LCR;
|
public WifiInformationElement LCI;
|
||||||
|
|
||||||
|
/** LCR information Element, only available to double side RTT. */
|
||||||
|
public WifiInformationElement LCR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** pseudo-private class used to parcel results */
|
/** pseudo-private class used to parcel results. */
|
||||||
public static class ParcelableRttResults implements Parcelable {
|
public static class ParcelableRttResults implements Parcelable {
|
||||||
|
|
||||||
public RttResult mResults[];
|
public RttResult mResults[];
|
||||||
@ -608,10 +720,17 @@ public class RttManager {
|
|||||||
dest.writeInt(result.distanceStandardDeviation);
|
dest.writeInt(result.distanceStandardDeviation);
|
||||||
dest.writeInt(result.distanceSpread);
|
dest.writeInt(result.distanceSpread);
|
||||||
dest.writeInt(result.burstDuration);
|
dest.writeInt(result.burstDuration);
|
||||||
//dest.writeInt(result.LCI.id);
|
dest.writeInt(result.negotiatedBurstNum);
|
||||||
//dest.writeString(result.LCI.data);
|
dest.writeByte(result.LCI.id);
|
||||||
//dest.writeInt(result.LCR.id);
|
if (result.LCI.id != (byte) 0xFF) {
|
||||||
//dest.writeString(result.LCR.data);
|
dest.writeByte((byte)result.LCI.data.length);
|
||||||
|
dest.writeByteArray(result.LCI.data);
|
||||||
|
}
|
||||||
|
dest.writeByte(result.LCR.id);
|
||||||
|
if (result.LCR.id != (byte) 0xFF) {
|
||||||
|
dest.writeInt((byte) result.LCR.data.length);
|
||||||
|
dest.writeByte(result.LCR.id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dest.writeInt(0);
|
dest.writeInt(0);
|
||||||
@ -651,10 +770,21 @@ public class RttManager {
|
|||||||
results[i].distanceStandardDeviation = in.readInt();
|
results[i].distanceStandardDeviation = in.readInt();
|
||||||
results[i].distanceSpread = in.readInt();
|
results[i].distanceSpread = in.readInt();
|
||||||
results[i].burstDuration = in.readInt();
|
results[i].burstDuration = in.readInt();
|
||||||
//results[i].LCI.id = in.readInt();
|
results[i].negotiatedBurstNum = in.readInt();
|
||||||
//results[i].LCI.data = in.readString();
|
results[i].LCI = new WifiInformationElement();
|
||||||
//results[i].LCR.id = in.readInt();
|
results[i].LCI.id = in.readByte();
|
||||||
//results[i].LCR.data = in.readString();
|
if (results[i].LCI.id != (byte) 0xFF) {
|
||||||
|
byte length = in.readByte();
|
||||||
|
results[i].LCI.data = new byte[length];
|
||||||
|
in.readByteArray(results[i].LCI.data);
|
||||||
|
}
|
||||||
|
results[i].LCR = new WifiInformationElement();
|
||||||
|
results[i].LCR.id = in.readByte();
|
||||||
|
if (results[i].LCR.id != (byte) 0xFF) {
|
||||||
|
byte length = in.readByte();
|
||||||
|
results[i].LCR.data = new byte[length];
|
||||||
|
in.readByteArray(results[i].LCR.data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ParcelableRttResults parcelableResults = new ParcelableRttResults(results);
|
ParcelableRttResults parcelableResults = new ParcelableRttResults(results);
|
||||||
@ -696,18 +826,24 @@ public class RttManager {
|
|||||||
!mRttCapabilities.twoSided11McRttSupported) {
|
!mRttCapabilities.twoSided11McRttSupported) {
|
||||||
Log.e(TAG, "Request " + index + ": two side RTT is not supported");
|
Log.e(TAG, "Request " + index + ": two side RTT is not supported");
|
||||||
return false;
|
return false;
|
||||||
} else if ( params.numberBurst <= 0 ) {
|
} else if(params.bssid == null || params.bssid.isEmpty()) {
|
||||||
|
Log.e(TAG,"No BSSID is input");
|
||||||
|
} else if ( params.numberBurst != 0 ) {
|
||||||
Log.e(TAG, "Request " + index + ": Illegal number of burst: " + params.numberBurst);
|
Log.e(TAG, "Request " + index + ": Illegal number of burst: " + params.numberBurst);
|
||||||
return false;
|
return false;
|
||||||
} else if (params.numberBurst > 1 && params.interval <= 0) {
|
} else if (params.numSamplesPerBurst <= 0 || params.numSamplesPerBurst > 31) {
|
||||||
Log.e(TAG, "Request " + index + ": Illegal interval value: " + params.interval);
|
|
||||||
return false;
|
|
||||||
} else if (params.numSamplesPerBurst <= 0) {
|
|
||||||
Log.e(TAG, "Request " + index + ": Illegal sample number per burst: " +
|
Log.e(TAG, "Request " + index + ": Illegal sample number per burst: " +
|
||||||
params.numSamplesPerBurst);
|
params.numSamplesPerBurst);
|
||||||
return false;
|
return false;
|
||||||
} else if (params.numRetriesPerMeasurementFrame < 0 || params.numRetriesPerFTMR < 0) {
|
} else if (params.numRetriesPerMeasurementFrame < 0 ||
|
||||||
Log.e(TAG, "Request " + index + ": Illegal retry number");
|
params.numRetriesPerMeasurementFrame > 3) {
|
||||||
|
Log.e(TAG, "Request " + index + ": Illegal measurement frame retry number:" +
|
||||||
|
params.numRetriesPerMeasurementFrame);
|
||||||
|
return false;
|
||||||
|
} else if(params.numRetriesPerFTMR < 0 ||
|
||||||
|
params.numRetriesPerFTMR > 3) {
|
||||||
|
Log.e(TAG, "Request " + index + ": Illegal FTMR frame retry number:" +
|
||||||
|
params.numRetriesPerFTMR);
|
||||||
return false;
|
return false;
|
||||||
} else if (params.LCIRequest && !mRttCapabilities.lciSupported) {
|
} else if (params.LCIRequest && !mRttCapabilities.lciSupported) {
|
||||||
Log.e(TAG, "Request " + index + ": LCI is not supported");
|
Log.e(TAG, "Request " + index + ": LCI is not supported");
|
||||||
@ -715,7 +851,8 @@ public class RttManager {
|
|||||||
} else if (params.LCRRequest && !mRttCapabilities.lcrSupported) {
|
} else if (params.LCRRequest && !mRttCapabilities.lcrSupported) {
|
||||||
Log.e(TAG, "Request " + index + ": LCR is not supported");
|
Log.e(TAG, "Request " + index + ": LCR is not supported");
|
||||||
return false;
|
return false;
|
||||||
} else if (params.burstTimeout <= 0){
|
} else if (params.burstTimeout < 1 ||
|
||||||
|
(params.burstTimeout > 11 && params.burstTimeout != 15)){
|
||||||
Log.e(TAG, "Request " + index + ": Illegal burst timeout: " + params.burstTimeout);
|
Log.e(TAG, "Request " + index + ": Illegal burst timeout: " + params.burstTimeout);
|
||||||
return false;
|
return false;
|
||||||
} else if ((params.preamble & mRttCapabilities.preambleSupported) == 0) {
|
} else if ((params.preamble & mRttCapabilities.preambleSupported) == 0) {
|
||||||
|
Reference in New Issue
Block a user