Language

BluetoothDevice クラス

定義

Bluetooth デバイスを表します。

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

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 デバイス情報
1511 10586 GetDeviceSelectorFromBluetoothAddress
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

プロパティ

Name 説明
BluetoothAddress

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

BluetoothDeviceId

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

ClassOfDevice

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

ConnectionStatus

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

DeviceAccessInformation

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

DeviceId

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

DeviceInformation

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

HostName

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

Name

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

RfcommServices

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

Important

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

SdpRecords

デバイスのサービス探索プロトコル (SDP) レコードの読み取り専用リストを取得します。

WasSecureConnectionUsedForPairing

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

メソッド

Name 説明
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 文字列は、DeviceInformation オブジェクトのコレクションを返すために CreateWatcher メソッドに渡されます。

GetDeviceSelectorFromClassOfDevice(BluetoothClassOfDevice)

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

GetDeviceSelectorFromConnectionStatus(BluetoothConnectionStatus)

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

GetDeviceSelectorFromDeviceName(String)

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

GetDeviceSelectorFromPairingState(Boolean)

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

GetRfcommServicesAsync()

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

GetRfcommServicesAsync(BluetoothCacheMode)

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

GetRfcommServicesForIdAsync(RfcommServiceId, BluetoothCacheMode)

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

GetRfcommServicesForIdAsync(RfcommServiceId)

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

RequestAccessAsync()

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

イベント

Name 説明
ConnectionStatusChanged

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

NameChanged

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

SdpRecordsChanged

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

適用対象

関連項目