Merge "Bluetooth 5 PHY simplification" am: a9acf9db97 am: d43127865b

am: ce8de6c3f7

Change-Id: I74da41983775b03ee2e642a07b5a8bdcf3be45cf
This commit is contained in:
Jakub Pawlowski
2017-04-12 21:56:26 +00:00
committed by android-build-merger
10 changed files with 64 additions and 107 deletions

View File

@@ -7604,9 +7604,11 @@ package android.bluetooth {
field public static final int PAIRING_VARIANT_PASSKEY_CONFIRMATION = 2; // 0x2 field public static final int PAIRING_VARIANT_PASSKEY_CONFIRMATION = 2; // 0x2
field public static final int PAIRING_VARIANT_PIN = 0; // 0x0 field public static final int PAIRING_VARIANT_PIN = 0; // 0x0
field public static final int PHY_LE_1M = 1; // 0x1 field public static final int PHY_LE_1M = 1; // 0x1
field public static final int PHY_LE_1M_MASK = 1; // 0x1
field public static final int PHY_LE_2M = 2; // 0x2 field public static final int PHY_LE_2M = 2; // 0x2
field public static final int PHY_LE_ANY = 7; // 0x7 field public static final int PHY_LE_2M_MASK = 2; // 0x2
field public static final int PHY_LE_CODED = 4; // 0x4 field public static final int PHY_LE_CODED = 3; // 0x3
field public static final int PHY_LE_CODED_MASK = 4; // 0x4
field public static final int PHY_OPTION_NO_PREFERRED = 0; // 0x0 field public static final int PHY_OPTION_NO_PREFERRED = 0; // 0x0
field public static final int PHY_OPTION_S2 = 1; // 0x1 field public static final int PHY_OPTION_S2 = 1; // 0x1
field public static final int PHY_OPTION_S8 = 2; // 0x2 field public static final int PHY_OPTION_S8 = 2; // 0x2
@@ -8024,9 +8026,6 @@ package android.bluetooth.le {
field public static final int INTERVAL_MAX = 16777215; // 0xffffff field public static final int INTERVAL_MAX = 16777215; // 0xffffff
field public static final int INTERVAL_MEDIUM = 400; // 0x190 field public static final int INTERVAL_MEDIUM = 400; // 0x190
field public static final int INTERVAL_MIN = 160; // 0xa0 field public static final int INTERVAL_MIN = 160; // 0xa0
field public static final int PHY_LE_1M = 1; // 0x1
field public static final int PHY_LE_2M = 2; // 0x2
field public static final int PHY_LE_CODED = 3; // 0x3
field public static final int TX_POWER_HIGH = 1; // 0x1 field public static final int TX_POWER_HIGH = 1; // 0x1
field public static final int TX_POWER_LOW = -15; // 0xfffffff1 field public static final int TX_POWER_LOW = -15; // 0xfffffff1
field public static final int TX_POWER_MAX = 1; // 0x1 field public static final int TX_POWER_MAX = 1; // 0x1
@@ -8155,9 +8154,6 @@ package android.bluetooth.le {
field public static final android.os.Parcelable.Creator<android.bluetooth.le.ScanResult> CREATOR; field public static final android.os.Parcelable.Creator<android.bluetooth.le.ScanResult> CREATOR;
field public static final int DATA_COMPLETE = 0; // 0x0 field public static final int DATA_COMPLETE = 0; // 0x0
field public static final int DATA_TRUNCATED = 2; // 0x2 field public static final int DATA_TRUNCATED = 2; // 0x2
field public static final int PHY_LE_1M = 1; // 0x1
field public static final int PHY_LE_2M = 2; // 0x2
field public static final int PHY_LE_CODED = 3; // 0x3
field public static final int PHY_UNUSED = 0; // 0x0 field public static final int PHY_UNUSED = 0; // 0x0
field public static final int SID_NOT_PRESENT = 255; // 0xff field public static final int SID_NOT_PRESENT = 255; // 0xff
} }
@@ -8180,9 +8176,7 @@ package android.bluetooth.le {
field public static final int MATCH_NUM_FEW_ADVERTISEMENT = 2; // 0x2 field public static final int MATCH_NUM_FEW_ADVERTISEMENT = 2; // 0x2
field public static final int MATCH_NUM_MAX_ADVERTISEMENT = 3; // 0x3 field public static final int MATCH_NUM_MAX_ADVERTISEMENT = 3; // 0x3
field public static final int MATCH_NUM_ONE_ADVERTISEMENT = 1; // 0x1 field public static final int MATCH_NUM_ONE_ADVERTISEMENT = 1; // 0x1
field public static final int PHY_LE_1M = 1; // 0x1
field public static final int PHY_LE_ALL_SUPPORTED = 255; // 0xff field public static final int PHY_LE_ALL_SUPPORTED = 255; // 0xff
field public static final int PHY_LE_CODED = 3; // 0x3
field public static final int SCAN_MODE_BALANCED = 1; // 0x1 field public static final int SCAN_MODE_BALANCED = 1; // 0x1
field public static final int SCAN_MODE_LOW_LATENCY = 2; // 0x2 field public static final int SCAN_MODE_LOW_LATENCY = 2; // 0x2
field public static final int SCAN_MODE_LOW_POWER = 0; // 0x0 field public static final int SCAN_MODE_LOW_POWER = 0; // 0x0

View File

@@ -8074,9 +8074,11 @@ package android.bluetooth {
field public static final int PAIRING_VARIANT_PASSKEY_CONFIRMATION = 2; // 0x2 field public static final int PAIRING_VARIANT_PASSKEY_CONFIRMATION = 2; // 0x2
field public static final int PAIRING_VARIANT_PIN = 0; // 0x0 field public static final int PAIRING_VARIANT_PIN = 0; // 0x0
field public static final int PHY_LE_1M = 1; // 0x1 field public static final int PHY_LE_1M = 1; // 0x1
field public static final int PHY_LE_1M_MASK = 1; // 0x1
field public static final int PHY_LE_2M = 2; // 0x2 field public static final int PHY_LE_2M = 2; // 0x2
field public static final int PHY_LE_ANY = 7; // 0x7 field public static final int PHY_LE_2M_MASK = 2; // 0x2
field public static final int PHY_LE_CODED = 4; // 0x4 field public static final int PHY_LE_CODED = 3; // 0x3
field public static final int PHY_LE_CODED_MASK = 4; // 0x4
field public static final int PHY_OPTION_NO_PREFERRED = 0; // 0x0 field public static final int PHY_OPTION_NO_PREFERRED = 0; // 0x0
field public static final int PHY_OPTION_S2 = 1; // 0x1 field public static final int PHY_OPTION_S2 = 1; // 0x1
field public static final int PHY_OPTION_S8 = 2; // 0x2 field public static final int PHY_OPTION_S8 = 2; // 0x2
@@ -8494,9 +8496,6 @@ package android.bluetooth.le {
field public static final int INTERVAL_MAX = 16777215; // 0xffffff field public static final int INTERVAL_MAX = 16777215; // 0xffffff
field public static final int INTERVAL_MEDIUM = 400; // 0x190 field public static final int INTERVAL_MEDIUM = 400; // 0x190
field public static final int INTERVAL_MIN = 160; // 0xa0 field public static final int INTERVAL_MIN = 160; // 0xa0
field public static final int PHY_LE_1M = 1; // 0x1
field public static final int PHY_LE_2M = 2; // 0x2
field public static final int PHY_LE_CODED = 3; // 0x3
field public static final int TX_POWER_HIGH = 1; // 0x1 field public static final int TX_POWER_HIGH = 1; // 0x1
field public static final int TX_POWER_LOW = -15; // 0xfffffff1 field public static final int TX_POWER_LOW = -15; // 0xfffffff1
field public static final int TX_POWER_MAX = 1; // 0x1 field public static final int TX_POWER_MAX = 1; // 0x1
@@ -8638,9 +8637,6 @@ package android.bluetooth.le {
field public static final android.os.Parcelable.Creator<android.bluetooth.le.ScanResult> CREATOR; field public static final android.os.Parcelable.Creator<android.bluetooth.le.ScanResult> CREATOR;
field public static final int DATA_COMPLETE = 0; // 0x0 field public static final int DATA_COMPLETE = 0; // 0x0
field public static final int DATA_TRUNCATED = 2; // 0x2 field public static final int DATA_TRUNCATED = 2; // 0x2
field public static final int PHY_LE_1M = 1; // 0x1
field public static final int PHY_LE_2M = 2; // 0x2
field public static final int PHY_LE_CODED = 3; // 0x3
field public static final int PHY_UNUSED = 0; // 0x0 field public static final int PHY_UNUSED = 0; // 0x0
field public static final int SID_NOT_PRESENT = 255; // 0xff field public static final int SID_NOT_PRESENT = 255; // 0xff
} }
@@ -8663,9 +8659,7 @@ package android.bluetooth.le {
field public static final int MATCH_NUM_FEW_ADVERTISEMENT = 2; // 0x2 field public static final int MATCH_NUM_FEW_ADVERTISEMENT = 2; // 0x2
field public static final int MATCH_NUM_MAX_ADVERTISEMENT = 3; // 0x3 field public static final int MATCH_NUM_MAX_ADVERTISEMENT = 3; // 0x3
field public static final int MATCH_NUM_ONE_ADVERTISEMENT = 1; // 0x1 field public static final int MATCH_NUM_ONE_ADVERTISEMENT = 1; // 0x1
field public static final int PHY_LE_1M = 1; // 0x1
field public static final int PHY_LE_ALL_SUPPORTED = 255; // 0xff field public static final int PHY_LE_ALL_SUPPORTED = 255; // 0xff
field public static final int PHY_LE_CODED = 3; // 0x3
field public static final int SCAN_MODE_BALANCED = 1; // 0x1 field public static final int SCAN_MODE_BALANCED = 1; // 0x1
field public static final int SCAN_MODE_LOW_LATENCY = 2; // 0x2 field public static final int SCAN_MODE_LOW_LATENCY = 2; // 0x2
field public static final int SCAN_MODE_LOW_POWER = 0; // 0x0 field public static final int SCAN_MODE_LOW_POWER = 0; // 0x0

View File

@@ -7635,9 +7635,11 @@ package android.bluetooth {
field public static final int PAIRING_VARIANT_PASSKEY_CONFIRMATION = 2; // 0x2 field public static final int PAIRING_VARIANT_PASSKEY_CONFIRMATION = 2; // 0x2
field public static final int PAIRING_VARIANT_PIN = 0; // 0x0 field public static final int PAIRING_VARIANT_PIN = 0; // 0x0
field public static final int PHY_LE_1M = 1; // 0x1 field public static final int PHY_LE_1M = 1; // 0x1
field public static final int PHY_LE_1M_MASK = 1; // 0x1
field public static final int PHY_LE_2M = 2; // 0x2 field public static final int PHY_LE_2M = 2; // 0x2
field public static final int PHY_LE_ANY = 7; // 0x7 field public static final int PHY_LE_2M_MASK = 2; // 0x2
field public static final int PHY_LE_CODED = 4; // 0x4 field public static final int PHY_LE_CODED = 3; // 0x3
field public static final int PHY_LE_CODED_MASK = 4; // 0x4
field public static final int PHY_OPTION_NO_PREFERRED = 0; // 0x0 field public static final int PHY_OPTION_NO_PREFERRED = 0; // 0x0
field public static final int PHY_OPTION_S2 = 1; // 0x1 field public static final int PHY_OPTION_S2 = 1; // 0x1
field public static final int PHY_OPTION_S8 = 2; // 0x2 field public static final int PHY_OPTION_S8 = 2; // 0x2
@@ -8055,9 +8057,6 @@ package android.bluetooth.le {
field public static final int INTERVAL_MAX = 16777215; // 0xffffff field public static final int INTERVAL_MAX = 16777215; // 0xffffff
field public static final int INTERVAL_MEDIUM = 400; // 0x190 field public static final int INTERVAL_MEDIUM = 400; // 0x190
field public static final int INTERVAL_MIN = 160; // 0xa0 field public static final int INTERVAL_MIN = 160; // 0xa0
field public static final int PHY_LE_1M = 1; // 0x1
field public static final int PHY_LE_2M = 2; // 0x2
field public static final int PHY_LE_CODED = 3; // 0x3
field public static final int TX_POWER_HIGH = 1; // 0x1 field public static final int TX_POWER_HIGH = 1; // 0x1
field public static final int TX_POWER_LOW = -15; // 0xfffffff1 field public static final int TX_POWER_LOW = -15; // 0xfffffff1
field public static final int TX_POWER_MAX = 1; // 0x1 field public static final int TX_POWER_MAX = 1; // 0x1
@@ -8186,9 +8185,6 @@ package android.bluetooth.le {
field public static final android.os.Parcelable.Creator<android.bluetooth.le.ScanResult> CREATOR; field public static final android.os.Parcelable.Creator<android.bluetooth.le.ScanResult> CREATOR;
field public static final int DATA_COMPLETE = 0; // 0x0 field public static final int DATA_COMPLETE = 0; // 0x0
field public static final int DATA_TRUNCATED = 2; // 0x2 field public static final int DATA_TRUNCATED = 2; // 0x2
field public static final int PHY_LE_1M = 1; // 0x1
field public static final int PHY_LE_2M = 2; // 0x2
field public static final int PHY_LE_CODED = 3; // 0x3
field public static final int PHY_UNUSED = 0; // 0x0 field public static final int PHY_UNUSED = 0; // 0x0
field public static final int SID_NOT_PRESENT = 255; // 0xff field public static final int SID_NOT_PRESENT = 255; // 0xff
} }
@@ -8211,9 +8207,7 @@ package android.bluetooth.le {
field public static final int MATCH_NUM_FEW_ADVERTISEMENT = 2; // 0x2 field public static final int MATCH_NUM_FEW_ADVERTISEMENT = 2; // 0x2
field public static final int MATCH_NUM_MAX_ADVERTISEMENT = 3; // 0x3 field public static final int MATCH_NUM_MAX_ADVERTISEMENT = 3; // 0x3
field public static final int MATCH_NUM_ONE_ADVERTISEMENT = 1; // 0x1 field public static final int MATCH_NUM_ONE_ADVERTISEMENT = 1; // 0x1
field public static final int PHY_LE_1M = 1; // 0x1
field public static final int PHY_LE_ALL_SUPPORTED = 255; // 0xff field public static final int PHY_LE_ALL_SUPPORTED = 255; // 0xff
field public static final int PHY_LE_CODED = 3; // 0x3
field public static final int SCAN_MODE_BALANCED = 1; // 0x1 field public static final int SCAN_MODE_BALANCED = 1; // 0x1
field public static final int SCAN_MODE_LOW_LATENCY = 2; // 0x2 field public static final int SCAN_MODE_LOW_LATENCY = 2; // 0x2
field public static final int SCAN_MODE_LOW_POWER = 0; // 0x0 field public static final int SCAN_MODE_LOW_POWER = 0; // 0x0

View File

@@ -593,24 +593,34 @@ public final class BluetoothDevice implements Parcelable {
public static final int TRANSPORT_LE = 2; public static final int TRANSPORT_LE = 2;
/** /**
* 1M initiating PHY. * Bluetooth LE 1M PHY.
*/ */
public static final int PHY_LE_1M = 1; public static final int PHY_LE_1M = 1;
/** /**
* 2M initiating PHY. * Bluetooth LE 2M PHY.
*/ */
public static final int PHY_LE_2M = 2; public static final int PHY_LE_2M = 2;
/** /**
* LE Coded initiating PHY. * Bluetooth LE Coded PHY.
*/ */
public static final int PHY_LE_CODED = 4; public static final int PHY_LE_CODED = 3;
/** /**
* Any LE PHY. * Bluetooth LE 1M PHY mask.
*/ */
public static final int PHY_LE_ANY = PHY_LE_1M | PHY_LE_2M | PHY_LE_CODED; public static final int PHY_LE_1M_MASK = 1;
/**
* Bluetooth LE 2M PHY mask.
*/
public static final int PHY_LE_2M_MASK = 2;
/**
* Bluetooth LE Coded PHY mask.
*/
public static final int PHY_LE_CODED_MASK = 4;
/** /**
* No preferred coding when transmitting on the LE Coded PHY. * No preferred coding when transmitting on the LE Coded PHY.
@@ -1651,7 +1661,7 @@ public final class BluetoothDevice implements Parcelable {
*/ */
public BluetoothGatt connectGatt(Context context, boolean autoConnect, public BluetoothGatt connectGatt(Context context, boolean autoConnect,
BluetoothGattCallback callback, int transport) { BluetoothGattCallback callback, int transport) {
return (connectGatt(context, autoConnect,callback, TRANSPORT_AUTO, PHY_LE_1M)); return (connectGatt(context, autoConnect,callback, TRANSPORT_AUTO, PHY_LE_1M_MASK));
} }
/** /**
@@ -1668,8 +1678,8 @@ public final class BluetoothDevice implements Parcelable {
* {@link BluetoothDevice#TRANSPORT_AUTO} or * {@link BluetoothDevice#TRANSPORT_AUTO} or
* {@link BluetoothDevice#TRANSPORT_BREDR} or {@link BluetoothDevice#TRANSPORT_LE} * {@link BluetoothDevice#TRANSPORT_BREDR} or {@link BluetoothDevice#TRANSPORT_LE}
* @param phy preferred PHY for connections to remote LE device. Bitwise OR of any of * @param phy preferred PHY for connections to remote LE device. Bitwise OR of any of
* {@link BluetoothDevice#PHY_LE_1M}, {@link BluetoothDevice#PHY_LE_2M}, * {@link BluetoothDevice#PHY_LE_1M_MASK}, {@link BluetoothDevice#PHY_LE_2M_MASK},
* and {@link BluetoothDevice#PHY_LE_CODED}. This option does not take effect if * and {@link BluetoothDevice#PHY_LE_CODED_MASK}. This option does not take effect if
* {@code autoConnect} is set to true. * {@code autoConnect} is set to true.
* @throws IllegalArgumentException if callback is null * @throws IllegalArgumentException if callback is null
*/ */

View File

@@ -785,11 +785,11 @@ public final class BluetoothGatt implements BluetoothProfile {
* if no PHY change happens. It is also triggered when remote device updates the PHY. * if no PHY change happens. It is also triggered when remote device updates the PHY.
* *
* @param txPhy preferred transmitter PHY. Bitwise OR of any of * @param txPhy preferred transmitter PHY. Bitwise OR of any of
* {@link BluetoothDevice#PHY_LE_1M}, {@link BluetoothDevice#PHY_LE_2M}, and * {@link BluetoothDevice#PHY_LE_1M_MASK}, {@link BluetoothDevice#PHY_LE_2M_MASK},
* {@link BluetoothDevice#PHY_LE_CODED}. * and {@link BluetoothDevice#PHY_LE_CODED_MASK}.
* @param rxPhy preferred receiver PHY. Bitwise OR of any of * @param rxPhy preferred receiver PHY. Bitwise OR of any of
* {@link BluetoothDevice#PHY_LE_1M}, {@link BluetoothDevice#PHY_LE_2M}, and * {@link BluetoothDevice#PHY_LE_1M_MASK}, {@link BluetoothDevice#PHY_LE_2M_MASK},
* {@link BluetoothDevice#PHY_LE_CODED}. * and {@link BluetoothDevice#PHY_LE_CODED_MASK}.
* @param phyOptions preferred coding to use when transmitting on the LE Coded PHY. Can be one * @param phyOptions preferred coding to use when transmitting on the LE Coded PHY. Can be one
* of {@link BluetoothDevice#PHY_OPTION_NO_PREFERRED}, * of {@link BluetoothDevice#PHY_OPTION_NO_PREFERRED},
* {@link BluetoothDevice#PHY_OPTION_S2} or {@link BluetoothDevice#PHY_OPTION_S8} * {@link BluetoothDevice#PHY_OPTION_S2} or {@link BluetoothDevice#PHY_OPTION_S8}

View File

@@ -558,11 +558,11 @@ public final class BluetoothGattServer implements BluetoothProfile {
* *
* @param device The remote device to send this response to * @param device The remote device to send this response to
* @param txPhy preferred transmitter PHY. Bitwise OR of any of * @param txPhy preferred transmitter PHY. Bitwise OR of any of
* {@link BluetoothDevice#PHY_LE_1M}, {@link BluetoothDevice#PHY_LE_2M}, and * {@link BluetoothDevice#PHY_LE_1M_MASK}, {@link BluetoothDevice#PHY_LE_2M_MASK},
* {@link BluetoothDevice#PHY_LE_CODED}. * and {@link BluetoothDevice#PHY_LE_CODED_MASK}.
* @param rxPhy preferred receiver PHY. Bitwise OR of any of * @param rxPhy preferred receiver PHY. Bitwise OR of any of
* {@link BluetoothDevice#PHY_LE_1M}, {@link BluetoothDevice#PHY_LE_2M}, and * {@link BluetoothDevice#PHY_LE_1M_MASK}, {@link BluetoothDevice#PHY_LE_2M_MASK},
* {@link BluetoothDevice#PHY_LE_CODED}. * and {@link BluetoothDevice#PHY_LE_CODED_MASK}.
* @param phyOptions preferred coding to use when transmitting on the LE Coded PHY. Can be one * @param phyOptions preferred coding to use when transmitting on the LE Coded PHY. Can be one
* of {@link BluetoothDevice#PHY_OPTION_NO_PREFERRED}, * of {@link BluetoothDevice#PHY_OPTION_NO_PREFERRED},
* {@link BluetoothDevice#PHY_OPTION_S2} or {@link BluetoothDevice#PHY_OPTION_S8} * {@link BluetoothDevice#PHY_OPTION_S2} or {@link BluetoothDevice#PHY_OPTION_S8}

View File

@@ -17,6 +17,7 @@
package android.bluetooth.le; package android.bluetooth.le;
import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.os.Parcel; import android.os.Parcel;
import android.os.Parcelable; import android.os.Parcelable;
@@ -29,21 +30,6 @@ import android.os.Parcelable;
*/ */
public final class AdvertisingSetParameters implements Parcelable { public final class AdvertisingSetParameters implements Parcelable {
/**
* 1M advertiser PHY.
*/
public static final int PHY_LE_1M = 1;
/**
* 2M advertiser PHY.
*/
public static final int PHY_LE_2M = 2;
/**
* LE Coded advertiser PHY.
*/
public static final int PHY_LE_CODED = 3;
/** /**
* Advertise on low frequency, around every 1000ms. This is the default and * Advertise on low frequency, around every 1000ms. This is the default and
* preferred advertising mode as it consumes the least power. * preferred advertising mode as it consumes the least power.
@@ -246,8 +232,8 @@ public final class AdvertisingSetParameters implements Parcelable {
private boolean isLegacy = false; private boolean isLegacy = false;
private boolean isAnonymous = false; private boolean isAnonymous = false;
private boolean includeTxPower = false; private boolean includeTxPower = false;
private int primaryPhy = PHY_LE_1M; private int primaryPhy = BluetoothDevice.PHY_LE_1M;
private int secondaryPhy = PHY_LE_1M; private int secondaryPhy = BluetoothDevice.PHY_LE_1M;
private int interval = INTERVAL_LOW; private int interval = INTERVAL_LOW;
private int txPowerLevel = TX_POWER_MEDIUM; private int txPowerLevel = TX_POWER_MEDIUM;
@@ -321,12 +307,13 @@ public final class AdvertisingSetParameters implements Parcelable {
* Use {@link BluetoothAdapter#isLeCodedPhySupported} to determine if LE Coded PHY is * Use {@link BluetoothAdapter#isLeCodedPhySupported} to determine if LE Coded PHY is
* supported on this device. * supported on this device.
* @param primaryPhy Primary advertising physical channel, can only be * @param primaryPhy Primary advertising physical channel, can only be
* {@link AdvertisingSetParameters#PHY_LE_1M} or * {@link BluetoothDevice#PHY_LE_1M} or
* {@link AdvertisingSetParameters#PHY_LE_CODED}. * {@link BluetoothDevice#PHY_LE_CODED}.
* @throws IllegalArgumentException If the primaryPhy is invalid. * @throws IllegalArgumentException If the primaryPhy is invalid.
*/ */
public Builder setPrimaryPhy(int primaryPhy) { public Builder setPrimaryPhy(int primaryPhy) {
if (primaryPhy != PHY_LE_1M && primaryPhy != PHY_LE_CODED) { if (primaryPhy != BluetoothDevice.PHY_LE_1M &&
primaryPhy != BluetoothDevice.PHY_LE_CODED) {
throw new IllegalArgumentException("bad primaryPhy " + primaryPhy); throw new IllegalArgumentException("bad primaryPhy " + primaryPhy);
} }
this.primaryPhy = primaryPhy; this.primaryPhy = primaryPhy;
@@ -343,14 +330,15 @@ public final class AdvertisingSetParameters implements Parcelable {
* supported on this device. * supported on this device.
* *
* @param secondaryPhy Secondary advertising physical channel, can only be * @param secondaryPhy Secondary advertising physical channel, can only be
* one of {@link AdvertisingSetParameters#PHY_LE_1M}, * one of {@link BluetoothDevice#PHY_LE_1M},
* {@link AdvertisingSetParameters#PHY_LE_2M} or * {@link BluetoothDevice#PHY_LE_2M} or
* {@link AdvertisingSetParameters#PHY_LE_CODED}. * {@link BluetoothDevice#PHY_LE_CODED}.
* @throws IllegalArgumentException If the secondaryPhy is invalid. * @throws IllegalArgumentException If the secondaryPhy is invalid.
*/ */
public Builder setSecondaryPhy(int secondaryPhy) { public Builder setSecondaryPhy(int secondaryPhy) {
if (secondaryPhy != PHY_LE_1M && secondaryPhy !=PHY_LE_2M && if (secondaryPhy != BluetoothDevice.PHY_LE_1M &&
secondaryPhy != PHY_LE_CODED) { secondaryPhy != BluetoothDevice.PHY_LE_2M &&
secondaryPhy != BluetoothDevice.PHY_LE_CODED) {
throw new IllegalArgumentException("bad secondaryPhy " + secondaryPhy); throw new IllegalArgumentException("bad secondaryPhy " + secondaryPhy);
} }
this.secondaryPhy = secondaryPhy; this.secondaryPhy = secondaryPhy;

View File

@@ -17,6 +17,7 @@
package android.bluetooth.le; package android.bluetooth.le;
import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothGatt; import android.bluetooth.BluetoothGatt;
import android.bluetooth.BluetoothUuid; import android.bluetooth.BluetoothUuid;
import android.bluetooth.IBluetoothGatt; import android.bluetooth.IBluetoothGatt;
@@ -363,12 +364,12 @@ public final class BluetoothLeAdvertiser {
boolean support2MPhy = mBluetoothAdapter.isLe2MPhySupported(); boolean support2MPhy = mBluetoothAdapter.isLe2MPhySupported();
int pphy = parameters.getPrimaryPhy(); int pphy = parameters.getPrimaryPhy();
int sphy = parameters.getSecondaryPhy(); int sphy = parameters.getSecondaryPhy();
if (pphy == AdvertisingSetParameters.PHY_LE_CODED && !supportCodedPhy) { if (pphy == BluetoothDevice.PHY_LE_CODED && !supportCodedPhy) {
throw new IllegalArgumentException("Unsupported primary PHY selected"); throw new IllegalArgumentException("Unsupported primary PHY selected");
} }
if ((sphy == AdvertisingSetParameters.PHY_LE_CODED && !supportCodedPhy) if ((sphy == BluetoothDevice.PHY_LE_CODED && !supportCodedPhy)
|| (sphy == AdvertisingSetParameters.PHY_LE_2M && !support2MPhy)) { || (sphy == BluetoothDevice.PHY_LE_2M && !support2MPhy)) {
throw new IllegalArgumentException("Unsupported secondary PHY selected"); throw new IllegalArgumentException("Unsupported secondary PHY selected");
} }

View File

@@ -46,21 +46,6 @@ public final class ScanResult implements Parcelable {
*/ */
public static final int PHY_UNUSED = 0x00; public static final int PHY_UNUSED = 0x00;
/**
* Bluetooth LE 1Mbit advertiser PHY.
*/
public static final int PHY_LE_1M = 0x01;
/**
* Bluetooth LE 2Mbit advertiser PHY.
*/
public static final int PHY_LE_2M = 0x02;
/**
* Bluetooth LE Coded advertiser PHY.
*/
public static final int PHY_LE_CODED = 0x03;
/** /**
* Advertising Set ID is not present in the packet. * Advertising Set ID is not present in the packet.
*/ */
@@ -112,7 +97,7 @@ public final class ScanResult implements Parcelable {
mRssi = rssi; mRssi = rssi;
mTimestampNanos = timestampNanos; mTimestampNanos = timestampNanos;
mEventType = (DATA_COMPLETE << 5) | ET_LEGACY_MASK | ET_CONNECTABLE_MASK; mEventType = (DATA_COMPLETE << 5) | ET_LEGACY_MASK | ET_CONNECTABLE_MASK;
mPrimaryPhy = PHY_LE_1M; mPrimaryPhy = BluetoothDevice.PHY_LE_1M;
mSecondaryPhy = PHY_UNUSED; mSecondaryPhy = PHY_UNUSED;
mAdvertisingSid = SID_NOT_PRESENT; mAdvertisingSid = SID_NOT_PRESENT;
mTxPower = 127; mTxPower = 127;
@@ -256,16 +241,16 @@ public final class ScanResult implements Parcelable {
/** /**
* Returns the primary Physical Layer * Returns the primary Physical Layer
* on which this advertisment was received. * on which this advertisment was received.
* Can be one of {@link ScanResult#PHY_LE_1M} or * Can be one of {@link BluetoothDevice#PHY_LE_1M} or
* {@link ScanResult#PHY_LE_CODED}. * {@link BluetoothDevice#PHY_LE_CODED}.
*/ */
public int getPrimaryPhy() { return mPrimaryPhy; } public int getPrimaryPhy() { return mPrimaryPhy; }
/** /**
* Returns the secondary Physical Layer * Returns the secondary Physical Layer
* on which this advertisment was received. * on which this advertisment was received.
* Can be one of {@link ScanResult#PHY_LE_1M}, * Can be one of {@link BluetoothDevice#PHY_LE_1M},
* {@link ScanResult#PHY_LE_2M}, {@link ScanResult#PHY_LE_CODED} * {@link BluetoothDevice#PHY_LE_2M}, {@link BluetoothDevice#PHY_LE_CODED}
* or {@link ScanResult#PHY_UNUSED} - if the advertisement * or {@link ScanResult#PHY_UNUSED} - if the advertisement
* was not received on a secondary physical channel. * was not received on a secondary physical channel.
*/ */

View File

@@ -17,6 +17,7 @@
package android.bluetooth.le; package android.bluetooth.le;
import android.annotation.SystemApi; import android.annotation.SystemApi;
import android.bluetooth.BluetoothDevice;
import android.os.Parcel; import android.os.Parcel;
import android.os.Parcelable; import android.os.Parcelable;
@@ -122,16 +123,6 @@ public final class ScanSettings implements Parcelable {
@SystemApi @SystemApi
public static final int SCAN_RESULT_TYPE_ABBREVIATED = 1; public static final int SCAN_RESULT_TYPE_ABBREVIATED = 1;
/**
* Use the Bluetooth LE 1Mbit PHY for scanning.
*/
public static final int PHY_LE_1M = 1;
/**
* Use Bluetooth LE Coded PHY for scanning.
*/
public static final int PHY_LE_CODED = 3;
/** /**
* Use all supported PHYs for scanning. * Use all supported PHYs for scanning.
* This will check the controller capabilities, and start * This will check the controller capabilities, and start
@@ -412,8 +403,8 @@ public final class ScanSettings implements Parcelable {
* Selecting an unsupported phy will result in failure to start scan. * Selecting an unsupported phy will result in failure to start scan.
* *
* @param phy Can be one of * @param phy Can be one of
* {@link ScanSettings#PHY_LE_1M}, * {@link BluetoothDevice#PHY_LE_1M},
* {@link ScanSettings#PHY_LE_CODED} or * {@link BluetoothDevice#PHY_LE_CODED} or
* {@link ScanSettings#PHY_LE_ALL_SUPPORTED} * {@link ScanSettings#PHY_LE_ALL_SUPPORTED}
*/ */
public Builder setPhy(int phy) { public Builder setPhy(int phy) {