BluetoothLEAdvertisementPublisher 類別

定義

傳送藍牙低能源 (LE) 廣告的物件。

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
繼承
Object Platform::Object IInspectable BluetoothLEAdvertisementPublisher
屬性

Windows 需求

裝置系列
Windows 10 (已於 10.0.10240.0 - for Xbox, see UWP features that aren't yet supported on Xbox 引進)
API contract
Windows.Foundation.UniversalApiContract (已於 v1.0 引進)
應用程式功能
bluetooth

備註

BluetoothLEAdvertisementPublisher 類別允許藍牙 LE 廣告封包的設定和廣告。 廣告要求會以最佳方式提供服務,而廣告參數是由廣告原則所定義。

當建構 BluetoothLEAdvertisementPublisher 時,就會設定廣告的承載。 BluetoothLEAdvertisementPublisher 的 Advertisement 屬性可以擷取承載。 藍牙LEAdvertisement類別必須使用這種方式由呼叫端管理。 例如,不建議直接重複使用從BluetoothLEAdvertisementReceivedEventArgs取得的BluetoothLEAdvertisement,因為它包含實際承載的重複,以利存取通用資料區段。 如果收到的 BluetoothLEAdvertisement 需要複製,則應該只複製 DataSections 屬性,因為它們代表原始格式的廣告資料區段。

本機公告資源受限於通訊協定層。 此資源的使用方式最適合受控制的案例,例如企業使用案例。 其他應用程式可能會競爭此有限的資源,且無法保證任何特定使用案例的廣告定期廣播。

允許下列廣告類型:

  • 製造商特定資訊 (0xFF)
  • 系統未保留的任何非標準類型,如下列清單所示。 如需非標準類型的詳細資訊,請參閱 指派的數位和 GAP 藍牙規格。

下列公告類型為系統保留,不允許:

  • 旗標 (0x01)
  • 未完成的 16 位服務 UUID 清單 (0x02)
  • 16 位服務 UUID 的完整清單 (0x03)
  • 未完成的 32 位服務 UUID 清單 (0x04)
  • 32 位服務 UUID 的完整清單 (0x05)
  • 未完成的 128 位服務 UUID 清單 (0x06)
  • 128 位服務 UUID 的完整清單 (0x07)
  • 縮短的本機名稱 (0x08)
  • 完整本機名稱 (0x09)
  • Tx 電源層級 (0x0A)
  • 裝置 (0x0D) 類別
  • 簡單配對雜湊 C192 (0x0E)
  • 簡單配對隨機化程式 R192 (0x0F)
  • 安全性管理員 TK 值 (0x10)
  • 安全性管理員頻外旗標 (0x11)
  • 周邊連線間隔範圍 (0x12)
  • 16 位服務要求 UUID 清單 (0x14)
  • 32 位服務要求 UUID 清單 (0x1F)
  • 128 位服務要求 UUID 清單 (0x15)
  • 服務資料 16 位 UUID (0x16)
  • 服務資料 32 位 UUID (0x20)
  • 服務資料 128 位 UUID (0x21)
  • 公用目標位址 (0x17)
  • 隨機目標位址 (0x18)
  • 外觀 (0x19)
  • 廣告間隔 (0x1A)
  • LE 藍牙裝置位址 (0x1B)
  • LE 角色 (0x1C)
  • 簡單配對雜湊 C256 (0x1D)
  • 簡單配對隨機化程式 R256 (0x1E)
  • 3D 資訊資料 (0x3D)

版本歷程記錄

Windows 版本 SDK 版本 已新增值
2004 19041 IncludeTransmitPowerLevel
2004 19041 IsAnonymous
2004 19041 PreferredTransmitPowerLevelInDBm
2004 19041 UseExtendedAdvertisement

建構函式

BluetoothLEAdvertisementPublisher()

建立新的 BluetoothLEAdvertisementPublisher 物件。

BluetoothLEAdvertisementPublisher(BluetoothLEAdvertisement)

使用藍牙 LE 公告建立新的 BluetoothLEAdvertisementPublisher 物件來發佈。

屬性

Advertisement

取得要發佈的藍牙 LE 公告複本。

設定發行者物件時,您無法在 BluetoothLEAdvertisementPublisher.Advertisement.FlagsBluetoothLEAdvertisementPublisher.Advertisement.LocalName) 新增受限制的區段 (類型。 嘗試設定這些屬性值會導致執行時間例外狀況。 您仍然可以設定制造商資料區段,或任何其他未由限制清單定義的區段。

IncludeTransmitPowerLevel

指定廣告標頭中是否包含傳輸電源等級。 預設為 False。

IsAnonymous

指定廣告標頭中是否包含裝置位址。 根據預設,會包含位址。

PreferredTransmitPowerLevelInDBm

如果指定,要求無線電針對廣告使用指定的傳輸電源等級。 預設值為 Null。

Status

取得 BluetoothLEAdvertisementPublisher的目前狀態。

UseExtendedAdvertisement

指定廣告發行者應該使用擴充廣告格式。

方法

Start()

開始公告藍牙 LE 廣告承載。

Stop()

停止發行者並停止廣告藍牙 LE 廣告承載。

事件

StatusChanged

BluetoothLEAdvertisementPublisher狀態已變更的通知。

適用於

另請參閱