Builder
class Builder
kotlin.Any | |
↳ | android.bluetooth.le.AdvertiseData.Builder |
Builder for AdvertiseData
.
Summary
Public constructors | |
---|---|
Builder() |
Public methods | |
---|---|
AdvertiseData.Builder! |
addManufacturerData(manufacturerId: Int, manufacturerSpecificData: ByteArray!) Add manufacturer specific data. |
AdvertiseData.Builder! |
addServiceData(serviceDataUuid: ParcelUuid!, serviceData: ByteArray!) Add service data to advertise data. |
AdvertiseData.Builder |
addServiceSolicitationUuid(serviceSolicitationUuid: ParcelUuid) Add a service solicitation UUID to advertise data. |
AdvertiseData.Builder! |
addServiceUuid(serviceUuid: ParcelUuid!) Add a service UUID to advertise data. |
AdvertiseData.Builder |
addTransportDiscoveryData(transportDiscoveryData: TransportDiscoveryData) Add Transport Discovery Data to advertise data. |
AdvertiseData! |
build() Build the |
AdvertiseData.Builder! |
setIncludeDeviceName(includeDeviceName: Boolean) Set whether the device name should be included in advertise packet. |
AdvertiseData.Builder! |
setIncludeTxPowerLevel(includeTxPowerLevel: Boolean) Whether the transmission power level should be included in the advertise packet. |
Public constructors
Public methods
addManufacturerData
fun addManufacturerData(
manufacturerId: Int,
manufacturerSpecificData: ByteArray!
): AdvertiseData.Builder!
Add manufacturer specific data.
Please refer to the Bluetooth Assigned Numbers document provided by the Bluetooth SIG for a list of existing company identifiers.
Parameters | |
---|---|
manufacturerId |
Int: Manufacturer ID assigned by Bluetooth SIG. |
manufacturerSpecificData |
ByteArray!: Manufacturer specific data |
Exceptions | |
---|---|
java.lang.IllegalArgumentException |
If the manufacturerId is negative or manufacturerSpecificData is null. |
addServiceData
fun addServiceData(
serviceDataUuid: ParcelUuid!,
serviceData: ByteArray!
): AdvertiseData.Builder!
Add service data to advertise data.
Parameters | |
---|---|
serviceDataUuid |
ParcelUuid!: 16-bit UUID of the service the data is associated with |
serviceData |
ByteArray!: Service data |
Exceptions | |
---|---|
java.lang.IllegalArgumentException |
If the serviceDataUuid or serviceData is empty. |
addServiceSolicitationUuid
fun addServiceSolicitationUuid(serviceSolicitationUuid: ParcelUuid): AdvertiseData.Builder
Add a service solicitation UUID to advertise data.
Parameters | |
---|---|
serviceSolicitationUuid |
ParcelUuid: A service solicitation UUID to be advertised. This value cannot be null . |
Return | |
---|---|
AdvertiseData.Builder |
This value cannot be null . |
Exceptions | |
---|---|
java.lang.IllegalArgumentException |
If the serviceSolicitationUuid is null. |
addServiceUuid
fun addServiceUuid(serviceUuid: ParcelUuid!): AdvertiseData.Builder!
Add a service UUID to advertise data.
Parameters | |
---|---|
serviceUuid |
ParcelUuid!: A service UUID to be advertised. |
Exceptions | |
---|---|
java.lang.IllegalArgumentException |
If the serviceUuid is null. |
addTransportDiscoveryData
fun addTransportDiscoveryData(transportDiscoveryData: TransportDiscoveryData): AdvertiseData.Builder
Add Transport Discovery Data to advertise data.
Parameters | |
---|---|
transportDiscoveryData |
TransportDiscoveryData: Transport Discovery Data, consisting of one or more Transport Blocks. Transport Discovery Data AD Type Code is already included. This value cannot be null . |
Return | |
---|---|
AdvertiseData.Builder |
This value cannot be null . |
Exceptions | |
---|---|
java.lang.IllegalArgumentException |
If the transportDiscoveryData is empty |
setIncludeDeviceName
fun setIncludeDeviceName(includeDeviceName: Boolean): AdvertiseData.Builder!
Set whether the device name should be included in advertise packet.
setIncludeTxPowerLevel
fun setIncludeTxPowerLevel(includeTxPowerLevel: Boolean): AdvertiseData.Builder!
Whether the transmission power level should be included in the advertise packet. Tx power level field takes 3 bytes in advertise packet.