Class AdvertiseData
java.lang.Object
com.codename1.bluetooth.le.server.AdvertiseData
The payload to advertise via BluetoothLE.startAdvertising. Keep it
small -- a legacy advertisement carries at most 31 bytes; oversized
payloads fail with
BluetoothError.ADVERTISE_FAILED. Fluent
setters return this for chaining.
Platform note: iOS only broadcasts the local name and service UUIDs -- CoreBluetooth silently ignores manufacturer data, service data and TX power inclusion when advertising (Android broadcasts everything).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddManufacturerData(int companyId, byte[] data) Adds manufacturer-specific data for the given company identifier.addServiceData(BluetoothUuid uuid, byte[] data) Adds service data for the given service UUID.addServiceUuid(BluetoothUuid uuid) Advertises the given service UUID so filtered scans can find this peripheral.The manufacturer data entries, keyed by company identifier.Map<BluetoothUuid, byte[]> The service data entries, keyed by service UUID.The service UUIDs to advertise.booleanWhether the device name is included.booleanWhether the TX power level is included.setIncludeDeviceName(boolean include) Includes the device name in the advertisement (off by default -- names use up scarce advertisement bytes).setIncludeTxPower(boolean include) Includes the TX power level in the advertisement.
-
Constructor Details
-
AdvertiseData
public AdvertiseData()
-
-
Method Details
-
addServiceUuid
Advertises the given service UUID so filtered scans can find this peripheral. -
setIncludeDeviceName
Includes the device name in the advertisement (off by default -- names use up scarce advertisement bytes). -
setIncludeTxPower
Includes the TX power level in the advertisement. -
addManufacturerData
Adds manufacturer-specific data for the given company identifier. -
addServiceData
Adds service data for the given service UUID. -
getServiceUuids
The service UUIDs to advertise. -
isIncludeDeviceName
public boolean isIncludeDeviceName()Whether the device name is included. -
isIncludeTxPower
public boolean isIncludeTxPower()Whether the TX power level is included. -
getManufacturerData
-
getServiceData
The service data entries, keyed by service UUID.
-