Merge "Remove enable from PeriodicAdvertisingPariameters (1/2)" am: 763765b1b1
am: 131cc43a2c
am: 6b1228a556
Change-Id: I58a18a01d88db5f3edc9a15cc304ad561440d3fb
This commit is contained in:
@ -8056,7 +8056,6 @@ package android.bluetooth.le {
|
|||||||
|
|
||||||
public final class PeriodicAdvertisingParameters implements android.os.Parcelable {
|
public final class PeriodicAdvertisingParameters implements android.os.Parcelable {
|
||||||
method public int describeContents();
|
method public int describeContents();
|
||||||
method public boolean getEnable();
|
|
||||||
method public boolean getIncludeTxPower();
|
method public boolean getIncludeTxPower();
|
||||||
method public int getInterval();
|
method public int getInterval();
|
||||||
method public void writeToParcel(android.os.Parcel, int);
|
method public void writeToParcel(android.os.Parcel, int);
|
||||||
@ -8066,7 +8065,6 @@ package android.bluetooth.le {
|
|||||||
public static final class PeriodicAdvertisingParameters.Builder {
|
public static final class PeriodicAdvertisingParameters.Builder {
|
||||||
ctor public PeriodicAdvertisingParameters.Builder();
|
ctor public PeriodicAdvertisingParameters.Builder();
|
||||||
method public android.bluetooth.le.PeriodicAdvertisingParameters build();
|
method public android.bluetooth.le.PeriodicAdvertisingParameters build();
|
||||||
method public android.bluetooth.le.PeriodicAdvertisingParameters.Builder setEnable(boolean);
|
|
||||||
method public android.bluetooth.le.PeriodicAdvertisingParameters.Builder setIncludeTxPower(boolean);
|
method public android.bluetooth.le.PeriodicAdvertisingParameters.Builder setIncludeTxPower(boolean);
|
||||||
method public android.bluetooth.le.PeriodicAdvertisingParameters.Builder setInterval(int);
|
method public android.bluetooth.le.PeriodicAdvertisingParameters.Builder setInterval(int);
|
||||||
}
|
}
|
||||||
|
@ -8527,7 +8527,6 @@ package android.bluetooth.le {
|
|||||||
|
|
||||||
public final class PeriodicAdvertisingParameters implements android.os.Parcelable {
|
public final class PeriodicAdvertisingParameters implements android.os.Parcelable {
|
||||||
method public int describeContents();
|
method public int describeContents();
|
||||||
method public boolean getEnable();
|
|
||||||
method public boolean getIncludeTxPower();
|
method public boolean getIncludeTxPower();
|
||||||
method public int getInterval();
|
method public int getInterval();
|
||||||
method public void writeToParcel(android.os.Parcel, int);
|
method public void writeToParcel(android.os.Parcel, int);
|
||||||
@ -8537,7 +8536,6 @@ package android.bluetooth.le {
|
|||||||
public static final class PeriodicAdvertisingParameters.Builder {
|
public static final class PeriodicAdvertisingParameters.Builder {
|
||||||
ctor public PeriodicAdvertisingParameters.Builder();
|
ctor public PeriodicAdvertisingParameters.Builder();
|
||||||
method public android.bluetooth.le.PeriodicAdvertisingParameters build();
|
method public android.bluetooth.le.PeriodicAdvertisingParameters build();
|
||||||
method public android.bluetooth.le.PeriodicAdvertisingParameters.Builder setEnable(boolean);
|
|
||||||
method public android.bluetooth.le.PeriodicAdvertisingParameters.Builder setIncludeTxPower(boolean);
|
method public android.bluetooth.le.PeriodicAdvertisingParameters.Builder setIncludeTxPower(boolean);
|
||||||
method public android.bluetooth.le.PeriodicAdvertisingParameters.Builder setInterval(int);
|
method public android.bluetooth.le.PeriodicAdvertisingParameters.Builder setInterval(int);
|
||||||
}
|
}
|
||||||
|
@ -8086,7 +8086,6 @@ package android.bluetooth.le {
|
|||||||
|
|
||||||
public final class PeriodicAdvertisingParameters implements android.os.Parcelable {
|
public final class PeriodicAdvertisingParameters implements android.os.Parcelable {
|
||||||
method public int describeContents();
|
method public int describeContents();
|
||||||
method public boolean getEnable();
|
|
||||||
method public boolean getIncludeTxPower();
|
method public boolean getIncludeTxPower();
|
||||||
method public int getInterval();
|
method public int getInterval();
|
||||||
method public void writeToParcel(android.os.Parcel, int);
|
method public void writeToParcel(android.os.Parcel, int);
|
||||||
@ -8096,7 +8095,6 @@ package android.bluetooth.le {
|
|||||||
public static final class PeriodicAdvertisingParameters.Builder {
|
public static final class PeriodicAdvertisingParameters.Builder {
|
||||||
ctor public PeriodicAdvertisingParameters.Builder();
|
ctor public PeriodicAdvertisingParameters.Builder();
|
||||||
method public android.bluetooth.le.PeriodicAdvertisingParameters build();
|
method public android.bluetooth.le.PeriodicAdvertisingParameters build();
|
||||||
method public android.bluetooth.le.PeriodicAdvertisingParameters.Builder setEnable(boolean);
|
|
||||||
method public android.bluetooth.le.PeriodicAdvertisingParameters.Builder setIncludeTxPower(boolean);
|
method public android.bluetooth.le.PeriodicAdvertisingParameters.Builder setIncludeTxPower(boolean);
|
||||||
method public android.bluetooth.le.PeriodicAdvertisingParameters.Builder setInterval(int);
|
method public android.bluetooth.le.PeriodicAdvertisingParameters.Builder setInterval(int);
|
||||||
}
|
}
|
||||||
|
@ -386,7 +386,7 @@ public final class BluetoothLeAdvertiser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
boolean supportPeriodic = mBluetoothAdapter.isLePeriodicAdvertisingSupported();
|
boolean supportPeriodic = mBluetoothAdapter.isLePeriodicAdvertisingSupported();
|
||||||
if (periodicParameters != null && periodicParameters.getEnable() && !supportPeriodic) {
|
if (periodicParameters != null && !supportPeriodic) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"Controller does not support LE Periodic Advertising");
|
"Controller does not support LE Periodic Advertising");
|
||||||
}
|
}
|
||||||
|
@ -29,27 +29,19 @@ public final class PeriodicAdvertisingParameters implements Parcelable {
|
|||||||
private static final int INTERVAL_MAX = 80;
|
private static final int INTERVAL_MAX = 80;
|
||||||
private static final int INTERVAL_MIN = 65519;
|
private static final int INTERVAL_MIN = 65519;
|
||||||
|
|
||||||
private final boolean enable;
|
|
||||||
private final boolean includeTxPower;
|
private final boolean includeTxPower;
|
||||||
private final int interval;
|
private final int interval;
|
||||||
|
|
||||||
private PeriodicAdvertisingParameters(boolean enable, boolean includeTxPower, int interval) {
|
private PeriodicAdvertisingParameters(boolean includeTxPower, int interval) {
|
||||||
this.enable = enable;
|
|
||||||
this.includeTxPower = includeTxPower;
|
this.includeTxPower = includeTxPower;
|
||||||
this.interval = interval;
|
this.interval = interval;
|
||||||
}
|
}
|
||||||
|
|
||||||
private PeriodicAdvertisingParameters(Parcel in) {
|
private PeriodicAdvertisingParameters(Parcel in) {
|
||||||
enable = in.readInt() != 0 ? true : false;
|
|
||||||
includeTxPower = in.readInt() != 0 ? true : false;
|
includeTxPower = in.readInt() != 0 ? true : false;
|
||||||
interval = in.readInt();
|
interval = in.readInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns whether the periodic advertising shall be enabled.
|
|
||||||
*/
|
|
||||||
public boolean getEnable() { return enable; }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the TX Power will be included.
|
* Returns whether the TX Power will be included.
|
||||||
*/
|
*/
|
||||||
@ -68,7 +60,6 @@ public final class PeriodicAdvertisingParameters implements Parcelable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
public void writeToParcel(Parcel dest, int flags) {
|
||||||
dest.writeInt(enable ? 1 : 0);
|
|
||||||
dest.writeInt(includeTxPower ? 1 : 0);
|
dest.writeInt(includeTxPower ? 1 : 0);
|
||||||
dest.writeInt(interval);
|
dest.writeInt(interval);
|
||||||
}
|
}
|
||||||
@ -89,17 +80,8 @@ public final class PeriodicAdvertisingParameters implements Parcelable {
|
|||||||
|
|
||||||
public static final class Builder {
|
public static final class Builder {
|
||||||
private boolean includeTxPower = false;
|
private boolean includeTxPower = false;
|
||||||
private boolean enable = false;
|
|
||||||
private int interval = INTERVAL_MAX;
|
private int interval = INTERVAL_MAX;
|
||||||
|
|
||||||
/**
|
|
||||||
* Set whether the Periodic Advertising should be enabled for this set.
|
|
||||||
*/
|
|
||||||
public Builder setEnable(boolean enable) {
|
|
||||||
this.enable = enable;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether the transmission power level should be included in the periodic
|
* Whether the transmission power level should be included in the periodic
|
||||||
* packet.
|
* packet.
|
||||||
@ -128,7 +110,7 @@ public final class PeriodicAdvertisingParameters implements Parcelable {
|
|||||||
* Build the {@link AdvertisingSetParameters} object.
|
* Build the {@link AdvertisingSetParameters} object.
|
||||||
*/
|
*/
|
||||||
public PeriodicAdvertisingParameters build() {
|
public PeriodicAdvertisingParameters build() {
|
||||||
return new PeriodicAdvertisingParameters(enable, includeTxPower, interval);
|
return new PeriodicAdvertisingParameters(includeTxPower, interval);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user