summaryrefslogtreecommitdiff
path: root/framework/java/android/bluetooth/le/AdvertisingSet.java
diff options
context:
space:
mode:
Diffstat (limited to 'framework/java/android/bluetooth/le/AdvertisingSet.java')
-rw-r--r--framework/java/android/bluetooth/le/AdvertisingSet.java38
1 files changed, 30 insertions, 8 deletions
diff --git a/framework/java/android/bluetooth/le/AdvertisingSet.java b/framework/java/android/bluetooth/le/AdvertisingSet.java
index 7355b0d4c7..d6991bf876 100644
--- a/framework/java/android/bluetooth/le/AdvertisingSet.java
+++ b/framework/java/android/bluetooth/le/AdvertisingSet.java
@@ -16,6 +16,7 @@
package android.bluetooth.le;
+import android.bluetooth.BluetoothAdapter;
import android.bluetooth.IBluetoothGatt;
import android.bluetooth.IBluetoothManager;
import android.bluetooth.le.IAdvertisingSetCallback;
@@ -57,11 +58,12 @@ public final class AdvertisingSet {
/**
* Enables Advertising. This method returns immediately, the operation status is
- * delivered
- * through {@code callback.onAdvertisingEnabled()}.
+ * delivered through {@code callback.onAdvertisingEnabled()}.
* <p>
* Requires {@link android.Manifest.permission#BLUETOOTH_ADMIN}
*
+ * @param enable whether the advertising should be enabled (true), or disabled (false)
+ * @param timeoutMillis duration for which that advertising set is enabled.
*/
public void enableAdvertising(boolean enable, int timeout) {
try {
@@ -77,10 +79,16 @@ public final class AdvertisingSet {
* delivered through {@code callback.onAdvertisingDataSet()}.
* <p>
* Advertising data must be empty if non-legacy scannable advertising is used.
+ *
+ * @param advertiseData Advertisement data to be broadcasted. Size must not exceed
+ * {@link BluetoothAdapter#getLeMaximumAdvertisingDataLength}. If the
+ * advertisement is connectable, three bytes will be added for flags. If the
+ * update takes place when the advertising set is enabled, the data can be
+ * maximum 251 bytes long.
*/
- public void setAdvertisingData(AdvertiseData data) {
+ public void setAdvertisingData(AdvertiseData advertiseData) {
try {
- gatt.setAdvertisingData(this.advertiserId, data);
+ gatt.setAdvertisingData(this.advertiserId, advertiseData);
} catch (RemoteException e) {
Log.e(TAG, "remote exception - ", e);
}
@@ -90,10 +98,15 @@ public final class AdvertisingSet {
* Set/update scan response data. Make sure that data doesn't exceed the size limit for
* specified AdvertisingSetParameters. This method returns immediately, the operation status
* is delivered through {@code callback.onScanResponseDataSet()}.
+ *
+ * @param scanResponse Scan response associated with the advertisement data. Size must not
+ * exceed {@link BluetoothAdapter#getLeMaximumAdvertisingDataLength}. If the
+ * update takes place when the advertising set is enabled, the data can be
+ * maximum 251 bytes long.
*/
- public void setScanResponseData(AdvertiseData data) {
+ public void setScanResponseData(AdvertiseData scanResponse) {
try {
- gatt.setScanResponseData(this.advertiserId, data);
+ gatt.setScanResponseData(this.advertiserId, scanResponse);
} catch (RemoteException e) {
Log.e(TAG, "remote exception - ", e);
}
@@ -103,6 +116,8 @@ public final class AdvertisingSet {
* Update advertising parameters associated with this AdvertisingSet. Must be called when
* advertising is not active. This method returns immediately, the operation status is delivered
* through {@code callback.onAdvertisingParametersUpdated}.
+ *
+ * @param parameters advertising set parameters.
*/
public void setAdvertisingParameters(AdvertisingSetParameters parameters) {
try {
@@ -130,10 +145,15 @@ public final class AdvertisingSet {
* or after advertising was started with periodic advertising data set. This method returns
* immediately, the operation status is delivered through
* {@code callback.onPeriodicAdvertisingDataSet()}.
+ *
+ * @param periodicData Periodic advertising data. Size must not exceed
+ * {@link BluetoothAdapter#getLeMaximumAdvertisingDataLength}. If the
+ * update takes place when the periodic advertising is enabled for this set,
+ * the data can be maximum 251 bytes long.
*/
- public void setPeriodicAdvertisingData(AdvertiseData data) {
+ public void setPeriodicAdvertisingData(AdvertiseData periodicData) {
try {
- gatt.setPeriodicAdvertisingData(this.advertiserId, data);
+ gatt.setPeriodicAdvertisingData(this.advertiserId, periodicData);
} catch (RemoteException e) {
Log.e(TAG, "remote exception - ", e);
}
@@ -142,6 +162,8 @@ public final class AdvertisingSet {
/**
* Used to enable/disable periodic advertising. This method returns immediately, the operation
* status is delivered through {@code callback.onPeriodicAdvertisingEnable()}.
+ *
+ * @param enable whether the periodic advertising should be enabled (true), or disabled (false).
*/
public void setPeriodicAdvertisingEnable(boolean enable) {
try {