FileDocCategorySizeDatePackage
AdvertiseSettings.javaAPI DocAndroid 5.1 API8571Thu Mar 12 22:22:10 GMT 2015android.bluetooth.le

AdvertiseSettings

public final class AdvertiseSettings extends Object implements android.os.Parcelable
The {@link AdvertiseSettings} provide a way to adjust advertising preferences for each Bluetooth LE advertisement instance. Use {@link AdvertiseSettings.Builder} to create an instance of this class.

Fields Summary
public static final int
ADVERTISE_MODE_LOW_POWER
Perform Bluetooth LE advertising in low power mode. This is the default and preferred advertising mode as it consumes the least power.
public static final int
ADVERTISE_MODE_BALANCED
Perform Bluetooth LE advertising in balanced power mode. This is balanced between advertising frequency and power consumption.
public static final int
ADVERTISE_MODE_LOW_LATENCY
Perform Bluetooth LE advertising in low latency, high power mode. This has the highest power consumption and should not be used for continuous background advertising.
public static final int
ADVERTISE_TX_POWER_ULTRA_LOW
Advertise using the lowest transmission (TX) power level. Low transmission power can be used to restrict the visibility range of advertising packets.
public static final int
ADVERTISE_TX_POWER_LOW
Advertise using low TX power level.
public static final int
ADVERTISE_TX_POWER_MEDIUM
Advertise using medium TX power level.
public static final int
ADVERTISE_TX_POWER_HIGH
Advertise using high TX power level. This corresponds to largest visibility range of the advertising packet.
private static final int
LIMITED_ADVERTISING_MAX_MILLIS
The maximum limited advertisement duration as specified by the Bluetooth SIG
private final int
mAdvertiseMode
private final int
mAdvertiseTxPowerLevel
private final int
mAdvertiseTimeoutMillis
private final boolean
mAdvertiseConnectable
public static final Parcelable.Creator
CREATOR
Constructors Summary
private AdvertiseSettings(int advertiseMode, int advertiseTxPowerLevel, boolean advertiseConnectable, int advertiseTimeout)


        
                
        mAdvertiseMode = advertiseMode;
        mAdvertiseTxPowerLevel = advertiseTxPowerLevel;
        mAdvertiseConnectable = advertiseConnectable;
        mAdvertiseTimeoutMillis = advertiseTimeout;
    
private AdvertiseSettings(android.os.Parcel in)

        mAdvertiseMode = in.readInt();
        mAdvertiseTxPowerLevel = in.readInt();
        mAdvertiseConnectable = in.readInt() != 0 ? true : false;
        mAdvertiseTimeoutMillis = in.readInt();
    
Methods Summary
public intdescribeContents()

        return 0;
    
public intgetMode()
Returns the advertise mode.

        return mAdvertiseMode;
    
public intgetTimeout()
Returns the advertising time limit in milliseconds.

        return mAdvertiseTimeoutMillis;
    
public intgetTxPowerLevel()
Returns the TX power level for advertising.

        return mAdvertiseTxPowerLevel;
    
public booleanisConnectable()
Returns whether the advertisement will indicate connectable.

        return mAdvertiseConnectable;
    
public java.lang.StringtoString()

        return "Settings [mAdvertiseMode=" + mAdvertiseMode
             + ", mAdvertiseTxPowerLevel=" + mAdvertiseTxPowerLevel
             + ", mAdvertiseConnectable=" + mAdvertiseConnectable
             + ", mAdvertiseTimeoutMillis=" + mAdvertiseTimeoutMillis + "]";
    
public voidwriteToParcel(android.os.Parcel dest, int flags)

        dest.writeInt(mAdvertiseMode);
        dest.writeInt(mAdvertiseTxPowerLevel);
        dest.writeInt(mAdvertiseConnectable ? 1 : 0);
        dest.writeInt(mAdvertiseTimeoutMillis);