BluetoothDevice 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
public ref class BluetoothDevice sealed : IClosable
/// [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 BluetoothDevice final : IClosable
[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 BluetoothDevice : System.IDisposable
Public NotInheritable Class BluetoothDevice
Implements IDisposable
- 繼承
- 屬性
- 實作
Windows 需求
| 規格需求 | Description |
|---|---|
| 裝置系列 |
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
|
備註
版本歷程記錄
| Windows版本 | SDK 版本 | 附加價值 |
|---|---|---|
| 1511 | 10586 | 裝置資訊 |
| 1511 | 10586 | GetDeviceSelectorFromBluetoothAddress |
| 1511 | 10586 | GetDeviceSelectorFromClassOfDevice |
| 1511 | 10586 | GetDeviceSelectorFromConnectionStatus |
| 1511 | 10586 | GetDeviceSelectorFromDeviceName |
| 1511 | 10586 | GetDeviceSelectorFromPairingState |
| 1607 | 14393 | 裝置存取資訊 |
| 1607 | 14393 | GetRfcommServicesAsync |
| 1607 | 14393 | GetRfcommServicesAsync(BluetoothCacheMode) |
| 1607 | 14393 | GetRfcommServicesForIdAsync(RfcommServiceId) |
| 1607 | 14393 | GetRfcommServicesForIdAsync(RfcommServiceId,BluetoothCacheMode) |
| 1607 | 14393 | 請求存取非同步 |
| 1709 | 16299 | 藍牙裝置識別 |
| 1803 | 17134 | Was SecureConnection用於配對 |
屬性
| 名稱 | Description |
|---|---|
| BluetoothAddress |
取得裝置位址。 |
| BluetoothDeviceId |
會取得藍牙裝置 ID。 |
| ClassOfDevice |
取得裝置的藍牙類別資訊。 |
| ConnectionStatus |
會取得裝置的連線狀態。 |
| DeviceAccessInformation |
目前裝置的 DeviceAccessInformation 物件。 用來檢查和監控裝置的存取變更。 |
| DeviceId |
取得來自 Windows 的裝置 ID。Devices.Enumeration.DeviceInformation.Id |
| DeviceInformation |
取得藍牙裝置的 DeviceInformation 物件。 |
| HostName |
會取得裝置的主機名稱。 |
| Name |
會取得裝置名稱。 |
| RfcommServices |
取得裝置支援的唯讀 RFCOMM 服務清單。 Important RfcommServices API 已被棄用,未來的 Windows 版本可能無法提供。 相反地,請使用 GetRfcommServicesAsync。 |
| SdpRecords |
取得該裝置的唯讀服務發現協定(SDP)紀錄清單。 |
| WasSecureConnectionUsedForPairing |
會收到一個布林值,顯示藍牙裝置是否使用安全連線配對。 |
方法
事件
| 名稱 | Description |
|---|---|
| ConnectionStatusChanged |
當裝置的連線狀態改變時,會發生這種情況。 |
| NameChanged |
當裝置名稱更改時會發生。 |
| SdpRecordsChanged |
當裝置的清單 SDP 記錄變更時會發生。 |