GattDeviceService.FromIdAsync 方法

定义

重载

FromIdAsync(String, GattSharingMode)

从设备 ID 实例化新的 GattDeviceService 对象。

FromIdAsync(String)

从设备 ID 实例化新的 GattDeviceService。

FromIdAsync(String, GattSharingMode)

从设备 ID 实例化新的 GattDeviceService 对象。

public:
 static IAsyncOperation<GattDeviceService ^> ^ FromIdAsync(Platform::String ^ deviceId, GattSharingMode sharingMode);
/// [Windows.Foundation.Metadata.Overload("FromIdWithSharingModeAsync")]
/// [Windows.Foundation.Metadata.RemoteAsync]
 static IAsyncOperation<GattDeviceService> FromIdAsync(winrt::hstring const& deviceId, GattSharingMode const& sharingMode);
[Windows.Foundation.Metadata.Overload("FromIdWithSharingModeAsync")]
[Windows.Foundation.Metadata.RemoteAsync]
public static IAsyncOperation<GattDeviceService> FromIdAsync(string deviceId, GattSharingMode sharingMode);
function fromIdAsync(deviceId, sharingMode)
Public Shared Function FromIdAsync (deviceId As String, sharingMode As GattSharingMode) As IAsyncOperation(Of GattDeviceService)

参数

deviceId
String

Platform::String

winrt::hstring

GATT 设备 ID。

sharingMode
GattSharingMode

GATT 设备的共享模式。

返回

使用 GattDeviceService 对象完成的异步操作。

属性

Windows 要求

设备系列
Windows 10 Creators Update (在 10.0.15063.0 中引入)
API contract
Windows.Foundation.UniversalApiContract (在 v4.0 中引入)
应用功能
bluetooth

适用于

FromIdAsync(String)

从设备 ID 实例化新的 GattDeviceService。

public:
 static IAsyncOperation<GattDeviceService ^> ^ FromIdAsync(Platform::String ^ deviceId);
/// [Windows.Foundation.Metadata.RemoteAsync]
 static IAsyncOperation<GattDeviceService> FromIdAsync(winrt::hstring const& deviceId);
/// [Windows.Foundation.Metadata.RemoteAsync]
/// [Windows.Foundation.Metadata.Overload("FromIdAsync")]
 static IAsyncOperation<GattDeviceService> FromIdAsync(winrt::hstring const& deviceId);
[Windows.Foundation.Metadata.RemoteAsync]
public static IAsyncOperation<GattDeviceService> FromIdAsync(string deviceId);
[Windows.Foundation.Metadata.RemoteAsync]
[Windows.Foundation.Metadata.Overload("FromIdAsync")]
public static IAsyncOperation<GattDeviceService> FromIdAsync(string deviceId);
function fromIdAsync(deviceId)
Public Shared Function FromIdAsync (deviceId As String) As IAsyncOperation(Of GattDeviceService)

参数

deviceId
String

Platform::String

winrt::hstring

GATT 设备 ID。

返回

用于管理异步操作的对象,该操作在完成后返回新实例化的 GattDeviceService。

属性

Windows 要求

应用功能
bluetooth

注解

应用商店应用首次调用此方法时,应从 UI 线程调用此方法,以显示同意提示。 在用户授予许可后,可以从任何应用程序线程调用 方法。

如果应用商店应用未声明正确的功能或用户未授予许可,则 该方法将返回 null 对象。

适用于