BluetoothDevice クラス

定義

Bluetooth デバイスを表します。

このクラスを使用するサンプル アプリケーションには、 デバイスの列挙とペアリングのサンプルBluetooth RFCOMM チャット サンプルが含まれます

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
継承
Object Platform::Object IInspectable BluetoothDevice
属性
実装

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

注釈

バージョン履歴

Windows のバージョン SDK バージョン 追加された値
1511 10586 DeviceInformation
1511 10586 GetDeviceSelectorFrom BluetoothAddress
1511 10586 GetDeviceSelectorFromClassOfDevice
1511 10586 GetDeviceSelectorFromConnectionStatus
1511 10586 GetDeviceSelectorFromDeviceName
1511 10586 GetDeviceSelectorFromPairingState
1607 14393 DeviceAccessInformation
1607 14393 GetRfcommServicesAsync
1607 14393 GetRfcommServicesAsync(BluetoothCacheMode)
1607 14393 GetRfcommServicesForIdAsync(RfcommServiceId)
1607 14393 GetRfcommServicesForIdAsync(RfcommServiceId,BluetoothCacheMode)
1607 14393 RequestAccessAsync
1709 16299 BluetoothDeviceId
1803 17134 WasSecureConnectionUsedForPairing

プロパティ

BluetoothAddress

デバイス アドレスを取得します。

BluetoothDeviceId

bluetooth デバイス ID を取得します。

ClassOfDevice

デバイスの Bluetooth クラスのデバイス情報を取得します。

ConnectionStatus

デバイスの接続状態を取得します。

DeviceAccessInformation

デバイスの現在の DeviceAccessInformation オブジェクト。 デバイスへのアクセス変更をチェックおよび監視するために使用されます。

DeviceId

Windows.Devices.Enumeration.DeviceInformation.Id から取得したデバイス ID を取得します。

DeviceInformation

Bluetooth デバイスの DeviceInformation オブジェクトを取得します。

HostName

デバイスの HostName を取得します。

Name

デバイスの名前を取得します。

RfcommServices

デバイスでサポートされている RFCOMM サービスの読み取り専用リストを取得します。

重要

RfcommServices API は非推奨であり、今後のバージョンの Windows では使用できない可能性があります。 代わりに、 GetRfcommServicesAsync を使用します。

SdpRecords

デバイスの Service Discovery Protocol (SDP) レコードの読み取り専用リストを取得します。

WasSecureConnectionUsedForPairing

BluetoothDevice がセキュア接続を使用してペアリングされたかどうかを示すブール値を取得します。

メソッド

Close()

Bluetooth デバイスを閉じます。

Dispose()

アンマネージ リソースの解放またはリセットに関連付けられているアプリケーション定義のタスクを実行します。

FromBluetoothAddressAsync(UInt64)

指定された BluetoothAddress の BluetoothDevice オブジェクトを返 します

FromHostNameAsync(HostName)

指定した HostName で識別される BluetoothDevice オブジェクトを返します。

FromIdAsync(String)

指定された DeviceId によって識別される BluetoothDevice オブジェクトを返します。

GetDeviceSelector()

このデバイスのインスタンスを識別するための高度なクエリ構文 (AQS) 文字列を取得します。 この文字列は FindAllAsync メソッドまたは CreateWatcher メソッドに渡されます。

GetDeviceSelectorFromBluetoothAddress(UInt64)

Bluetooth デバイスを表す 64 ビット アドレスから高度なクエリ構文 (AQS) フィルター文字列を作成します。 AQS 文字列は CreateWatcher メソッドに渡され、 DeviceInformation オブジェクトのコレクションを返します。

GetDeviceSelectorFromClassOfDevice(BluetoothClassOfDevice)

BluetoothClassOfDevice オブジェクトから高度なクエリ構文 (AQS) フィルター文字列を作成します。 AQS 文字列は CreateWatcher メソッドに渡され、 DeviceInformation オブジェクトのコレクションを返します。

GetDeviceSelectorFromConnectionStatus(BluetoothConnectionStatus)

指定された BluetoothConnectionStatus を使用して、Bluetooth デバイスのクエリを含む高度なクエリ構文 (AQS) フィルター文字列を作成します。 AQS 文字列は CreateWatcher メソッドに渡され、指定された Bluetooth 接続状態を持つ DeviceInformation オブジェクトのコレクションを返します。

GetDeviceSelectorFromDeviceName(String)

Bluetooth デバイス名のクエリを含む高度なクエリ構文 (AQS) フィルター文字列を作成します。 AQS 文字列は CreateWatcher メソッドに渡され、指定された Bluetooth デバイス名を含む DeviceInformation オブジェクトのコレクションを返します。

GetDeviceSelectorFromPairingState(Boolean)

ペアになっているかペアになっていない Bluetooth デバイスのクエリを含む高度なクエリ構文 (AQS) フィルター文字列を作成します。 AQS 文字列は CreateWatcher メソッドに渡され、 DeviceInformation オブジェクトのコレクションを返します。

GetRfcommServicesAsync()

リモート Bluetooth デバイス上のすべての Rfcomm サービスを取得します。

GetRfcommServicesAsync(BluetoothCacheMode)

リモート Bluetooth デバイス上のすべてのキャッシュされた Rfcomm サービスを取得します。

GetRfcommServicesForIdAsync(RfcommServiceId)

指定した RfcommServiceId と一致するリモート Bluetooth デバイス上のすべての Rfcomm サービスを取得します。

GetRfcommServicesForIdAsync(RfcommServiceId, BluetoothCacheMode)

指定した RfcommServiceId と一致するリモート Bluetooth デバイス上のすべてのキャッシュ された Rfcomm サービスを取得します。

RequestAccessAsync()

Bluetooth デバイスへの明示的なアクセスを要求するために使用されます。 これにより、デバイスの同意が呼び出され、UI スレッドで呼び出す必要があります。

イベント

ConnectionStatusChanged

デバイスの接続状態が変更されたときに発生します。

NameChanged

デバイスの名前が変更されたときに発生します。

SdpRecordsChanged

デバイスのリスト SDP レコードが変更されたときに発生します。

適用対象

こちらもご覧ください