BluetoothLEDevice Kelas
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
Mewakili perangkat BLUETOOTH LE.
Untuk contoh kode, lihat sampel Bluetooth Low Energy dan Enumerasi perangkat dan sampel pemasangan.
public ref class BluetoothLEDevice 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 BluetoothLEDevice 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 BluetoothLEDevice : System.IDisposable
Public NotInheritable Class BluetoothLEDevice
Implements IDisposable
- Warisan
- Atribut
- Penerapan
Persyaratan Windows
Rangkaian perangkat |
Windows 10 (diperkenalkan dalam 10.0.10240.0 - for Xbox, see UWP features that aren't yet supported on Xbox)
|
API contract |
Windows.Foundation.UniversalApiContract (diperkenalkan dalam v1.0)
|
Kemampuan aplikasi |
bluetooth
|
Keterangan
Riwayat versi
Versi Windows | Versi SDK | Nilai ditambahkan |
---|---|---|
1511 | 10586 | Penampilan |
1511 | 10586 | BluetoothAddressType |
1511 | 10586 | DeviceInformation |
1511 | 10586 | FromBluetoothAddressAsync(UInt64,BluetoothAddressType) |
1511 | 10586 | GetDeviceSelectorFromAppearance |
1511 | 10586 | GetDeviceSelectorFromBluetoothAddress(UInt64) |
1511 | 10586 | GetDeviceSelectorFromBluetoothAddress(UInt64,BluetoothAddressType) |
1511 | 10586 | GetDeviceSelectorFromConnectionStatus |
1511 | 10586 | GetDeviceSelectorFromDeviceName |
1511 | 10586 | GetDeviceSelectorFromPairingState |
1703 | 15063 | DeviceAccessInformation |
1703 | 15063 | GetGattServicesAsync |
1703 | 15063 | GetGattServicesAsync(BluetoothCacheMode) |
1703 | 15063 | GetGattServicesForUuidAsync(Guid) |
1703 | 15063 | GetGattServicesForUuidAsync(Guid,BluetoothCacheMode) |
1703 | 15063 | RequestAccessAsync |
1709 | 16299 | BluetoothDeviceId |
1803 | 17134 | WasSecureConnectionUsedForPairing |
Properti
Appearance |
Mendapatkan objek BluetoothLEAppearance untuk perangkat BLUETOOTH LE. |
BluetoothAddress |
Mendapatkan alamat perangkat. |
BluetoothAddressType |
Mendapatkan jenis alamat untuk perangkat BLUETOOTH LE. |
BluetoothDeviceId |
Mendapatkan ID perangkat bluetooth. |
ConnectionStatus |
Mendapatkan status koneksi perangkat. |
DeviceAccessInformation |
Mendapatkan DeviceAccessInformation. |
DeviceId |
Mendapatkan ID perangkat. |
DeviceInformation |
Mendapatkan informasi perangkat untuk perangkat BLUETOOTH LE. |
GattServices |
Mendapatkan daftar layanan GATT baca-saja yang didukung oleh perangkat. Penting GATTServices API tidak digunakan lagi, dan mungkin tidak tersedia di versi Windows yang akan datang. Sebagai gantinya, gunakan GetGattServicesAsync. |
Name |
Mendapatkan nama perangkat BLUETOOTH LE. |
WasSecureConnectionUsedForPairing |
Mendapatkan boolean yang menunjukkan apakah BluetoothLEDevice dipasangkan menggunakan Koneksi Aman. |
Metode
Close() |
Menutup perangkat BLUETOOTH LE ini. Ini dapat menutup koneksi ke perangkat jika ini adalah satu-satunya aplikasi dengan koneksi. |
Dispose() |
Melakukan tugas yang ditentukan aplikasi yang terkait dengan membebaskan, merilis, atau mengatur ulang sumber daya yang tidak dikelola. |
FromBluetoothAddressAsync(UInt64) |
Mengembalikan objek BluetoothLEDevice yang mewakili perangkat LE Bluetooth serekan dengan alamat yang diberikan. Lihat Komentar (dalam topik anggota ini). |
FromBluetoothAddressAsync(UInt64, BluetoothAddressType) |
Mengembalikan objek BluetoothLEDevice yang mewakili perangkat serekan dengan alamat dan jenis alamat yang diberikan. Lihat Komentar (dalam topik anggota ini). |
FromIdAsync(String) |
Mengembalikan objek BluetoothLEDevice untuk Id yang diberikan. Lihat Komentar dalam topik anggota. |
GetConnectionParameters() |
Mengambil parameter koneksi untuk perangkat jarak jauh. Jika beberapa aplikasi atau skenario sistem lainnya juga meminta parameter ini, maka sistem secara otomatis menggabungkan parameter, jika kompatibel, berdasarkan prioritas sistem. Catatan Ketika perangkat tidak tersambung, parameter koneksi tidak valid (semua nol). |
GetConnectionPhy() |
Mengambil info tentang lapisan fisik BLUETOOTH LE (PHY). Catatan Ketika perangkat tidak tersambung, PHY koneksi tidak valid (semua salah) |
GetDeviceSelector() |
Mendapatkan string Advanced Query Syntax (AQS) untuk mengidentifikasi semua perangkat Bluetooth Low Energy (LE). String ini diteruskan ke metode FindAllAsync atau CreateWatcher untuk mendapatkan daftar perangkat BLUETOOTH LE. |
GetDeviceSelectorFromAppearance(BluetoothLEAppearance) |
Membuat string filter Advanced Query Syntax (AQS) dari objek BluetoothLEAppearance . String AQS diteruskan ke metode CreateWatcher untuk mengembalikan kumpulan objek DeviceInformation dengan tampilan yang ditentukan. |
GetDeviceSelectorFromBluetoothAddress(UInt64) |
Membuat string filter Advanced Query Syntax (AQS) dari alamat 64-bit yang mewakili perangkat BLUETOOTH LE. String AQS diteruskan ke metode CreateWatcher untuk mengembalikan kumpulan objek DeviceInformation . |
GetDeviceSelectorFromBluetoothAddress(UInt64, BluetoothAddressType) |
Membuat string filter Advanced Query Syntax (AQS) dari alamat 64-bit dan jenis alamat yang mewakili perangkat BLUETOOTH LE. String AQS diteruskan ke metode CreateWatcher . |
GetDeviceSelectorFromConnectionStatus(BluetoothConnectionStatus) |
Membuat string filter Advanced Query Syntax (AQS) yang berisi kueri untuk perangkat Bluetooth LE dengan BluetoothConnectionStatus yang ditunjukkan. String AQS diteruskan ke metode CreateWatcher untuk mengembalikan kumpulan objek DeviceInformation dengan status koneksi Bluetooth yang ditunjukkan. |
GetDeviceSelectorFromDeviceName(String) |
Membuat string filter Advanced Query Syntax (AQS) yang berisi kueri untuk nama perangkat Bluetooth LE. String AQS diteruskan ke metode CreateWatcher untuk mengembalikan kumpulan objek DeviceInformation yang berisi nama perangkat Bluetooth LE yang ditentukan. |
GetDeviceSelectorFromPairingState(Boolean) |
Membuat string filter Advanced Query Syntax (AQS) yang berisi kueri untuk perangkat Bluetooth LE yang dipasangkan atau tidak dipasangkan. String AQS diteruskan ke metode CreateWatcher untuk mengembalikan kumpulan objek DeviceInformation . |
GetGattService(Guid) |
Mengembalikan layanan GATT dengan Id layanan yang diberikan. Penting GetGattService API tidak digunakan lagi, dan mungkin tidak tersedia di versi Windows yang akan datang. Sebagai gantinya, gunakan GetGattServicesAsync. |
GetGattServicesAsync() |
Mendapatkan GattDeviceServices untuk perangkat Bluetooth LowEnergy ini. |
GetGattServicesAsync(BluetoothCacheMode) |
Mengembalikan GattDeviceServices untuk perangkat Bluetooth LowEnergy ini dengan mode cache yang ditentukan. |
GetGattServicesForUuidAsync(Guid) |
Mengembalikan GattDeviceServices untuk perangkat Bluetooth LowEnergy dengan UUID yang ditentukan. |
GetGattServicesForUuidAsync(Guid, BluetoothCacheMode) |
Mengembalikan GattDeviceServices untuk perangkat Bluetooth LowEnergy dengan UUID yang ditentukan. |
RequestAccessAsync() |
Meminta akses ke perangkat Bluetooth LowEnergy. |
RequestPreferredConnectionParameters(BluetoothLEPreferredConnectionParameters) |
Mengambil objek permintaan parameter koneksi pilihan BLUETOOTH LE untuk objek parameter koneksi pilihan Bluetooth LE yang ditentukan. |
Acara
ConnectionParametersChanged |
Peristiwa yang dimunculkan saat parameter koneksi saat ini untuk perangkat berubah. Parameter hanya akan diperbarui setelah koneksi ke perangkat dibuat. |
ConnectionPhyChanged |
Peristiwa yang dimunculkan saat PHY saat ini untuk perangkat berubah. PHY akan diperbarui hanya setelah koneksi ke perangkat dibuat. |
ConnectionStatusChanged |
Terjadi ketika status koneksi untuk perangkat telah berubah. |
GattServicesChanged |
Muncul ketika daftar layanan GATT yang didukung oleh perangkat telah berubah. |
NameChanged |
Terjadi ketika nama perangkat telah berubah. |