public static final class AdvertiseSettings.Builder extends Object
AdvertiseSettings
.Constructor and Description |
---|
Builder() |
Modifier and Type | Method and Description |
---|---|
AdvertiseSettings |
build()
Build the
AdvertiseSettings object. |
AdvertiseSettings.Builder |
setAdvertiseMode(int advertiseMode)
Set advertise mode to control the advertising power and latency.
|
AdvertiseSettings.Builder |
setConnectable(boolean connectable)
Set whether the advertisement type should be connectable or non-connectable.
|
AdvertiseSettings.Builder |
setTimeout(int timeoutMillis)
Limit advertising to a given amount of time.
|
AdvertiseSettings.Builder |
setTxPowerLevel(int txPowerLevel)
Set advertise TX power level to control the transmission power level for the advertising.
|
public AdvertiseSettings.Builder setAdvertiseMode(int advertiseMode)
advertiseMode
- Bluetooth LE Advertising mode, can only be one of
AdvertiseSettings.ADVERTISE_MODE_LOW_POWER
,
AdvertiseSettings.ADVERTISE_MODE_BALANCED
, or
AdvertiseSettings.ADVERTISE_MODE_LOW_LATENCY
.IllegalArgumentException
- If the advertiseMode is invalid.public AdvertiseSettings.Builder setTxPowerLevel(int txPowerLevel)
txPowerLevel
- Transmission power of Bluetooth LE Advertising, can only be one of
AdvertiseSettings.ADVERTISE_TX_POWER_ULTRA_LOW
,
AdvertiseSettings.ADVERTISE_TX_POWER_LOW
,
AdvertiseSettings.ADVERTISE_TX_POWER_MEDIUM
or
AdvertiseSettings.ADVERTISE_TX_POWER_HIGH
.IllegalArgumentException
- If the txPowerLevel
is invalid.public AdvertiseSettings.Builder setConnectable(boolean connectable)
connectable
- Controls whether the advertisment type will be connectable (true)
or non-connectable (false).public AdvertiseSettings.Builder setTimeout(int timeoutMillis)
timeoutMillis
- Advertising time limit. May not exceed 180000 milliseconds.
A value of 0 will disable the time limit.IllegalArgumentException
- If the provided timeout is over 180000 ms.public AdvertiseSettings build()
AdvertiseSettings
object.