Share via


BluetoothLEAdvertisementPublisher Class

Definition

An object to send Bluetooth Low Energy (LE) advertisements.

public ref class BluetoothLEAdvertisementPublisher sealed
/// [Windows.Foundation.Metadata.Activatable(65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.Activatable(Windows.Devices.Bluetooth.Advertisement.IBluetoothLEAdvertisementPublisherFactory, 65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class BluetoothLEAdvertisementPublisher final
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.Activatable(Windows.Devices.Bluetooth.Advertisement.IBluetoothLEAdvertisementPublisherFactory, 65536, "Windows.Foundation.UniversalApiContract")]
/// [Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
class BluetoothLEAdvertisementPublisher final
[Windows.Foundation.Metadata.Activatable(65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.Activatable(typeof(Windows.Devices.Bluetooth.Advertisement.IBluetoothLEAdvertisementPublisherFactory), 65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class BluetoothLEAdvertisementPublisher
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.Activatable(typeof(Windows.Devices.Bluetooth.Advertisement.IBluetoothLEAdvertisementPublisherFactory), 65536, "Windows.Foundation.UniversalApiContract")]
[Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
public sealed class BluetoothLEAdvertisementPublisher
function BluetoothLEAdvertisementPublisher(advertisement)
Public NotInheritable Class BluetoothLEAdvertisementPublisher
Inheritance
Object Platform::Object IInspectable BluetoothLEAdvertisementPublisher
Attributes

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0 - for Xbox, see UWP features that aren't yet supported on Xbox)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)
App capabilities
bluetooth

Remarks

The BluetoothLEAdvertisementPublisher class allows the configuration and advertising of a Bluetooth LE advertisement packet. The advertising request is serviced on a best effort basis and the advertising parameters are defined by an advertising policy.

The payload of the advertisement is configured when the BluetoothLEAdvertisementPublisher is constructed. The payload can be retrieved by the Advertisement property of the BluetoothLEAdvertisementPublisher. The BluetoothLEAdvertisement class must be managed by the caller if used this way. For example, it is not recommended to directly reuse a BluetoothLEAdvertisement obtained from a BluetoothLEAdvertisementReceivedEventArgs because it contains duplication of actual payload in order to facilitate the access to common data sections. If a received BluetoothLEAdvertisement needs to be duplicated, only the DataSections property should be copied, as they represent the advertisement data sections in their raw form.

The local advertisement resource is limited at the protocol layer. Usage of this resource is best suited for controlled scenarios such as enterprise use cases. Other apps may compete for this limited resource and regular broadcast of advertisements for any specific use case cannot be guaranteed.

The following advertisement types are allowed:

  • Manufacturer Specific Information (0xFF)
  • Any non-standard type not reserved by the system, as shown in the list below. For more information on non-standard types, see the Assigned numbers and GAP Bluetooth specification.

The following advertisement types are system-reserved and are not allowed:

  • Flags (0x01)
  • Incomplete List of 16-bit Service UUIDs (0x02)
  • Complete List of 16-bit Service UUIDs (0x03)
  • Incomplete List of 32-bit Service UUIDs (0x04)
  • Complete List of 32-bit Service UUIDs (0x05)
  • Incomplete List of 128-bit Service UUIDs (0x06)
  • Complete List of 128-bit Service UUIDs (0x07)
  • Shortened Local Name (0x08)
  • Complete Local Name (0x09)
  • Tx Power Level (0x0A)
  • Class of Device (0x0D)
  • Simple Pairing Hash C192 (0x0E)
  • Simple Pairing Randomizer R192 (0x0F)
  • Security Manager TK Values (0x10)
  • Security Manager Out-of-Band Flags (0x11)
  • Peripheral Connection Interval Range (0x12)
  • List of 16-bit Service Solicitation UUIDs (0x14)
  • List of 32-bit Service Solicitation UUIDs (0x1F)
  • List of 128-bit Service Solicitation UUIDs (0x15)
  • Service Data 16-bit UUID (0x16)
  • Service Data 32-bit UUID (0x20)
  • Service Data 128-bit UUID (0x21)
  • Public Target Address (0x17)
  • Random Target Address (0x18)
  • Appearance (0x19)
  • Advertising Interval (0x1A)
  • LE Bluetooth Device Address (0x1B)
  • LE Role (0x1C)
  • Simple Pairing Hash C256 (0x1D)
  • Simple Pairing Randomizer R256 (0x1E)
  • 3D Information Data (0x3D)

Version history

Windows version SDK version Value added
2004 19041 IncludeTransmitPowerLevel
2004 19041 IsAnonymous
2004 19041 PreferredTransmitPowerLevelInDBm
2004 19041 UseExtendedAdvertisement

Constructors

BluetoothLEAdvertisementPublisher()

Creates a new BluetoothLEAdvertisementPublisher object.

BluetoothLEAdvertisementPublisher(BluetoothLEAdvertisement)

Creates a new BluetoothLEAdvertisementPublisher object with the Bluetooth LE advertisement to publish.

Properties

Advertisement

Gets a copy of the Bluetooth LE advertisement to publish.

When configuring the publisher object, you can't add restricted section types (BluetoothLEAdvertisementPublisher.Advertisement.Flags and BluetoothLEAdvertisementPublisher.Advertisement.LocalName). Trying to set those property values results in a runtime exception. You can still set the manufacturer data section, or any other sections not defined by the list of restrictions.

IncludeTransmitPowerLevel

Specifies whether the transmit power level is included in the advertisement header. Defaults to False.

IsAnonymous

Specifies whether or not the device address is included in the advertisement header. By default, the address is included.

PreferredTransmitPowerLevelInDBm

If specified, requests that the radio use the indicated transmit power level for the advertisement. Defaults to Null.

PrimaryPhy
SecondaryPhy
Status

Gets the current status of the BluetoothLEAdvertisementPublisher.

UseExtendedAdvertisement

Specifies that the advertisement publisher should use the Extended Advertising format.

Methods

Start()

Start advertising a Bluetooth LE advertisement payload.

Stop()

Stop the publisher and stop advertising a Bluetooth LE advertisement payload.

Events

StatusChanged

Notification that the status of the BluetoothLEAdvertisementPublisher has changed.

Applies to

See also