Merge changes from topic 'bt5-cherry-pickery-2' into oc-dev

* changes:
  Remove enable from PeriodicAdvertisingPariameters (1/2)
  Bluetooth 5 fix default AdvertisingSetParameters values
  Bluetooth: fix comment wording
This commit is contained in:
Jakub Pawlowski
2017-04-11 19:19:32 +00:00
committed by Android (Google) Code Review
6 changed files with 10 additions and 34 deletions

View File

@@ -8056,7 +8056,6 @@ package android.bluetooth.le {
public final class PeriodicAdvertisingParameters implements android.os.Parcelable {
method public int describeContents();
method public boolean getEnable();
method public boolean getIncludeTxPower();
method public int getInterval();
method public void writeToParcel(android.os.Parcel, int);
@@ -8066,7 +8065,6 @@ package android.bluetooth.le {
public static final class PeriodicAdvertisingParameters.Builder {
ctor public PeriodicAdvertisingParameters.Builder();
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 setInterval(int);
}

View File

@@ -8527,7 +8527,6 @@ package android.bluetooth.le {
public final class PeriodicAdvertisingParameters implements android.os.Parcelable {
method public int describeContents();
method public boolean getEnable();
method public boolean getIncludeTxPower();
method public int getInterval();
method public void writeToParcel(android.os.Parcel, int);
@@ -8537,7 +8536,6 @@ package android.bluetooth.le {
public static final class PeriodicAdvertisingParameters.Builder {
ctor public PeriodicAdvertisingParameters.Builder();
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 setInterval(int);
}

View File

@@ -8086,7 +8086,6 @@ package android.bluetooth.le {
public final class PeriodicAdvertisingParameters implements android.os.Parcelable {
method public int describeContents();
method public boolean getEnable();
method public boolean getIncludeTxPower();
method public int getInterval();
method public void writeToParcel(android.os.Parcel, int);
@@ -8096,7 +8095,6 @@ package android.bluetooth.le {
public static final class PeriodicAdvertisingParameters.Builder {
ctor public PeriodicAdvertisingParameters.Builder();
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 setInterval(int);
}

View File

@@ -241,8 +241,8 @@ public final class AdvertisingSetParameters implements Parcelable {
*/
public static final class Builder {
private boolean connectable = true;
private boolean scannable = true;
private boolean connectable = false;
private boolean scannable = false;
private boolean isLegacy = false;
private boolean isAnonymous = false;
private boolean includeTxPower = false;
@@ -254,8 +254,8 @@ public final class AdvertisingSetParameters implements Parcelable {
/**
* Set whether the advertisement type should be connectable or
* non-connectable.
* Legacy advertisements can be both connectable and scannable. Other
* advertisements can be connectable only if not scannable.
* Legacy advertisements can be both connectable and scannable. Non-legacy
* advertisements can be only scannable or only connectable.
* @param connectable Controls whether the advertisment type will be
* connectable (true) or non-connectable (false).
*/
@@ -265,9 +265,9 @@ public final class AdvertisingSetParameters implements Parcelable {
}
/**
* Set whether the advertisement type should be scannable
* Legacy advertisements can be both connectable and scannable. Other
* advertisements can be scannable only if not connectable.
* Set whether the advertisement type should be scannable.
* Legacy advertisements can be both connectable and scannable. Non-legacy
* advertisements can be only scannable or only connectable.
* @param scannable Controls whether the advertisment type will be
* scannable (true) or non-scannable (false).
*/

View File

@@ -386,7 +386,7 @@ public final class BluetoothLeAdvertiser {
}
boolean supportPeriodic = mBluetoothAdapter.isLePeriodicAdvertisingSupported();
if (periodicParameters != null && periodicParameters.getEnable() && !supportPeriodic) {
if (periodicParameters != null && !supportPeriodic) {
throw new IllegalArgumentException(
"Controller does not support LE Periodic Advertising");
}

View File

@@ -29,27 +29,19 @@ public final class PeriodicAdvertisingParameters implements Parcelable {
private static final int INTERVAL_MAX = 80;
private static final int INTERVAL_MIN = 65519;
private final boolean enable;
private final boolean includeTxPower;
private final int interval;
private PeriodicAdvertisingParameters(boolean enable, boolean includeTxPower, int interval) {
this.enable = enable;
private PeriodicAdvertisingParameters(boolean includeTxPower, int interval) {
this.includeTxPower = includeTxPower;
this.interval = interval;
}
private PeriodicAdvertisingParameters(Parcel in) {
enable = in.readInt() != 0 ? true : false;
includeTxPower = in.readInt() != 0 ? true : false;
interval = in.readInt();
}
/**
* Returns whether the periodic advertising shall be enabled.
*/
public boolean getEnable() { return enable; }
/**
* Returns whether the TX Power will be included.
*/
@@ -68,7 +60,6 @@ public final class PeriodicAdvertisingParameters implements Parcelable {
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(enable ? 1 : 0);
dest.writeInt(includeTxPower ? 1 : 0);
dest.writeInt(interval);
}
@@ -89,17 +80,8 @@ public final class PeriodicAdvertisingParameters implements Parcelable {
public static final class Builder {
private boolean includeTxPower = false;
private boolean enable = false;
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
* packet.
@@ -128,7 +110,7 @@ public final class PeriodicAdvertisingParameters implements Parcelable {
* Build the {@link AdvertisingSetParameters} object.
*/
public PeriodicAdvertisingParameters build() {
return new PeriodicAdvertisingParameters(enable, includeTxPower, interval);
return new PeriodicAdvertisingParameters(includeTxPower, interval);
}
}
}