public static final class AdvertiseData.Builder
extends Object
java.lang.Object | |
↳ | android.bluetooth.le.AdvertiseData.Builder |
建造者为 AdvertiseData
。
Public constructors |
|
---|---|
AdvertiseData.Builder() |
Public methods |
|
---|---|
AdvertiseData.Builder |
addManufacturerData(int manufacturerId, byte[] manufacturerSpecificData) 添加制造商特定数据。 |
AdvertiseData.Builder |
addServiceData(ParcelUuid serviceDataUuid, byte[] serviceData) 添加服务数据来宣传数据。 |
AdvertiseData.Builder |
addServiceUuid(ParcelUuid serviceUuid) 添加服务UUID以通告数据。 |
AdvertiseData |
build() 建立 |
AdvertiseData.Builder |
setIncludeDeviceName(boolean includeDeviceName) 设置是否在通告报文中包含设备名称。 |
AdvertiseData.Builder |
setIncludeTxPowerLevel(boolean includeTxPowerLevel) 广播报文中是否包含传输功率等级。 |
Inherited methods |
|
---|---|
From class java.lang.Object
|
AdvertiseData.Builder addManufacturerData (int manufacturerId, byte[] manufacturerSpecificData)
添加制造商特定数据。
有关现有公司标识符的列表,请参阅 Bluetooth SIG提供的Bluetooth Assigned Numbers文档。
Parameters | |
---|---|
manufacturerId |
int : Manufacturer ID assigned by Bluetooth SIG. |
manufacturerSpecificData |
byte : Manufacturer specific data |
Returns | |
---|---|
AdvertiseData.Builder |
Throws | |
---|---|
IllegalArgumentException |
If the manufacturerId is negative or manufacturerSpecificData is null. |
AdvertiseData.Builder addServiceData (ParcelUuid serviceDataUuid, byte[] serviceData)
添加服务数据来宣传数据。
Parameters | |
---|---|
serviceDataUuid |
ParcelUuid : 16-bit UUID of the service the data is associated with |
serviceData |
byte : Service data |
Returns | |
---|---|
AdvertiseData.Builder |
Throws | |
---|---|
IllegalArgumentException |
If the serviceDataUuid or serviceData is empty. |
AdvertiseData.Builder addServiceUuid (ParcelUuid serviceUuid)
添加服务UUID以通告数据。
Parameters | |
---|---|
serviceUuid |
ParcelUuid : A service UUID to be advertised. |
Returns | |
---|---|
AdvertiseData.Builder |
Throws | |
---|---|
IllegalArgumentException |
If the serviceUuids are null. |
AdvertiseData.Builder setIncludeDeviceName (boolean includeDeviceName)
设置是否在通告报文中包含设备名称。
Parameters | |
---|---|
includeDeviceName |
boolean
|
Returns | |
---|---|
AdvertiseData.Builder |
AdvertiseData.Builder setIncludeTxPowerLevel (boolean includeTxPowerLevel)
广播报文中是否包含传输功率等级。 发送功率电平字段在通告分组中占用3个字节。
Parameters | |
---|---|
includeTxPowerLevel |
boolean
|
Returns | |
---|---|
AdvertiseData.Builder |