BluetoothLEAdvertisementPublisher
BluetoothLEAdvertisementPublisher
BluetoothLEAdvertisementPublisher
BluetoothLEAdvertisementPublisher
Class
Definition
An object to send Bluetooth Low Energy (LE) advertisements.
public : sealed class BluetoothLEAdvertisementPublisher : IBluetoothLEAdvertisementPublisherpublic sealed class BluetoothLEAdvertisementPublisher : IBluetoothLEAdvertisementPublisherPublic NotInheritable Class BluetoothLEAdvertisementPublisher Implements IBluetoothLEAdvertisementPublisher// You can use this class in JavaScript.
- Attributes
| Device family |
Windows 10 (introduced v10.0.10240.0 - for Xbox, see UWP features that aren't yet supported on Xbox)
|
| API contract |
Windows.Foundation.UniversalApiContract (introduced v1)
|
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 this page from the 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)
- Slave 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)
Constructors
BluetoothLEAdvertisementPublisher() BluetoothLEAdvertisementPublisher() BluetoothLEAdvertisementPublisher() BluetoothLEAdvertisementPublisher()
Creates a new BluetoothLEAdvertisementPublisher object.
public : BluetoothLEAdvertisementPublisher()public BluetoothLEAdvertisementPublisher()Public Sub New()// You can use this method in JavaScript.
- See Also
BluetoothLEAdvertisementPublisher(BluetoothLEAdvertisement) BluetoothLEAdvertisementPublisher(BluetoothLEAdvertisement) BluetoothLEAdvertisementPublisher(BluetoothLEAdvertisement) BluetoothLEAdvertisementPublisher(BluetoothLEAdvertisement)
Creates a new BluetoothLEAdvertisementPublisher object with the Bluetooth LE advertisement to publish.
public : BluetoothLEAdvertisementPublisher(BluetoothLEAdvertisement advertisement)public BluetoothLEAdvertisementPublisher(BluetoothLEAdvertisement advertisement)Public Sub New(advertisement As BluetoothLEAdvertisement)// You can use this method in JavaScript.
- advertisement
- BluetoothLEAdvertisement BluetoothLEAdvertisement BluetoothLEAdvertisement BluetoothLEAdvertisement
The Bluetooth LE advertisement to publish.
Remarks
There are additional policy restrictions on certain system-reserved data types that cannot be advertised through using the BluetoothLEAdvertisementPublisher. Advertisement containing these data types will be rejected and an exception will be thrown when the Start method is called.
- See Also
Properties
Advertisement Advertisement Advertisement Advertisement
Gets a copy of the Bluetooth LE advertisement to publish.
public : BluetoothLEAdvertisement Advertisement { get; }public BluetoothLEAdvertisement Advertisement { get; }Public ReadOnly Property Advertisement As BluetoothLEAdvertisement// You can use this property in JavaScript.
- Value
- BluetoothLEAdvertisement BluetoothLEAdvertisement BluetoothLEAdvertisement BluetoothLEAdvertisement
A copy of the Bluetooth LE advertisement to publish.
- See Also
Status Status Status Status
Gets the current status of the BluetoothLEAdvertisementPublisher.
public : BluetoothLEAdvertisementPublisherStatus Status { get; }public BluetoothLEAdvertisementPublisherStatus Status { get; }Public ReadOnly Property Status As BluetoothLEAdvertisementPublisherStatus// You can use this property in JavaScript.
- Value
- BluetoothLEAdvertisementPublisherStatus BluetoothLEAdvertisementPublisherStatus BluetoothLEAdvertisementPublisherStatus BluetoothLEAdvertisementPublisherStatus
The current status of the BluetoothLEAdvertisementPublisher.
- See Also
Methods
Start() Start() Start() Start()
Start advertising a Bluetooth LE advertisement payload.
public : void Start()public void Start()Public Function Start() As void// You can use this method in JavaScript.
Remarks
The status of the BluetoothLEAdvertisementPublisher will transition to Started or Waiting depending on whether the advertisement can be serviced or to the Aborted state if the request failed immediately due to error.
If the Start method is called in the Stopping state, the request will be pended and the state will remain in the Stopping state until the request completes, at which time a new request will be sent and the state will transition into Started.
The BluetoothLEAdvertisementPublisher will be automatically stopped when an app is suspended.
- See Also
Stop() Stop() Stop() Stop()
Stop the publisher and stop advertising a Bluetooth LE advertisement payload.
public : void Stop()public void Stop()Public Function Stop() As void// You can use this method in JavaScript.
Remarks
The status of the BluetoothLEAdvertisementPublisher will transition to the Stopping state until the advertising is cancelled in which the state will transition to Stopped state. Calling the Stop method in the Stopped or Aborted state has no effect. Calling the Stop method in the Stopping state will overwrite any advertisements in the last Start method call during that state.
The BluetoothLEAdvertisementPublisher will be automatically stopped when an app is suspended.
- See Also
Events
StatusChanged StatusChanged StatusChanged StatusChanged
Notification that the status of the BluetoothLEAdvertisementPublisher has changed.
public : event TypedEventHandler StatusChanged<BluetoothLEAdvertisementPublisher, BluetoothLEAdvertisementPublisherStatusChangedEventArgs>public event TypedEventHandler StatusChanged<BluetoothLEAdvertisementPublisher, BluetoothLEAdvertisementPublisherStatusChangedEventArgs>Public Event StatusChanged<BluetoothLEAdvertisementPublisher, BluetoothLEAdvertisementPublisherStatusChangedEventArgs>// You can use this event in JavaScript.
- See Also