共用方式為


GattDeviceService 類別

定義

代表藍牙裝置上的 GATT 主要服務。 GattDeviceService 類別代表藍牙 LE 裝置上的 GATT 服務。 它會使用裝置服務實例路徑具現化,方法是使用 Windows.Devices.Enumeration API 尋找裝置來取得。

public ref class GattDeviceService sealed : IClosable
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class GattDeviceService final : 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 GattDeviceService final : IClosable
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class GattDeviceService : System.IDisposable
[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 GattDeviceService : System.IDisposable
Public NotInheritable Class GattDeviceService
Implements IDisposable
繼承
Object Platform::Object IInspectable GattDeviceService
屬性
實作

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 版本 新增值
1703 15063 DeviceAccessInformation
1703 15063 FromIdAsync (String,GattSharingMode)
1703 15063 GetCharacteristicsAsync
1703 15063 GetCharacteristicsAsync (BluetoothCacheMode)
1703 15063 GetCharacteristicsForUuidAsync (Guid)
1703 15063 GetCharacteristicsForUuidAsync (Guid,BluetoothCacheMode)
1703 15063 GetDeviceSelectorForBluetoothDeviceId (BluetoothDeviceId)
1703 15063 GetDeviceSelectorForBluetoothDeviceId (BluetoothDeviceId,BluetoothCacheMode)
1703 15063 GetDeviceSelectorForBluetoothDeviceIdAndUuid (BluetoothDeviceId,Guid)
1703 15063 GetDeviceSelectorForBluetoothDeviceIdAndUuid (BluetoothDeviceId,Guid,BluetoothCacheMode)
1703 15063 GetIncludedServicesAsync
1703 15063 GetIncludedServicesAsync (BluetoothCacheMode)
1703 15063 GetIncludedServicesForUuidAsync (Guid)
1703 15063 GetIncludedServicesForUuidAsync (Guid,BluetoothCacheMode)
1703 15063 OpenAsync
1703 15063 RequestAccessAsync
1703 15063 工作階段
1703 15063 SharingMode

屬性

AttributeHandle

取得用來唯一識別 GATT 型服務屬性的句柄,如藍牙 LE 裝置上宣告。

Device

取得 BluetoothLEDevice 物件,描述與目前 GattDeviceService 對象相關聯的裝置。

重要

裝置 API 已被取代,未來版本的 Windows 可能無法使用。 請改用 會話

DeviceAccessInformation

取得與目前 GattDeviceService 對象相關聯的裝置存取資訊。

DeviceId

取得字串,表示用來具現化 GattDeviceService 的 GATT 服務實例路徑。

ParentServices

取得這個服務的父服務唯讀清單。

重要

ParentServices API 已被取代,未來版本的 Windows 可能無法使用。

Session

取得這個 GATT 裝置服務實例的會話。

SharingMode

取得這個 GATT 裝置服務實例的共用模式。

Uuid

取得與這個 GattDeviceService 相關聯的 GATT 服務 UUID

方法

Close()

釋放與 GattDeviceService 類別相關聯的資源。 這可讓其他應用程式存取 有問題的 GattDeviceService 資源。 在叫用 GattDeviceService 對象之後,請勿使用 GattDeviceService 物件;相反地,使用FromIdAsync方法具現化新的GattDeviceService物件。

針對 C++,呼叫 Close。 針對 .NET 語言,這個 Close 方法會投影到 Dispose 中。

ConvertShortIdToUuid(UInt16)

將藍牙 SIG 定義的簡短標識碼轉換為完整的 GATT UUID。

重要

ConvertShortIdToUuid API 已被取代,未來版本的 Windows 可能無法使用。 請改用 BluetoothUuidHelper.FromShortId

Dispose()

執行與釋放 (Free)、釋放 (Release) 或重設 Unmanaged 資源相關聯之應用程式定義的工作。

FromIdAsync(String)

從裝置標識碼具現化新的 GattDeviceService。

FromIdAsync(String, GattSharingMode)

從裝置標識碼具現化新的 GattDeviceService 物件。

GetAllCharacteristics()

取得屬於這個 GattDeviceService 實例的所有特性集合。

重要

GetAllCharacteristics API 已被取代,未來版本的 Windows 可能無法使用。 請改用 GetCharacteristicsAsync

GetAllIncludedServices()

取得屬於這個 GattDeviceService 實例之所有內含服務的集合。

重要

GetAllCharacteristics API 已被取代,未來版本的 Windows 可能無法使用。 請改用 GetIncludedServicesAsync

GetCharacteristics(Guid)

傳回特性向量,由指定的 UUID 識別並屬於這個 GattDeviceService 實例。

重要

GetCharacteristics API 已被取代,未來 Windows 版本可能無法使用。 請改用 GetCharacteristicsForUuidAsync

GetCharacteristicsAsync()

取得屬於這個 GattDeviceService 實例的特性。

GetCharacteristicsAsync(BluetoothCacheMode)

取得屬於這個 GattDeviceService 實例的特性。

GetCharacteristicsForUuidAsync(Guid)

取得屬於這個 GattDeviceService 實例且與特性Uuid 相關聯的 characterisitics。

GetCharacteristicsForUuidAsync(Guid, BluetoothCacheMode)

取得屬於這個 GattDeviceService 實例且與特性Uuid 相關聯的 characterisitics。

GetDeviceSelectorForBluetoothDeviceId(BluetoothDeviceId)

從 BluetoothDeviceId 建立適當的 AQS 篩選字串,以搭配 CreateWatcher 方法使用。

GetDeviceSelectorForBluetoothDeviceId(BluetoothDeviceId, BluetoothCacheMode)

從 BluetoothDeviceId 建立適當的 AQS 篩選字串,以搭配 CreateWatcher 方法使用。

GetDeviceSelectorForBluetoothDeviceIdAndUuid(BluetoothDeviceId, Guid)

從 BluetoothDeviceId 和 serviceUuid 建立適當的 AQS 篩選字串,以搭配 CreateWatcher 方法使用。

GetDeviceSelectorForBluetoothDeviceIdAndUuid(BluetoothDeviceId, Guid, BluetoothCacheMode)

從 BluetoothDeviceId 和 serviceUuid 建立適當的 AQS 篩選字串,以搭配 CreateWatcher 方法使用。

GetDeviceSelectorFromShortId(UInt16)

從16位藍牙 GATT服務 UUID 建立適當的 AQS 篩選字串,以搭配 CreateWatcher 方法使用。

重要

GetDeviceSelectorFromShortId API 已被取代,未來版本的 Windows 可能無法使用。 請改用 GetDeviceSelectorFromUuid

GetDeviceSelectorFromUuid(Guid)

從藍牙服務 UUID 建立適當的 AQS 篩選字串,以搭配 CreateWatcher 方法使用。

GetIncludedServices(Guid)

傳回所包含服務的向量,由指定的 UUID 識別並屬於這個 GattDeviceService 實例。

重要

GetIncludedServices API 已被取代,未來版本的 Windows 可能無法使用。 請改用 GetIncludedServicesForUuidAsync

GetIncludedServicesAsync()

取得與這個 GattDeviceService 實例相關聯的內含服務。

GetIncludedServicesAsync(BluetoothCacheMode)

取得與這個 GattDeviceService 實例相關聯的內含服務。

GetIncludedServicesForUuidAsync(Guid)

從與這個 GattDeviceService 實例相關聯的 serviceUuid 取得包含的服務。

GetIncludedServicesForUuidAsync(Guid, BluetoothCacheMode)

從與這個 GattDeviceService 實例相關聯的 serviceUuid 取得包含的服務。

OpenAsync(GattSharingMode)

使用指定的 sharingMode 開啟 GATT 裝置服務。

RequestAccessAsync()

要求存取 GattDeviceService。

適用於

另請參閱