RTT framework interface update
Bug:19917983
Change-Id: I1c89c4c583923137983243814e35c8981f6db54a
diff --git a/api/system-current.txt b/api/system-current.txt
index d86efb9..646b9a0 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -19271,21 +19271,25 @@
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_80_SUPPORT = 16; // 0x10
- field public static final int RTT_CHANNEL_WIDTH_10 = 6; // 0x6
- field public static final int RTT_CHANNEL_WIDTH_160 = 3; // 0x3
- field public static final int RTT_CHANNEL_WIDTH_20 = 0; // 0x0
- field public static final int RTT_CHANNEL_WIDTH_40 = 1; // 0x1
- field public static final int RTT_CHANNEL_WIDTH_5 = 5; // 0x5
- field public static final 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_10 = 6; // 0x6
+ field public static final deprecated int RTT_CHANNEL_WIDTH_160 = 3; // 0x3
+ field public static final deprecated int RTT_CHANNEL_WIDTH_20 = 0; // 0x0
+ field public static final deprecated int RTT_CHANNEL_WIDTH_40 = 1; // 0x1
+ field public static final deprecated int RTT_CHANNEL_WIDTH_5 = 5; // 0x5
+ field public static final deprecated int RTT_CHANNEL_WIDTH_80 = 2; // 0x2
+ 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 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_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_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_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_NOT_SCHEDULED_YET = 4; // 0x4
field public static final int RTT_STATUS_FAIL_NO_CAPABILITY = 7; // 0x7
@@ -19294,11 +19298,13 @@
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_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 deprecated int RTT_TYPE_11_MC = 4; // 0x4
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_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
}
@@ -19366,6 +19372,8 @@
public static class 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 int burstDuration;
field public int burstNumber;
@@ -19378,6 +19386,7 @@
field public int frameNumberPerBurstPeer;
field public int measurementFrameNumber;
field public int measurementType;
+ field public int negotiatedBurstNum;
field public deprecated int requestType;
field public int retryAfterDuration;
field public int rssi;
@@ -19397,10 +19406,10 @@
field public deprecated int tx_rate;
}
- public class RttManager.wifiInformationElement {
- ctor public RttManager.wifiInformationElement();
- field public java.lang.String data;
- field public int id;
+ public static class RttManager.WifiInformationElement {
+ ctor public RttManager.WifiInformationElement();
+ field public byte[] data;
+ field public byte id;
}
public class ScanResult implements android.os.Parcelable {
diff --git a/wifi/java/android/net/wifi/RttManager.java b/wifi/java/android/net/wifi/RttManager.java
index 65ecf5d..b156d0c 100644
--- a/wifi/java/android/net/wifi/RttManager.java
+++ b/wifi/java/android/net/wifi/RttManager.java
@@ -26,51 +26,109 @@
private static final boolean DBG = true;
private static final String TAG = "RttManager";
- /** @deprecated Type must be specified*/
+ /** @deprecated It is Not supported anymore. */
@Deprecated
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
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
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_AP = 1;
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;
+
+ /**
+ * @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;
+
+ /**
+ * @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;
+
+ /**@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;
+
+ /**@deprecated not supported anymore*/
+ @Deprecated
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;
+
+ /**@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;
- /** @deprecated channel info must be specified*/
+ /** @deprecated channel info must be specified. */
@Deprecated
public static final int RTT_CHANNEL_WIDTH_UNSPECIFIED = -1;
public static final int RTT_STATUS_SUCCESS = 0;
+ /** General failure*/
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;
+ /** 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_NOT_SCHEDULED_YET = 4;
+ /** Timing measurement timeout*/
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;
+ /** This type of Ranging is not support by Hardware*/
public static final int RTT_STATUS_FAIL_NO_CAPABILITY = 7;
+ /** Request abort fro uncertain reason*/
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;
- //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;
+ /** Request can not be scheduled by hardware*/
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;
+ /** 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_NOT_AVAILABLE = -2;
@@ -80,30 +138,30 @@
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_10_SUPPORT = 0x2;
- public static final int RTT_BW_20_SUPPORT = 0x4;
- public static final int RTT_BW_40_SUPPORT = 0x8;
+ public static final int RTT_BW_5_SUPPORT = 0x01;
+ public static final int RTT_BW_10_SUPPORT = 0x02;
+ public static final int RTT_BW_20_SUPPORT = 0x04;
+ public static final int RTT_BW_40_SUPPORT = 0x08;
public static final int RTT_BW_80_SUPPORT = 0x10;
public static final int RTT_BW_160_SUPPORT = 0x20;
/**
* RTT Preamble Support bit mask
*/
- public static final int PREAMBLE_LEGACY = 0x1;
- public static final int PREAMBLE_HT = 0x2;
- public static final int PREAMBLE_VHT = 0x4;
+ public static final int PREAMBLE_LEGACY = 0x01;
+ public static final int PREAMBLE_HT = 0x02;
+ 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
public class Capabilities {
public int supportedType;
public int supportedPeerType;
}
- /** @deprecated It has been replaced by getRttCapabilities*/
+ /** @deprecated Use the new {@link android.net.wifi.RttManager#getRttCapabilities()} API.*/
@Deprecated
public Capabilities getCapabilities() {
return new Capabilities();
@@ -241,28 +299,35 @@
/** specifies parameters for RTT request */
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;
/**
- * 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;
- /** mac address of the device being ranged */
+ /**
+ * mac address of the device being ranged
+ * Default value: null
+ */
public String bssid;
/**
- * The primary 20 MHz frequency (in MHz) of the channel over which the client is
- * communicating with the access point.Similar as ScanResult.frequency
+ * The primary control channel over which the client is
+ * communicating with the AP.Same as ScanResult.frequency
+ * Default value: 0
*/
public int frequency;
/**
- * channel width 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
- * better accuracy. However, the frame loss can increase. Similar as ScanResult.channelWidth
+ * channel width of the destination AP. Same as ScanResult.channelWidth
+ * Default value: 0
*/
public int channelWidth;
@@ -270,77 +335,113 @@
* 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 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;
/**
* 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
- * similar as ScanResult.centerFreq1
+ * same as ScanResult.centerFreq1
+ * Default value: 0
*/
public int centerFreq1;
+
/**
* 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
public int num_samples;
/**
* 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
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;
- /** 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;
- /** 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;
/** 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;
- /** 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;
- /** Request LCI information */
+ /**
+ * Request LCI information, only available when choose double side RTT measurement
+ * need check RttCapabilties first.
+ * Default value: false
+ * */
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;
- /** 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;
/** 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;
/** 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
* 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 RttParams() {
//provide initial value for RttParams
deviceType = RTT_PEER_TYPE_AP;
- numberBurst = 1;
+ requestType = RTT_TYPE_ONE_SIDED;
+ numberBurst = 0;
numSamplesPerBurst = 8;
numRetriesPerMeasurementFrame = 0;
- burstTimeout = 40 + numSamplesPerBurst *4;
- preamble = PREAMBLE_LEGACY;
- bandwidth = RTT_CHANNEL_WIDTH_20;
+ numRetriesPerFTMR = 0;
+ burstTimeout = 15;
+ preamble = PREAMBLE_HT;
+ bandwidth = RTT_BW_20_SUPPORT;
}
}
@@ -430,26 +531,29 @@
};
}
- public class wifiInformationElement {
- /** Information Element ID*/
- public int id;
- public String data;
+ public static class WifiInformationElement {
+ /** Information Element ID 0xFF means element is invalid. */
+ public byte id;
+ public byte[] data;
}
/** specifies RTT results */
public static class RttResult {
- /** mac address of the device being ranged */
+ /** mac address of the device being ranged. */
public String bssid;
- /** # of burst for this measurement*/
+ /** # of burst for this measurement. */
public int burstNumber;
- /** total number of measurement frames in this measurement*/
+ /** total number of measurement frames attempted in this measurement. */
public int measurementFrameNumber;
- /** total successful number of measurement frames in this measurement*/
+ /** total successful number of measurement frames in this measurement. */
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;
/** status of the request */
@@ -457,120 +561,128 @@
/**
* type of the request used
- * @deprecated It has been replaced by measurementType
+ * @deprecated Use {@link android.net.wifi.RttManager.RttResult#measurementType}
*/
@Deprecated
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.
*/
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;
- /** timestamp of completion, in microsecond since boot */
+ /** timestamp of completion, in microsecond since boot. */
public long ts;
- /** average RSSI observed, unit of 0.5 dB */
+ /** average RSSI observed, unit of 0.5 dB. */
public int rssi;
/**
* 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
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;
/**
* average transmit rate
- * @deprecated It has been replaced by txRate
+ * @deprecated Use {@link android.net.wifi.RttManager.RttResult#txRate} API.
*/
@Deprecated
public int tx_rate;
- /** average transmit rate */
+ /** average transmit rate. Unit (100kbps). */
public int txRate;
- /** average receiving rate */
+ /** average receiving rate Unit (100kbps). */
public int rxRate;
/**
* 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
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;
/**
* 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
public long rtt_sd_ns;
- /** standard deviation of RTT in 0.1 ns */
+ /** standard deviation of RTT in 0.1 ns. */
public long rttStandardDeviation;
/**
* 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
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;
/**
* 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
public int distance_cm;
- /** average distance in cm, computed based on rtt */
+ /** average distance in cm, computed based on rtt. */
public int distance;
/**
* standard deviation observed in distance
- * @deprecated It has been replaced with distanceStandardDeviation
+ * @deprecated
+ * Use {@link .android.net.wifi.RttManager.RttResult#distanceStandardDeviation} API.
*/
@Deprecated
public int distance_sd_cm;
- /** standard deviation observed in distance in cm*/
+ /** standard deviation observed in distance in cm. */
public int distanceStandardDeviation;
/**
* spread (i.e. max - min) distance
- * @deprecated It has been replaced by distanceSpread
+ * @deprecate Use {@link android.net.wifi.RttManager.RttResult#distanceSpread} API.
*/
@Deprecated
public int distance_spread_cm;
- /** spread (i.e. max - min) distance in cm */
+ /** spread (i.e. max - min) distance in cm. */
public int distanceSpread;
- /** the duration of this measurement burst*/
+ /** the duration of this measurement burst, unit ms. */
public int burstDuration;
- /** LCI information Element*/
- wifiInformationElement LCI;
+ /** Burst number supported by peer after negotiation, 2side RTT only*/
+ public int negotiatedBurstNum;
- /** LCR information Element*/
- wifiInformationElement LCR;
+ /** LCI information Element, only available for double side RTT. */
+ 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 RttResult mResults[];
@@ -608,10 +720,17 @@
dest.writeInt(result.distanceStandardDeviation);
dest.writeInt(result.distanceSpread);
dest.writeInt(result.burstDuration);
- //dest.writeInt(result.LCI.id);
- //dest.writeString(result.LCI.data);
- //dest.writeInt(result.LCR.id);
- //dest.writeString(result.LCR.data);
+ dest.writeInt(result.negotiatedBurstNum);
+ dest.writeByte(result.LCI.id);
+ if (result.LCI.id != (byte) 0xFF) {
+ 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 {
dest.writeInt(0);
@@ -651,10 +770,21 @@
results[i].distanceStandardDeviation = in.readInt();
results[i].distanceSpread = in.readInt();
results[i].burstDuration = in.readInt();
- //results[i].LCI.id = in.readInt();
- //results[i].LCI.data = in.readString();
- //results[i].LCR.id = in.readInt();
- //results[i].LCR.data = in.readString();
+ results[i].negotiatedBurstNum = in.readInt();
+ results[i].LCI = new WifiInformationElement();
+ results[i].LCI.id = in.readByte();
+ 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);
@@ -696,18 +826,24 @@
!mRttCapabilities.twoSided11McRttSupported) {
Log.e(TAG, "Request " + index + ": two side RTT is not supported");
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);
return false;
- } else if (params.numberBurst > 1 && params.interval <= 0) {
- Log.e(TAG, "Request " + index + ": Illegal interval value: " + params.interval);
- return false;
- } else if (params.numSamplesPerBurst <= 0) {
+ } else if (params.numSamplesPerBurst <= 0 || params.numSamplesPerBurst > 31) {
Log.e(TAG, "Request " + index + ": Illegal sample number per burst: " +
params.numSamplesPerBurst);
return false;
- } else if (params.numRetriesPerMeasurementFrame < 0 || params.numRetriesPerFTMR < 0) {
- Log.e(TAG, "Request " + index + ": Illegal retry number");
+ } else if (params.numRetriesPerMeasurementFrame < 0 ||
+ 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;
} else if (params.LCIRequest && !mRttCapabilities.lciSupported) {
Log.e(TAG, "Request " + index + ": LCI is not supported");
@@ -715,7 +851,8 @@
} else if (params.LCRRequest && !mRttCapabilities.lcrSupported) {
Log.e(TAG, "Request " + index + ": LCR is not supported");
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);
return false;
} else if ((params.preamble & mRttCapabilities.preambleSupported) == 0) {